Weld SVN: r5399 - in core/trunk/impl/src/main: java/org/jboss/weld/logging and 3 other directories.
by weld-commits@lists.jboss.org
Author: dallen6
Date: 2010-01-08 09:20:58 -0500 (Fri, 08 Jan 2010)
New Revision: 5399
Modified:
core/trunk/impl/src/main/java/org/jboss/weld/el/AbstractWeldELResolver.java
core/trunk/impl/src/main/java/org/jboss/weld/logging/Category.java
core/trunk/impl/src/main/java/org/jboss/weld/logging/messages/ElMessage.java
core/trunk/impl/src/main/java/org/jboss/weld/logging/messages/ServletMessage.java
core/trunk/impl/src/main/java/org/jboss/weld/servlet/WeldListener.java
core/trunk/impl/src/main/resources/org/jboss/weld/messages/el_en.properties
core/trunk/impl/src/main/resources/org/jboss/weld/messages/servlet_en.properties
Log:
Added trace messages in a few places and the category for EL
Modified: core/trunk/impl/src/main/java/org/jboss/weld/el/AbstractWeldELResolver.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/el/AbstractWeldELResolver.java 2010-01-08 13:59:36 UTC (rev 5398)
+++ core/trunk/impl/src/main/java/org/jboss/weld/el/AbstractWeldELResolver.java 2010-01-08 14:20:58 UTC (rev 5399)
@@ -17,6 +17,10 @@
package org.jboss.weld.el;
import static org.jboss.weld.el.ELCreationalContextStack.getCreationalContextStore;
+import static org.jboss.weld.logging.Category.EL;
+import static org.jboss.weld.logging.LoggerFactory.loggerFactory;
+import static org.jboss.weld.logging.messages.ElMessage.PROPERTY_LOOKUP;
+import static org.jboss.weld.logging.messages.ElMessage.PROPERTY_RESOLVED;
import static org.jboss.weld.logging.messages.ElMessage.RESOLUTION_ERROR;
import java.beans.FeatureDescriptor;
@@ -29,6 +33,7 @@
import org.jboss.weld.exceptions.WeldException;
import org.jboss.weld.manager.BeanManagerImpl;
+import org.slf4j.cal10n.LocLogger;
/**
* An EL-resolver against the named beans
@@ -37,6 +42,7 @@
*/
public abstract class AbstractWeldELResolver extends ELResolver
{
+ private static final LocLogger log = loggerFactory().getLogger(EL);
protected abstract BeanManagerImpl getManager(ELContext context);
@@ -64,13 +70,16 @@
if (property != null)
{
String propertyString = property.toString();
+ log.trace(PROPERTY_LOOKUP, propertyString);
Namespace namespace = null;
- if (base == null)
+ if (base == null)
{
if (getManager(context).getRootNamespace().contains(propertyString))
{
+ Object value = getManager(context).getRootNamespace().get(propertyString);
context.setPropertyResolved(true);
- return getManager(context).getRootNamespace().get(propertyString);
+ log.trace(PROPERTY_RESOLVED, propertyString, value);
+ return value;
}
}
else if (base instanceof Namespace)
@@ -81,7 +90,9 @@
if (namespace.contains(propertyString))
{
// There is a child namespace
- return namespace.get(propertyString);
+ Object value = namespace.get(propertyString);
+ log.trace(PROPERTY_RESOLVED, propertyString, value);
+ return value;
}
}
else
@@ -108,12 +119,12 @@
{
value = creationalContext.putIfAbsent(bean, new Callable<Object>()
{
-
+
public Object call() throws Exception
{
return getManager(context).getReference(bean, creationalContext, false);
}
-
+
});
}
}
@@ -124,6 +135,7 @@
if (value != null)
{
context.setPropertyResolved(true);
+ log.trace(PROPERTY_RESOLVED, propertyString, value);
return value;
}
}
Modified: core/trunk/impl/src/main/java/org/jboss/weld/logging/Category.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/logging/Category.java 2010-01-08 13:59:36 UTC (rev 5398)
+++ core/trunk/impl/src/main/java/org/jboss/weld/logging/Category.java 2010-01-08 14:20:58 UTC (rev 5399)
@@ -12,7 +12,8 @@
JSF("JSF"),
EVENT("Event"),
CONVERSATION("Conversation"),
- CONTEXT("Context");
+ CONTEXT("Context"),
+ EL("El");
private static final String LOG_PREFIX = "org.jboss.weld.";
Modified: core/trunk/impl/src/main/java/org/jboss/weld/logging/messages/ElMessage.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/logging/messages/ElMessage.java 2010-01-08 13:59:36 UTC (rev 5398)
+++ core/trunk/impl/src/main/java/org/jboss/weld/logging/messages/ElMessage.java 2010-01-08 14:20:58 UTC (rev 5399)
@@ -38,5 +38,7 @@
public enum ElMessage
{
@MessageId("001000") RESOLUTION_ERROR,
- @MessageId("001001") NULL_EXPRESSION_FACTORY;
+ @MessageId("001001") NULL_EXPRESSION_FACTORY,
+ @MessageId("001002") PROPERTY_LOOKUP,
+ @MessageId("001003") PROPERTY_RESOLVED;
}
Modified: core/trunk/impl/src/main/java/org/jboss/weld/logging/messages/ServletMessage.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/logging/messages/ServletMessage.java 2010-01-08 13:59:36 UTC (rev 5398)
+++ core/trunk/impl/src/main/java/org/jboss/weld/logging/messages/ServletMessage.java 2010-01-08 14:20:58 UTC (rev 5399)
@@ -25,6 +25,8 @@
@MessageId("000704") BEAN_DEPLOYMENT_ARCHIVE_MISSING,
@MessageId("000705") BEAN_MANAGER_FOR_ARCHIVE_NOT_FOUND,
@MessageId("000706") ILLEGAL_USE_OF_WELD_LISTENER,
- @MessageId("000707") ONLY_HTTP_SERVLET_LIFECYCLE_DEFINED;
+ @MessageId("000707") ONLY_HTTP_SERVLET_LIFECYCLE_DEFINED,
+ @MessageId("000708") REQUEST_INITIALIZED,
+ @MessageId("000709") REQUEST_DESTROYED;
}
Modified: core/trunk/impl/src/main/java/org/jboss/weld/servlet/WeldListener.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/servlet/WeldListener.java 2010-01-08 13:59:36 UTC (rev 5398)
+++ core/trunk/impl/src/main/java/org/jboss/weld/servlet/WeldListener.java 2010-01-08 14:20:58 UTC (rev 5399)
@@ -29,6 +29,8 @@
import static org.jboss.weld.logging.messages.ServletMessage.ILLEGAL_USE_OF_WELD_LISTENER;
import static org.jboss.weld.logging.messages.ServletMessage.NOT_STARTING;
import static org.jboss.weld.logging.messages.ServletMessage.ONLY_HTTP_SERVLET_LIFECYCLE_DEFINED;
+import static org.jboss.weld.logging.messages.ServletMessage.REQUEST_DESTROYED;
+import static org.jboss.weld.logging.messages.ServletMessage.REQUEST_INITIALIZED;
import javax.enterprise.inject.spi.BeanManager;
import javax.servlet.ServletContext;
@@ -148,6 +150,7 @@
@Override
public void requestDestroyed(ServletRequestEvent event)
{
+ log.trace(REQUEST_DESTROYED, event.getServletRequest());
// JBoss AS will still start the deployment even if WB fails
if (Container.available())
{
@@ -170,6 +173,7 @@
@Override
public void requestInitialized(ServletRequestEvent event)
{
+ log.trace(REQUEST_INITIALIZED, event.getServletRequest());
// JBoss AS will still start the deployment even if WB fails
if (Container.available())
{
Modified: core/trunk/impl/src/main/resources/org/jboss/weld/messages/el_en.properties
===================================================================
--- core/trunk/impl/src/main/resources/org/jboss/weld/messages/el_en.properties 2010-01-08 13:59:36 UTC (rev 5398)
+++ core/trunk/impl/src/main/resources/org/jboss/weld/messages/el_en.properties 2010-01-08 14:20:58 UTC (rev 5399)
@@ -1,2 +1,4 @@
RESOLUTION_ERROR=Error resolving property {0} against base {1}
NULL_EXPRESSION_FACTORY=Cannot pass null expressionFactory
+PROPERTY_LOOKUP=Looking for EL property {0}
+PROPERTY_RESOLVED=EL property {0} resolved to {1}
Modified: core/trunk/impl/src/main/resources/org/jboss/weld/messages/servlet_en.properties
===================================================================
--- core/trunk/impl/src/main/resources/org/jboss/weld/messages/servlet_en.properties 2010-01-08 13:59:36 UTC (rev 5398)
+++ core/trunk/impl/src/main/resources/org/jboss/weld/messages/servlet_en.properties 2010-01-08 14:20:58 UTC (rev 5399)
@@ -6,3 +6,5 @@
BEAN_MANAGER_FOR_ARCHIVE_NOT_FOUND=Unable to locate bean manager for {0} in {1}
ILLEGAL_USE_OF_WELD_LISTENER=Cannot use WeldListener without ServletServices
ONLY_HTTP_SERVLET_LIFECYCLE_DEFINED=Non Http-Servlet lifecycle not defined
+REQUEST_INITIALIZED=Initializing request {0}
+REQUEST_DESTROYED=Destroying request {0}
15 years
Weld SVN: r5398 - in core/trunk: impl/src/main/java/org/jboss/weld/bean and 51 other directories.
by weld-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2010-01-08 08:59:36 -0500 (Fri, 08 Jan 2010)
New Revision: 5398
Added:
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/Validator.java
core/trunk/impl/src/main/java/org/jboss/weld/exceptions/
core/trunk/impl/src/main/java/org/jboss/weld/exceptions/AmbiguousResolutionException.java
core/trunk/impl/src/main/java/org/jboss/weld/exceptions/CreationException.java
core/trunk/impl/src/main/java/org/jboss/weld/exceptions/DefinitionException.java
core/trunk/impl/src/main/java/org/jboss/weld/exceptions/DeploymentException.java
core/trunk/impl/src/main/java/org/jboss/weld/exceptions/ForbiddenArgumentException.java
core/trunk/impl/src/main/java/org/jboss/weld/exceptions/ForbiddenStateException.java
core/trunk/impl/src/main/java/org/jboss/weld/exceptions/IllegalProductException.java
core/trunk/impl/src/main/java/org/jboss/weld/exceptions/InconsistentSpecializationException.java
core/trunk/impl/src/main/java/org/jboss/weld/exceptions/InjectionException.java
core/trunk/impl/src/main/java/org/jboss/weld/exceptions/InvalidObjectException.java
core/trunk/impl/src/main/java/org/jboss/weld/exceptions/InvalidOperationException.java
core/trunk/impl/src/main/java/org/jboss/weld/exceptions/NullInstanceException.java
core/trunk/impl/src/main/java/org/jboss/weld/exceptions/NullableDependencyException.java
core/trunk/impl/src/main/java/org/jboss/weld/exceptions/UnproxyableResolutionException.java
core/trunk/impl/src/main/java/org/jboss/weld/exceptions/UnsatisfiedResolutionException.java
core/trunk/impl/src/main/java/org/jboss/weld/exceptions/UnserializableDependencyException.java
core/trunk/impl/src/main/java/org/jboss/weld/exceptions/WeldException.java
core/trunk/impl/src/main/java/org/jboss/weld/exceptions/WeldExceptionMessage.java
core/trunk/impl/src/main/java/org/jboss/weld/manager/
core/trunk/impl/src/main/java/org/jboss/weld/manager/BeanManagerImpl.java
core/trunk/impl/src/main/java/org/jboss/weld/manager/SimpleInjectionTarget.java
core/trunk/impl/src/main/java/org/jboss/weld/manager/SingleThreadExecutorServices.java
core/trunk/impl/src/main/java/org/jboss/weld/util/CleanableMethodHandler.java
core/trunk/impl/src/main/java/org/jboss/weld/util/JavassistCleaner.java
Removed:
core/trunk/impl/src/main/java/org/jboss/weld/AmbiguousResolutionException.java
core/trunk/impl/src/main/java/org/jboss/weld/BeanManagerImpl.java
core/trunk/impl/src/main/java/org/jboss/weld/CreationException.java
core/trunk/impl/src/main/java/org/jboss/weld/DefinitionException.java
core/trunk/impl/src/main/java/org/jboss/weld/DeploymentException.java
core/trunk/impl/src/main/java/org/jboss/weld/ForbiddenArgumentException.java
core/trunk/impl/src/main/java/org/jboss/weld/ForbiddenStateException.java
core/trunk/impl/src/main/java/org/jboss/weld/IllegalProductException.java
core/trunk/impl/src/main/java/org/jboss/weld/InconsistentSpecializationException.java
core/trunk/impl/src/main/java/org/jboss/weld/InjectionException.java
core/trunk/impl/src/main/java/org/jboss/weld/InvalidObjectException.java
core/trunk/impl/src/main/java/org/jboss/weld/InvalidOperationException.java
core/trunk/impl/src/main/java/org/jboss/weld/Logger.java
core/trunk/impl/src/main/java/org/jboss/weld/NullInstanceException.java
core/trunk/impl/src/main/java/org/jboss/weld/NullableDependencyException.java
core/trunk/impl/src/main/java/org/jboss/weld/SimpleInjectionTarget.java
core/trunk/impl/src/main/java/org/jboss/weld/SingleThreadExecutorServices.java
core/trunk/impl/src/main/java/org/jboss/weld/UnproxyableResolutionException.java
core/trunk/impl/src/main/java/org/jboss/weld/UnsatisfiedResolutionException.java
core/trunk/impl/src/main/java/org/jboss/weld/UnserializableDependencyException.java
core/trunk/impl/src/main/java/org/jboss/weld/Validator.java
core/trunk/impl/src/main/java/org/jboss/weld/WeldException.java
core/trunk/impl/src/main/java/org/jboss/weld/WeldExceptionMessage.java
Modified:
core/trunk/impl/src/main/java/org/jboss/weld/Container.java
core/trunk/impl/src/main/java/org/jboss/weld/bean/AbstractBean.java
core/trunk/impl/src/main/java/org/jboss/weld/bean/AbstractClassBean.java
core/trunk/impl/src/main/java/org/jboss/weld/bean/AbstractProducerBean.java
core/trunk/impl/src/main/java/org/jboss/weld/bean/AbstractReceiverBean.java
core/trunk/impl/src/main/java/org/jboss/weld/bean/CustomDecoratorWrapper.java
core/trunk/impl/src/main/java/org/jboss/weld/bean/DecoratorImpl.java
core/trunk/impl/src/main/java/org/jboss/weld/bean/DisposalMethod.java
core/trunk/impl/src/main/java/org/jboss/weld/bean/InterceptorImpl.java
core/trunk/impl/src/main/java/org/jboss/weld/bean/ManagedBean.java
core/trunk/impl/src/main/java/org/jboss/weld/bean/NewManagedBean.java
core/trunk/impl/src/main/java/org/jboss/weld/bean/NewSessionBean.java
core/trunk/impl/src/main/java/org/jboss/weld/bean/ProducerField.java
core/trunk/impl/src/main/java/org/jboss/weld/bean/ProducerMethod.java
core/trunk/impl/src/main/java/org/jboss/weld/bean/RIBean.java
core/trunk/impl/src/main/java/org/jboss/weld/bean/SessionBean.java
core/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/AbstractBuiltInBean.java
core/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/AbstractFacade.java
core/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/AbstractFacadeBean.java
core/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/BeanManagerBean.java
core/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/CallableMethodHandler.java
core/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/EventBean.java
core/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/ExtensionBean.java
core/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/InjectionPointBean.java
core/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/InstanceBean.java
core/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/InstanceImpl.java
core/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/ee/AbstractEEBean.java
core/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/ee/AbstractEECallable.java
core/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/ee/DefaultValidatorBean.java
core/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/ee/DefaultValidatorFactoryBean.java
core/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/ee/EEResourceProducerField.java
core/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/ee/PrincipalBean.java
core/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/ee/UserTransactionBean.java
core/trunk/impl/src/main/java/org/jboss/weld/bean/interceptor/CdiInterceptorHandlerFactory.java
core/trunk/impl/src/main/java/org/jboss/weld/bean/interceptor/ClassInterceptionHandlerFactory.java
core/trunk/impl/src/main/java/org/jboss/weld/bean/interceptor/InterceptorBindingsAdapter.java
core/trunk/impl/src/main/java/org/jboss/weld/bean/proxy/ClientProxyMethodHandler.java
core/trunk/impl/src/main/java/org/jboss/weld/bean/proxy/ClientProxyProvider.java
core/trunk/impl/src/main/java/org/jboss/weld/bean/proxy/DecoratorProxyMethodHandler.java
core/trunk/impl/src/main/java/org/jboss/weld/bean/proxy/EnterpriseBeanProxyMethodHandler.java
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/AbstractBeanDeployer.java
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/BeanDeployer.java
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/BeanDeployerEnvironment.java
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/BeanDeployment.java
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/ExtensionBeanDeployer.java
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/ExtensionBeanDeployerEnvironment.java
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/WeldBootstrap.java
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AbstractBeanDiscoveryEvent.java
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AbstractContainerEvent.java
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AbstractDefinitionContainerEvent.java
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AbstractDeploymentContainerEvent.java
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AbstractProcessClassBean.java
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AbstractProcessInjectionTarget.java
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AbstractProcessProducerBean.java
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AfterBeanDiscoveryImpl.java
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AfterDeploymentValidationImpl.java
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/BeforeBeanDiscoveryImpl.java
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/BeforeShutdownImpl.java
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessAnnotatedTypeImpl.java
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessBeanImpl.java
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessBeanInjectionTarget.java
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessManagedBeanImpl.java
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessObserverMethodImpl.java
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessProducerFieldImpl.java
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessProducerImpl.java
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessProducerMethodImpl.java
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessSessionBeanImpl.java
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessSimpleInjectionTarget.java
core/trunk/impl/src/main/java/org/jboss/weld/context/AbstractMapContext.java
core/trunk/impl/src/main/java/org/jboss/weld/context/ContextNotActiveException.java
core/trunk/impl/src/main/java/org/jboss/weld/context/beanstore/NamingScheme.java
core/trunk/impl/src/main/java/org/jboss/weld/conversation/ConversationImpl.java
core/trunk/impl/src/main/java/org/jboss/weld/ejb/EjbDescriptors.java
core/trunk/impl/src/main/java/org/jboss/weld/el/AbstractWeldELResolver.java
core/trunk/impl/src/main/java/org/jboss/weld/el/WeldELResolver.java
core/trunk/impl/src/main/java/org/jboss/weld/el/WeldExpressionFactory.java
core/trunk/impl/src/main/java/org/jboss/weld/event/EventImpl.java
core/trunk/impl/src/main/java/org/jboss/weld/event/ObserverFactory.java
core/trunk/impl/src/main/java/org/jboss/weld/event/ObserverMethodImpl.java
core/trunk/impl/src/main/java/org/jboss/weld/event/TransactionalObserverMethodImpl.java
core/trunk/impl/src/main/java/org/jboss/weld/injection/ConstructorInjectionPoint.java
core/trunk/impl/src/main/java/org/jboss/weld/injection/Exceptions.java
core/trunk/impl/src/main/java/org/jboss/weld/injection/FieldInjectionPoint.java
core/trunk/impl/src/main/java/org/jboss/weld/injection/InjectionContextImpl.java
core/trunk/impl/src/main/java/org/jboss/weld/injection/MethodInjectionPoint.java
core/trunk/impl/src/main/java/org/jboss/weld/injection/ParameterInjectionPoint.java
core/trunk/impl/src/main/java/org/jboss/weld/injection/ProxyClassConstructorInjectionPointWrapper.java
core/trunk/impl/src/main/java/org/jboss/weld/introspector/AnnotationStore.java
core/trunk/impl/src/main/java/org/jboss/weld/introspector/jlr/WeldConstructorImpl.java
core/trunk/impl/src/main/java/org/jboss/weld/introspector/jlr/WeldFieldImpl.java
core/trunk/impl/src/main/java/org/jboss/weld/introspector/jlr/WeldParameterImpl.java
core/trunk/impl/src/main/java/org/jboss/weld/jsf/JsfHelper.java
core/trunk/impl/src/main/java/org/jboss/weld/jsf/WeldPhaseListener.java
core/trunk/impl/src/main/java/org/jboss/weld/logging/messages/ReflectionMessage.java
core/trunk/impl/src/main/java/org/jboss/weld/metadata/cache/AnnotationModel.java
core/trunk/impl/src/main/java/org/jboss/weld/metadata/cache/BindingTypeModel.java
core/trunk/impl/src/main/java/org/jboss/weld/metadata/cache/InterceptorBindingModel.java
core/trunk/impl/src/main/java/org/jboss/weld/metadata/cache/MergedStereotypes.java
core/trunk/impl/src/main/java/org/jboss/weld/metadata/cache/StereotypeModel.java
core/trunk/impl/src/main/java/org/jboss/weld/resolution/NameBasedResolver.java
core/trunk/impl/src/main/java/org/jboss/weld/resolution/ResolvableWeldClass.java
core/trunk/impl/src/main/java/org/jboss/weld/resolution/TypeSafeBeanResolver.java
core/trunk/impl/src/main/java/org/jboss/weld/resolution/TypeSafeDecoratorResolver.java
core/trunk/impl/src/main/java/org/jboss/weld/resolution/TypeSafeDisposerResolver.java
core/trunk/impl/src/main/java/org/jboss/weld/resolution/TypeSafeInterceptorResolver.java
core/trunk/impl/src/main/java/org/jboss/weld/resolution/TypeSafeObserverResolver.java
core/trunk/impl/src/main/java/org/jboss/weld/resources/ManagerObjectFactory.java
core/trunk/impl/src/main/java/org/jboss/weld/servlet/ServletHelper.java
core/trunk/impl/src/main/java/org/jboss/weld/servlet/ServletLifecycle.java
core/trunk/impl/src/main/java/org/jboss/weld/servlet/WeldListener.java
core/trunk/impl/src/main/java/org/jboss/weld/util/ApiAbstraction.java
core/trunk/impl/src/main/java/org/jboss/weld/util/Beans.java
core/trunk/impl/src/main/java/org/jboss/weld/util/Deployers.java
core/trunk/impl/src/main/java/org/jboss/weld/util/DeploymentStructures.java
core/trunk/impl/src/main/java/org/jboss/weld/util/Observers.java
core/trunk/impl/src/main/java/org/jboss/weld/util/Proxies.java
core/trunk/impl/src/main/java/org/jboss/weld/util/collections/ConcurrentCache.java
core/trunk/impl/src/main/java/org/jboss/weld/util/dom/NodeListIterator.java
core/trunk/impl/src/main/java/org/jboss/weld/util/reflection/SecureReflections.java
core/trunk/impl/src/main/java/org/jboss/weld/util/serviceProvider/DefaultServiceLoader.java
core/trunk/impl/src/main/java/org/jboss/weld/xml/WeldXmlException.java
core/trunk/impl/src/main/resources/org/jboss/weld/messages/reflection_en.properties
core/trunk/jboss-as/build.properties
core/trunk/jboss-tck-runner/pom.xml
core/trunk/porting-package/src/main/java/org/jboss/weld/tck/ELImpl.java
core/trunk/porting-package/src/main/java/org/jboss/weld/tck/ManagersImpl.java
core/trunk/tests/src/main/java/org/jboss/weld/mock/TestContainer.java
core/trunk/tests/src/main/java/org/jboss/weld/mock/cluster/AbstractClusterTest.java
core/trunk/tests/src/main/java/org/jboss/weld/mock/el/EL.java
core/trunk/tests/src/main/java/org/jboss/weld/test/AbstractWeldTest.java
core/trunk/tests/src/main/java/org/jboss/weld/test/BeanManagerLocator.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/activities/ActivitiesTest.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/activities/child/SameBeanTypeInChildActivityTest.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/activities/current/ELCurrentActivityTest.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/activities/current/InstanceCurrentActivityTest.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/beanManager/serializability/ManagerTest.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/broken/SimpleAbstractDecoratorWithInvalidAbstractMethodTest.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/custom/CustomDecoratorTest.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/event/SimpleEventTest.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/passivation/broken/interceptorWithNonSerializableField/InterceptorWithNonSerializableFieldOnPassivatingBean.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/passivation/broken/nonSerializableInterceptor/NonPassivatingInterceptorOnPassivatingBean.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/cluster/NaiveClusterTest.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/deployment/structure/extensions/NonBdaExtensionTest.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/deployment/structure/nonTransitiveResolution/TransitiveResolutionTest.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/deployment/structure/resolution/AccessibleManagerResolutionTest.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/environments/servlet/ServletEnvironmentTest.java
Log:
move Manager to own package, add cleanup for method handlers
Deleted: core/trunk/impl/src/main/java/org/jboss/weld/AmbiguousResolutionException.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/AmbiguousResolutionException.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/AmbiguousResolutionException.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -1,67 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat, Inc. and/or its affiliates, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.jboss.weld;
-
-/**
- * Provides message localization service for the
- * {@link javax.enterprise.inject.AmbiguousResolutionException}.
- *
- * @author David Allen
- */
-public class AmbiguousResolutionException extends javax.enterprise.inject.AmbiguousResolutionException
-{
- private static final long serialVersionUID = 2L;
-
- private WeldExceptionMessage message;
-
- /**
- * Creates a new exception with the given cause.
- *
- * @param throwable The cause of the exception
- */
- public AmbiguousResolutionException(Throwable throwable)
- {
- super(throwable);
- message = new WeldExceptionMessage(throwable.getLocalizedMessage());
- }
-
- /**
- * Creates a new exception with the given localized message key and optional
- * arguments for the message.
- *
- * @param <E> The enumeration type for the message keys
- * @param key The localized message to use
- * @param args Optional arguments to insert into the message
- */
- public <E extends Enum<?>> AmbiguousResolutionException(E key, Object... args)
- {
- message = new WeldExceptionMessage(key, args);
- }
-
- @Override
- public String getLocalizedMessage()
- {
- return getMessage();
- }
-
- @Override
- public String getMessage()
- {
- return message.getAsString();
- }
-}
Deleted: core/trunk/impl/src/main/java/org/jboss/weld/BeanManagerImpl.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/BeanManagerImpl.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/BeanManagerImpl.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -1,1562 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.weld;
-
-import static org.jboss.weld.logging.messages.BeanManagerMessage.AMBIGUOUS_BEANS_FOR_DEPENDENCY;
-import static org.jboss.weld.logging.messages.BeanManagerMessage.CONTEXT_NOT_ACTIVE;
-import static org.jboss.weld.logging.messages.BeanManagerMessage.DUPLICATE_ACTIVE_CONTEXTS;
-import static org.jboss.weld.logging.messages.BeanManagerMessage.DUPLICATE_INTERCEPTOR_BINDING;
-import static org.jboss.weld.logging.messages.BeanManagerMessage.DUPLICATE_QUALIFIERS;
-import static org.jboss.weld.logging.messages.BeanManagerMessage.INTERCEPTOR_BINDINGS_EMPTY;
-import static org.jboss.weld.logging.messages.BeanManagerMessage.INTERCEPTOR_RESOLUTION_WITH_NONBINDING_TYPE;
-import static org.jboss.weld.logging.messages.BeanManagerMessage.INVALID_QUALIFIER;
-import static org.jboss.weld.logging.messages.BeanManagerMessage.NON_NORMAL_SCOPE;
-import static org.jboss.weld.logging.messages.BeanManagerMessage.NOT_INTERCEPTOR_BINDING_TYPE;
-import static org.jboss.weld.logging.messages.BeanManagerMessage.NOT_PROXYABLE;
-import static org.jboss.weld.logging.messages.BeanManagerMessage.NOT_STEREOTYPE;
-import static org.jboss.weld.logging.messages.BeanManagerMessage.NO_DECORATOR_TYPES;
-import static org.jboss.weld.logging.messages.BeanManagerMessage.SPECIFIED_TYPE_NOT_BEAN_TYPE;
-import static org.jboss.weld.logging.messages.BeanManagerMessage.TOO_MANY_ACTIVITIES;
-import static org.jboss.weld.logging.messages.BeanManagerMessage.UNPROXYABLE_RESOLUTION;
-import static org.jboss.weld.logging.messages.BeanManagerMessage.UNRESOLVABLE_ELEMENT;
-import static org.jboss.weld.logging.messages.BeanManagerMessage.UNRESOLVABLE_TYPE;
-
-import java.io.Serializable;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Member;
-import java.lang.reflect.Type;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.Stack;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.CopyOnWriteArrayList;
-import java.util.concurrent.CopyOnWriteArraySet;
-import java.util.concurrent.atomic.AtomicInteger;
-
-import javax.el.ELResolver;
-import javax.el.ExpressionFactory;
-import javax.enterprise.context.spi.Context;
-import javax.enterprise.context.spi.Contextual;
-import javax.enterprise.context.spi.CreationalContext;
-import javax.enterprise.inject.spi.Annotated;
-import javax.enterprise.inject.spi.AnnotatedType;
-import javax.enterprise.inject.spi.Bean;
-import javax.enterprise.inject.spi.Decorator;
-import javax.enterprise.inject.spi.InjectionPoint;
-import javax.enterprise.inject.spi.InjectionTarget;
-import javax.enterprise.inject.spi.InterceptionType;
-import javax.enterprise.inject.spi.Interceptor;
-import javax.enterprise.inject.spi.ObserverMethod;
-import javax.enterprise.inject.spi.PassivationCapable;
-import javax.inject.Qualifier;
-
-import org.jboss.interceptor.registry.InterceptorRegistry;
-import org.jboss.weld.bean.NewBean;
-import org.jboss.weld.bean.RIBean;
-import org.jboss.weld.bean.SessionBean;
-import org.jboss.weld.bean.builtin.AbstractBuiltInBean;
-import org.jboss.weld.bean.builtin.ExtensionBean;
-import org.jboss.weld.bean.proxy.ClientProxyProvider;
-import org.jboss.weld.bootstrap.api.ServiceRegistry;
-import org.jboss.weld.bootstrap.events.AbstractProcessInjectionTarget;
-import org.jboss.weld.context.ContextNotActiveException;
-import org.jboss.weld.context.CreationalContextImpl;
-import org.jboss.weld.context.WeldCreationalContext;
-import org.jboss.weld.ejb.EjbDescriptors;
-import org.jboss.weld.ejb.spi.EjbDescriptor;
-import org.jboss.weld.el.Namespace;
-import org.jboss.weld.el.WeldELResolver;
-import org.jboss.weld.el.WeldExpressionFactory;
-import org.jboss.weld.introspector.WeldAnnotated;
-import org.jboss.weld.literal.AnyLiteral;
-import org.jboss.weld.manager.api.WeldManager;
-import org.jboss.weld.metadata.cache.MetaAnnotationStore;
-import org.jboss.weld.metadata.cache.ScopeModel;
-import org.jboss.weld.resolution.NameBasedResolver;
-import org.jboss.weld.resolution.Resolvable;
-import org.jboss.weld.resolution.ResolvableFactory;
-import org.jboss.weld.resolution.ResolvableWeldClass;
-import org.jboss.weld.resolution.TypeSafeBeanResolver;
-import org.jboss.weld.resolution.TypeSafeDecoratorResolver;
-import org.jboss.weld.resolution.TypeSafeInterceptorResolver;
-import org.jboss.weld.resolution.TypeSafeObserverResolver;
-import org.jboss.weld.resolution.TypeSafeResolver;
-import org.jboss.weld.resources.ClassTransformer;
-import org.jboss.weld.serialization.spi.ContextualStore;
-import org.jboss.weld.serialization.spi.helpers.SerializableContextual;
-import org.jboss.weld.util.Beans;
-import org.jboss.weld.util.Observers;
-import org.jboss.weld.util.Proxies;
-import org.jboss.weld.util.reflection.HierarchyDiscovery;
-import org.jboss.weld.util.reflection.Reflections;
-
-import com.google.common.base.Function;
-import com.google.common.base.Supplier;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Iterators;
-import com.google.common.collect.ListMultimap;
-import com.google.common.collect.Multimaps;
-
-/**
- * Implementation of the Bean Manager.
- *
- * Essentially a singleton for registering Beans, Contexts, Observers,
- * Interceptors etc. as well as providing resolution
- *
- * @author Pete Muir
- * @author Marius Bogoevici
- */
-public class BeanManagerImpl implements WeldManager, Serializable
-{
-
-
- private static class CurrentActivity
- {
-
- private final Context context;
- private final BeanManagerImpl manager;
-
- public CurrentActivity(Context context, BeanManagerImpl manager)
- {
- this.context = context;
- this.manager = manager;
- }
-
- public Context getContext()
- {
- return context;
- }
-
- public BeanManagerImpl getManager()
- {
- return manager;
- }
-
- @Override
- public boolean equals(Object obj)
- {
- if (obj instanceof CurrentActivity)
- {
- return this.getContext().equals(((CurrentActivity) obj).getContext());
- }
- else
- {
- return false;
- }
- }
-
- @Override
- public int hashCode()
- {
- return getContext().hashCode();
- }
-
- @Override
- public String toString()
- {
- return getContext() + " -> " + getManager();
- }
- }
-
- private static final long serialVersionUID = 3021562879133838561L;
-
- public static final InjectionPoint DUMMY_INJECTION_POINT = new InjectionPoint()
- {
-
- public boolean isTransient()
- {
- return true;
- }
-
- public boolean isDelegate()
- {
- return false;
- }
-
- public Type getType()
- {
- return InjectionPoint.class;
- }
-
- public Set<Annotation> getQualifiers()
- {
- return Collections.emptySet();
- }
-
- public Member getMember()
- {
- return null;
- }
-
- public Bean<?> getBean()
- {
- return null;
- }
-
- public Annotated getAnnotated()
- {
- return null;
- }
- };
-
- /*
- * Application scoped services
- * ***************************
- */
- private transient final ServiceRegistry services;
-
- /*
- * Application scoped data structures
- * ***********************************
- */
-
- // Contexts are shared across the application
- private transient final ListMultimap<Class<? extends Annotation>, Context> contexts;
-
- // Client proxies can be used application wide
- private transient final ClientProxyProvider clientProxyProvider;
-
- // TODO review this structure
- private transient final Map<EjbDescriptor<?>, SessionBean<?>> enterpriseBeans;
-
- // TODO This isn't right, specialization should follow accessibility rules, but I think we can enforce these in resolve()
- private transient final Map<Contextual<?>, Contextual<?>> specializedBeans;
-
- /*
- * Archive scoped data structures
- * ******************************
- */
-
- /* These data structures are all non-transitive in terms of bean deployment
- * archive accessibility, and the configuration for this bean deployment
- * archive
- */
- private transient Collection<Class<?>> enabledAlternativeClasses;
- private transient Collection<Class<? extends Annotation>> enabledAlternativeStereotypes;
- private transient List<Class<?>> enabledDecoratorClasses;
- private transient List<Class<?>> enabledInterceptorClasses;
- private transient final Set<CurrentActivity> currentActivities;
-
- /*
- * Activity scoped services
- * *************************
- */
-
- /* These services are scoped to this activity only, but use data
- * structures that are transitive accessible from other bean deployment
- * archives
- */
- private transient final TypeSafeBeanResolver<Bean<?>> beanResolver;
- private transient final TypeSafeResolver<? extends Resolvable, Decorator<?>> decoratorResolver;
- private transient final TypeSafeResolver<? extends Resolvable, Interceptor<?>> interceptorResolver;
- private transient final TypeSafeResolver<? extends Resolvable, ObserverMethod<?>> observerResolver;
- private transient final NameBasedResolver nameBasedResolver;
- private transient final ELResolver weldELResolver;
- private transient Namespace rootNamespace;
-
- /*
- * Activity scoped data structures
- * ********************************
- */
-
- /* These data structures are scoped to this bean deployment archive activity
- * only and represent the beans, decorators, interceptors, namespaces and
- * observers deployed in this bean deployment archive activity
- */
- private transient final List<Bean<?>> beans;
- private transient final List<Bean<?>> transitiveBeans;
- private transient final List<Decorator<?>> decorators;
- private transient final List<Interceptor<?>> interceptors;
- private transient final List<String> namespaces;
- private transient final List<ObserverMethod<?>> observers;
-
- /*
- * These data structures represent the managers *accessible* from this bean
- * deployment archive activity
- */
- private transient final HashSet<BeanManagerImpl> accessibleManagers;
-
- /*
- * This data structures represents child activities for this activity, it is
- * not transitively accessible
- */
- private transient final Set<BeanManagerImpl> childActivities;
-
- private final AtomicInteger childIds;
- private final String id;
-
- /*
- * Runtime data transfer
- * *********************
- */
- private transient final ThreadLocal<Stack<InjectionPoint>> currentInjectionPoint;
-
- /**
- * Interception model
- */
- private transient final InterceptorRegistry<Class<?>, SerializableContextual<Interceptor<?>, ?>> boundInterceptorsRegistry = new InterceptorRegistry<Class<?>, SerializableContextual<Interceptor<?>,?>>();
- private transient final InterceptorRegistry<Class<?>, Class<?>> declaredInterceptorsRegistry = new InterceptorRegistry<Class<?>, Class<?>>();
-
- /**
- * Create a new, root, manager
- *
- * @param serviceRegistry
- * @return
- */
- public static BeanManagerImpl newRootManager(String id, ServiceRegistry serviceRegistry)
- {
- ListMultimap<Class<? extends Annotation>, Context> contexts = Multimaps.newListMultimap(new ConcurrentHashMap<Class<? extends Annotation>, Collection<Context>>(), new Supplier<List<Context>>()
- {
-
- public List<Context> get()
- {
- return new CopyOnWriteArrayList<Context>();
- }
-
- });
-
- return new BeanManagerImpl(
- serviceRegistry,
- new CopyOnWriteArrayList<Bean<?>>(),
- new CopyOnWriteArrayList<Bean<?>>(),
- new CopyOnWriteArrayList<Decorator<?>>(),
- new CopyOnWriteArrayList<Interceptor<?>>(),
- new CopyOnWriteArrayList<ObserverMethod<?>>(),
- new CopyOnWriteArrayList<String>(),
- new ConcurrentHashMap<EjbDescriptor<?>, SessionBean<?>>(),
- new ClientProxyProvider(),
- contexts,
- new CopyOnWriteArraySet<CurrentActivity>(),
- new HashMap<Contextual<?>, Contextual<?>>(),
- new ArrayList<Class<?>>(),
- new ArrayList<Class<? extends Annotation>>(),
- new ArrayList<Class<?>>(),
- new ArrayList<Class<?>>(),
- id,
- new AtomicInteger());
- }
-
- /**
- * Create a new, root, manager
- *
- * @param serviceRegistry
- * @return
- */
- public static BeanManagerImpl newManager(BeanManagerImpl rootManager, String id, ServiceRegistry services)
- {
- return new BeanManagerImpl(
- services,
- new CopyOnWriteArrayList<Bean<?>>(),
- new CopyOnWriteArrayList<Bean<?>>(),
- new CopyOnWriteArrayList<Decorator<?>>(),
- new CopyOnWriteArrayList<Interceptor<?>>(),
- new CopyOnWriteArrayList<ObserverMethod<?>>(),
- new CopyOnWriteArrayList<String>(),
- rootManager.getEnterpriseBeans(),
- rootManager.getClientProxyProvider(),
- rootManager.getContexts(),
- new CopyOnWriteArraySet<CurrentActivity>(),
- new HashMap<Contextual<?>, Contextual<?>>(),
- new ArrayList<Class<?>>(),
- new ArrayList<Class<? extends Annotation>>(),
- new ArrayList<Class<?>>(),
- new ArrayList<Class<?>>(),
- id,
- new AtomicInteger());
- }
-
- /**
- * Create a new child manager
- *
- * @param parentManager
- * @return
- */
- public static BeanManagerImpl newChildActivityManager(BeanManagerImpl parentManager)
- {
- List<Bean<?>> beans = new CopyOnWriteArrayList<Bean<?>>();
- beans.addAll(parentManager.getBeans());
- List<Bean<?>> transitiveBeans = new CopyOnWriteArrayList<Bean<?>>();
- beans.addAll(parentManager.getTransitiveBeans());
-
- List<ObserverMethod<?>> registeredObservers = new CopyOnWriteArrayList<ObserverMethod<?>>();
- registeredObservers.addAll(parentManager.getObservers());
- List<String> namespaces = new CopyOnWriteArrayList<String>();
- namespaces.addAll(parentManager.getNamespaces());
-
- return new BeanManagerImpl(
- parentManager.getServices(),
- beans,
- transitiveBeans,
- parentManager.getDecorators(),
- parentManager.getInterceptors(),
- registeredObservers,
- namespaces,
- parentManager.getEnterpriseBeans(),
- parentManager.getClientProxyProvider(),
- parentManager.getContexts(),
- parentManager.getCurrentActivities(),
- parentManager.getSpecializedBeans(),
- parentManager.getEnabledAlternativeClasses(),
- parentManager.getEnabledAlternativeStereotypes(),
- parentManager.getEnabledDecoratorClasses(),
- parentManager.getEnabledInterceptorClasses(),
- new StringBuilder().append(parentManager.getChildIds().incrementAndGet()).toString(),
- parentManager.getChildIds());
- }
-
- /**
- * Create a new manager
- * @param enabledDecoratorClasses
- *
- * @param ejbServices the ejbResolver to use
- */
- private BeanManagerImpl(
- ServiceRegistry serviceRegistry,
- List<Bean<?>> beans,
- List<Bean<?>> transitiveBeans,
- List<Decorator<?>> decorators,
- List<Interceptor<?>> interceptors,
- List<ObserverMethod<?>> observers,
- List<String> namespaces,
- Map<EjbDescriptor<?>, SessionBean<?>> enterpriseBeans,
- ClientProxyProvider clientProxyProvider,
- ListMultimap<Class<? extends Annotation>, Context> contexts,
- Set<CurrentActivity> currentActivities,
- Map<Contextual<?>, Contextual<?>> specializedBeans,
- Collection<Class<?>> enabledAlternativeClasses,
- Collection<Class<? extends Annotation>> enabledAlternativeStereotypes,
- List<Class<?>> enabledDecoratorClasses,
- List<Class<?>> enabledInterceptorClasses,
- String id,
- AtomicInteger childIds)
- {
- this.services = serviceRegistry;
- this.beans = beans;
- this.transitiveBeans = transitiveBeans;
- this.decorators = decorators;
- this.interceptors = interceptors;
- this.enterpriseBeans = enterpriseBeans;
- this.clientProxyProvider = clientProxyProvider;
- this.contexts = contexts;
- this.currentActivities = currentActivities;
- this.specializedBeans = specializedBeans;
- this.observers = observers;
- this.enabledAlternativeClasses = enabledAlternativeClasses;
- this.enabledAlternativeStereotypes = enabledAlternativeStereotypes;
- setEnabledDecoratorClasses(enabledDecoratorClasses);
- setEnabledInterceptorClasses(enabledInterceptorClasses);
- this.namespaces = namespaces;
- this.id = id;
- this.childIds = new AtomicInteger();
-
- // Set up the structure to store accessible managers in
- this.accessibleManagers = new HashSet<BeanManagerImpl>();
-
-
-
- // TODO Currently we build the accessible bean list on the fly, we need to set it in stone once bootstrap is finished...
- Transform<Bean<?>> beanTransform = new Transform.BeanTransform(this);
- this.beanResolver = new TypeSafeBeanResolver<Bean<?>>(this, createDynamicAccessibleIterable(beanTransform));
- this.decoratorResolver = new TypeSafeDecoratorResolver(this, createDynamicAccessibleIterable(Transform.DECORATOR_BEAN));
- this.interceptorResolver = new TypeSafeInterceptorResolver(this, createDynamicAccessibleIterable(Transform.INTERCEPTOR_BEAN));
- this.observerResolver = new TypeSafeObserverResolver(this, createDynamicAccessibleIterable(Transform.EVENT_OBSERVER));
- this.nameBasedResolver = new NameBasedResolver(this, createDynamicAccessibleIterable(beanTransform));
- this.weldELResolver = new WeldELResolver(this);
- this.childActivities = new CopyOnWriteArraySet<BeanManagerImpl>();
-
- this.currentInjectionPoint = new ThreadLocal<Stack<InjectionPoint>>()
- {
- @Override
- protected Stack<InjectionPoint> initialValue()
- {
- return new Stack<InjectionPoint>();
- }
- };
- }
-
- private <T> Set<Iterable<T>> buildAccessibleClosure(Collection<BeanManagerImpl> hierarchy, Transform<T> transform)
- {
- Set<Iterable<T>> result = new HashSet<Iterable<T>>();
- hierarchy.add(this);
- result.add(transform.transform(this));
- for (BeanManagerImpl beanManager : accessibleManagers)
- {
- // Only add if we aren't already in the tree (remove cycles)
- if (!hierarchy.contains(beanManager))
- {
- result.addAll(beanManager.buildAccessibleClosure(new ArrayList<BeanManagerImpl>(hierarchy), transform));
- }
- }
- return result;
- }
-
- private <T> Iterable<T> createDynamicAccessibleIterable(final Transform<T> transform)
- {
- return new Iterable<T>()
- {
-
- private Function<Iterable<T>, Iterator<T>> function = new Function<Iterable<T>, Iterator<T>>()
- {
-
- public Iterator<T> apply(Iterable<T> iterable)
- {
- return iterable.iterator();
- }
-
- };
-
- public Iterator<T> iterator()
- {
- Set<Iterable<T>> iterable = buildAccessibleClosure(new ArrayList<BeanManagerImpl>(), transform);
- return Iterators.concat(Iterators.transform(iterable.iterator(), function));
- }
-
- };
- }
-
- private <T> Iterable<T> createStaticAccessibleIterable(final Transform<T> transform)
- {
- Set<Iterable<T>> iterable = buildAccessibleClosure(new ArrayList<BeanManagerImpl>(), transform);
- return Iterables.concat(iterable);
- }
-
- private static interface Transform<T>
- {
-
- public static class BeanTransform implements Transform<Bean<?>>
- {
-
- private final BeanManagerImpl declaringBeanManager;
-
- public BeanTransform(BeanManagerImpl declaringBeanManager)
- {
- this.declaringBeanManager = declaringBeanManager;
- }
-
- public Iterable<Bean<?>> transform(BeanManagerImpl beanManager)
- {
- // New beans and built in beans aren't resolvable transitively
- if (beanManager.equals(declaringBeanManager))
- {
- return beanManager.getBeans();
- }
- else
- {
- return beanManager.getTransitiveBeans();
- }
- }
-
- };
-
- public static Transform<Decorator<?>> DECORATOR_BEAN = new Transform<Decorator<?>>()
- {
-
- public Iterable<Decorator<?>> transform(BeanManagerImpl beanManager)
- {
- return beanManager.getDecorators();
- }
-
- };
-
- public static Transform<Interceptor<?>> INTERCEPTOR_BEAN = new Transform<Interceptor<?>>()
- {
-
- public Iterable<Interceptor<?>> transform(BeanManagerImpl beanManager)
- {
- return beanManager.getInterceptors();
- }
-
- };
-
- public static Transform<ObserverMethod<?>> EVENT_OBSERVER = new Transform<ObserverMethod<?>>()
- {
-
- public Iterable<ObserverMethod<?>> transform(BeanManagerImpl beanManager)
- {
- return beanManager.getObservers();
- }
-
- };
-
- public static Transform<String> NAMESPACE = new Transform<String>()
- {
-
- public Iterable<String> transform(BeanManagerImpl beanManager)
- {
- return beanManager.getNamespaces();
- }
-
- };
-
- public Iterable<T> transform(BeanManagerImpl beanManager);
-
- }
-
- public void addAccessibleBeanManager(BeanManagerImpl accessibleBeanManager)
- {
- accessibleManagers.add(accessibleBeanManager);
- beanResolver.clear();
- }
-
- public void addBean(Bean<?> bean)
- {
- if (beans.contains(bean))
- {
- return;
- }
- if (bean.getClass().equals(SessionBean.class))
- {
- SessionBean<?> enterpriseBean = (SessionBean<?>) bean;
- enterpriseBeans.put(enterpriseBean.getEjbDescriptor(), enterpriseBean);
- }
- if (bean instanceof PassivationCapable)
- {
- Container.instance().deploymentServices().get(ContextualStore.class).putIfAbsent(bean);
- }
- registerBeanNamespace(bean);
- for (BeanManagerImpl childActivity : childActivities)
- {
- childActivity.addBean(bean);
- }
- // New beans and most built in beans aren't resolvable transtively
- if (bean instanceof ExtensionBean || (!(bean instanceof NewBean) && !(bean instanceof AbstractBuiltInBean<?>)))
- {
- this.transitiveBeans.add(bean);
- }
- this.beans.add(bean);
- beanResolver.clear();
- }
-
- public void addDecorator(Decorator<?> bean)
- {
- decorators.add(bean);
- getServices().get(ContextualStore.class).putIfAbsent(bean);
- decoratorResolver.clear();
- }
-
- public <T> Set<ObserverMethod<? super T>> resolveObserverMethods(T event, Annotation... bindings)
- {
- Observers.checkEventObjectType(event);
- return this.<T>resolveObserverMethods(event.getClass(), bindings);
- }
-
- public void addInterceptor(Interceptor<?> bean)
- {
- interceptors.add(bean);
- getServices().get(ContextualStore.class).putIfAbsent(bean);
- interceptorResolver.clear();
- }
-
-
- @SuppressWarnings("unchecked")
- public <T> Set<ObserverMethod<? super T>> resolveObserverMethods(Type eventType, Annotation... bindings)
- {
- checkBindingTypes(Arrays.asList(bindings));
- HashSet<Annotation> bindingAnnotations = new HashSet<Annotation>(Arrays.asList(bindings));
- bindingAnnotations.add(new AnyLiteral());
- Set<ObserverMethod<? super T>> observers = new HashSet<ObserverMethod<? super T>>();
- Set<ObserverMethod<?>> eventObservers = observerResolver.resolve(ResolvableFactory.of(new HierarchyDiscovery(eventType).getTypeClosure(), bindingAnnotations, null));
- for (ObserverMethod<?> observer : eventObservers)
- {
- observers.add((ObserverMethod<T>) observer);
- }
- return observers;
- }
-
- private void checkBindingTypes(Collection<Annotation> bindings)
- {
- HashSet<Annotation> bindingAnnotations = new HashSet<Annotation>(bindings);
- for (Annotation annotation : bindings)
- {
- if (!getServices().get(MetaAnnotationStore.class).getBindingTypeModel(annotation.annotationType()).isValid())
- {
- throw new ForbiddenArgumentException(INVALID_QUALIFIER, annotation);
- }
- }
- if (bindingAnnotations.size() < bindings.size())
- {
- throw new ForbiddenArgumentException(DUPLICATE_QUALIFIERS, bindings);
- }
-
- }
-
- /**
- * A collection of enabled alternative classes
- *
- */
- public Collection<Class<?>> getEnabledAlternativeClasses()
- {
- return Collections.unmodifiableCollection(enabledAlternativeClasses);
- }
-
- /**
- * @return the enabled alternative stereotypes
- */
- public Collection<Class<? extends Annotation>> getEnabledAlternativeStereotypes()
- {
- return Collections.unmodifiableCollection(enabledAlternativeStereotypes);
- }
-
- public boolean isBeanEnabled(Bean<?> bean)
- {
- return Beans.isBeanEnabled(bean, getEnabledAlternativeClasses(), getEnabledAlternativeStereotypes());
- }
-
- /**
- * @return the enabledDecoratorClasses
- */
- public List<Class<?>> getEnabledDecoratorClasses()
- {
- return Collections.unmodifiableList(enabledDecoratorClasses);
- }
-
- /**
- * @return the enabledInterceptorClasses
- */
- public List<Class<?>> getEnabledInterceptorClasses()
- {
- return Collections.unmodifiableList(enabledInterceptorClasses);
- }
-
- public void setEnabledAlternativeClasses(Collection<Class<?>> enabledAlternativeClasses)
- {
- this.enabledAlternativeClasses = enabledAlternativeClasses;
- }
-
- public void setEnabledAlternativeStereotypes(Collection<Class<? extends Annotation>> enabledAlternativeSterotypes)
- {
- this.enabledAlternativeStereotypes = enabledAlternativeSterotypes;
- }
-
- public void setEnabledDecoratorClasses(List<Class<?>> enabledDecoratorClasses)
- {
- this.enabledDecoratorClasses = enabledDecoratorClasses;
- }
-
- public void setEnabledInterceptorClasses(List<Class<?>> enabledInterceptorClasses)
- {
- this.enabledInterceptorClasses = enabledInterceptorClasses;
- }
-
- public Set<Bean<?>> getBeans(Type beanType, Annotation... bindings)
- {
- return getBeans(ResolvableWeldClass.of(beanType, bindings, this), bindings);
- }
-
- public Set<Bean<?>> getBeans(WeldAnnotated<?, ?> element, Annotation... bindings)
- {
- for (Annotation annotation : element.getAnnotations())
- {
- if (!getServices().get(MetaAnnotationStore.class).getBindingTypeModel(annotation.annotationType()).isValid())
- {
- throw new ForbiddenArgumentException(INVALID_QUALIFIER, annotation);
- }
- }
-// for (Type type : element.getActualTypeArguments())
-// {
-// if (type instanceof WildcardType)
-// {
-// throw new IllegalArgumentException("Cannot resolve a type parameterized with a wildcard " + element);
-// }
-// if (type instanceof TypeVariable<?>)
-// {
-// throw new IllegalArgumentException("Cannot resolve a type parameterized with a type parameter " + element);
-// }
-// }
- if (bindings != null && bindings.length > element.getMetaAnnotations(Qualifier.class).size())
- {
- throw new ForbiddenArgumentException(DUPLICATE_QUALIFIERS, Arrays.asList(bindings));
- }
- return beanResolver.resolve(ResolvableFactory.of(element));
- }
-
- public Set<Bean<?>> getInjectableBeans(InjectionPoint injectionPoint)
- {
- boolean registerInjectionPoint = !injectionPoint.getType().equals(InjectionPoint.class);
- try
- {
- if (registerInjectionPoint)
- {
- currentInjectionPoint.get().push(injectionPoint);
- }
- // TODO Do this properly
- Set<Bean<?>> beans = getBeans(ResolvableWeldClass.of(injectionPoint.getType(), injectionPoint.getQualifiers().toArray(new Annotation[0]), this));
- Set<Bean<?>> injectableBeans = new HashSet<Bean<?>>();
- for (Bean<?> bean : beans)
- {
- if (!(bean instanceof Decorator || bean instanceof Interceptor))
- {
- injectableBeans.add(bean);
- }
- }
- return injectableBeans;
- }
- finally
- {
- if (registerInjectionPoint)
- {
- currentInjectionPoint.get().pop();
- }
- }
- }
-
- protected void registerBeanNamespace(Bean<?> bean)
- {
- if (bean.getName() != null && bean.getName().indexOf('.') > 0)
- {
- namespaces.add(bean.getName().substring(0, bean.getName().lastIndexOf('.')));
- }
- }
-
- /**
- * Gets the class-mapped beans. For internal use.
- *
- * @return The bean map
- */
- public Map<EjbDescriptor<?>, SessionBean<?>> getEnterpriseBeans()
- {
- return enterpriseBeans;
- }
-
- /**
- * The beans registered with the Web Bean manager which are resolvable. Does
- * not include interceptor and decorator beans
- *
- * @return The list of known beans
- */
- public List<Bean<?>> getBeans()
- {
- return Collections.unmodifiableList(beans);
- }
-
- private List<Bean<?>> getTransitiveBeans()
- {
- return Collections.unmodifiableList(transitiveBeans);
- }
-
- public List<Decorator<?>> getDecorators()
- {
- return Collections.unmodifiableList(decorators);
- }
-
- public List<Interceptor<?>> getInterceptors()
- {
- return Collections.unmodifiableList(interceptors);
- }
-
- public Iterable<Bean<?>> getAccessibleBeans()
- {
- return createDynamicAccessibleIterable(new Transform.BeanTransform(this));
- }
-
- public void addContext(Context context)
- {
- contexts.put(context.getScope(), context);
- }
-
- /**
- * Does the actual observer registration
- *
- * @param observer
-= */
- public void addObserver(ObserverMethod<?> observer)
- {
- //checkEventType(observer.getObservedType());
- observers.add(observer);
- for (BeanManagerImpl childActivity : childActivities)
- {
- childActivity.addObserver(observer);
- }
- }
-
- /**
- * Fires an event object with given event object for given bindings
- *
- * @param event The event object to pass along
- * @param bindings The binding types to match
- *
- * @see javax.enterprise.inject.spi.BeanManager#fireEvent(java.lang.Object,
- * java.lang.annotation.Annotation[])
- */
- public void fireEvent(Object event, Annotation... qualifiers)
- {
- fireEvent(event.getClass(), event, qualifiers);
- }
-
- public void fireEvent(Type eventType, Object event, Annotation... qualifiers)
- {
- Observers.checkEventObjectType(event);
- notifyObservers(event, resolveObserverMethods(eventType, qualifiers));
- }
-
- private <T> void notifyObservers(final T event, final Set<ObserverMethod<? super T>> observers)
- {
- for (ObserverMethod<? super T> observer : observers)
- {
- observer.notify(event);
- }
- }
-
- /**
- * Gets an active context of the given scope. Throws an exception if there
- * are no active contexts found or if there are too many matches
- *
- * @param scopeType The scope to match
- * @return A single active context of the given scope
- *
- * @see javax.enterprise.inject.spi.BeanManager#getContext(java.lang.Class)
- */
- public Context getContext(Class<? extends Annotation> scopeType)
- {
- List<Context> activeContexts = new ArrayList<Context>();
- for (Context context : contexts.get(scopeType))
- {
- if (context.isActive())
- {
- activeContexts.add(context);
- }
- }
- if (activeContexts.isEmpty())
- {
- throw new ContextNotActiveException(CONTEXT_NOT_ACTIVE, scopeType.getName());
- }
- if (activeContexts.size() > 1)
- {
- throw new ForbiddenStateException(DUPLICATE_ACTIVE_CONTEXTS, scopeType.getName());
- }
- return activeContexts.iterator().next();
-
- }
-
- public Object getReference(Bean<?> bean, CreationalContext<?> creationalContext, boolean delegate)
- {
- bean = getMostSpecializedBean(bean);
- if (creationalContext instanceof WeldCreationalContext<?>)
- {
- creationalContext = ((WeldCreationalContext<?>) creationalContext).getCreationalContext(bean);
- }
- if (!delegate && isProxyRequired(bean))
- {
- if (creationalContext != null || getContext(bean.getScope()).get(bean) != null)
- {
- return clientProxyProvider.getClientProxy(this, bean);
- }
- else
- {
- return null;
- }
- }
- else
- {
- return getContext(bean.getScope()).get((Contextual) bean, creationalContext);
- }
- }
-
- private boolean isProxyRequired(Bean<?> bean)
- {
- if (getServices().get(MetaAnnotationStore.class).getScopeModel(bean.getScope()).isNormal())
- {
- return true;
- }
- else if (bean instanceof RIBean<?>)
- {
- return ((RIBean<?>) bean).isProxyRequired();
- }
- else
- {
- return false;
- }
- }
-
- public Object getReference(Bean<?> bean, Type beanType, CreationalContext<?> creationalContext)
- {
- if (!Reflections.isAssignableFrom(bean.getTypes(), beanType))
- {
- throw new ForbiddenArgumentException(SPECIFIED_TYPE_NOT_BEAN_TYPE, beanType, bean );
- }
- return getReference(bean, creationalContext, false);
- }
-
-
- /**
- * Get a reference, registering the injection point used.
- *
- * @param injectionPoint the injection point to register
- * @param resolvedBean the bean to get a reference to
- * @param creationalContext the creationalContext
- * @return
- */
- public Object getReference(InjectionPoint injectionPoint, Bean<?> resolvedBean, CreationalContext<?> creationalContext)
- {
- boolean registerInjectionPoint = (injectionPoint != null && !injectionPoint.getType().equals(InjectionPoint.class));
- boolean delegateInjectionPoint = injectionPoint != null && injectionPoint.isDelegate();
- try
- {
- if (registerInjectionPoint)
- {
- currentInjectionPoint.get().push(injectionPoint);
- }
- if (getServices().get(MetaAnnotationStore.class).getScopeModel(resolvedBean.getScope()).isNormal() && !Proxies.isTypeProxyable(injectionPoint.getType()))
- {
- throw new UnproxyableResolutionException(UNPROXYABLE_RESOLUTION, resolvedBean, injectionPoint);
- }
- // TODO Can we move this logic to getReference?
- if (creationalContext instanceof WeldCreationalContext<?>)
- {
- WeldCreationalContext<?> wbCreationalContext = (WeldCreationalContext<?>) creationalContext;
- if (wbCreationalContext.containsIncompleteInstance(resolvedBean))
- {
- return wbCreationalContext.getIncompleteInstance(resolvedBean);
- }
- else
- {
- return getReference(resolvedBean, wbCreationalContext, delegateInjectionPoint);
- }
- }
- else
- {
- return getReference(resolvedBean, creationalContext, delegateInjectionPoint);
- }
- }
- finally
- {
- if (registerInjectionPoint)
- {
- currentInjectionPoint.get().pop();
- }
- }
- }
-
-
- public Object getInjectableReference(InjectionPoint injectionPoint, CreationalContext<?> creationalContext)
- {
- WeldAnnotated<?, ?> element = ResolvableWeldClass.of(injectionPoint.getType(), injectionPoint.getQualifiers().toArray(new Annotation[0]), this);
- Bean<?> resolvedBean = getBean(element, element.getBindingsAsArray());
- return getReference(injectionPoint, resolvedBean, creationalContext);
- }
-
- /**
- * Returns an instance by API type and binding types
- *
- * @param beanType The API type to match
- * @param bindings The binding types to match
- * @return An instance of the bean
- *
- */
- @Deprecated
- public <T> T getInstanceByType(Class<T> beanType, Annotation... bindings)
- {
- Set<Bean<?>> beans = getBeans(beanType, bindings);
- Bean<?> bean = resolve(beans);
- if (bean == null)
- {
- throw new UnsatisfiedResolutionException(UNRESOLVABLE_TYPE, beanType, Arrays.toString(bindings));
- }
- Object reference = getReference(bean, beanType, createCreationalContext(bean));
-
- @SuppressWarnings("unchecked")
- T instance = (T) reference;
-
- return instance;
- }
-
- public <T> Bean<T> getBean(WeldAnnotated<T, ?> element, Annotation... bindings)
- {
- Bean<T> bean = (Bean<T>) resolve(getBeans(element, bindings));
- if (bean == null)
- {
- throw new UnsatisfiedResolutionException(UNRESOLVABLE_ELEMENT, element);
- }
-
- boolean normalScoped = getServices().get(MetaAnnotationStore.class).getScopeModel(bean.getScope()).isNormal();
- if (normalScoped && !Beans.isBeanProxyable(bean))
- {
- throw new UnproxyableResolutionException(NOT_PROXYABLE, bean);
- }
- return bean;
- }
-
- public Set<Bean<?>> getBeans(String name)
- {
- return nameBasedResolver.resolve(name);
- }
-
- /**
- * Resolves a list of decorators based on API types and binding types
- *
- * @param types The set of API types to match
- * @param bindings The binding types to match
- * @return A list of matching decorators
- *
- * @see javax.enterprise.inject.spi.BeanManager#resolveDecorators(java.util.Set,
- * java.lang.annotation.Annotation[])
- */
- public List<Decorator<?>> resolveDecorators(Set<Type> types, Annotation... bindings)
- {
- checkResolveDecoratorsArguments(types, Arrays.asList(bindings));
- // TODO Fix this cast and make the resolver return a list
- return new ArrayList<Decorator<?>>(decoratorResolver.resolve(ResolvableFactory.of(types, null, bindings)));
- }
-
- public List<Decorator<?>> resolveDecorators(Set<Type> types, Set<Annotation> bindings)
- {
- checkResolveDecoratorsArguments(types, bindings);
- // TODO Fix this cast and make the resolver return a list
- return new ArrayList<Decorator<?>>(decoratorResolver.resolve(ResolvableFactory.of(types, bindings, null)));
- }
-
- private void checkResolveDecoratorsArguments(Set<Type> types, Collection<Annotation> bindings)
- {
- if (types.isEmpty())
- {
- throw new ForbiddenArgumentException(NO_DECORATOR_TYPES);
- }
- checkBindingTypes(bindings);
- }
-
- /**
- * Resolves a list of interceptors based on interception type and interceptor
- * bindings
- *
- * @param type The interception type to resolve
- * @param interceptorBindings The binding types to match
- * @return A list of matching interceptors
- *
- * @see javax.enterprise.inject.spi.BeanManager#resolveInterceptors(javax.enterprise.inject.spi.InterceptionType,
- * java.lang.annotation.Annotation[])
- */
- public List<Interceptor<?>> resolveInterceptors(InterceptionType type, Annotation... interceptorBindings)
- {
- if (interceptorBindings.length == 0)
- throw new ForbiddenArgumentException(INTERCEPTOR_BINDINGS_EMPTY);
- Set<Class<?>> uniqueInterceptorBindings = new HashSet<Class<?>>();
- for (Annotation interceptorBinding: interceptorBindings)
- {
- if (uniqueInterceptorBindings.contains(interceptorBinding.annotationType()))
- throw new ForbiddenArgumentException(DUPLICATE_INTERCEPTOR_BINDING, interceptorBinding.annotationType());
- if (!isInterceptorBinding(interceptorBinding.annotationType()))
- throw new ForbiddenArgumentException(INTERCEPTOR_RESOLUTION_WITH_NONBINDING_TYPE, interceptorBinding.annotationType());
- uniqueInterceptorBindings.add(interceptorBinding.annotationType());
- }
- return new ArrayList<Interceptor<?>>(interceptorResolver.resolve(ResolvableFactory.of(type,interceptorBindings)));
- }
-
- /**
- * Get the web bean resolver. For internal use
- *
- * @return The resolver
- */
- public TypeSafeBeanResolver<Bean<?>> getBeanResolver()
- {
- return beanResolver;
- }
-
- /**
- * Gets a string representation
- *
- * @return A string representation
- */
- @Override
- public String toString()
- {
- StringBuilder buffer = new StringBuilder();
- buffer.append("Manager\n");
- buffer.append("Enabled alternatives: " + getEnabledAlternativeClasses() + " " + getEnabledAlternativeStereotypes() + "\n");
- buffer.append("Registered contexts: " + contexts.keySet() + "\n");
- buffer.append("Registered beans: " + getBeans().size() + "\n");
- buffer.append("Specialized beans: " + specializedBeans.size() + "\n");
- return buffer.toString();
- }
-
- @Override
- public boolean equals(Object obj)
- {
- if (obj instanceof BeanManagerImpl)
- {
- BeanManagerImpl that = (BeanManagerImpl) obj;
- return this.getId().equals(that.getId());
- }
- else
- {
- return false;
- }
- }
-
- @Override
- public int hashCode()
- {
- return getId().hashCode();
- }
-
- public BeanManagerImpl createActivity()
- {
- BeanManagerImpl childActivity = newChildActivityManager(this);
- childActivities.add(childActivity);
- Container.instance().addActivity(childActivity);
- return childActivity;
- }
-
- public BeanManagerImpl setCurrent(Class<? extends Annotation> scopeType)
- {
- if (!getServices().get(MetaAnnotationStore.class).getScopeModel(scopeType).isNormal())
- {
- throw new ForbiddenArgumentException(NON_NORMAL_SCOPE, scopeType);
- }
- currentActivities.add(new CurrentActivity(getContext(scopeType), this));
- return this;
- }
-
- public BeanManagerImpl getCurrent()
- {
- List<CurrentActivity> activeCurrentActivities = new ArrayList<CurrentActivity>();
- for (CurrentActivity currentActivity : currentActivities)
- {
- if (currentActivity.getContext().isActive())
- {
- activeCurrentActivities.add(currentActivity);
- }
- }
- if (activeCurrentActivities.size() == 0)
- {
- return this;
- }
- else if (activeCurrentActivities.size() == 1)
- {
- return activeCurrentActivities.get(0).getManager();
- }
- throw new ForbiddenStateException(TOO_MANY_ACTIVITIES, currentActivities);
- }
-
- public ServiceRegistry getServices()
- {
- return services;
- }
-
- /**
- * The injection point being operated on for this thread
- *
- * @return the current injection point
- */
- public InjectionPoint getCurrentInjectionPoint()
- {
- if (!currentInjectionPoint.get().empty())
- {
- return currentInjectionPoint.get().peek();
- }
- else
- {
- return null;
- }
- }
-
- /**
- * Replaces (or adds) the current injection point. If a current injection
- * point exists, it will be replaced. If no current injection point exists,
- * one will be added.
- *
- * @param injectionPoint the injection point to use
- * @return the injection point added, or null if non previous existed
- */
- public InjectionPoint replaceOrPushCurrentInjectionPoint(InjectionPoint injectionPoint)
- {
- InjectionPoint originalInjectionPoint = null;
- if (!currentInjectionPoint.get().empty())
- {
- originalInjectionPoint = currentInjectionPoint.get().pop();
- }
- currentInjectionPoint.get().push(injectionPoint);
- return originalInjectionPoint;
- }
-
- public void pushDummyInjectionPoint()
- {
- currentInjectionPoint.get().push(DUMMY_INJECTION_POINT);
- }
-
- public void popDummyInjectionPoint()
- {
- if (!currentInjectionPoint.get().isEmpty() && DUMMY_INJECTION_POINT.equals(currentInjectionPoint.get().peek()))
- {
- currentInjectionPoint.get().pop();
- }
- }
-
- /**
- *
- * @return
- */
- public Map<Contextual<?>, Contextual<?>> getSpecializedBeans()
- {
- // TODO make this unmodifiable after deploy!
- return specializedBeans;
- }
-
- // Serialization
-
- protected Object readResolve()
- {
- return Container.instance().activityManager(id);
- }
-
- protected ClientProxyProvider getClientProxyProvider()
- {
- return clientProxyProvider;
- }
-
- protected ListMultimap<Class<? extends Annotation>, Context> getContexts()
- {
- return contexts;
- }
-
- /**
- * @return the namespaces
- */
- protected List<String> getNamespaces()
- {
- return namespaces;
- }
-
- public Iterable<String> getAccessibleNamespaces()
- {
- // TODO Cache this
- return createDynamicAccessibleIterable(Transform.NAMESPACE);
- }
-
- private Set<CurrentActivity> getCurrentActivities()
- {
- return currentActivities;
- }
-
- public String getId()
- {
- return id;
- }
-
- public AtomicInteger getChildIds()
- {
- return childIds;
- }
-
- public List<ObserverMethod<?>> getObservers()
- {
- return observers;
- }
-
- public Namespace getRootNamespace()
- {
- // TODO I don't like this lazy init
- if (rootNamespace == null)
- {
- rootNamespace = new Namespace(createDynamicAccessibleIterable(Transform.NAMESPACE));
- }
- return rootNamespace;
- }
-
- public <T> InjectionTarget<T> createInjectionTarget(AnnotatedType<T> type)
- {
- return new SimpleInjectionTarget<T>(getServices().get(ClassTransformer.class).loadClass(type), this);
- }
-
- public <T> InjectionTarget<T> createInjectionTarget(EjbDescriptor<T> descriptor)
- {
- return getBean(descriptor).getInjectionTarget();
- }
-
- public <X> Bean<? extends X> getMostSpecializedBean(Bean<X> bean)
- {
- Contextual<?> key = bean;
- while (specializedBeans.containsKey(key))
- {
- if (key == null)
- {
- System.out.println("null key " + bean);
- }
- key = specializedBeans.get(key);
- }
- return (Bean<X>) key;
- }
-
- public void validate(InjectionPoint ij)
- {
- try
- {
- getServices().get(Validator.class).validateInjectionPoint(ij, this);
- }
- catch (DeploymentException e)
- {
- throw new InjectionException(e.getLocalizedMessage(), e.getCause());
- }
- }
-
- public Set<Annotation> getInterceptorBindingDefinition(Class<? extends Annotation> bindingType)
- {
- if (getServices().get(MetaAnnotationStore.class).getInterceptorBindingModel(bindingType).isValid())
- {
- return getServices().get(MetaAnnotationStore.class).getInterceptorBindingModel(bindingType).getMetaAnnotations();
- }
- else
- {
- throw new ForbiddenArgumentException(NOT_INTERCEPTOR_BINDING_TYPE, bindingType);
- }
- }
-
- public Bean<?> getPassivationCapableBean(String id)
- {
- return getServices().get(ContextualStore.class).<Bean<Object>, Object>getContextual(id);
- }
-
- public Set<Annotation> getStereotypeDefinition(Class<? extends Annotation> stereotype)
- {
- if (getServices().get(MetaAnnotationStore.class).getStereotype(stereotype).isValid())
- {
- return getServices().get(MetaAnnotationStore.class).getStereotype(stereotype).getMetaAnnotations();
- }
- else
- {
- throw new ForbiddenArgumentException(NOT_STEREOTYPE, stereotype);
- }
- }
-
- public boolean isQualifier(Class<? extends Annotation> annotationType)
- {
- return getServices().get(MetaAnnotationStore.class).getBindingTypeModel(annotationType).isValid();
- }
-
- public boolean isInterceptorBinding(Class<? extends Annotation> annotationType)
- {
- return getServices().get(MetaAnnotationStore.class).getInterceptorBindingModel(annotationType).isValid();
- }
-
- public boolean isNormalScope(Class<? extends Annotation> annotationType)
- {
- ScopeModel<?> scope = getServices().get(MetaAnnotationStore.class).getScopeModel(annotationType);
- return scope.isValid() && scope.isNormal();
- }
-
- public boolean isPassivatingScope(Class<? extends Annotation> annotationType)
- {
- ScopeModel<?> scope = getServices().get(MetaAnnotationStore.class).getScopeModel(annotationType);
- return scope.isValid() && scope.isPassivating();
- }
-
- public boolean isScope(Class<? extends Annotation> annotationType)
- {
- return getServices().get(MetaAnnotationStore.class).getScopeModel(annotationType).isValid();
- }
-
- public boolean isStereotype(Class<? extends Annotation> annotationType)
- {
- return getServices().get(MetaAnnotationStore.class).getStereotype(annotationType).isValid();
- }
-
- public ELResolver getELResolver()
- {
- return weldELResolver;
- }
-
- public ExpressionFactory wrapExpressionFactory(ExpressionFactory expressionFactory)
- {
- return new WeldExpressionFactory(expressionFactory);
- }
-
- public <T> WeldCreationalContext<T> createCreationalContext(Contextual<T> contextual)
- {
- return new CreationalContextImpl<T>(contextual);
- }
-
- public <T> AnnotatedType<T> createAnnotatedType(Class<T> type)
- {
- return getServices().get(ClassTransformer.class).loadClass(type);
- }
-
- public <X> Bean<? extends X> resolve(Set<Bean<? extends X>> beans)
- {
- Set<Bean<? extends X>> resolvedBeans = beanResolver.resolve(beans);
- if (resolvedBeans.size() == 0)
- {
- return null;
- }
- if (resolvedBeans.size() == 1)
- {
- return resolvedBeans.iterator().next();
- }
- else
- {
- throw new AmbiguousResolutionException(AMBIGUOUS_BEANS_FOR_DEPENDENCY, beans);
- }
- }
-
- public <T> EjbDescriptor<T> getEjbDescriptor(String beanName)
- {
- return getServices().get(EjbDescriptors.class).get(beanName);
- }
-
- public <T> SessionBean<T> getBean(EjbDescriptor<T> descriptor)
- {
- return (SessionBean<T>) getEnterpriseBeans().get(descriptor);
- }
-
- public void cleanup()
- {
- services.cleanup();
- this.currentInjectionPoint.remove();
- this.accessibleManagers.clear();
- this.beanResolver.clear();
- this.beans.clear();
- this.childActivities.clear();
- this.clientProxyProvider.clear();
- this.contexts.clear();
- this.currentActivities.clear();
- this.decoratorResolver.clear();
- this.decorators.clear();
- this.enabledDecoratorClasses.clear();
- this.enabledInterceptorClasses.clear();
- this.enabledAlternativeClasses.clear();
- this.enabledAlternativeStereotypes.clear();
- this.enterpriseBeans.clear();
- this.interceptorResolver.clear();
- this.interceptors.clear();
- this.nameBasedResolver.clear();
- this.namespaces.clear();
- this.observerResolver.clear();
- this.observers.clear();
- this.specializedBeans.clear();
- }
-
- public InterceptorRegistry<Class<?>, SerializableContextual<Interceptor<?>, ?>> getCdiInterceptorsRegistry()
- {
- return boundInterceptorsRegistry;
- }
-
- public InterceptorRegistry<Class<?>, Class<?>> getClassDeclaredInterceptorsRegistry()
- {
- return declaredInterceptorsRegistry;
- }
-
- public <X> InjectionTarget<X> fireProcessInjectionTarget(AnnotatedType<X> annotatedType)
- {
- return AbstractProcessInjectionTarget.fire(this, annotatedType, createInjectionTarget(annotatedType));
- }
-}
Modified: core/trunk/impl/src/main/java/org/jboss/weld/Container.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/Container.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/Container.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -27,8 +27,10 @@
import org.jboss.weld.bootstrap.api.Singleton;
import org.jboss.weld.bootstrap.api.SingletonProvider;
import org.jboss.weld.bootstrap.spi.BeanDeploymentArchive;
+import org.jboss.weld.exceptions.ForbiddenArgumentException;
import org.jboss.weld.logging.LoggerFactory;
import org.jboss.weld.logging.MessageConveyorFactory;
+import org.jboss.weld.manager.BeanManagerImpl;
/**
* A Weld application container
Deleted: core/trunk/impl/src/main/java/org/jboss/weld/CreationException.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/CreationException.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/CreationException.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -1,72 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat, Inc. and/or its affiliates, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.jboss.weld;
-
-/**
- * A version of {@link javax.enterprise.inject.CreationException} that supports
- * message localization.
- *
- * @author David Allen
- */
-public class CreationException extends javax.enterprise.inject.CreationException
-{
-
- private static final long serialVersionUID = 2L;
-
- private WeldExceptionMessage message;
-
- /**
- * Creates a new exception with the given localized message key and optional
- * arguments for the message.
- *
- * @param <E> The enumeration type for the message keys
- * @param key The localized message to use
- * @param args Optional arguments to insert into the message
- */
- public <E extends Enum<?>> CreationException(E key, Object... args)
- {
- message = new WeldExceptionMessage(key, args);
- }
-
- /**
- * Creates a new exception with the given localized message key, the cause
- * for this exception and optional arguments for the message.
- *
- * @param <E> The enumeration type for the message keys
- * @param key The localized message to use
- * @param throwable The cause for this exception
- * @param args Optional arguments to insert into the message
- */
- public <E extends Enum<?>> CreationException(E key, Throwable throwable, Object... args)
- {
- super(throwable);
- message = new WeldExceptionMessage(key, args);
- }
-
- @Override
- public String getLocalizedMessage()
- {
- return getMessage();
- }
-
- @Override
- public String getMessage()
- {
- return message.getAsString();
- }
-}
Deleted: core/trunk/impl/src/main/java/org/jboss/weld/DefinitionException.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/DefinitionException.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/DefinitionException.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -1,79 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.weld;
-
-import java.util.List;
-
-/**
- * Thrown if the definition of a bean is incorrect
- *
- * @author Pete Muir
- */
-public class DefinitionException extends WeldException
-{
- private static final long serialVersionUID = 8014646336322875707L;
-
- /**
- * Creates a new exception with the given localized message key and optional
- * arguments for the message.
- *
- * @param <E> The enumeration type for the message keys
- * @param key The localized message to use
- * @param args Optional arguments to insert into the message
- */
- public <E extends Enum<?>> DefinitionException(E key, Object... args)
- {
- super(key, args);
- }
-
- /**
- * Creates a new exception with the given localized message key, the cause
- * for this exception and optional arguments for the message.
- *
- * @param <E> The enumeration type for the message keys
- * @param key The localized message to use
- * @param throwable The cause for this exception
- * @param args Optional arguments to insert into the message
- */
- public <E extends Enum<?>> DefinitionException(E key, Throwable throwable, Object... args)
- {
- super(throwable);
- }
-
- /**
- * Creates a new exception with the given cause.
- *
- * @param throwable The cause of the exception
- */
- public DefinitionException(Throwable throwable)
- {
- super(throwable);
- }
-
- /**
- * Creates a new exception based on a list of throwables. The throwables are not
- * used as the cause, but the message from each throwable is included as the message
- * for this exception.
- *
- * @param errors A list of throwables to use in the message
- */
- public DefinitionException(List<Throwable> errors)
- {
- super(errors);
- }
-
-}
Deleted: core/trunk/impl/src/main/java/org/jboss/weld/DeploymentException.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/DeploymentException.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/DeploymentException.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -1,78 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.weld;
-
-import java.util.List;
-
-/**
- * Thrown if an deployment exception occurs.
- *
- * @author Pete Muir
- */
-public class DeploymentException extends WeldException
-{
- private static final long serialVersionUID = 8014646336322875707L;
-
- /**
- * Creates a new exception with the given localized message key and optional
- * arguments for the message.
- *
- * @param <E> The enumeration type for the message keys
- * @param key The localized message to use
- * @param args Optional arguments to insert into the message
- */
- public <E extends Enum<?>> DeploymentException(E key, Object... args)
- {
- super(key, args);
- }
-
- /**
- * Creates a new exception with the given localized message key, the cause
- * for this exception and optional arguments for the message.
- *
- * @param <E> The enumeration type for the message keys
- * @param key The localized message to use
- * @param throwable The cause for this exception
- * @param args Optional arguments to insert into the message
- */
- public <E extends Enum<?>> DeploymentException(E key, Throwable throwable, Object... args)
- {
- super(key, throwable, args);
- }
-
- /**
- * Creates a new exception with the given cause.
- *
- * @param throwable The cause of the exception
- */
- public DeploymentException(Throwable throwable)
- {
- super(throwable);
- }
-
- /**
- * Creates a new exception based on a list of throwables. The throwables are not
- * used as the cause, but the message from each throwable is included as the message
- * for this exception.
- *
- * @param errors A list of throwables to use in the message
- */
- public DeploymentException(List<Throwable> errors)
- {
- super(errors);
- }
-}
Deleted: core/trunk/impl/src/main/java/org/jboss/weld/ForbiddenArgumentException.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/ForbiddenArgumentException.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/ForbiddenArgumentException.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -1,68 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat, Inc. and/or its affiliates, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.jboss.weld;
-
-/**
- * This exception is used when the specification calls for an
- * {@link java.lang.IllegalArgumentException}.
- *
- * @author David Allen
- */
-public class ForbiddenArgumentException extends IllegalArgumentException
-{
-
- private static final long serialVersionUID = 2L;
-
- private WeldExceptionMessage message;
-
- /**
- * Creates a new exception with the given cause.
- *
- * @param throwable The cause of the exception
- */
- public ForbiddenArgumentException(Throwable throwable)
- {
- super(throwable);
- message = new WeldExceptionMessage(throwable.getLocalizedMessage());
- }
-
- /**
- * Creates a new exception with the given localized message key and optional
- * arguments for the message.
- *
- * @param <E> The enumeration type for the message keys
- * @param key The localized message to use
- * @param args Optional arguments to insert into the message
- */
- public <E extends Enum<?>> ForbiddenArgumentException(E key, Object... args)
- {
- message = new WeldExceptionMessage(key, args);
- }
-
- @Override
- public String getLocalizedMessage()
- {
- return getMessage();
- }
-
- @Override
- public String getMessage()
- {
- return message.getAsString();
- }
-}
Deleted: core/trunk/impl/src/main/java/org/jboss/weld/ForbiddenStateException.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/ForbiddenStateException.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/ForbiddenStateException.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -1,66 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat, Inc. and/or its affiliates, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.jboss.weld;
-
-/**
- * This exception is used when the specification calls for an
- * {@link java.lang.IllegalStateException}.
- *
- * @author David Allen
- */
-public class ForbiddenStateException extends IllegalStateException
-{
- private static final long serialVersionUID = 2L;
-
- private WeldExceptionMessage message;
-
- /**
- * Creates a new exception with the given localized message key and optional
- * arguments for the message.
- *
- * @param <E> The enumeration type for the message keys
- * @param key The localized message to use
- * @param args Optional arguments to insert into the message
- */
- public <E extends Enum<?>> ForbiddenStateException(E key, Object... args)
- {
- message = new WeldExceptionMessage(key, args);
- }
-
- /**
- * Creates a new exception with the given cause.
- *
- * @param throwable The cause of the exception
- */
- public ForbiddenStateException(Throwable cause)
- {
- super(cause.getLocalizedMessage(), cause);
- }
-
- @Override
- public String getLocalizedMessage()
- {
- return getMessage();
- }
-
- @Override
- public String getMessage()
- {
- return message.getAsString();
- }
-}
Deleted: core/trunk/impl/src/main/java/org/jboss/weld/IllegalProductException.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/IllegalProductException.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/IllegalProductException.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -1,57 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat, Inc. and/or its affiliates, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.jboss.weld;
-
-/**
- * An {@link javax.enterprise.inject.IllegalProductException} with support for
- * localized messages in Weld.
- *
- * @author David Allen
- */
-public class IllegalProductException extends javax.enterprise.inject.IllegalProductException
-{
-
- private static final long serialVersionUID = 2L;
-
- private WeldExceptionMessage message;
-
- /**
- * Creates a new exception with the given localized message key and optional
- * arguments for the message.
- *
- * @param <E> The enumeration type for the message keys
- * @param key The localized message to use
- * @param args Optional arguments to insert into the message
- */
- public <E extends Enum<?>> IllegalProductException(E key, Object... args)
- {
- message = new WeldExceptionMessage(key, args);
- }
-
- @Override
- public String getLocalizedMessage()
- {
- return getMessage();
- }
-
- @Override
- public String getMessage()
- {
- return message.getAsString();
- }
-}
Deleted: core/trunk/impl/src/main/java/org/jboss/weld/InconsistentSpecializationException.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/InconsistentSpecializationException.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/InconsistentSpecializationException.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -1,54 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.weld;
-
-
-/**
- *
- * @author Pete Muir
- */
-public class InconsistentSpecializationException extends DeploymentException
-{
-
- private static final long serialVersionUID = 4359656880524913555L;
-
- /**
- * Creates a new exception with the given localized message key and optional
- * arguments for the message.
- *
- * @param <E> The enumeration type for the message keys
- * @param key The localized message to use
- * @param args Optional arguments to insert into the message
- */
- public <E extends Enum<?>> InconsistentSpecializationException(E key, Object... args)
- {
- super(key, args);
- }
-
- /**
- * Creates a new exception with the given cause.
- *
- * @param throwable The cause of the exception
- */
- public InconsistentSpecializationException(Throwable throwable)
- {
- super(throwable);
- }
-
-
-
-}
Deleted: core/trunk/impl/src/main/java/org/jboss/weld/InjectionException.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/InjectionException.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/InjectionException.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -1,81 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat, Inc. and/or its affiliates, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.jboss.weld;
-
-/**
- * Provides message localization service for the
- * {@link javax.enterprise.inject.InjectionException}.
- *
- * @author David Allen
- */
-public class InjectionException extends javax.enterprise.inject.InjectionException
-{
- private static final long serialVersionUID = 2L;
-
- private WeldExceptionMessage message;
-
- /**
- * Creates a new exception with the given cause.
- *
- * @param throwable The cause of the exception
- */
- public InjectionException(Throwable throwable)
- {
- super(throwable);
- message = new WeldExceptionMessage(throwable.getLocalizedMessage());
- }
-
- /**
- * Creates a new exception with an arbitrary message and the cause of the
- * exception. It is not recommended to use this constructor since the message
- * cannot be localized.
- *
- * @param message The error message
- * @param throwable The cause of the exception or wrapped throwable
- */
- public InjectionException(String message, Throwable throwable)
- {
- super(throwable);
- this.message = new WeldExceptionMessage(message);
- }
-
- /**
- * Creates a new exception with the given localized message key and optional
- * arguments for the message.
- *
- * @param <E> The enumeration type for the message keys
- * @param key The localized message to use
- * @param args Optional arguments to insert into the message
- */
- public <E extends Enum<?>> InjectionException(E key, Object... args)
- {
- message = new WeldExceptionMessage(key, args);
- }
-
- @Override
- public String getLocalizedMessage()
- {
- return getMessage();
- }
-
- @Override
- public String getMessage()
- {
- return message.getAsString();
- }
-}
Deleted: core/trunk/impl/src/main/java/org/jboss/weld/InvalidObjectException.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/InvalidObjectException.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/InvalidObjectException.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -1,59 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat, Inc. and/or its affiliates, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.jboss.weld;
-
-/**
- * An extended version of {@link java.io.InvalidObjectException} that supports
- * localization.
- *
- * @author David Allen
- */
-public class InvalidObjectException extends java.io.InvalidObjectException
-{
-
- private static final long serialVersionUID = 2L;
-
- private WeldExceptionMessage message;
-
- /**
- * Creates a new exception with the given localized message key and optional
- * arguments for the message.
- *
- * @param <E> The enumeration type for the message keys
- * @param key The localized message to use
- * @param args Optional arguments to insert into the message
- */
- public <E extends Enum<?>> InvalidObjectException(E key, Object... args)
- {
- super(null);
- message = new WeldExceptionMessage(key, args);
- }
-
- @Override
- public String getLocalizedMessage()
- {
- return getMessage();
- }
-
- @Override
- public String getMessage()
- {
- return message.getAsString();
- }
-
-}
Deleted: core/trunk/impl/src/main/java/org/jboss/weld/InvalidOperationException.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/InvalidOperationException.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/InvalidOperationException.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -1,67 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat, Inc. and/or its affiliates, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.jboss.weld;
-
-/**
- * An exception used for unsupported operations or invocations of operations
- * that are invalid in certain contexts.
- *
- * @author David Allen
- */
-public class InvalidOperationException extends UnsupportedOperationException
-{
-
- private static final long serialVersionUID = 2L;
-
- private WeldExceptionMessage message;
-
- /**
- * Creates a new exception with no message. Here the stacktrace serves as the
- * main information since it has the method which was invoked causing this
- * exception.
- */
- public InvalidOperationException()
- {
- super();
- }
-
- /**
- * Creates a new exception with the given localized message key and optional
- * arguments for the message.
- *
- * @param <E> The enumeration type for the message keys
- * @param key The localized message to use
- * @param args Optional arguments to insert into the message
- */
- public <E extends Enum<?>> InvalidOperationException(E key, Object... args)
- {
- message = new WeldExceptionMessage(key, args);
- }
-
- @Override
- public String getLocalizedMessage()
- {
- return getMessage();
- }
-
- @Override
- public String getMessage()
- {
- return message.getAsString();
- }
-}
Deleted: core/trunk/impl/src/main/java/org/jboss/weld/Logger.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/Logger.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/Logger.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -1,51 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.weld;
-
-/**
- * @author pmuir
- *
- */
-public interface Logger {
-
- public enum LogMessages {
-
- WRONG_PASSWORD
-
- }
-
- public static class Test {
-
- public void test()
- {
- Logger logger = new Logger()
- {
-
- public void warn(Enum<?> message)
- {
- // No-op, this is a mock
- }
-
- };
- logger.warn(LogMessages.WRONG_PASSWORD);
- }
-
- }
-
- public void warn(Enum<?> message);
-
-}
Deleted: core/trunk/impl/src/main/java/org/jboss/weld/NullInstanceException.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/NullInstanceException.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/NullInstanceException.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -1,46 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat, Inc. and/or its affiliates, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.jboss.weld;
-
-/**
- * This exception occurs in cases where an object instance was expected, but
- * the reference was null. A typical example is with a producer method that
- * is not allowed to return null.
- *
- * @author David Allen
- *
- */
-public class NullInstanceException extends WeldException
-{
-
- private static final long serialVersionUID = 1L;
-
- /**
- * Creates a new exception with the given localized message key and optional
- * arguments for the message.
- *
- * @param <E> The enumeration type for the message keys
- * @param key The localized message to use
- * @param args Optional arguments to insert into the message
- */
- public <E extends Enum<?>> NullInstanceException(E key, Object... args)
- {
- super(key, args);
- }
-
-}
Deleted: core/trunk/impl/src/main/java/org/jboss/weld/NullableDependencyException.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/NullableDependencyException.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/NullableDependencyException.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -1,56 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.weld;
-
-
-/**
- * Thrown if an injection point of primitive type resolves to a bean which may
- * be null
- *
- * @author Pete Muir
- */
-public class NullableDependencyException extends DeploymentException
-{
-
- private static final long serialVersionUID = 6877485218767005761L;
-
- /**
- * Creates a new exception with the given localized message key and optional
- * arguments for the message.
- *
- * @param <E> The enumeration type for the message keys
- * @param key The localized message to use
- * @param args Optional arguments to insert into the message
- */
- public <E extends Enum<?>> NullableDependencyException(E key, Object... args)
- {
- super(key, args);
- }
-
- /**
- * Creates a new exception with the given cause.
- *
- * @param throwable The cause of the exception
- */
- public NullableDependencyException(Throwable throwable)
- {
- super(throwable);
- }
-
-
-
-}
Deleted: core/trunk/impl/src/main/java/org/jboss/weld/SimpleInjectionTarget.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/SimpleInjectionTarget.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/SimpleInjectionTarget.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -1,166 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.weld;
-
-import static org.jboss.weld.logging.messages.BeanManagerMessage.ERROR_INVOKING_POST_CONSTRUCT;
-import static org.jboss.weld.logging.messages.BeanManagerMessage.ERROR_INVOKING_PRE_DESTROY;
-import static org.jboss.weld.logging.messages.BeanManagerMessage.INJECTION_ON_NON_CONTEXTUAL;
-import static org.jboss.weld.logging.messages.BeanManagerMessage.MISSING_BEAN_CONSTRUCTOR_FOUND;
-
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import javax.enterprise.context.spi.CreationalContext;
-import javax.enterprise.inject.spi.InjectionPoint;
-import javax.enterprise.inject.spi.InjectionTarget;
-
-import org.jboss.weld.injection.ConstructorInjectionPoint;
-import org.jboss.weld.injection.FieldInjectionPoint;
-import org.jboss.weld.injection.InjectionContextImpl;
-import org.jboss.weld.injection.MethodInjectionPoint;
-import org.jboss.weld.injection.WeldInjectionPoint;
-import org.jboss.weld.introspector.WeldClass;
-import org.jboss.weld.introspector.WeldMethod;
-import org.jboss.weld.util.Beans;
-
-/**
- * @author pmuir
- *
- */
-public class SimpleInjectionTarget<T> implements InjectionTarget<T>
-{
-
- private final BeanManagerImpl beanManager;
- private final WeldClass<T> type;
- private final ConstructorInjectionPoint<T> constructor;
- private final List<Set<FieldInjectionPoint<?, ?>>> injectableFields;
- private final List<Set<MethodInjectionPoint<?, ?>>> initializerMethods;
- private final WeldMethod<?, ?> postConstruct;
- private final WeldMethod<?, ?> preDestroy;
- private final Set<InjectionPoint> injectionPoints;
- private final Set<WeldInjectionPoint<?, ?>> ejbInjectionPoints;
- private final Set<WeldInjectionPoint<?, ?>> persistenceContextInjectionPoints;
- private final Set<WeldInjectionPoint<?, ?>> persistenceUnitInjectionPoints;
- private final Set<WeldInjectionPoint<?, ?>> resourceInjectionPoints;
-
- public SimpleInjectionTarget(WeldClass<T> type, BeanManagerImpl beanManager)
- {
- this.beanManager = beanManager;
- this.type = type;
- this.injectionPoints = new HashSet<InjectionPoint>();
- ConstructorInjectionPoint<T> constructor = null;
- try
- {
- constructor = Beans.getBeanConstructor(null, type);
- this.injectionPoints.addAll(Beans.getParameterInjectionPoints(null, constructor));
- }
- catch (Exception e)
- {
- // this means the bean of a type that cannot be produce()d, but that is non-fatal
- // unless someone calls produce()
- }
- this.constructor = constructor;
- this.injectableFields = Beans.getFieldInjectionPoints(null, type);
- this.injectionPoints.addAll(Beans.getFieldInjectionPoints(null, this.injectableFields));
- this.initializerMethods = Beans.getInitializerMethods(null, type);
- this.injectionPoints.addAll(Beans.getParameterInjectionPoints(null, initializerMethods));
- this.postConstruct = Beans.getPostConstruct(type);
- this.preDestroy = Beans.getPreDestroy(type);
- this.ejbInjectionPoints = Beans.getEjbInjectionPoints(null, type, beanManager);
- this.persistenceContextInjectionPoints = Beans.getPersistenceContextInjectionPoints(null, type, beanManager);
- this.persistenceUnitInjectionPoints = Beans.getPersistenceUnitInjectionPoints(null, type, beanManager);
- this.resourceInjectionPoints = Beans.getResourceInjectionPoints(null, type, beanManager);
- for (InjectionPoint ip : this.injectionPoints)
- {
- if (ip.getType().equals(InjectionPoint.class))
- {
- throw new DefinitionException(INJECTION_ON_NON_CONTEXTUAL, type, ip);
- }
- }
- }
-
- public T produce(CreationalContext<T> ctx)
- {
- if (constructor == null)
- {
- // this means we couldn't find a constructor on instantiation, which
- // means there isn't one that's spec-compliant
- // try again so the correct DefinitionException is thrown
- Beans.getBeanConstructor(null, type);
- // should not be reached
- throw new ForbiddenStateException(MISSING_BEAN_CONSTRUCTOR_FOUND);
- }
- return constructor.newInstance(beanManager, ctx);
- }
-
- public void inject(final T instance, final CreationalContext<T> ctx)
- {
- new InjectionContextImpl<T>(beanManager, this, instance)
- {
-
- public void proceed()
- {
- Beans.injectEEFields(instance, beanManager, ejbInjectionPoints, persistenceContextInjectionPoints, persistenceUnitInjectionPoints, resourceInjectionPoints);
- Beans.injectFieldsAndInitializers(instance, ctx, beanManager, injectableFields, initializerMethods);
- }
-
- }.run();
-
- }
-
- public void postConstruct(T instance)
- {
- if (postConstruct == null)
- return;
-
- try
- {
- postConstruct.invoke(instance);
- }
- catch (Exception e)
- {
- throw new WeldException(ERROR_INVOKING_POST_CONSTRUCT, e, postConstruct);
- }
- }
-
- public void preDestroy(T instance)
- {
- if (preDestroy == null)
- return;
-
- try
- {
- preDestroy.invoke(instance);
- }
- catch (Exception e)
- {
- throw new WeldException(ERROR_INVOKING_PRE_DESTROY, e, preDestroy);
- }
- }
-
- public void dispose(T instance)
- {
- // No-op
- }
-
- public Set<InjectionPoint> getInjectionPoints()
- {
- return injectionPoints;
- }
-
-}
Deleted: core/trunk/impl/src/main/java/org/jboss/weld/SingleThreadExecutorServices.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/SingleThreadExecutorServices.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/SingleThreadExecutorServices.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -1,70 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.weld;
-
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.TimeUnit;
-
-import org.jboss.weld.manager.api.ExecutorServices;
-
-/**
- * @author pmuir
- *
- */
-public class SingleThreadExecutorServices implements ExecutorServices
-{
-
- private transient final ExecutorService taskExecutor = Executors.newSingleThreadExecutor();
-
-
- /**
- * Provides access to the executor service used for asynchronous tasks.
- *
- * @return the ExecutorService for this manager
- */
- public ExecutorService getTaskExecutor()
- {
- return taskExecutor;
- }
-
- public void cleanup()
- {
- taskExecutor.shutdown();
- try
- {
- // Wait a while for existing tasks to terminate
- if (!taskExecutor.awaitTermination(60, TimeUnit.SECONDS))
- {
- taskExecutor.shutdownNow(); // Cancel currently executing tasks
- // Wait a while for tasks to respond to being cancelled
- if (!taskExecutor.awaitTermination(60, TimeUnit.SECONDS))
- {
- // Log the error here
- }
- }
- }
- catch (InterruptedException ie)
- {
- // (Re-)Cancel if current thread also interrupted
- taskExecutor.shutdownNow();
- // Preserve interrupt status
- Thread.currentThread().interrupt();
- }
- }
-
-}
Deleted: core/trunk/impl/src/main/java/org/jboss/weld/UnproxyableResolutionException.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/UnproxyableResolutionException.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/UnproxyableResolutionException.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -1,68 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat, Inc. and/or its affiliates, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.jboss.weld;
-
-/**
- * Provides message localization service for the
- * {@link javax.enterprise.inject.UnproxyableResolutionException}.
- *
- * @author David Allen
- */
-public class UnproxyableResolutionException extends javax.enterprise.inject.UnproxyableResolutionException
-{
- private static final long serialVersionUID = 2L;
-
- private WeldExceptionMessage message;
-
- /**
- * Creates a new exception with the given cause.
- *
- * @param throwable The cause of the exception
- */
- public UnproxyableResolutionException(Throwable throwable)
- {
- super(throwable);
- message = new WeldExceptionMessage(throwable.getLocalizedMessage());
- }
-
- /**
- * Creates a new exception with the given localized message key and optional
- * arguments for the message.
- *
- * @param <E> The enumeration type for the message keys
- * @param key The localized message to use
- * @param args Optional arguments to insert into the message
- */
- public <E extends Enum<?>> UnproxyableResolutionException(E key, Object... args)
- {
- message = new WeldExceptionMessage(key, args);
- }
-
- @Override
- public String getLocalizedMessage()
- {
- return getMessage();
- }
-
- @Override
- public String getMessage()
- {
- return message.getAsString();
- }
-
-}
Deleted: core/trunk/impl/src/main/java/org/jboss/weld/UnsatisfiedResolutionException.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/UnsatisfiedResolutionException.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/UnsatisfiedResolutionException.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -1,68 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat, Inc. and/or its affiliates, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.jboss.weld;
-
-/**
- * Provides message localization service for the
- * {@link javax.enterprise.inject.UnsatisfiedResolutionException}.
- *
- * @author David Allen
- */
-public class UnsatisfiedResolutionException extends javax.enterprise.inject.UnsatisfiedResolutionException
-{
- private static final long serialVersionUID = 2L;
-
- private WeldExceptionMessage message;
-
- /**
- * Creates a new exception with the given cause.
- *
- * @param throwable The cause of the exception
- */
- public UnsatisfiedResolutionException(Throwable throwable)
- {
- super(throwable);
- message = new WeldExceptionMessage(throwable.getLocalizedMessage());
- }
-
- /**
- * Creates a new exception with the given localized message key and optional
- * arguments for the message.
- *
- * @param <E> The enumeration type for the message keys
- * @param key The localized message to use
- * @param args Optional arguments to insert into the message
- */
- public <E extends Enum<?>> UnsatisfiedResolutionException(E key, Object... args)
- {
- message = new WeldExceptionMessage(key, args);
- }
-
- @Override
- public String getLocalizedMessage()
- {
- return getMessage();
- }
-
- @Override
- public String getMessage()
- {
- return message.getAsString();
- }
-
-}
Deleted: core/trunk/impl/src/main/java/org/jboss/weld/UnserializableDependencyException.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/UnserializableDependencyException.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/UnserializableDependencyException.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -1,59 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.weld;
-
-
-
-/**
- * Thrown if a simple bean is dependent scoped and injected into a stateful
- * session bean, into a non-transient field, bean constructor parameter or
- * initializer method parameter of a bean which declares a passivating scope, or
- * into a parameter of a producer method which declares a passivating scope
- *
- * @author Pete Muir
- */
-public class UnserializableDependencyException extends DeploymentException
-{
-
- private static final long serialVersionUID = -6287506607413810688L;
-
- /**
- * Creates a new exception with the given localized message key and optional
- * arguments for the message.
- *
- * @param <E> The enumeration type for the message keys
- * @param key The localized message to use
- * @param args Optional arguments to insert into the message
- */
- public <E extends Enum<?>> UnserializableDependencyException(E key, Object... args)
- {
- super(key, args);
- }
-
- /**
- * Creates a new exception with the given cause.
- *
- * @param throwable The cause of the exception
- */
- public UnserializableDependencyException(Throwable throwable)
- {
- super(throwable);
- }
-
-
-
-}
Deleted: core/trunk/impl/src/main/java/org/jboss/weld/Validator.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/Validator.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/Validator.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -1,462 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.weld;
-
-import static org.jboss.weld.logging.messages.ValidatorMessage.ALTERNATIVE_BEAN_CLASS_NOT_ANNOTATED;
-import static org.jboss.weld.logging.messages.ValidatorMessage.ALTERNATIVE_BEAN_CLASS_SPECIFIED_MULTIPLE_TIMES;
-import static org.jboss.weld.logging.messages.ValidatorMessage.ALTERNATIVE_STEREOTYPE_NOT_ANNOTATED;
-import static org.jboss.weld.logging.messages.ValidatorMessage.ALTERNATIVE_STEREOTYPE_SPECIFIED_MULTIPLE_TIMES;
-import static org.jboss.weld.logging.messages.ValidatorMessage.AMBIGUOUS_EL_NAME;
-import static org.jboss.weld.logging.messages.ValidatorMessage.BEAN_NAME_IS_PREFIX;
-import static org.jboss.weld.logging.messages.ValidatorMessage.BEAN_SPECIALIZED_TOO_MANY_TIMES;
-import static org.jboss.weld.logging.messages.ValidatorMessage.DECORATOR_CLASS_NOT_BEAN_CLASS_OF_DECORATOR;
-import static org.jboss.weld.logging.messages.ValidatorMessage.DECORATOR_SPECIFIED_TWICE;
-import static org.jboss.weld.logging.messages.ValidatorMessage.DISPOSAL_METHODS_WITHOUT_PRODUCER;
-import static org.jboss.weld.logging.messages.ValidatorMessage.INJECTION_INTO_NON_BEAN;
-import static org.jboss.weld.logging.messages.ValidatorMessage.INJECTION_INTO_NON_DEPENDENT_BEAN;
-import static org.jboss.weld.logging.messages.ValidatorMessage.INJECTION_POINT_HAS_AMBIGUOUS_DEPENDENCIES;
-import static org.jboss.weld.logging.messages.ValidatorMessage.INJECTION_POINT_HAS_NON_PROXYABLE_DEPENDENCIES;
-import static org.jboss.weld.logging.messages.ValidatorMessage.INJECTION_POINT_HAS_NON_SERIALIZABLE_DEPENDENCY;
-import static org.jboss.weld.logging.messages.ValidatorMessage.INJECTION_POINT_HAS_NULLABLE_DEPENDENCIES;
-import static org.jboss.weld.logging.messages.ValidatorMessage.INJECTION_POINT_HAS_UNSATISFIED_DEPENDENCIES;
-import static org.jboss.weld.logging.messages.ValidatorMessage.INJECTION_POINT_HAS_WILDCARD;
-import static org.jboss.weld.logging.messages.ValidatorMessage.INJECTION_POINT_MUST_HAVE_TYPE_PARAMETER;
-import static org.jboss.weld.logging.messages.ValidatorMessage.INJECTION_POINT_WITH_TYPE_VARIABLE;
-import static org.jboss.weld.logging.messages.ValidatorMessage.INTERCEPTOR_NOT_ANNOTATED_OR_REGISTERED;
-import static org.jboss.weld.logging.messages.ValidatorMessage.INTERCEPTOR_SPECIFIED_TWICE;
-import static org.jboss.weld.logging.messages.ValidatorMessage.NEW_WITH_QUALIFIERS;
-import static org.jboss.weld.logging.messages.ValidatorMessage.NON_SERIALIZABLE_BEAN_INJECTED_INTO_PASSIVATING_BEAN;
-import static org.jboss.weld.logging.messages.ValidatorMessage.NOT_PROXYABLE;
-import static org.jboss.weld.logging.messages.ValidatorMessage.PASSIVATING_BEAN_WITH_NONSERIALIZABLE_DECORATOR;
-import static org.jboss.weld.logging.messages.ValidatorMessage.PASSIVATING_BEAN_WITH_NONSERIALIZABLE_INTERCEPTOR;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.ParameterizedType;
-import java.lang.reflect.TypeVariable;
-import java.lang.reflect.WildcardType;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import javax.enterprise.context.Dependent;
-import javax.enterprise.event.Event;
-import javax.enterprise.inject.Alternative;
-import javax.enterprise.inject.Instance;
-import javax.enterprise.inject.New;
-import javax.enterprise.inject.spi.Bean;
-import javax.enterprise.inject.spi.Decorator;
-import javax.enterprise.inject.spi.InjectionPoint;
-import javax.enterprise.inject.spi.InjectionTarget;
-import javax.enterprise.inject.spi.Interceptor;
-
-import org.jboss.interceptor.model.InterceptionModel;
-import org.jboss.weld.bean.AbstractClassBean;
-import org.jboss.weld.bean.AbstractProducerBean;
-import org.jboss.weld.bean.DisposalMethod;
-import org.jboss.weld.bean.InterceptorImpl;
-import org.jboss.weld.bean.NewManagedBean;
-import org.jboss.weld.bean.NewSessionBean;
-import org.jboss.weld.bean.RIBean;
-import org.jboss.weld.bean.WeldDecorator;
-import org.jboss.weld.bootstrap.BeanDeployerEnvironment;
-import org.jboss.weld.bootstrap.api.Service;
-import org.jboss.weld.introspector.WeldAnnotated;
-import org.jboss.weld.metadata.cache.MetaAnnotationStore;
-import org.jboss.weld.resolution.ResolvableWeldClass;
-import org.jboss.weld.serialization.spi.helpers.SerializableContextual;
-import org.jboss.weld.util.Beans;
-import org.jboss.weld.util.Proxies;
-import org.jboss.weld.util.reflection.Reflections;
-
-import com.google.common.base.Supplier;
-import com.google.common.collect.Multimap;
-import com.google.common.collect.Multimaps;
-
-/**
- * Checks a list of beans for DeploymentExceptions and their subclasses
- *
- * @author Nicklas Karlsson
- * @author David Allen
- */
-public class Validator implements Service
-{
-
- private void validateBean(Bean<?> bean, BeanManagerImpl beanManager)
- {
- for (InjectionPoint ij : bean.getInjectionPoints())
- {
- validateInjectionPoint(ij, beanManager);
- }
- boolean normalScoped = beanManager.getServices().get(MetaAnnotationStore.class).getScopeModel(bean.getScope()).isNormal();
- if (normalScoped && !Beans.isBeanProxyable(bean))
- {
- throw new UnproxyableResolutionException(NOT_PROXYABLE, bean);
- }
- }
-
- /**
- * Validate an RIBean. This includes validating whether two beans specialize
- * the same bean
- *
- * @param bean the bean to validate
- * @param beanManager the current manager
- * @param specializedBeans the existing specialized beans
- */
- private void validateRIBean(RIBean<?> bean, BeanManagerImpl beanManager, Collection<RIBean<?>> specializedBeans)
- {
- validateBean(bean, beanManager);
- if (!(bean instanceof NewManagedBean<?>) && !(bean instanceof NewSessionBean<?>))
- {
- RIBean<?> abstractBean = bean;
- if (abstractBean.isSpecializing())
- {
- if (specializedBeans.contains(abstractBean.getSpecializedBean()))
- {
- throw new InconsistentSpecializationException(BEAN_SPECIALIZED_TOO_MANY_TIMES, bean);
- }
- specializedBeans.add(abstractBean.getSpecializedBean());
- }
- if ((bean instanceof AbstractClassBean<?>) && bean.isPassivationCapableBean())
- {
- AbstractClassBean<?> classBean = (AbstractClassBean<?>) bean;
- if (classBean.hasDecorators())
- {
- validateDecorators(beanManager, classBean);
- }
- // validate CDI-defined interceptors
- if (classBean.hasCdiBoundInterceptors())
- {
- validateCdiBoundInterceptors(beanManager, classBean);
- }
- // validate EJB-defined interceptors
- if (((AbstractClassBean<?>) bean).hasDirectlyDefinedInterceptors())
- {
- validateDirectlyDefinedInterceptorClasses(beanManager, classBean);
- }
- }
- }
- }
-
- @SuppressWarnings("unchecked")
- private void validateDirectlyDefinedInterceptorClasses(BeanManagerImpl beanManager, AbstractClassBean<?> classBean)
- {
- InterceptionModel<Class<?>, Class<?>> ejbInterceptorModel = beanManager.getClassDeclaredInterceptorsRegistry().getInterceptionModel(classBean.getType());
- if (ejbInterceptorModel != null)
- {
- Class<?>[] classDeclaredInterceptors = ejbInterceptorModel.getAllInterceptors().toArray(new Class<?>[ejbInterceptorModel.getAllInterceptors().size()]);
- if (classDeclaredInterceptors != null)
- {
- for (Class<?> interceptorClass : classDeclaredInterceptors)
- {
- if (!Reflections.isSerializable(interceptorClass))
- {
- throw new DeploymentException(PASSIVATING_BEAN_WITH_NONSERIALIZABLE_INTERCEPTOR, this, interceptorClass.getName());
- }
- InjectionTarget<Object> injectionTarget = (InjectionTarget<Object>) beanManager.createInjectionTarget(beanManager.createAnnotatedType(interceptorClass));
- for (InjectionPoint injectionPoint : injectionTarget.getInjectionPoints())
- {
- Bean<?> resolvedBean = beanManager.resolve(beanManager.getInjectableBeans(injectionPoint));
- validateInjectionPointPassivationCapable(injectionPoint, resolvedBean, beanManager);
- }
- }
- }
- }
- }
-
- private void validateCdiBoundInterceptors(BeanManagerImpl beanManager, AbstractClassBean<?> classBean)
- {
- InterceptionModel<Class<?>, SerializableContextual<Interceptor<?>, ?>> cdiInterceptorModel = beanManager.getCdiInterceptorsRegistry().getInterceptionModel(classBean.getType());
- if (cdiInterceptorModel != null)
- {
- Collection<SerializableContextual<Interceptor<?>, ?>> interceptors = cdiInterceptorModel.getAllInterceptors();
- if (interceptors.size() > 0)
- {
- for (SerializableContextual<Interceptor<?>, ?> serializableContextual : interceptors)
- {
- if (!((InterceptorImpl<?>)serializableContextual.get()).isSerializable())
- {
- throw new DeploymentException(PASSIVATING_BEAN_WITH_NONSERIALIZABLE_INTERCEPTOR, classBean, serializableContextual.get());
- }
- for (InjectionPoint injectionPoint : serializableContextual.get().getInjectionPoints())
- {
- Bean<?> resolvedBean = beanManager.resolve(beanManager.getInjectableBeans(injectionPoint));
- validateInjectionPointPassivationCapable(injectionPoint, resolvedBean, beanManager);
- }
- }
- }
- }
- }
-
- private void validateDecorators(BeanManagerImpl beanManager, AbstractClassBean<?> classBean)
- {
- for (Decorator<?> decorator : classBean.getDecorators())
- {
- if (!((WeldDecorator<?>)decorator).getAnnotatedItem().isSerializable())
- {
- throw new UnserializableDependencyException(PASSIVATING_BEAN_WITH_NONSERIALIZABLE_DECORATOR, classBean, decorator);
- }
- for (InjectionPoint ij : decorator.getInjectionPoints())
- {
- Bean<?> resolvedBean = beanManager.resolve(beanManager.getInjectableBeans(ij));
- validateInjectionPointPassivationCapable(ij, resolvedBean, beanManager);
- }
- }
- }
-
- /**
- * Validate an injection point
- *
- * @param ij the injection point to validate
- * @param declaringBean the bean into which the injectionPoint has been
- * injected, if null, certain validations aren't available
- * @param beanManager
- */
- public void validateInjectionPoint(InjectionPoint ij, BeanManagerImpl beanManager)
- {
- if (ij.getAnnotated().getAnnotation(New.class) != null && ij.getQualifiers().size() > 1)
- {
- throw new DefinitionException(NEW_WITH_QUALIFIERS, ij);
- }
- if (ij.getType().equals(InjectionPoint.class) && ij.getBean() == null)
- {
- throw new DefinitionException(INJECTION_INTO_NON_BEAN, ij);
- }
- if (ij.getType().equals(InjectionPoint.class) && !Dependent.class.equals(ij.getBean().getScope()))
- {
- throw new DefinitionException(INJECTION_INTO_NON_DEPENDENT_BEAN, ij);
- }
- if (ij.getType() instanceof TypeVariable<?>)
- {
- throw new DefinitionException(INJECTION_POINT_WITH_TYPE_VARIABLE, ij);
- }
- checkFacadeInjectionPoint(ij, Instance.class);
- checkFacadeInjectionPoint(ij, Event.class);
- Annotation[] bindings = ij.getQualifiers().toArray(new Annotation[0]);
- WeldAnnotated<?, ?> annotatedItem = ResolvableWeldClass.of(ij.getType(), bindings, beanManager);
- Set<?> resolvedBeans = beanManager.getBeanResolver().resolve(beanManager.getInjectableBeans(ij));
- if (resolvedBeans.isEmpty())
- {
- throw new DeploymentException(INJECTION_POINT_HAS_UNSATISFIED_DEPENDENCIES, ij, Arrays.toString(bindings));
- }
- if (resolvedBeans.size() > 1)
- {
- throw new DeploymentException(INJECTION_POINT_HAS_AMBIGUOUS_DEPENDENCIES, ij, Arrays.toString(bindings) + "; Possible dependencies: " + resolvedBeans);
- }
- Bean<?> resolvedBean = (Bean<?>) resolvedBeans.iterator().next();
- if (beanManager.getServices().get(MetaAnnotationStore.class).getScopeModel(resolvedBean.getScope()).isNormal() && !Proxies.isTypeProxyable(ij.getType()))
- {
- throw new UnproxyableResolutionException(INJECTION_POINT_HAS_NON_PROXYABLE_DEPENDENCIES, ij);
- }
- if (Reflections.isPrimitive(annotatedItem.getJavaClass()) && resolvedBean.isNullable())
- {
- throw new NullableDependencyException(INJECTION_POINT_HAS_NULLABLE_DEPENDENCIES, ij);
- }
- if (ij.getBean() != null && Beans.isPassivatingScope(ij.getBean(), beanManager) && (!ij.isTransient()) && !Beans.isPassivationCapableBean(resolvedBean))
- {
- validateInjectionPointPassivationCapable(ij, resolvedBean, beanManager);
- }
- }
-
- public void validateInjectionPointPassivationCapable(InjectionPoint ij, Bean<?> resolvedBean, BeanManagerImpl beanManager)
- {
- if (!ij.isTransient() && !Beans.isPassivationCapableDependency(resolvedBean))
- {
- if (resolvedBean.getScope().equals(Dependent.class) && resolvedBean instanceof AbstractProducerBean<?, ?, ?>)
- {
- throw new IllegalProductException(NON_SERIALIZABLE_BEAN_INJECTED_INTO_PASSIVATING_BEAN, ij.getBean(), resolvedBean);
- }
- throw new UnserializableDependencyException(INJECTION_POINT_HAS_NON_SERIALIZABLE_DEPENDENCY, ij.getBean(), resolvedBean);
- }
- }
-
- public void validateDeployment(BeanManagerImpl manager, BeanDeployerEnvironment environment)
- {
- validateBeans(manager.getDecorators(), new ArrayList<RIBean<?>>(), manager);
- validateBeans(manager.getBeans(), new ArrayList<RIBean<?>>(), manager);
- validateEnabledDecoratorClasses(manager);
- validateEnabledInterceptorClasses(manager);
- validateEnabledAlternatives(manager);
- validateDisposalMethods(environment);
- validateBeanNames(manager);
- }
-
- public void validateBeans(Collection<? extends Bean<?>> beans, Collection<RIBean<?>> specializedBeans, BeanManagerImpl manager)
- {
- for (Bean<?> bean : beans)
- {
- if (bean instanceof RIBean<?>)
- {
- validateRIBean((RIBean<?>) bean, manager, specializedBeans);
- }
- else
- {
- validateBean(bean, manager);
- }
- }
- }
-
- public void validateBeanNames(BeanManagerImpl beanManager)
- {
- Multimap<String, Bean<?>> namedAccessibleBeans = Multimaps.newSetMultimap(new HashMap<String, Collection<Bean<?>>>(), new Supplier<Set<Bean<?>>>()
- {
-
- public Set<Bean<?>> get()
- {
- return new HashSet<Bean<?>>();
- }
-
- });
- for (Bean<?> bean : beanManager.getAccessibleBeans())
- {
- if (bean.getName() != null)
- {
- namedAccessibleBeans.put(bean.getName(), bean);
- }
- }
-
- List<String> accessibleNamespaces = new ArrayList<String>();
- for (String namespace : beanManager.getAccessibleNamespaces())
- {
- accessibleNamespaces.add(namespace);
- }
-
- for (String name : namedAccessibleBeans.keySet())
- {
- Set<Bean<?>> resolvedBeans = beanManager.getBeanResolver().resolve(namedAccessibleBeans.get(name));
- if (resolvedBeans.size() > 1)
- {
- throw new DeploymentException(AMBIGUOUS_EL_NAME, name, resolvedBeans);
- }
- if (accessibleNamespaces.contains(name))
- {
- throw new DeploymentException(BEAN_NAME_IS_PREFIX, name);
- }
- }
- }
-
- private void validateEnabledInterceptorClasses(BeanManagerImpl beanManager)
- {
- Set<Class<?>> interceptorBeanClasses = new HashSet<Class<?>>();
- for (Interceptor<?> interceptor : beanManager.getInterceptors())
- {
- interceptorBeanClasses.add(interceptor.getBeanClass());
- }
- for (Class<?> enabledInterceptorClass : beanManager.getEnabledInterceptorClasses())
- {
- if (beanManager.getEnabledInterceptorClasses().indexOf(enabledInterceptorClass) < beanManager.getEnabledInterceptorClasses().lastIndexOf(enabledInterceptorClass))
- {
- throw new DeploymentException(INTERCEPTOR_SPECIFIED_TWICE, enabledInterceptorClass + " specified twice");
- }
- if (!interceptorBeanClasses.contains(enabledInterceptorClass))
- {
- throw new DeploymentException(INTERCEPTOR_NOT_ANNOTATED_OR_REGISTERED, enabledInterceptorClass);
- }
- }
- }
-
- private void validateEnabledDecoratorClasses(BeanManagerImpl beanManager)
- {
- // TODO Move building this list to the boot or sth
- Set<Class<?>> decoratorBeanClasses = new HashSet<Class<?>>();
- for (Decorator<?> bean : beanManager.getDecorators())
- {
- decoratorBeanClasses.add(bean.getBeanClass());
- }
- for (Class<?> clazz : beanManager.getEnabledDecoratorClasses())
- {
- if (beanManager.getEnabledDecoratorClasses().indexOf(clazz) < beanManager.getEnabledDecoratorClasses().lastIndexOf(clazz))
- {
- throw new DeploymentException(DECORATOR_SPECIFIED_TWICE, clazz);
- }
- if (!decoratorBeanClasses.contains(clazz))
- {
- throw new DeploymentException(DECORATOR_CLASS_NOT_BEAN_CLASS_OF_DECORATOR, clazz, decoratorBeanClasses);
- }
- }
- }
-
- private void validateEnabledAlternatives(BeanManagerImpl beanManager)
- {
- List<Class<?>> seenAlternatives = new ArrayList<Class<?>>();
- for (Class<? extends Annotation> stereotype : beanManager.getEnabledAlternativeStereotypes())
- {
- if (!stereotype.isAnnotationPresent(Alternative.class))
- {
- throw new DeploymentException(ALTERNATIVE_STEREOTYPE_NOT_ANNOTATED, stereotype);
- }
- if (seenAlternatives.contains(stereotype))
- {
- throw new DeploymentException(ALTERNATIVE_STEREOTYPE_SPECIFIED_MULTIPLE_TIMES, stereotype);
- }
- seenAlternatives.add(stereotype);
- }
- for (Class<?> clazz : beanManager.getEnabledAlternativeClasses())
- {
- if (!clazz.isAnnotationPresent(Alternative.class))
- {
- throw new DeploymentException(ALTERNATIVE_BEAN_CLASS_NOT_ANNOTATED, clazz);
- }
- if (seenAlternatives.contains(clazz))
- {
- throw new DeploymentException(ALTERNATIVE_BEAN_CLASS_SPECIFIED_MULTIPLE_TIMES, clazz);
- }
- seenAlternatives.add(clazz);
- }
- }
-
- private void validateDisposalMethods(BeanDeployerEnvironment environment)
- {
- Set<DisposalMethod<?, ?>> beans = environment.getUnresolvedDisposalBeans();
- if (!beans.isEmpty())
- {
- throw new DefinitionException(DISPOSAL_METHODS_WITHOUT_PRODUCER, beans);
- }
- }
-
- private static void checkFacadeInjectionPoint(InjectionPoint injectionPoint, Class<?> type)
- {
- if (injectionPoint.getAnnotated().getBaseType().equals(type))
- {
- if (injectionPoint.getType() instanceof ParameterizedType)
- {
- ParameterizedType parameterizedType = (ParameterizedType) injectionPoint.getType();
- if (parameterizedType.getActualTypeArguments()[0] instanceof TypeVariable<?>)
- {
- throw new DefinitionException(INJECTION_POINT_WITH_TYPE_VARIABLE, injectionPoint);
- }
- if (parameterizedType.getActualTypeArguments()[0] instanceof WildcardType)
- {
- throw new DefinitionException(INJECTION_POINT_HAS_WILDCARD, type, injectionPoint);
- }
- }
- else
- {
- throw new DefinitionException(INJECTION_POINT_MUST_HAVE_TYPE_PARAMETER, type, injectionPoint);
- }
- }
-
- }
-
- public void cleanup()
- {
- }
-
-}
Deleted: core/trunk/impl/src/main/java/org/jboss/weld/WeldException.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/WeldException.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/WeldException.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -1,107 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat, Inc. and/or its affiliates, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.jboss.weld;
-
-import java.util.List;
-
-/**
- * A general run-time exception used by the JSR-299 reference implementation Weld.
- *
- * @author David Allen
- */
-public class WeldException extends RuntimeException
-{
- private static final long serialVersionUID = 2L;
-
- private WeldExceptionMessage message;
-
- /**
- * Creates a new exception with the given cause.
- *
- * @param throwable The cause of the exception
- */
- public WeldException(Throwable throwable)
- {
- super(throwable);
- this.message = new WeldExceptionMessage(throwable.getLocalizedMessage());
- }
-
- /**
- * Creates a new exception with the given localized message key and optional
- * arguments for the message.
- *
- * @param <E> The enumeration type for the message keys
- * @param key The localized message to use
- * @param args Optional arguments to insert into the message
- */
- public <E extends Enum<?>> WeldException(E key, Object... args)
- {
- this.message = new WeldExceptionMessage(key, args);
- }
-
- /**
- * Creates a new exception with the given localized message key, the cause
- * for this exception and optional arguments for the message.
- *
- * @param <E> The enumeration type for the message keys
- * @param key The localized message to use
- * @param throwable The cause for this exception
- * @param args Optional arguments to insert into the message
- */
- public <E extends Enum<?>> WeldException(E key, Throwable throwable, Object... args)
- {
- super(throwable);
- this.message = new WeldExceptionMessage(key, args);
- }
-
- /**
- * Creates a new exception based on a list of throwables. The throwables are not
- * used as the cause, but the message from each throwable is included as the message
- * for this exception.
- *
- * @param errors A list of throwables to use in the message
- */
- public WeldException(List<Throwable> errors)
- {
- super();
- StringBuilder errorMessage = new StringBuilder();
- boolean firstError = true;
- for (Throwable throwable : errors)
- {
- if (!firstError)
- {
- errorMessage.append('\n');
- }
- errorMessage.append(throwable.getLocalizedMessage());
- }
- this.message = new WeldExceptionMessage(errorMessage.toString());
- }
-
- @Override
- public String getLocalizedMessage()
- {
- return getMessage();
- }
-
- @Override
- public String getMessage()
- {
- return message.getAsString();
- }
-
-}
Deleted: core/trunk/impl/src/main/java/org/jboss/weld/WeldExceptionMessage.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/WeldExceptionMessage.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/WeldExceptionMessage.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -1,117 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat, Inc. and/or its affiliates, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.jboss.weld;
-
-import static org.jboss.weld.logging.LoggerFactory.loggerFactory;
-
-import java.io.Serializable;
-
-/**
- * <p>
- * The message for exceptions generated by Weld. Each exception contains one
- * message object which will handle the generation of the string message at the
- * time the message is needed. This includes localization of the message based
- * on the settings in the JVM where the {@link java.lang.Throwable#getMessage()}
- * or {@link java.lang.Throwable#getLocalizedMessage()} methods are invoked.
- * </p>
- *
- * @author David Allen
- */
-public class WeldExceptionMessage implements Serializable
-{
-
- private static final long serialVersionUID = 2L;
-
- /**
- * The string version of the message. This is only used when the original
- * message from a wrapped exception is being used. Since it is already
- * localized, it will simply be stored here and used as the message.
- */
- private String message;
-
- private Enum<?> messageKey;
- private Object messageArguments[];
-
- /**
- * <p>
- * Creates a new exception message initialized to a static message. Use this
- * only for messages generated by third-party software, i.e., those which do
- * not use enumerated message keys.
- * </p>
- *
- * @param message the static message
- */
- public WeldExceptionMessage(String message)
- {
- // This will not be further localized
- this.message = message;
- }
-
- /**
- * <p>
- * Creates a new exception message based on an enumerated message key. This
- * message will not be localized until it is actually logged or other
- * software invokes the {@link #getMessage()} method.
- * </p>
- *
- * @param <E> the message key enumeration
- * @param key the message key from the above enumeration
- * @param args optional arguments for the message
- */
- public <E extends Enum<?>> WeldExceptionMessage(E key, Object... args)
- {
- this.messageKey = key;
- if ((args != null) && (args.length > 0))
- {
- this.messageArguments = new String[args.length];
- int index = 0;
- for (Object arg : args)
- {
- messageArguments[index++] = arg.toString();
- }
- }
- }
-
- /**
- * Generates the localized message for the exception.
- *
- * @return exception message as a string
- */
- public String getAsString()
- {
- String result = message;
- if (result == null)
- {
- try
- {
- result = loggerFactory().getMessageConveyor().getMessage(messageKey, messageArguments);
- }
- catch (Exception e)
- {
- // We want the using exception to be processed, but also include
- // this one in its message
- result = "Exception message for key " + messageKey + " not found due to " + e.getLocalizedMessage();
- }
- if (result == null)
- {
- result = "Exception message for key " + messageKey + " not found";
- }
- }
- return result;
- }
-}
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bean/AbstractBean.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bean/AbstractBean.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/AbstractBean.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -44,14 +44,14 @@
import javax.inject.Named;
import javax.inject.Qualifier;
-import org.jboss.weld.BeanManagerImpl;
import org.jboss.weld.Container;
-import org.jboss.weld.DefinitionException;
import org.jboss.weld.bootstrap.BeanDeployerEnvironment;
+import org.jboss.weld.exceptions.DefinitionException;
import org.jboss.weld.injection.WeldInjectionPoint;
import org.jboss.weld.introspector.WeldAnnotated;
import org.jboss.weld.literal.AnyLiteral;
import org.jboss.weld.literal.DefaultLiteral;
+import org.jboss.weld.manager.BeanManagerImpl;
import org.jboss.weld.metadata.cache.MergedStereotypes;
import org.jboss.weld.metadata.cache.MetaAnnotationStore;
import org.jboss.weld.util.Beans;
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bean/AbstractClassBean.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bean/AbstractClassBean.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/AbstractClassBean.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -36,8 +36,6 @@
import java.util.List;
import java.util.Set;
-import javassist.util.proxy.ProxyObject;
-
import javax.enterprise.context.Dependent;
import javax.enterprise.context.NormalScope;
import javax.enterprise.context.spi.CreationalContext;
@@ -56,21 +54,21 @@
import org.jboss.interceptor.model.InterceptorClassMetadataImpl;
import org.jboss.interceptor.util.InterceptionUtils;
import org.jboss.interceptor.util.proxy.TargetInstanceProxy;
-import org.jboss.weld.BeanManagerImpl;
-import org.jboss.weld.DefinitionException;
-import org.jboss.weld.DeploymentException;
-import org.jboss.weld.ForbiddenStateException;
-import org.jboss.weld.WeldException;
import org.jboss.weld.bean.proxy.DecoratorProxyMethodHandler;
import org.jboss.weld.bootstrap.BeanDeployerEnvironment;
import org.jboss.weld.context.SerializableContextualImpl;
import org.jboss.weld.context.SerializableContextualInstanceImpl;
import org.jboss.weld.ejb.EJBApiAbstraction;
+import org.jboss.weld.exceptions.DefinitionException;
+import org.jboss.weld.exceptions.DeploymentException;
+import org.jboss.weld.exceptions.ForbiddenStateException;
+import org.jboss.weld.exceptions.WeldException;
import org.jboss.weld.injection.ConstructorInjectionPoint;
import org.jboss.weld.injection.FieldInjectionPoint;
import org.jboss.weld.injection.MethodInjectionPoint;
import org.jboss.weld.introspector.WeldClass;
import org.jboss.weld.introspector.WeldMethod;
+import org.jboss.weld.manager.BeanManagerImpl;
import org.jboss.weld.metadata.cache.MetaAnnotationStore;
import org.jboss.weld.serialization.spi.helpers.SerializableContextual;
import org.jboss.weld.serialization.spi.helpers.SerializableContextualInstance;
@@ -235,7 +233,7 @@
// temporary fix for decorators - make sure that the instance wrapped by the decorators
// is the contextual instance
// TODO - correct the decoration algorithm to avoid the creation of new target class instances
- ((ProxyObject) proxy).setHandler(new DecoratorProxyMethodHandler(decoratorInstances, decoratedActualInstance.get()));
+ Proxies.attachMethodHandler(proxy, new DecoratorProxyMethodHandler(decoratorInstances, decoratedActualInstance.get()));
return proxy;
}
catch (InstantiationException e)
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bean/AbstractProducerBean.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bean/AbstractProducerBean.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/AbstractProducerBean.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -53,13 +53,13 @@
import javax.inject.Inject;
import javax.inject.Scope;
-import org.jboss.weld.BeanManagerImpl;
import org.jboss.weld.Container;
-import org.jboss.weld.DefinitionException;
-import org.jboss.weld.IllegalProductException;
-import org.jboss.weld.WeldException;
import org.jboss.weld.bootstrap.BeanDeployerEnvironment;
+import org.jboss.weld.exceptions.DefinitionException;
+import org.jboss.weld.exceptions.IllegalProductException;
+import org.jboss.weld.exceptions.WeldException;
import org.jboss.weld.introspector.WeldMember;
+import org.jboss.weld.manager.BeanManagerImpl;
import org.jboss.weld.metadata.cache.MetaAnnotationStore;
import org.jboss.weld.util.Beans;
import org.jboss.weld.util.Names;
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bean/AbstractReceiverBean.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bean/AbstractReceiverBean.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/AbstractReceiverBean.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -25,10 +25,10 @@
import javax.enterprise.context.spi.CreationalContext;
import javax.enterprise.inject.Alternative;
-import org.jboss.weld.BeanManagerImpl;
import org.jboss.weld.bootstrap.BeanDeployerEnvironment;
import org.jboss.weld.context.WeldCreationalContext;
import org.jboss.weld.introspector.WeldMember;
+import org.jboss.weld.manager.BeanManagerImpl;
import org.slf4j.cal10n.LocLogger;
/**
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bean/CustomDecoratorWrapper.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bean/CustomDecoratorWrapper.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/CustomDecoratorWrapper.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -19,9 +19,9 @@
import javax.enterprise.inject.spi.Decorator;
-import org.jboss.weld.BeanManagerImpl;
import org.jboss.weld.introspector.MethodSignature;
import org.jboss.weld.introspector.WeldClass;
+import org.jboss.weld.manager.BeanManagerImpl;
import org.jboss.weld.resources.ClassTransformer;
import org.jboss.weld.util.Deployers;
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bean/DecoratorImpl.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bean/DecoratorImpl.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/DecoratorImpl.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -33,17 +33,14 @@
import java.util.HashSet;
import java.util.Set;
-import javassist.util.proxy.ProxyObject;
-
import javax.enterprise.context.spi.CreationalContext;
import javax.enterprise.inject.spi.AnnotatedMethod;
import javax.enterprise.inject.spi.Decorator;
import javax.inject.Inject;
-import org.jboss.weld.BeanManagerImpl;
-import org.jboss.weld.DefinitionException;
import org.jboss.weld.bean.proxy.AbstractDecoratorMethodHandler;
import org.jboss.weld.bootstrap.BeanDeployerEnvironment;
+import org.jboss.weld.exceptions.DefinitionException;
import org.jboss.weld.injection.MethodInjectionPoint;
import org.jboss.weld.injection.ProxyClassConstructorInjectionPointWrapper;
import org.jboss.weld.injection.WeldInjectionPoint;
@@ -53,6 +50,7 @@
import org.jboss.weld.introspector.WeldMethod;
import org.jboss.weld.introspector.jlr.WeldClassImpl;
import org.jboss.weld.introspector.jlr.WeldConstructorImpl;
+import org.jboss.weld.manager.BeanManagerImpl;
import org.jboss.weld.resources.ClassTransformer;
import org.jboss.weld.util.Deployers;
import org.jboss.weld.util.Proxies;
@@ -293,8 +291,7 @@
{
ProxyClassConstructorInjectionPointWrapper<T> constructorInjectionPointWrapper = new ProxyClassConstructorInjectionPointWrapper(this, constructorForAbstractDecorator, getConstructor());
T instance = constructorInjectionPointWrapper.newInstance(manager, ctx);
- AbstractDecoratorMethodHandler abstractDecoratorMethodHandler = new AbstractDecoratorMethodHandler(annotatedDelegateItem, getDelegateInjectionPoint(), constructorInjectionPointWrapper.getInjectedDelegate());
- ((ProxyObject)instance).setHandler(abstractDecoratorMethodHandler);
+ Proxies.attachMethodHandler(instance, new AbstractDecoratorMethodHandler(annotatedDelegateItem, getDelegateInjectionPoint(), constructorInjectionPointWrapper.getInjectedDelegate()));
return instance;
}
}
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bean/DisposalMethod.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bean/DisposalMethod.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/DisposalMethod.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -34,12 +34,12 @@
import javax.enterprise.inject.Produces;
import javax.inject.Inject;
-import org.jboss.weld.BeanManagerImpl;
-import org.jboss.weld.DefinitionException;
import org.jboss.weld.bootstrap.BeanDeployerEnvironment;
+import org.jboss.weld.exceptions.DefinitionException;
import org.jboss.weld.injection.MethodInjectionPoint;
import org.jboss.weld.introspector.WeldMethod;
import org.jboss.weld.introspector.WeldParameter;
+import org.jboss.weld.manager.BeanManagerImpl;
import org.jboss.weld.util.Beans;
import org.jboss.weld.util.reflection.SecureReflections;
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bean/InterceptorImpl.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bean/InterceptorImpl.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/InterceptorImpl.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -31,10 +31,10 @@
import org.jboss.interceptor.model.InterceptorClassMetadata;
import org.jboss.interceptor.proxy.DirectClassInterceptionHandler;
import org.jboss.interceptor.registry.InterceptorClassMetadataRegistry;
-import org.jboss.weld.BeanManagerImpl;
-import org.jboss.weld.DeploymentException;
-import org.jboss.weld.WeldException;
+import org.jboss.weld.exceptions.DeploymentException;
+import org.jboss.weld.exceptions.WeldException;
import org.jboss.weld.introspector.WeldClass;
+import org.jboss.weld.manager.BeanManagerImpl;
import org.jboss.weld.util.Beans;
/**
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bean/ManagedBean.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bean/ManagedBean.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/ManagedBean.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -45,19 +45,19 @@
import org.jboss.interceptor.proxy.InterceptorProxyCreatorImpl;
import org.jboss.interceptor.registry.InterceptorRegistry;
import org.jboss.interceptor.util.InterceptionUtils;
-import org.jboss.weld.BeanManagerImpl;
import org.jboss.weld.Container;
-import org.jboss.weld.DefinitionException;
-import org.jboss.weld.DeploymentException;
-import org.jboss.weld.ForbiddenStateException;
import org.jboss.weld.bean.interceptor.CdiInterceptorHandlerFactory;
import org.jboss.weld.bean.interceptor.ClassInterceptionHandlerFactory;
import org.jboss.weld.bootstrap.BeanDeployerEnvironment;
+import org.jboss.weld.exceptions.DefinitionException;
+import org.jboss.weld.exceptions.DeploymentException;
+import org.jboss.weld.exceptions.ForbiddenStateException;
import org.jboss.weld.injection.InjectionContextImpl;
import org.jboss.weld.injection.WeldInjectionPoint;
import org.jboss.weld.introspector.WeldClass;
import org.jboss.weld.introspector.WeldField;
import org.jboss.weld.introspector.WeldMethod;
+import org.jboss.weld.manager.BeanManagerImpl;
import org.jboss.weld.metadata.cache.MetaAnnotationStore;
import org.jboss.weld.serialization.spi.helpers.SerializableContextual;
import org.jboss.weld.util.Beans;
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bean/NewManagedBean.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bean/NewManagedBean.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/NewManagedBean.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -22,9 +22,9 @@
import javax.enterprise.context.Dependent;
-import org.jboss.weld.BeanManagerImpl;
import org.jboss.weld.introspector.WeldClass;
import org.jboss.weld.literal.NewLiteral;
+import org.jboss.weld.manager.BeanManagerImpl;
/**
* Represents a @New simple bean
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bean/NewSessionBean.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bean/NewSessionBean.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/NewSessionBean.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -22,10 +22,10 @@
import javax.enterprise.context.Dependent;
-import org.jboss.weld.BeanManagerImpl;
import org.jboss.weld.ejb.InternalEjbDescriptor;
import org.jboss.weld.introspector.WeldClass;
import org.jboss.weld.literal.NewLiteral;
+import org.jboss.weld.manager.BeanManagerImpl;
import org.jboss.weld.resources.ClassTransformer;
/**
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bean/ProducerField.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bean/ProducerField.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/ProducerField.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -26,9 +26,9 @@
import javax.enterprise.inject.spi.Producer;
import org.jboss.interceptor.util.InterceptionUtils;
-import org.jboss.weld.BeanManagerImpl;
import org.jboss.weld.bootstrap.BeanDeployerEnvironment;
import org.jboss.weld.introspector.WeldField;
+import org.jboss.weld.manager.BeanManagerImpl;
import org.jboss.weld.util.Names;
/**
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bean/ProducerMethod.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bean/ProducerMethod.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/ProducerMethod.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -34,14 +34,14 @@
import javax.enterprise.inject.spi.InjectionPoint;
import javax.enterprise.inject.spi.Producer;
-import org.jboss.weld.BeanManagerImpl;
-import org.jboss.weld.DefinitionException;
-import org.jboss.weld.ForbiddenStateException;
import org.jboss.weld.bootstrap.BeanDeployerEnvironment;
+import org.jboss.weld.exceptions.DefinitionException;
+import org.jboss.weld.exceptions.ForbiddenStateException;
import org.jboss.weld.injection.MethodInjectionPoint;
import org.jboss.weld.injection.ParameterInjectionPoint;
import org.jboss.weld.introspector.WeldMethod;
import org.jboss.weld.introspector.WeldParameter;
+import org.jboss.weld.manager.BeanManagerImpl;
import org.jboss.weld.util.Names;
import org.jboss.weld.util.reflection.SecureReflections;
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bean/RIBean.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bean/RIBean.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/RIBean.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -23,9 +23,9 @@
import javax.enterprise.inject.spi.InjectionPoint;
import javax.enterprise.inject.spi.PassivationCapable;
-import org.jboss.weld.BeanManagerImpl;
import org.jboss.weld.bootstrap.BeanDeployerEnvironment;
import org.jboss.weld.injection.WeldInjectionPoint;
+import org.jboss.weld.manager.BeanManagerImpl;
/**
* Abstract base class with functions specific to RI built-in beans
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bean/SessionBean.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bean/SessionBean.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/SessionBean.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -50,12 +50,6 @@
import javax.interceptor.Interceptor;
import org.jboss.interceptor.model.InterceptionModel;
-import org.jboss.weld.BeanManagerImpl;
-import org.jboss.weld.CreationException;
-import org.jboss.weld.DefinitionException;
-import org.jboss.weld.ForbiddenArgumentException;
-import org.jboss.weld.ForbiddenStateException;
-import org.jboss.weld.WeldException;
import org.jboss.weld.bean.interceptor.InterceptorBindingsAdapter;
import org.jboss.weld.bean.proxy.EnterpriseBeanInstance;
import org.jboss.weld.bean.proxy.EnterpriseBeanProxyMethodHandler;
@@ -65,9 +59,15 @@
import org.jboss.weld.ejb.api.SessionObjectReference;
import org.jboss.weld.ejb.spi.BusinessInterfaceDescriptor;
import org.jboss.weld.ejb.spi.EjbServices;
+import org.jboss.weld.exceptions.CreationException;
+import org.jboss.weld.exceptions.DefinitionException;
+import org.jboss.weld.exceptions.ForbiddenArgumentException;
+import org.jboss.weld.exceptions.ForbiddenStateException;
+import org.jboss.weld.exceptions.WeldException;
import org.jboss.weld.injection.InjectionContextImpl;
import org.jboss.weld.introspector.WeldClass;
import org.jboss.weld.introspector.WeldMethod;
+import org.jboss.weld.manager.BeanManagerImpl;
import org.jboss.weld.resources.ClassTransformer;
import org.jboss.weld.serialization.spi.helpers.SerializableContextual;
import org.jboss.weld.util.Beans;
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/AbstractBuiltInBean.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/AbstractBuiltInBean.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/AbstractBuiltInBean.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -24,12 +24,12 @@
import javax.enterprise.context.Dependent;
-import org.jboss.weld.BeanManagerImpl;
import org.jboss.weld.bean.RIBean;
import org.jboss.weld.bootstrap.BeanDeployerEnvironment;
import org.jboss.weld.injection.WeldInjectionPoint;
import org.jboss.weld.literal.AnyLiteral;
import org.jboss.weld.literal.DefaultLiteral;
+import org.jboss.weld.manager.BeanManagerImpl;
public abstract class AbstractBuiltInBean<T> extends RIBean<T>
{
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/AbstractFacade.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/AbstractFacade.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/AbstractFacade.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -26,8 +26,8 @@
import javax.enterprise.inject.spi.InjectionPoint;
-import org.jboss.weld.BeanManagerImpl;
-import org.jboss.weld.ForbiddenStateException;
+import org.jboss.weld.exceptions.ForbiddenStateException;
+import org.jboss.weld.manager.BeanManagerImpl;
/**
* Common implementation for binding-type-based helpers
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/AbstractFacadeBean.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/AbstractFacadeBean.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/AbstractFacadeBean.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -23,7 +23,7 @@
import javax.enterprise.context.spi.CreationalContext;
import javax.enterprise.inject.spi.InjectionPoint;
-import org.jboss.weld.BeanManagerImpl;
+import org.jboss.weld.manager.BeanManagerImpl;
import org.slf4j.cal10n.LocLogger;
public abstract class AbstractFacadeBean<T> extends AbstractBuiltInBean<T>
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/BeanManagerBean.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/BeanManagerBean.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/BeanManagerBean.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -22,7 +22,7 @@
import javax.enterprise.context.spi.CreationalContext;
import javax.enterprise.inject.spi.BeanManager;
-import org.jboss.weld.BeanManagerImpl;
+import org.jboss.weld.manager.BeanManagerImpl;
import org.jboss.weld.util.collections.Arrays2;
public class BeanManagerBean extends AbstractBuiltInBean<BeanManagerImpl>
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/CallableMethodHandler.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/CallableMethodHandler.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/CallableMethodHandler.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -8,49 +8,17 @@
import java.io.Serializable;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
-import java.util.Collection;
-import java.util.HashSet;
import java.util.concurrent.Callable;
-import javassist.tools.reflect.Reflection;
import javassist.util.proxy.MethodHandler;
-import org.jboss.weld.Container;
-import org.jboss.weld.NullInstanceException;
-import org.jboss.weld.bootstrap.api.Service;
-import org.jboss.weld.util.reflection.Reflections;
+import org.jboss.weld.exceptions.NullInstanceException;
import org.jboss.weld.util.reflection.SecureReflections;
import org.slf4j.cal10n.LocLogger;
public class CallableMethodHandler implements MethodHandler, Serializable
{
- public static class CallableMethodHandlerCleaner implements Service
- {
-
- private final Collection<CallableMethodHandler> callableMethodHandlers;
-
- public CallableMethodHandlerCleaner()
- {
- this.callableMethodHandlers = new HashSet<CallableMethodHandler>();
- }
-
- private void add(CallableMethodHandler callableMethodHandler)
- {
- this.callableMethodHandlers.add(callableMethodHandler);
- }
-
- public void cleanup()
- {
- for (CallableMethodHandler callableMethodHandler : callableMethodHandlers)
- {
- callableMethodHandler.cleanup();
- }
- callableMethodHandlers.clear();
- }
-
- }
-
private static final long serialVersionUID = -1348302663981663427L;
private static final LocLogger log = loggerFactory().getLogger(BEAN);
@@ -61,7 +29,6 @@
{
super();
this.callable = callable;
- Container.instance().deploymentServices().get(CallableMethodHandlerCleaner.class).add(this);
}
public Object invoke(Object self, Method proxiedMethod, Method proceed, Object[] args) throws Throwable
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/EventBean.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/EventBean.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/EventBean.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -26,9 +26,9 @@
import javax.enterprise.inject.spi.InjectionPoint;
import javax.enterprise.util.TypeLiteral;
-import org.jboss.weld.BeanManagerImpl;
import org.jboss.weld.event.EventImpl;
import org.jboss.weld.literal.AnyLiteral;
+import org.jboss.weld.manager.BeanManagerImpl;
import org.jboss.weld.resolution.ResolvableTransformer;
import org.jboss.weld.util.collections.Arrays2;
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/ExtensionBean.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/ExtensionBean.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/ExtensionBean.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -24,8 +24,8 @@
import javax.enterprise.context.spi.CreationalContext;
import javax.enterprise.inject.spi.Extension;
-import org.jboss.weld.BeanManagerImpl;
import org.jboss.weld.introspector.WeldClass;
+import org.jboss.weld.manager.BeanManagerImpl;
/**
* @author pmuir
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/InjectionPointBean.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/InjectionPointBean.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/InjectionPointBean.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -22,7 +22,7 @@
import javax.enterprise.context.spi.CreationalContext;
import javax.enterprise.inject.spi.InjectionPoint;
-import org.jboss.weld.BeanManagerImpl;
+import org.jboss.weld.manager.BeanManagerImpl;
import org.jboss.weld.util.collections.Arrays2;
/**
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/InstanceBean.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/InstanceBean.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/InstanceBean.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -28,8 +28,8 @@
import javax.enterprise.util.TypeLiteral;
import javax.inject.Provider;
-import org.jboss.weld.BeanManagerImpl;
import org.jboss.weld.literal.AnyLiteral;
+import org.jboss.weld.manager.BeanManagerImpl;
import org.jboss.weld.resolution.ResolvableTransformer;
import org.jboss.weld.util.collections.Arrays2;
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/InstanceImpl.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/InstanceImpl.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/InstanceImpl.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -34,8 +34,8 @@
import javax.enterprise.inject.spi.InjectionPoint;
import javax.enterprise.util.TypeLiteral;
-import org.jboss.weld.BeanManagerImpl;
-import org.jboss.weld.InvalidObjectException;
+import org.jboss.weld.exceptions.InvalidObjectException;
+import org.jboss.weld.manager.BeanManagerImpl;
import org.jboss.weld.resolution.ResolvableWeldClass;
import org.jboss.weld.util.Beans;
import org.jboss.weld.util.Names;
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/ee/AbstractEEBean.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/ee/AbstractEEBean.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/ee/AbstractEEBean.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -11,10 +11,10 @@
import javax.enterprise.context.spi.CreationalContext;
-import org.jboss.weld.BeanManagerImpl;
-import org.jboss.weld.DefinitionException;
import org.jboss.weld.bean.builtin.AbstractBuiltInBean;
import org.jboss.weld.bean.builtin.CallableMethodHandler;
+import org.jboss.weld.exceptions.DefinitionException;
+import org.jboss.weld.manager.BeanManagerImpl;
import org.jboss.weld.util.Proxies;
import org.jboss.weld.util.Proxies.TypeInfo;
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/ee/AbstractEECallable.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/ee/AbstractEECallable.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/ee/AbstractEECallable.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -3,7 +3,7 @@
import java.io.Serializable;
import java.util.concurrent.Callable;
-import org.jboss.weld.BeanManagerImpl;
+import org.jboss.weld.manager.BeanManagerImpl;
public abstract class AbstractEECallable<V> implements Callable<V>, Serializable
{
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/ee/DefaultValidatorBean.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/ee/DefaultValidatorBean.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/ee/DefaultValidatorBean.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -20,9 +20,9 @@
import javax.validation.Validator;
-import org.jboss.weld.BeanManagerImpl;
import org.jboss.weld.Container;
-import org.jboss.weld.ForbiddenStateException;
+import org.jboss.weld.exceptions.ForbiddenStateException;
+import org.jboss.weld.manager.BeanManagerImpl;
import org.jboss.weld.validation.spi.ValidationServices;
/**
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/ee/DefaultValidatorFactoryBean.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/ee/DefaultValidatorFactoryBean.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/ee/DefaultValidatorFactoryBean.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -20,8 +20,8 @@
import javax.validation.ValidatorFactory;
-import org.jboss.weld.BeanManagerImpl;
-import org.jboss.weld.ForbiddenStateException;
+import org.jboss.weld.exceptions.ForbiddenStateException;
+import org.jboss.weld.manager.BeanManagerImpl;
import org.jboss.weld.validation.spi.ValidationServices;
/**
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/ee/EEResourceProducerField.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/ee/EEResourceProducerField.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/ee/EEResourceProducerField.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -26,16 +26,16 @@
import javax.enterprise.context.spi.Contextual;
import javax.enterprise.context.spi.CreationalContext;
-import org.jboss.weld.BeanManagerImpl;
import org.jboss.weld.Container;
-import org.jboss.weld.ForbiddenStateException;
-import org.jboss.weld.WeldException;
import org.jboss.weld.bean.AbstractClassBean;
import org.jboss.weld.bean.ProducerField;
import org.jboss.weld.bean.builtin.CallableMethodHandler;
import org.jboss.weld.bootstrap.BeanDeployerEnvironment;
import org.jboss.weld.ejb.EJBApiAbstraction;
+import org.jboss.weld.exceptions.ForbiddenStateException;
+import org.jboss.weld.exceptions.WeldException;
import org.jboss.weld.introspector.WeldField;
+import org.jboss.weld.manager.BeanManagerImpl;
import org.jboss.weld.persistence.PersistenceApiAbstraction;
import org.jboss.weld.serialization.spi.ContextualStore;
import org.jboss.weld.util.Proxies;
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/ee/PrincipalBean.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/ee/PrincipalBean.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/ee/PrincipalBean.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -20,8 +20,8 @@
import java.security.Principal;
-import org.jboss.weld.BeanManagerImpl;
-import org.jboss.weld.ForbiddenStateException;
+import org.jboss.weld.exceptions.ForbiddenStateException;
+import org.jboss.weld.manager.BeanManagerImpl;
import org.jboss.weld.security.spi.SecurityServices;
/**
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/ee/UserTransactionBean.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/ee/UserTransactionBean.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/ee/UserTransactionBean.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -20,8 +20,8 @@
import javax.transaction.UserTransaction;
-import org.jboss.weld.BeanManagerImpl;
-import org.jboss.weld.ForbiddenStateException;
+import org.jboss.weld.exceptions.ForbiddenStateException;
+import org.jboss.weld.manager.BeanManagerImpl;
import org.jboss.weld.transaction.spi.TransactionServices;
/**
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bean/interceptor/CdiInterceptorHandlerFactory.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bean/interceptor/CdiInterceptorHandlerFactory.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/interceptor/CdiInterceptorHandlerFactory.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -22,7 +22,7 @@
import org.jboss.interceptor.proxy.InterceptionHandler;
import org.jboss.interceptor.proxy.InterceptionHandlerFactory;
-import org.jboss.weld.BeanManagerImpl;
+import org.jboss.weld.manager.BeanManagerImpl;
import org.jboss.weld.serialization.spi.helpers.SerializableContextual;
import org.jboss.weld.context.SerializableContextualInstanceImpl;
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bean/interceptor/ClassInterceptionHandlerFactory.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bean/interceptor/ClassInterceptionHandlerFactory.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/interceptor/ClassInterceptionHandlerFactory.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -24,8 +24,8 @@
import org.jboss.interceptor.proxy.DirectClassInterceptionHandler;
import org.jboss.interceptor.proxy.InterceptionHandler;
import org.jboss.interceptor.proxy.InterceptionHandlerFactory;
-import org.jboss.weld.BeanManagerImpl;
-import org.jboss.weld.DeploymentException;
+import org.jboss.weld.exceptions.DeploymentException;
+import org.jboss.weld.manager.BeanManagerImpl;
import org.jboss.weld.util.reflection.SecureReflections;
/**
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bean/interceptor/InterceptorBindingsAdapter.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bean/interceptor/InterceptorBindingsAdapter.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/interceptor/InterceptorBindingsAdapter.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -32,8 +32,8 @@
import javax.enterprise.inject.spi.Interceptor;
import org.jboss.interceptor.model.InterceptionModel;
-import org.jboss.weld.ForbiddenArgumentException;
import org.jboss.weld.ejb.spi.InterceptorBindings;
+import org.jboss.weld.exceptions.ForbiddenArgumentException;
import org.jboss.weld.serialization.spi.helpers.SerializableContextual;
/**
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bean/proxy/ClientProxyMethodHandler.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bean/proxy/ClientProxyMethodHandler.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/proxy/ClientProxyMethodHandler.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -29,9 +29,9 @@
import javax.enterprise.context.spi.Context;
import javax.enterprise.inject.spi.Bean;
-import org.jboss.weld.BeanManagerImpl;
import org.jboss.weld.Container;
import org.jboss.weld.context.WeldCreationalContext;
+import org.jboss.weld.manager.BeanManagerImpl;
import org.jboss.weld.serialization.spi.ContextualStore;
import org.jboss.weld.util.reflection.Reflections;
import org.jboss.weld.util.reflection.SecureReflections;
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bean/proxy/ClientProxyProvider.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bean/proxy/ClientProxyProvider.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/proxy/ClientProxyProvider.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -25,11 +25,11 @@
import javax.enterprise.inject.spi.Bean;
-import org.jboss.weld.BeanManagerImpl;
import org.jboss.weld.Container;
-import org.jboss.weld.DefinitionException;
-import org.jboss.weld.WeldException;
+import org.jboss.weld.exceptions.DefinitionException;
+import org.jboss.weld.exceptions.WeldException;
import org.jboss.weld.logging.messages.BeanMessage;
+import org.jboss.weld.manager.BeanManagerImpl;
import org.jboss.weld.serialization.spi.ContextualStore;
import org.jboss.weld.util.Proxies;
import org.jboss.weld.util.Proxies.TypeInfo;
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bean/proxy/DecoratorProxyMethodHandler.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bean/proxy/DecoratorProxyMethodHandler.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/proxy/DecoratorProxyMethodHandler.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -24,8 +24,8 @@
import javax.enterprise.inject.spi.Decorator;
import org.jboss.interceptor.util.proxy.TargetInstanceProxyMethodHandler;
-import org.jboss.weld.ForbiddenStateException;
import org.jboss.weld.bean.WeldDecorator;
+import org.jboss.weld.exceptions.ForbiddenStateException;
import org.jboss.weld.introspector.MethodSignature;
import org.jboss.weld.introspector.WeldMethod;
import org.jboss.weld.introspector.jlr.MethodSignatureImpl;
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bean/proxy/EnterpriseBeanProxyMethodHandler.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bean/proxy/EnterpriseBeanProxyMethodHandler.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/proxy/EnterpriseBeanProxyMethodHandler.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -31,9 +31,9 @@
import javax.enterprise.context.spi.CreationalContext;
-import org.jboss.weld.InvalidOperationException;
import org.jboss.weld.bean.SessionBean;
import org.jboss.weld.ejb.api.SessionObjectReference;
+import org.jboss.weld.exceptions.InvalidOperationException;
import org.jboss.weld.introspector.MethodSignature;
import org.jboss.weld.introspector.jlr.MethodSignatureImpl;
import org.jboss.weld.util.reflection.Reflections;
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/AbstractBeanDeployer.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/AbstractBeanDeployer.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/AbstractBeanDeployer.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -32,7 +32,6 @@
import javax.enterprise.inject.spi.Extension;
import javax.inject.Inject;
-import org.jboss.weld.BeanManagerImpl;
import org.jboss.weld.bean.AbstractClassBean;
import org.jboss.weld.bean.AbstractProducerBean;
import org.jboss.weld.bean.DecoratorImpl;
@@ -63,6 +62,7 @@
import org.jboss.weld.introspector.WeldField;
import org.jboss.weld.introspector.WeldMethod;
import org.jboss.weld.jsf.JsfApiAbstraction;
+import org.jboss.weld.manager.BeanManagerImpl;
import org.jboss.weld.persistence.PersistenceApiAbstraction;
import org.jboss.weld.servlet.ServletApiAbstraction;
import org.jboss.weld.util.reflection.Reflections;
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/BeanDeployer.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/BeanDeployer.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/BeanDeployer.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -25,13 +25,13 @@
import javax.enterprise.inject.spi.AnnotatedType;
import javax.interceptor.Interceptor;
-import org.jboss.weld.BeanManagerImpl;
import org.jboss.weld.Container;
-import org.jboss.weld.DeploymentException;
import org.jboss.weld.bootstrap.events.ProcessAnnotatedTypeImpl;
import org.jboss.weld.ejb.EjbDescriptors;
import org.jboss.weld.ejb.InternalEjbDescriptor;
+import org.jboss.weld.exceptions.DeploymentException;
import org.jboss.weld.introspector.WeldClass;
+import org.jboss.weld.manager.BeanManagerImpl;
import org.jboss.weld.resources.ClassTransformer;
/**
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/BeanDeployerEnvironment.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/BeanDeployerEnvironment.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/BeanDeployerEnvironment.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -28,7 +28,6 @@
import javax.enterprise.inject.New;
-import org.jboss.weld.BeanManagerImpl;
import org.jboss.weld.bean.AbstractBean;
import org.jboss.weld.bean.AbstractClassBean;
import org.jboss.weld.bean.DecoratorImpl;
@@ -50,6 +49,7 @@
import org.jboss.weld.injection.WeldInjectionPoint;
import org.jboss.weld.introspector.WeldClass;
import org.jboss.weld.introspector.WeldMethod;
+import org.jboss.weld.manager.BeanManagerImpl;
import org.jboss.weld.resolution.ResolvableFactory;
import org.jboss.weld.resolution.TypeSafeDisposerResolver;
import org.jboss.weld.resources.ClassTransformer;
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/BeanDeployment.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/BeanDeployment.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/BeanDeployment.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -26,7 +26,6 @@
import javax.enterprise.inject.spi.Bean;
-import org.jboss.weld.BeanManagerImpl;
import org.jboss.weld.bean.RIBean;
import org.jboss.weld.bean.builtin.BeanManagerBean;
import org.jboss.weld.bean.builtin.EventBean;
@@ -42,6 +41,7 @@
import org.jboss.weld.bootstrap.spi.BeanDeploymentArchive;
import org.jboss.weld.ejb.EjbDescriptors;
import org.jboss.weld.ejb.spi.EjbServices;
+import org.jboss.weld.manager.BeanManagerImpl;
import org.jboss.weld.resources.spi.ResourceLoader;
import org.jboss.weld.security.spi.SecurityServices;
import org.jboss.weld.transaction.spi.TransactionServices;
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/ExtensionBeanDeployer.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/ExtensionBeanDeployer.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/ExtensionBeanDeployer.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -23,7 +23,6 @@
import javax.enterprise.event.Observes;
import javax.enterprise.inject.spi.Extension;
-import org.jboss.weld.BeanManagerImpl;
import org.jboss.weld.Container;
import org.jboss.weld.bean.RIBean;
import org.jboss.weld.bean.builtin.ExtensionBean;
@@ -33,6 +32,7 @@
import org.jboss.weld.event.ObserverMethodImpl;
import org.jboss.weld.introspector.WeldClass;
import org.jboss.weld.introspector.WeldMethod;
+import org.jboss.weld.manager.BeanManagerImpl;
import org.jboss.weld.resources.ClassTransformer;
import org.jboss.weld.util.DeploymentStructures;
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/ExtensionBeanDeployerEnvironment.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/ExtensionBeanDeployerEnvironment.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/ExtensionBeanDeployerEnvironment.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -3,9 +3,9 @@
import java.util.HashSet;
import java.util.Set;
-import org.jboss.weld.BeanManagerImpl;
import org.jboss.weld.bean.builtin.ExtensionBean;
import org.jboss.weld.ejb.EjbDescriptors;
+import org.jboss.weld.manager.BeanManagerImpl;
public class ExtensionBeanDeployerEnvironment extends BeanDeployerEnvironment
{
Copied: core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/Validator.java (from rev 5388, core/trunk/impl/src/main/java/org/jboss/weld/Validator.java)
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/Validator.java (rev 0)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/Validator.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -0,0 +1,469 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.bootstrap;
+
+import static org.jboss.weld.logging.messages.ValidatorMessage.ALTERNATIVE_BEAN_CLASS_NOT_ANNOTATED;
+import static org.jboss.weld.logging.messages.ValidatorMessage.ALTERNATIVE_BEAN_CLASS_SPECIFIED_MULTIPLE_TIMES;
+import static org.jboss.weld.logging.messages.ValidatorMessage.ALTERNATIVE_STEREOTYPE_NOT_ANNOTATED;
+import static org.jboss.weld.logging.messages.ValidatorMessage.ALTERNATIVE_STEREOTYPE_SPECIFIED_MULTIPLE_TIMES;
+import static org.jboss.weld.logging.messages.ValidatorMessage.AMBIGUOUS_EL_NAME;
+import static org.jboss.weld.logging.messages.ValidatorMessage.BEAN_NAME_IS_PREFIX;
+import static org.jboss.weld.logging.messages.ValidatorMessage.BEAN_SPECIALIZED_TOO_MANY_TIMES;
+import static org.jboss.weld.logging.messages.ValidatorMessage.DECORATOR_CLASS_NOT_BEAN_CLASS_OF_DECORATOR;
+import static org.jboss.weld.logging.messages.ValidatorMessage.DECORATOR_SPECIFIED_TWICE;
+import static org.jboss.weld.logging.messages.ValidatorMessage.DISPOSAL_METHODS_WITHOUT_PRODUCER;
+import static org.jboss.weld.logging.messages.ValidatorMessage.INJECTION_INTO_NON_BEAN;
+import static org.jboss.weld.logging.messages.ValidatorMessage.INJECTION_INTO_NON_DEPENDENT_BEAN;
+import static org.jboss.weld.logging.messages.ValidatorMessage.INJECTION_POINT_HAS_AMBIGUOUS_DEPENDENCIES;
+import static org.jboss.weld.logging.messages.ValidatorMessage.INJECTION_POINT_HAS_NON_PROXYABLE_DEPENDENCIES;
+import static org.jboss.weld.logging.messages.ValidatorMessage.INJECTION_POINT_HAS_NON_SERIALIZABLE_DEPENDENCY;
+import static org.jboss.weld.logging.messages.ValidatorMessage.INJECTION_POINT_HAS_NULLABLE_DEPENDENCIES;
+import static org.jboss.weld.logging.messages.ValidatorMessage.INJECTION_POINT_HAS_UNSATISFIED_DEPENDENCIES;
+import static org.jboss.weld.logging.messages.ValidatorMessage.INJECTION_POINT_HAS_WILDCARD;
+import static org.jboss.weld.logging.messages.ValidatorMessage.INJECTION_POINT_MUST_HAVE_TYPE_PARAMETER;
+import static org.jboss.weld.logging.messages.ValidatorMessage.INJECTION_POINT_WITH_TYPE_VARIABLE;
+import static org.jboss.weld.logging.messages.ValidatorMessage.INTERCEPTOR_NOT_ANNOTATED_OR_REGISTERED;
+import static org.jboss.weld.logging.messages.ValidatorMessage.INTERCEPTOR_SPECIFIED_TWICE;
+import static org.jboss.weld.logging.messages.ValidatorMessage.NEW_WITH_QUALIFIERS;
+import static org.jboss.weld.logging.messages.ValidatorMessage.NON_SERIALIZABLE_BEAN_INJECTED_INTO_PASSIVATING_BEAN;
+import static org.jboss.weld.logging.messages.ValidatorMessage.NOT_PROXYABLE;
+import static org.jboss.weld.logging.messages.ValidatorMessage.PASSIVATING_BEAN_WITH_NONSERIALIZABLE_DECORATOR;
+import static org.jboss.weld.logging.messages.ValidatorMessage.PASSIVATING_BEAN_WITH_NONSERIALIZABLE_INTERCEPTOR;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.TypeVariable;
+import java.lang.reflect.WildcardType;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import javax.enterprise.context.Dependent;
+import javax.enterprise.event.Event;
+import javax.enterprise.inject.Alternative;
+import javax.enterprise.inject.Instance;
+import javax.enterprise.inject.New;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.Decorator;
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.enterprise.inject.spi.InjectionTarget;
+import javax.enterprise.inject.spi.Interceptor;
+
+import org.jboss.interceptor.model.InterceptionModel;
+import org.jboss.weld.bean.AbstractClassBean;
+import org.jboss.weld.bean.AbstractProducerBean;
+import org.jboss.weld.bean.DisposalMethod;
+import org.jboss.weld.bean.InterceptorImpl;
+import org.jboss.weld.bean.NewManagedBean;
+import org.jboss.weld.bean.NewSessionBean;
+import org.jboss.weld.bean.RIBean;
+import org.jboss.weld.bean.WeldDecorator;
+import org.jboss.weld.bootstrap.api.Service;
+import org.jboss.weld.exceptions.DefinitionException;
+import org.jboss.weld.exceptions.DeploymentException;
+import org.jboss.weld.exceptions.IllegalProductException;
+import org.jboss.weld.exceptions.InconsistentSpecializationException;
+import org.jboss.weld.exceptions.NullableDependencyException;
+import org.jboss.weld.exceptions.UnproxyableResolutionException;
+import org.jboss.weld.exceptions.UnserializableDependencyException;
+import org.jboss.weld.introspector.WeldAnnotated;
+import org.jboss.weld.manager.BeanManagerImpl;
+import org.jboss.weld.metadata.cache.MetaAnnotationStore;
+import org.jboss.weld.resolution.ResolvableWeldClass;
+import org.jboss.weld.serialization.spi.helpers.SerializableContextual;
+import org.jboss.weld.util.Beans;
+import org.jboss.weld.util.Proxies;
+import org.jboss.weld.util.reflection.Reflections;
+
+import com.google.common.base.Supplier;
+import com.google.common.collect.Multimap;
+import com.google.common.collect.Multimaps;
+
+/**
+ * Checks a list of beans for DeploymentExceptions and their subclasses
+ *
+ * @author Nicklas Karlsson
+ * @author David Allen
+ */
+public class Validator implements Service
+{
+
+ private void validateBean(Bean<?> bean, BeanManagerImpl beanManager)
+ {
+ for (InjectionPoint ij : bean.getInjectionPoints())
+ {
+ validateInjectionPoint(ij, beanManager);
+ }
+ boolean normalScoped = beanManager.getServices().get(MetaAnnotationStore.class).getScopeModel(bean.getScope()).isNormal();
+ if (normalScoped && !Beans.isBeanProxyable(bean))
+ {
+ throw new UnproxyableResolutionException(NOT_PROXYABLE, bean);
+ }
+ }
+
+ /**
+ * Validate an RIBean. This includes validating whether two beans specialize
+ * the same bean
+ *
+ * @param bean the bean to validate
+ * @param beanManager the current manager
+ * @param specializedBeans the existing specialized beans
+ */
+ private void validateRIBean(RIBean<?> bean, BeanManagerImpl beanManager, Collection<RIBean<?>> specializedBeans)
+ {
+ validateBean(bean, beanManager);
+ if (!(bean instanceof NewManagedBean<?>) && !(bean instanceof NewSessionBean<?>))
+ {
+ RIBean<?> abstractBean = bean;
+ if (abstractBean.isSpecializing())
+ {
+ if (specializedBeans.contains(abstractBean.getSpecializedBean()))
+ {
+ throw new InconsistentSpecializationException(BEAN_SPECIALIZED_TOO_MANY_TIMES, bean);
+ }
+ specializedBeans.add(abstractBean.getSpecializedBean());
+ }
+ if ((bean instanceof AbstractClassBean<?>) && bean.isPassivationCapableBean())
+ {
+ AbstractClassBean<?> classBean = (AbstractClassBean<?>) bean;
+ if (classBean.hasDecorators())
+ {
+ validateDecorators(beanManager, classBean);
+ }
+ // validate CDI-defined interceptors
+ if (classBean.hasCdiBoundInterceptors())
+ {
+ validateCdiBoundInterceptors(beanManager, classBean);
+ }
+ // validate EJB-defined interceptors
+ if (((AbstractClassBean<?>) bean).hasDirectlyDefinedInterceptors())
+ {
+ validateDirectlyDefinedInterceptorClasses(beanManager, classBean);
+ }
+ }
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ private void validateDirectlyDefinedInterceptorClasses(BeanManagerImpl beanManager, AbstractClassBean<?> classBean)
+ {
+ InterceptionModel<Class<?>, Class<?>> ejbInterceptorModel = beanManager.getClassDeclaredInterceptorsRegistry().getInterceptionModel(classBean.getType());
+ if (ejbInterceptorModel != null)
+ {
+ Class<?>[] classDeclaredInterceptors = ejbInterceptorModel.getAllInterceptors().toArray(new Class<?>[ejbInterceptorModel.getAllInterceptors().size()]);
+ if (classDeclaredInterceptors != null)
+ {
+ for (Class<?> interceptorClass : classDeclaredInterceptors)
+ {
+ if (!Reflections.isSerializable(interceptorClass))
+ {
+ throw new DeploymentException(PASSIVATING_BEAN_WITH_NONSERIALIZABLE_INTERCEPTOR, this, interceptorClass.getName());
+ }
+ InjectionTarget<Object> injectionTarget = (InjectionTarget<Object>) beanManager.createInjectionTarget(beanManager.createAnnotatedType(interceptorClass));
+ for (InjectionPoint injectionPoint : injectionTarget.getInjectionPoints())
+ {
+ Bean<?> resolvedBean = beanManager.resolve(beanManager.getInjectableBeans(injectionPoint));
+ validateInjectionPointPassivationCapable(injectionPoint, resolvedBean, beanManager);
+ }
+ }
+ }
+ }
+ }
+
+ private void validateCdiBoundInterceptors(BeanManagerImpl beanManager, AbstractClassBean<?> classBean)
+ {
+ InterceptionModel<Class<?>, SerializableContextual<Interceptor<?>, ?>> cdiInterceptorModel = beanManager.getCdiInterceptorsRegistry().getInterceptionModel(classBean.getType());
+ if (cdiInterceptorModel != null)
+ {
+ Collection<SerializableContextual<Interceptor<?>, ?>> interceptors = cdiInterceptorModel.getAllInterceptors();
+ if (interceptors.size() > 0)
+ {
+ for (SerializableContextual<Interceptor<?>, ?> serializableContextual : interceptors)
+ {
+ if (!((InterceptorImpl<?>)serializableContextual.get()).isSerializable())
+ {
+ throw new DeploymentException(PASSIVATING_BEAN_WITH_NONSERIALIZABLE_INTERCEPTOR, classBean, serializableContextual.get());
+ }
+ for (InjectionPoint injectionPoint : serializableContextual.get().getInjectionPoints())
+ {
+ Bean<?> resolvedBean = beanManager.resolve(beanManager.getInjectableBeans(injectionPoint));
+ validateInjectionPointPassivationCapable(injectionPoint, resolvedBean, beanManager);
+ }
+ }
+ }
+ }
+ }
+
+ private void validateDecorators(BeanManagerImpl beanManager, AbstractClassBean<?> classBean)
+ {
+ for (Decorator<?> decorator : classBean.getDecorators())
+ {
+ if (!((WeldDecorator<?>)decorator).getAnnotatedItem().isSerializable())
+ {
+ throw new UnserializableDependencyException(PASSIVATING_BEAN_WITH_NONSERIALIZABLE_DECORATOR, classBean, decorator);
+ }
+ for (InjectionPoint ij : decorator.getInjectionPoints())
+ {
+ Bean<?> resolvedBean = beanManager.resolve(beanManager.getInjectableBeans(ij));
+ validateInjectionPointPassivationCapable(ij, resolvedBean, beanManager);
+ }
+ }
+ }
+
+ /**
+ * Validate an injection point
+ *
+ * @param ij the injection point to validate
+ * @param declaringBean the bean into which the injectionPoint has been
+ * injected, if null, certain validations aren't available
+ * @param beanManager
+ */
+ public void validateInjectionPoint(InjectionPoint ij, BeanManagerImpl beanManager)
+ {
+ if (ij.getAnnotated().getAnnotation(New.class) != null && ij.getQualifiers().size() > 1)
+ {
+ throw new DefinitionException(NEW_WITH_QUALIFIERS, ij);
+ }
+ if (ij.getType().equals(InjectionPoint.class) && ij.getBean() == null)
+ {
+ throw new DefinitionException(INJECTION_INTO_NON_BEAN, ij);
+ }
+ if (ij.getType().equals(InjectionPoint.class) && !Dependent.class.equals(ij.getBean().getScope()))
+ {
+ throw new DefinitionException(INJECTION_INTO_NON_DEPENDENT_BEAN, ij);
+ }
+ if (ij.getType() instanceof TypeVariable<?>)
+ {
+ throw new DefinitionException(INJECTION_POINT_WITH_TYPE_VARIABLE, ij);
+ }
+ checkFacadeInjectionPoint(ij, Instance.class);
+ checkFacadeInjectionPoint(ij, Event.class);
+ Annotation[] bindings = ij.getQualifiers().toArray(new Annotation[0]);
+ WeldAnnotated<?, ?> annotatedItem = ResolvableWeldClass.of(ij.getType(), bindings, beanManager);
+ Set<?> resolvedBeans = beanManager.getBeanResolver().resolve(beanManager.getInjectableBeans(ij));
+ if (resolvedBeans.isEmpty())
+ {
+ throw new DeploymentException(INJECTION_POINT_HAS_UNSATISFIED_DEPENDENCIES, ij, Arrays.toString(bindings));
+ }
+ if (resolvedBeans.size() > 1)
+ {
+ throw new DeploymentException(INJECTION_POINT_HAS_AMBIGUOUS_DEPENDENCIES, ij, Arrays.toString(bindings) + "; Possible dependencies: " + resolvedBeans);
+ }
+ Bean<?> resolvedBean = (Bean<?>) resolvedBeans.iterator().next();
+ if (beanManager.getServices().get(MetaAnnotationStore.class).getScopeModel(resolvedBean.getScope()).isNormal() && !Proxies.isTypeProxyable(ij.getType()))
+ {
+ throw new UnproxyableResolutionException(INJECTION_POINT_HAS_NON_PROXYABLE_DEPENDENCIES, ij);
+ }
+ if (Reflections.isPrimitive(annotatedItem.getJavaClass()) && resolvedBean.isNullable())
+ {
+ throw new NullableDependencyException(INJECTION_POINT_HAS_NULLABLE_DEPENDENCIES, ij);
+ }
+ if (ij.getBean() != null && Beans.isPassivatingScope(ij.getBean(), beanManager) && (!ij.isTransient()) && !Beans.isPassivationCapableBean(resolvedBean))
+ {
+ validateInjectionPointPassivationCapable(ij, resolvedBean, beanManager);
+ }
+ }
+
+ public void validateInjectionPointPassivationCapable(InjectionPoint ij, Bean<?> resolvedBean, BeanManagerImpl beanManager)
+ {
+ if (!ij.isTransient() && !Beans.isPassivationCapableDependency(resolvedBean))
+ {
+ if (resolvedBean.getScope().equals(Dependent.class) && resolvedBean instanceof AbstractProducerBean<?, ?, ?>)
+ {
+ throw new IllegalProductException(NON_SERIALIZABLE_BEAN_INJECTED_INTO_PASSIVATING_BEAN, ij.getBean(), resolvedBean);
+ }
+ throw new UnserializableDependencyException(INJECTION_POINT_HAS_NON_SERIALIZABLE_DEPENDENCY, ij.getBean(), resolvedBean);
+ }
+ }
+
+ public void validateDeployment(BeanManagerImpl manager, BeanDeployerEnvironment environment)
+ {
+ validateBeans(manager.getDecorators(), new ArrayList<RIBean<?>>(), manager);
+ validateBeans(manager.getBeans(), new ArrayList<RIBean<?>>(), manager);
+ validateEnabledDecoratorClasses(manager);
+ validateEnabledInterceptorClasses(manager);
+ validateEnabledAlternatives(manager);
+ validateDisposalMethods(environment);
+ validateBeanNames(manager);
+ }
+
+ public void validateBeans(Collection<? extends Bean<?>> beans, Collection<RIBean<?>> specializedBeans, BeanManagerImpl manager)
+ {
+ for (Bean<?> bean : beans)
+ {
+ if (bean instanceof RIBean<?>)
+ {
+ validateRIBean((RIBean<?>) bean, manager, specializedBeans);
+ }
+ else
+ {
+ validateBean(bean, manager);
+ }
+ }
+ }
+
+ public void validateBeanNames(BeanManagerImpl beanManager)
+ {
+ Multimap<String, Bean<?>> namedAccessibleBeans = Multimaps.newSetMultimap(new HashMap<String, Collection<Bean<?>>>(), new Supplier<Set<Bean<?>>>()
+ {
+
+ public Set<Bean<?>> get()
+ {
+ return new HashSet<Bean<?>>();
+ }
+
+ });
+ for (Bean<?> bean : beanManager.getAccessibleBeans())
+ {
+ if (bean.getName() != null)
+ {
+ namedAccessibleBeans.put(bean.getName(), bean);
+ }
+ }
+
+ List<String> accessibleNamespaces = new ArrayList<String>();
+ for (String namespace : beanManager.getAccessibleNamespaces())
+ {
+ accessibleNamespaces.add(namespace);
+ }
+
+ for (String name : namedAccessibleBeans.keySet())
+ {
+ Set<Bean<?>> resolvedBeans = beanManager.getBeanResolver().resolve(namedAccessibleBeans.get(name));
+ if (resolvedBeans.size() > 1)
+ {
+ throw new DeploymentException(AMBIGUOUS_EL_NAME, name, resolvedBeans);
+ }
+ if (accessibleNamespaces.contains(name))
+ {
+ throw new DeploymentException(BEAN_NAME_IS_PREFIX, name);
+ }
+ }
+ }
+
+ private void validateEnabledInterceptorClasses(BeanManagerImpl beanManager)
+ {
+ Set<Class<?>> interceptorBeanClasses = new HashSet<Class<?>>();
+ for (Interceptor<?> interceptor : beanManager.getInterceptors())
+ {
+ interceptorBeanClasses.add(interceptor.getBeanClass());
+ }
+ for (Class<?> enabledInterceptorClass : beanManager.getEnabledInterceptorClasses())
+ {
+ if (beanManager.getEnabledInterceptorClasses().indexOf(enabledInterceptorClass) < beanManager.getEnabledInterceptorClasses().lastIndexOf(enabledInterceptorClass))
+ {
+ throw new DeploymentException(INTERCEPTOR_SPECIFIED_TWICE, enabledInterceptorClass + " specified twice");
+ }
+ if (!interceptorBeanClasses.contains(enabledInterceptorClass))
+ {
+ throw new DeploymentException(INTERCEPTOR_NOT_ANNOTATED_OR_REGISTERED, enabledInterceptorClass);
+ }
+ }
+ }
+
+ private void validateEnabledDecoratorClasses(BeanManagerImpl beanManager)
+ {
+ // TODO Move building this list to the boot or sth
+ Set<Class<?>> decoratorBeanClasses = new HashSet<Class<?>>();
+ for (Decorator<?> bean : beanManager.getDecorators())
+ {
+ decoratorBeanClasses.add(bean.getBeanClass());
+ }
+ for (Class<?> clazz : beanManager.getEnabledDecoratorClasses())
+ {
+ if (beanManager.getEnabledDecoratorClasses().indexOf(clazz) < beanManager.getEnabledDecoratorClasses().lastIndexOf(clazz))
+ {
+ throw new DeploymentException(DECORATOR_SPECIFIED_TWICE, clazz);
+ }
+ if (!decoratorBeanClasses.contains(clazz))
+ {
+ throw new DeploymentException(DECORATOR_CLASS_NOT_BEAN_CLASS_OF_DECORATOR, clazz, decoratorBeanClasses);
+ }
+ }
+ }
+
+ private void validateEnabledAlternatives(BeanManagerImpl beanManager)
+ {
+ List<Class<?>> seenAlternatives = new ArrayList<Class<?>>();
+ for (Class<? extends Annotation> stereotype : beanManager.getEnabledAlternativeStereotypes())
+ {
+ if (!stereotype.isAnnotationPresent(Alternative.class))
+ {
+ throw new DeploymentException(ALTERNATIVE_STEREOTYPE_NOT_ANNOTATED, stereotype);
+ }
+ if (seenAlternatives.contains(stereotype))
+ {
+ throw new DeploymentException(ALTERNATIVE_STEREOTYPE_SPECIFIED_MULTIPLE_TIMES, stereotype);
+ }
+ seenAlternatives.add(stereotype);
+ }
+ for (Class<?> clazz : beanManager.getEnabledAlternativeClasses())
+ {
+ if (!clazz.isAnnotationPresent(Alternative.class))
+ {
+ throw new DeploymentException(ALTERNATIVE_BEAN_CLASS_NOT_ANNOTATED, clazz);
+ }
+ if (seenAlternatives.contains(clazz))
+ {
+ throw new DeploymentException(ALTERNATIVE_BEAN_CLASS_SPECIFIED_MULTIPLE_TIMES, clazz);
+ }
+ seenAlternatives.add(clazz);
+ }
+ }
+
+ private void validateDisposalMethods(BeanDeployerEnvironment environment)
+ {
+ Set<DisposalMethod<?, ?>> beans = environment.getUnresolvedDisposalBeans();
+ if (!beans.isEmpty())
+ {
+ throw new DefinitionException(DISPOSAL_METHODS_WITHOUT_PRODUCER, beans);
+ }
+ }
+
+ private static void checkFacadeInjectionPoint(InjectionPoint injectionPoint, Class<?> type)
+ {
+ if (injectionPoint.getAnnotated().getBaseType().equals(type))
+ {
+ if (injectionPoint.getType() instanceof ParameterizedType)
+ {
+ ParameterizedType parameterizedType = (ParameterizedType) injectionPoint.getType();
+ if (parameterizedType.getActualTypeArguments()[0] instanceof TypeVariable<?>)
+ {
+ throw new DefinitionException(INJECTION_POINT_WITH_TYPE_VARIABLE, injectionPoint);
+ }
+ if (parameterizedType.getActualTypeArguments()[0] instanceof WildcardType)
+ {
+ throw new DefinitionException(INJECTION_POINT_HAS_WILDCARD, type, injectionPoint);
+ }
+ }
+ else
+ {
+ throw new DefinitionException(INJECTION_POINT_MUST_HAVE_TYPE_PARAMETER, type, injectionPoint);
+ }
+ }
+
+ }
+
+ public void cleanup()
+ {
+ }
+
+}
Property changes on: core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/Validator.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/WeldBootstrap.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/WeldBootstrap.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/WeldBootstrap.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -38,15 +38,10 @@
import javax.enterprise.inject.spi.Extension;
-import org.jboss.weld.BeanManagerImpl;
import org.jboss.weld.Container;
import org.jboss.weld.ContextualStoreImpl;
-import org.jboss.weld.ForbiddenArgumentException;
-import org.jboss.weld.ForbiddenStateException;
-import org.jboss.weld.Validator;
import org.jboss.weld.Container.Status;
import org.jboss.weld.bean.builtin.BeanManagerBean;
-import org.jboss.weld.bean.builtin.CallableMethodHandler.CallableMethodHandlerCleaner;
import org.jboss.weld.bootstrap.api.Bootstrap;
import org.jboss.weld.bootstrap.api.Environment;
import org.jboss.weld.bootstrap.api.Lifecycle;
@@ -75,8 +70,11 @@
import org.jboss.weld.ejb.EJBApiAbstraction;
import org.jboss.weld.ejb.EjbDescriptors;
import org.jboss.weld.ejb.spi.EjbDescriptor;
+import org.jboss.weld.exceptions.ForbiddenArgumentException;
+import org.jboss.weld.exceptions.ForbiddenStateException;
import org.jboss.weld.jsf.JsfApiAbstraction;
import org.jboss.weld.logging.messages.VersionMessage;
+import org.jboss.weld.manager.BeanManagerImpl;
import org.jboss.weld.metadata.TypeStore;
import org.jboss.weld.metadata.cache.MetaAnnotationStore;
import org.jboss.weld.persistence.PersistenceApiAbstraction;
@@ -90,6 +88,7 @@
import org.jboss.weld.servlet.ServletApiAbstraction;
import org.jboss.weld.servlet.api.ServletServices;
import org.jboss.weld.transaction.spi.TransactionServices;
+import org.jboss.weld.util.JavassistCleaner;
import org.jboss.weld.util.Names;
import org.jboss.weld.util.collections.Arrays2;
import org.jboss.weld.util.serviceProvider.DefaultServiceLoaderFactory;
@@ -321,7 +320,7 @@
services.add(MetaAnnotationStore.class, new MetaAnnotationStore(services.get(ClassTransformer.class)));
services.add(ContextualStore.class, new ContextualStoreImpl());
services.add(ServiceLoaderFactory.class, new DefaultServiceLoaderFactory());
- services.add(CallableMethodHandlerCleaner.class, new CallableMethodHandlerCleaner());
+ services.add(JavassistCleaner.class, new JavassistCleaner());
return services;
}
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AbstractBeanDiscoveryEvent.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AbstractBeanDiscoveryEvent.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AbstractBeanDiscoveryEvent.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -19,11 +19,11 @@
import java.lang.reflect.Type;
import java.util.Map;
-import org.jboss.weld.BeanManagerImpl;
import org.jboss.weld.bootstrap.BeanDeployment;
import org.jboss.weld.bootstrap.ExtensionBeanDeployerEnvironment;
import org.jboss.weld.bootstrap.spi.BeanDeploymentArchive;
import org.jboss.weld.bootstrap.spi.Deployment;
+import org.jboss.weld.manager.BeanManagerImpl;
import org.jboss.weld.metadata.TypeStore;
import org.jboss.weld.util.DeploymentStructures;
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AbstractContainerEvent.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AbstractContainerEvent.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AbstractContainerEvent.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -9,9 +9,9 @@
import javax.enterprise.inject.spi.ObserverMethod;
-import org.jboss.weld.BeanManagerImpl;
import org.jboss.weld.bootstrap.BeanDeployment;
import org.jboss.weld.bootstrap.spi.BeanDeploymentArchive;
+import org.jboss.weld.manager.BeanManagerImpl;
import org.jboss.weld.util.reflection.ParameterizedTypeImpl;
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AbstractDefinitionContainerEvent.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AbstractDefinitionContainerEvent.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AbstractDefinitionContainerEvent.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -18,8 +18,8 @@
import java.lang.reflect.Type;
-import org.jboss.weld.BeanManagerImpl;
-import org.jboss.weld.DefinitionException;
+import org.jboss.weld.exceptions.DefinitionException;
+import org.jboss.weld.manager.BeanManagerImpl;
/**
* @author pmuir
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AbstractDeploymentContainerEvent.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AbstractDeploymentContainerEvent.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AbstractDeploymentContainerEvent.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -18,8 +18,8 @@
import java.lang.reflect.Type;
-import org.jboss.weld.BeanManagerImpl;
-import org.jboss.weld.DeploymentException;
+import org.jboss.weld.exceptions.DeploymentException;
+import org.jboss.weld.manager.BeanManagerImpl;
/**
* @author pmuir
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AbstractProcessClassBean.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AbstractProcessClassBean.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AbstractProcessClassBean.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -5,8 +5,8 @@
import javax.enterprise.inject.spi.Annotated;
import javax.enterprise.inject.spi.ProcessBean;
-import org.jboss.weld.BeanManagerImpl;
import org.jboss.weld.bean.AbstractClassBean;
+import org.jboss.weld.manager.BeanManagerImpl;
public abstract class AbstractProcessClassBean<X, B extends AbstractClassBean<X>> extends AbstractDefinitionContainerEvent implements ProcessBean<X>
{
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AbstractProcessInjectionTarget.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AbstractProcessInjectionTarget.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AbstractProcessInjectionTarget.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -7,8 +7,8 @@
import javax.enterprise.inject.spi.InjectionTarget;
import javax.enterprise.inject.spi.ProcessInjectionTarget;
-import org.jboss.weld.BeanManagerImpl;
import org.jboss.weld.bean.AbstractClassBean;
+import org.jboss.weld.manager.BeanManagerImpl;
public abstract class AbstractProcessInjectionTarget<T> extends AbstractDefinitionContainerEvent
{
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AbstractProcessProducerBean.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AbstractProcessProducerBean.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AbstractProcessProducerBean.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -5,8 +5,8 @@
import javax.enterprise.inject.spi.Annotated;
import javax.enterprise.inject.spi.ProcessBean;
-import org.jboss.weld.BeanManagerImpl;
import org.jboss.weld.bean.AbstractProducerBean;
+import org.jboss.weld.manager.BeanManagerImpl;
public abstract class AbstractProcessProducerBean<X, T, B extends AbstractProducerBean<X, T, ? >> extends AbstractDefinitionContainerEvent implements ProcessBean<T>
{
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AfterBeanDiscoveryImpl.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AfterBeanDiscoveryImpl.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AfterBeanDiscoveryImpl.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -27,11 +27,11 @@
import javax.enterprise.inject.spi.Interceptor;
import javax.enterprise.inject.spi.Decorator;
-import org.jboss.weld.BeanManagerImpl;
import org.jboss.weld.bean.CustomDecoratorWrapper;
import org.jboss.weld.bootstrap.BeanDeployment;
import org.jboss.weld.bootstrap.spi.BeanDeploymentArchive;
import org.jboss.weld.bootstrap.spi.Deployment;
+import org.jboss.weld.manager.BeanManagerImpl;
public class AfterBeanDiscoveryImpl extends AbstractBeanDiscoveryEvent implements AfterBeanDiscovery
{
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AfterDeploymentValidationImpl.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AfterDeploymentValidationImpl.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AfterDeploymentValidationImpl.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -20,9 +20,9 @@
import javax.enterprise.inject.spi.AfterDeploymentValidation;
-import org.jboss.weld.BeanManagerImpl;
import org.jboss.weld.bootstrap.BeanDeployment;
import org.jboss.weld.bootstrap.spi.BeanDeploymentArchive;
+import org.jboss.weld.manager.BeanManagerImpl;
public class AfterDeploymentValidationImpl extends AbstractDeploymentContainerEvent implements AfterDeploymentValidation
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/BeforeBeanDiscoveryImpl.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/BeforeBeanDiscoveryImpl.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/BeforeBeanDiscoveryImpl.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -22,7 +22,6 @@
import javax.enterprise.inject.spi.AnnotatedType;
import javax.enterprise.inject.spi.BeforeBeanDiscovery;
-import org.jboss.weld.BeanManagerImpl;
import org.jboss.weld.bootstrap.BeanDeployment;
import org.jboss.weld.bootstrap.spi.BeanDeploymentArchive;
import org.jboss.weld.bootstrap.spi.Deployment;
@@ -31,6 +30,7 @@
import org.jboss.weld.literal.NormalScopeLiteral;
import org.jboss.weld.literal.ScopeLiteral;
import org.jboss.weld.literal.StereotypeLiteral;
+import org.jboss.weld.manager.BeanManagerImpl;
public class BeforeBeanDiscoveryImpl extends AbstractBeanDiscoveryEvent implements BeforeBeanDiscovery
{
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/BeforeShutdownImpl.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/BeforeShutdownImpl.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/BeforeShutdownImpl.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -18,7 +18,7 @@
import javax.enterprise.inject.spi.BeforeShutdown;
-import org.jboss.weld.BeanManagerImpl;
+import org.jboss.weld.manager.BeanManagerImpl;
/**
* @author pmuir
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessAnnotatedTypeImpl.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessAnnotatedTypeImpl.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessAnnotatedTypeImpl.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -23,9 +23,9 @@
import javax.enterprise.inject.spi.AnnotatedType;
import javax.enterprise.inject.spi.ProcessAnnotatedType;
-import org.jboss.weld.BeanManagerImpl;
-import org.jboss.weld.ForbiddenArgumentException;
+import org.jboss.weld.exceptions.ForbiddenArgumentException;
import org.jboss.weld.introspector.WeldClass;
+import org.jboss.weld.manager.BeanManagerImpl;
/**
* Container lifecycle event for each Java class or interface discovered by
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessBeanImpl.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessBeanImpl.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessBeanImpl.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -6,8 +6,8 @@
import javax.enterprise.inject.spi.Bean;
import javax.enterprise.inject.spi.ProcessBean;
-import org.jboss.weld.BeanManagerImpl;
import org.jboss.weld.introspector.WeldAnnotated;
+import org.jboss.weld.manager.BeanManagerImpl;
import org.jboss.weld.resources.ClassTransformer;
public abstract class ProcessBeanImpl<X> extends AbstractDefinitionContainerEvent implements ProcessBean<X>
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessBeanInjectionTarget.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessBeanInjectionTarget.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessBeanInjectionTarget.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -3,8 +3,8 @@
import javax.enterprise.inject.spi.InjectionTarget;
import javax.enterprise.inject.spi.ProcessInjectionTarget;
-import org.jboss.weld.BeanManagerImpl;
import org.jboss.weld.bean.AbstractClassBean;
+import org.jboss.weld.manager.BeanManagerImpl;
public class ProcessBeanInjectionTarget<T> extends AbstractProcessInjectionTarget<T> implements ProcessInjectionTarget<T>
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessManagedBeanImpl.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessManagedBeanImpl.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessManagedBeanImpl.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -5,8 +5,8 @@
import javax.enterprise.inject.spi.AnnotatedType;
import javax.enterprise.inject.spi.ProcessManagedBean;
-import org.jboss.weld.BeanManagerImpl;
import org.jboss.weld.bean.ManagedBean;
+import org.jboss.weld.manager.BeanManagerImpl;
public class ProcessManagedBeanImpl<X> extends AbstractProcessClassBean<X, ManagedBean<X>> implements ProcessManagedBean<X>
{
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessObserverMethodImpl.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessObserverMethodImpl.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessObserverMethodImpl.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -25,8 +25,8 @@
import javax.enterprise.inject.spi.ObserverMethod;
import javax.enterprise.inject.spi.ProcessObserverMethod;
-import org.jboss.weld.BeanManagerImpl;
import org.jboss.weld.event.ObserverMethodImpl;
+import org.jboss.weld.manager.BeanManagerImpl;
/**
* Implementation of the event used to notify observers for each observer
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessProducerFieldImpl.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessProducerFieldImpl.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessProducerFieldImpl.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -5,8 +5,8 @@
import javax.enterprise.inject.spi.AnnotatedField;
import javax.enterprise.inject.spi.ProcessProducerField;
-import org.jboss.weld.BeanManagerImpl;
import org.jboss.weld.bean.ProducerField;
+import org.jboss.weld.manager.BeanManagerImpl;
public class ProcessProducerFieldImpl<X, T> extends AbstractProcessProducerBean<X, T, ProducerField<X, T>> implements ProcessProducerField<X, T>
{
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessProducerImpl.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessProducerImpl.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessProducerImpl.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -7,8 +7,8 @@
import javax.enterprise.inject.spi.ProcessProducer;
import javax.enterprise.inject.spi.Producer;
-import org.jboss.weld.BeanManagerImpl;
import org.jboss.weld.bean.AbstractProducerBean;
+import org.jboss.weld.manager.BeanManagerImpl;
public class ProcessProducerImpl<X, T> extends AbstractDefinitionContainerEvent implements ProcessProducer<X, T>
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessProducerMethodImpl.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessProducerMethodImpl.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessProducerMethodImpl.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -6,8 +6,8 @@
import javax.enterprise.inject.spi.AnnotatedParameter;
import javax.enterprise.inject.spi.ProcessProducerMethod;
-import org.jboss.weld.BeanManagerImpl;
import org.jboss.weld.bean.ProducerMethod;
+import org.jboss.weld.manager.BeanManagerImpl;
public class ProcessProducerMethodImpl<X, T> extends AbstractProcessProducerBean<X, T, ProducerMethod<X, T>> implements ProcessProducerMethod<X, T>
{
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessSessionBeanImpl.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessSessionBeanImpl.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessSessionBeanImpl.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -8,9 +8,9 @@
import javax.enterprise.inject.spi.ProcessSessionBean;
import javax.enterprise.inject.spi.SessionBeanType;
-import org.jboss.weld.BeanManagerImpl;
-import org.jboss.weld.ForbiddenStateException;
import org.jboss.weld.bean.SessionBean;
+import org.jboss.weld.exceptions.ForbiddenStateException;
+import org.jboss.weld.manager.BeanManagerImpl;
public class ProcessSessionBeanImpl<X> extends AbstractProcessClassBean<Object, SessionBean<Object>> implements ProcessSessionBean<X>
{
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessSimpleInjectionTarget.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessSimpleInjectionTarget.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessSimpleInjectionTarget.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -4,7 +4,7 @@
import javax.enterprise.inject.spi.InjectionTarget;
import javax.enterprise.inject.spi.ProcessInjectionTarget;
-import org.jboss.weld.BeanManagerImpl;
+import org.jboss.weld.manager.BeanManagerImpl;
public class ProcessSimpleInjectionTarget<T> extends AbstractProcessInjectionTarget<T> implements ProcessInjectionTarget<T>
Modified: core/trunk/impl/src/main/java/org/jboss/weld/context/AbstractMapContext.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/context/AbstractMapContext.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/context/AbstractMapContext.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -31,10 +31,10 @@
import javax.enterprise.context.spi.CreationalContext;
import org.jboss.weld.Container;
-import org.jboss.weld.ForbiddenArgumentException;
-import org.jboss.weld.ForbiddenStateException;
import org.jboss.weld.context.api.BeanStore;
import org.jboss.weld.context.api.ContextualInstance;
+import org.jboss.weld.exceptions.ForbiddenArgumentException;
+import org.jboss.weld.exceptions.ForbiddenStateException;
import org.jboss.weld.serialization.spi.ContextualStore;
import org.slf4j.cal10n.LocLogger;
Modified: core/trunk/impl/src/main/java/org/jboss/weld/context/ContextNotActiveException.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/context/ContextNotActiveException.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/context/ContextNotActiveException.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -17,7 +17,7 @@
package org.jboss.weld.context;
-import org.jboss.weld.WeldExceptionMessage;
+import org.jboss.weld.exceptions.WeldExceptionMessage;
/**
* A localized message version of the
Modified: core/trunk/impl/src/main/java/org/jboss/weld/context/beanstore/NamingScheme.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/context/beanstore/NamingScheme.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/context/beanstore/NamingScheme.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -18,7 +18,7 @@
import static org.jboss.weld.logging.messages.ContextMessage.DELIMITER_IN_PREFIX;
-import org.jboss.weld.ForbiddenArgumentException;
+import org.jboss.weld.exceptions.ForbiddenArgumentException;
Modified: core/trunk/impl/src/main/java/org/jboss/weld/conversation/ConversationImpl.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/conversation/ConversationImpl.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/conversation/ConversationImpl.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -32,7 +32,7 @@
import javax.inject.Inject;
import javax.inject.Named;
-import org.jboss.weld.ForbiddenStateException;
+import org.jboss.weld.exceptions.ForbiddenStateException;
import org.slf4j.cal10n.LocLogger;
/**
Modified: core/trunk/impl/src/main/java/org/jboss/weld/ejb/EjbDescriptors.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/ejb/EjbDescriptors.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/ejb/EjbDescriptors.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -25,10 +25,10 @@
import java.util.Map;
import java.util.Set;
-import org.jboss.weld.ForbiddenStateException;
-import org.jboss.weld.InvalidOperationException;
import org.jboss.weld.bootstrap.api.Service;
import org.jboss.weld.ejb.spi.EjbDescriptor;
+import org.jboss.weld.exceptions.ForbiddenStateException;
+import org.jboss.weld.exceptions.InvalidOperationException;
import com.google.common.base.Supplier;
import com.google.common.collect.Multimaps;
Modified: core/trunk/impl/src/main/java/org/jboss/weld/el/AbstractWeldELResolver.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/el/AbstractWeldELResolver.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/el/AbstractWeldELResolver.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -27,8 +27,8 @@
import javax.el.ELResolver;
import javax.enterprise.inject.spi.Bean;
-import org.jboss.weld.BeanManagerImpl;
-import org.jboss.weld.WeldException;
+import org.jboss.weld.exceptions.WeldException;
+import org.jboss.weld.manager.BeanManagerImpl;
/**
* An EL-resolver against the named beans
Modified: core/trunk/impl/src/main/java/org/jboss/weld/el/WeldELResolver.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/el/WeldELResolver.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/el/WeldELResolver.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -18,7 +18,7 @@
import javax.el.ELContext;
-import org.jboss.weld.BeanManagerImpl;
+import org.jboss.weld.manager.BeanManagerImpl;
/**
* @author pmuir
Modified: core/trunk/impl/src/main/java/org/jboss/weld/el/WeldExpressionFactory.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/el/WeldExpressionFactory.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/el/WeldExpressionFactory.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -23,7 +23,7 @@
import javax.el.MethodExpression;
import javax.el.ValueExpression;
-import org.jboss.weld.ForbiddenArgumentException;
+import org.jboss.weld.exceptions.ForbiddenArgumentException;
import org.jboss.weld.util.el.ForwardingExpressionFactory;
/**
Modified: core/trunk/impl/src/main/java/org/jboss/weld/event/EventImpl.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/event/EventImpl.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/event/EventImpl.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -32,10 +32,10 @@
import javax.enterprise.inject.spi.InjectionPoint;
import javax.enterprise.util.TypeLiteral;
-import org.jboss.weld.BeanManagerImpl;
-import org.jboss.weld.InvalidObjectException;
import org.jboss.weld.bean.builtin.AbstractFacade;
+import org.jboss.weld.exceptions.InvalidObjectException;
import org.jboss.weld.literal.DefaultLiteral;
+import org.jboss.weld.manager.BeanManagerImpl;
import org.jboss.weld.util.Beans;
import org.jboss.weld.util.Names;
import org.jboss.weld.util.Observers;
Modified: core/trunk/impl/src/main/java/org/jboss/weld/event/ObserverFactory.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/event/ObserverFactory.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/event/ObserverFactory.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -19,10 +19,10 @@
import javax.enterprise.event.Observes;
import javax.enterprise.event.TransactionPhase;
-import org.jboss.weld.BeanManagerImpl;
import org.jboss.weld.bean.RIBean;
import org.jboss.weld.introspector.WeldMethod;
import org.jboss.weld.introspector.WeldParameter;
+import org.jboss.weld.manager.BeanManagerImpl;
import org.jboss.weld.transaction.spi.TransactionServices;
/**
Modified: core/trunk/impl/src/main/java/org/jboss/weld/event/ObserverMethodImpl.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/event/ObserverMethodImpl.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/event/ObserverMethodImpl.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -42,14 +42,14 @@
import javax.inject.Inject;
import javax.inject.Qualifier;
-import org.jboss.weld.BeanManagerImpl;
-import org.jboss.weld.DefinitionException;
import org.jboss.weld.bean.RIBean;
import org.jboss.weld.bootstrap.events.AbstractContainerEvent;
+import org.jboss.weld.exceptions.DefinitionException;
import org.jboss.weld.injection.MethodInjectionPoint;
import org.jboss.weld.injection.WeldInjectionPoint;
import org.jboss.weld.introspector.WeldMethod;
import org.jboss.weld.introspector.WeldParameter;
+import org.jboss.weld.manager.BeanManagerImpl;
import org.jboss.weld.util.Beans;
/**
Modified: core/trunk/impl/src/main/java/org/jboss/weld/event/TransactionalObserverMethodImpl.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/event/TransactionalObserverMethodImpl.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/event/TransactionalObserverMethodImpl.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -19,9 +19,9 @@
import javax.enterprise.event.TransactionPhase;
import javax.transaction.Synchronization;
-import org.jboss.weld.BeanManagerImpl;
import org.jboss.weld.bean.RIBean;
import org.jboss.weld.introspector.WeldMethod;
+import org.jboss.weld.manager.BeanManagerImpl;
import org.jboss.weld.transaction.spi.TransactionServices;
/**
Copied: core/trunk/impl/src/main/java/org/jboss/weld/exceptions/AmbiguousResolutionException.java (from rev 5388, core/trunk/impl/src/main/java/org/jboss/weld/AmbiguousResolutionException.java)
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/exceptions/AmbiguousResolutionException.java (rev 0)
+++ core/trunk/impl/src/main/java/org/jboss/weld/exceptions/AmbiguousResolutionException.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -0,0 +1,67 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat, Inc. and/or its affiliates, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.weld.exceptions;
+
+/**
+ * Provides message localization service for the
+ * {@link javax.enterprise.inject.AmbiguousResolutionException}.
+ *
+ * @author David Allen
+ */
+public class AmbiguousResolutionException extends javax.enterprise.inject.AmbiguousResolutionException
+{
+ private static final long serialVersionUID = 2L;
+
+ private WeldExceptionMessage message;
+
+ /**
+ * Creates a new exception with the given cause.
+ *
+ * @param throwable The cause of the exception
+ */
+ public AmbiguousResolutionException(Throwable throwable)
+ {
+ super(throwable);
+ message = new WeldExceptionMessage(throwable.getLocalizedMessage());
+ }
+
+ /**
+ * Creates a new exception with the given localized message key and optional
+ * arguments for the message.
+ *
+ * @param <E> The enumeration type for the message keys
+ * @param key The localized message to use
+ * @param args Optional arguments to insert into the message
+ */
+ public <E extends Enum<?>> AmbiguousResolutionException(E key, Object... args)
+ {
+ message = new WeldExceptionMessage(key, args);
+ }
+
+ @Override
+ public String getLocalizedMessage()
+ {
+ return getMessage();
+ }
+
+ @Override
+ public String getMessage()
+ {
+ return message.getAsString();
+ }
+}
Property changes on: core/trunk/impl/src/main/java/org/jboss/weld/exceptions/AmbiguousResolutionException.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: core/trunk/impl/src/main/java/org/jboss/weld/exceptions/CreationException.java (from rev 5388, core/trunk/impl/src/main/java/org/jboss/weld/CreationException.java)
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/exceptions/CreationException.java (rev 0)
+++ core/trunk/impl/src/main/java/org/jboss/weld/exceptions/CreationException.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -0,0 +1,72 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat, Inc. and/or its affiliates, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.weld.exceptions;
+
+/**
+ * A version of {@link javax.enterprise.inject.CreationException} that supports
+ * message localization.
+ *
+ * @author David Allen
+ */
+public class CreationException extends javax.enterprise.inject.CreationException
+{
+
+ private static final long serialVersionUID = 2L;
+
+ private WeldExceptionMessage message;
+
+ /**
+ * Creates a new exception with the given localized message key and optional
+ * arguments for the message.
+ *
+ * @param <E> The enumeration type for the message keys
+ * @param key The localized message to use
+ * @param args Optional arguments to insert into the message
+ */
+ public <E extends Enum<?>> CreationException(E key, Object... args)
+ {
+ message = new WeldExceptionMessage(key, args);
+ }
+
+ /**
+ * Creates a new exception with the given localized message key, the cause
+ * for this exception and optional arguments for the message.
+ *
+ * @param <E> The enumeration type for the message keys
+ * @param key The localized message to use
+ * @param throwable The cause for this exception
+ * @param args Optional arguments to insert into the message
+ */
+ public <E extends Enum<?>> CreationException(E key, Throwable throwable, Object... args)
+ {
+ super(throwable);
+ message = new WeldExceptionMessage(key, args);
+ }
+
+ @Override
+ public String getLocalizedMessage()
+ {
+ return getMessage();
+ }
+
+ @Override
+ public String getMessage()
+ {
+ return message.getAsString();
+ }
+}
Property changes on: core/trunk/impl/src/main/java/org/jboss/weld/exceptions/CreationException.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: core/trunk/impl/src/main/java/org/jboss/weld/exceptions/DefinitionException.java (from rev 5388, core/trunk/impl/src/main/java/org/jboss/weld/DefinitionException.java)
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/exceptions/DefinitionException.java (rev 0)
+++ core/trunk/impl/src/main/java/org/jboss/weld/exceptions/DefinitionException.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -0,0 +1,79 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.exceptions;
+
+import java.util.List;
+
+/**
+ * Thrown if the definition of a bean is incorrect
+ *
+ * @author Pete Muir
+ */
+public class DefinitionException extends WeldException
+{
+ private static final long serialVersionUID = 8014646336322875707L;
+
+ /**
+ * Creates a new exception with the given localized message key and optional
+ * arguments for the message.
+ *
+ * @param <E> The enumeration type for the message keys
+ * @param key The localized message to use
+ * @param args Optional arguments to insert into the message
+ */
+ public <E extends Enum<?>> DefinitionException(E key, Object... args)
+ {
+ super(key, args);
+ }
+
+ /**
+ * Creates a new exception with the given localized message key, the cause
+ * for this exception and optional arguments for the message.
+ *
+ * @param <E> The enumeration type for the message keys
+ * @param key The localized message to use
+ * @param throwable The cause for this exception
+ * @param args Optional arguments to insert into the message
+ */
+ public <E extends Enum<?>> DefinitionException(E key, Throwable throwable, Object... args)
+ {
+ super(throwable);
+ }
+
+ /**
+ * Creates a new exception with the given cause.
+ *
+ * @param throwable The cause of the exception
+ */
+ public DefinitionException(Throwable throwable)
+ {
+ super(throwable);
+ }
+
+ /**
+ * Creates a new exception based on a list of throwables. The throwables are not
+ * used as the cause, but the message from each throwable is included as the message
+ * for this exception.
+ *
+ * @param errors A list of throwables to use in the message
+ */
+ public DefinitionException(List<Throwable> errors)
+ {
+ super(errors);
+ }
+
+}
Property changes on: core/trunk/impl/src/main/java/org/jboss/weld/exceptions/DefinitionException.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Copied: core/trunk/impl/src/main/java/org/jboss/weld/exceptions/DeploymentException.java (from rev 5388, core/trunk/impl/src/main/java/org/jboss/weld/DeploymentException.java)
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/exceptions/DeploymentException.java (rev 0)
+++ core/trunk/impl/src/main/java/org/jboss/weld/exceptions/DeploymentException.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -0,0 +1,78 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.exceptions;
+
+import java.util.List;
+
+/**
+ * Thrown if an deployment exception occurs.
+ *
+ * @author Pete Muir
+ */
+public class DeploymentException extends WeldException
+{
+ private static final long serialVersionUID = 8014646336322875707L;
+
+ /**
+ * Creates a new exception with the given localized message key and optional
+ * arguments for the message.
+ *
+ * @param <E> The enumeration type for the message keys
+ * @param key The localized message to use
+ * @param args Optional arguments to insert into the message
+ */
+ public <E extends Enum<?>> DeploymentException(E key, Object... args)
+ {
+ super(key, args);
+ }
+
+ /**
+ * Creates a new exception with the given localized message key, the cause
+ * for this exception and optional arguments for the message.
+ *
+ * @param <E> The enumeration type for the message keys
+ * @param key The localized message to use
+ * @param throwable The cause for this exception
+ * @param args Optional arguments to insert into the message
+ */
+ public <E extends Enum<?>> DeploymentException(E key, Throwable throwable, Object... args)
+ {
+ super(key, throwable, args);
+ }
+
+ /**
+ * Creates a new exception with the given cause.
+ *
+ * @param throwable The cause of the exception
+ */
+ public DeploymentException(Throwable throwable)
+ {
+ super(throwable);
+ }
+
+ /**
+ * Creates a new exception based on a list of throwables. The throwables are not
+ * used as the cause, but the message from each throwable is included as the message
+ * for this exception.
+ *
+ * @param errors A list of throwables to use in the message
+ */
+ public DeploymentException(List<Throwable> errors)
+ {
+ super(errors);
+ }
+}
Property changes on: core/trunk/impl/src/main/java/org/jboss/weld/exceptions/DeploymentException.java
___________________________________________________________________
Name: svn:eol-style
+ native
Copied: core/trunk/impl/src/main/java/org/jboss/weld/exceptions/ForbiddenArgumentException.java (from rev 5388, core/trunk/impl/src/main/java/org/jboss/weld/ForbiddenArgumentException.java)
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/exceptions/ForbiddenArgumentException.java (rev 0)
+++ core/trunk/impl/src/main/java/org/jboss/weld/exceptions/ForbiddenArgumentException.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -0,0 +1,68 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat, Inc. and/or its affiliates, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.weld.exceptions;
+
+/**
+ * This exception is used when the specification calls for an
+ * {@link java.lang.IllegalArgumentException}.
+ *
+ * @author David Allen
+ */
+public class ForbiddenArgumentException extends IllegalArgumentException
+{
+
+ private static final long serialVersionUID = 2L;
+
+ private WeldExceptionMessage message;
+
+ /**
+ * Creates a new exception with the given cause.
+ *
+ * @param throwable The cause of the exception
+ */
+ public ForbiddenArgumentException(Throwable throwable)
+ {
+ super(throwable);
+ message = new WeldExceptionMessage(throwable.getLocalizedMessage());
+ }
+
+ /**
+ * Creates a new exception with the given localized message key and optional
+ * arguments for the message.
+ *
+ * @param <E> The enumeration type for the message keys
+ * @param key The localized message to use
+ * @param args Optional arguments to insert into the message
+ */
+ public <E extends Enum<?>> ForbiddenArgumentException(E key, Object... args)
+ {
+ message = new WeldExceptionMessage(key, args);
+ }
+
+ @Override
+ public String getLocalizedMessage()
+ {
+ return getMessage();
+ }
+
+ @Override
+ public String getMessage()
+ {
+ return message.getAsString();
+ }
+}
Property changes on: core/trunk/impl/src/main/java/org/jboss/weld/exceptions/ForbiddenArgumentException.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: core/trunk/impl/src/main/java/org/jboss/weld/exceptions/ForbiddenStateException.java (from rev 5388, core/trunk/impl/src/main/java/org/jboss/weld/ForbiddenStateException.java)
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/exceptions/ForbiddenStateException.java (rev 0)
+++ core/trunk/impl/src/main/java/org/jboss/weld/exceptions/ForbiddenStateException.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -0,0 +1,66 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat, Inc. and/or its affiliates, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.weld.exceptions;
+
+/**
+ * This exception is used when the specification calls for an
+ * {@link java.lang.IllegalStateException}.
+ *
+ * @author David Allen
+ */
+public class ForbiddenStateException extends IllegalStateException
+{
+ private static final long serialVersionUID = 2L;
+
+ private WeldExceptionMessage message;
+
+ /**
+ * Creates a new exception with the given localized message key and optional
+ * arguments for the message.
+ *
+ * @param <E> The enumeration type for the message keys
+ * @param key The localized message to use
+ * @param args Optional arguments to insert into the message
+ */
+ public <E extends Enum<?>> ForbiddenStateException(E key, Object... args)
+ {
+ message = new WeldExceptionMessage(key, args);
+ }
+
+ /**
+ * Creates a new exception with the given cause.
+ *
+ * @param throwable The cause of the exception
+ */
+ public ForbiddenStateException(Throwable cause)
+ {
+ super(cause.getLocalizedMessage(), cause);
+ }
+
+ @Override
+ public String getLocalizedMessage()
+ {
+ return getMessage();
+ }
+
+ @Override
+ public String getMessage()
+ {
+ return message.getAsString();
+ }
+}
Property changes on: core/trunk/impl/src/main/java/org/jboss/weld/exceptions/ForbiddenStateException.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: core/trunk/impl/src/main/java/org/jboss/weld/exceptions/IllegalProductException.java (from rev 5388, core/trunk/impl/src/main/java/org/jboss/weld/IllegalProductException.java)
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/exceptions/IllegalProductException.java (rev 0)
+++ core/trunk/impl/src/main/java/org/jboss/weld/exceptions/IllegalProductException.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -0,0 +1,57 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat, Inc. and/or its affiliates, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.weld.exceptions;
+
+/**
+ * An {@link javax.enterprise.inject.IllegalProductException} with support for
+ * localized messages in Weld.
+ *
+ * @author David Allen
+ */
+public class IllegalProductException extends javax.enterprise.inject.IllegalProductException
+{
+
+ private static final long serialVersionUID = 2L;
+
+ private WeldExceptionMessage message;
+
+ /**
+ * Creates a new exception with the given localized message key and optional
+ * arguments for the message.
+ *
+ * @param <E> The enumeration type for the message keys
+ * @param key The localized message to use
+ * @param args Optional arguments to insert into the message
+ */
+ public <E extends Enum<?>> IllegalProductException(E key, Object... args)
+ {
+ message = new WeldExceptionMessage(key, args);
+ }
+
+ @Override
+ public String getLocalizedMessage()
+ {
+ return getMessage();
+ }
+
+ @Override
+ public String getMessage()
+ {
+ return message.getAsString();
+ }
+}
Property changes on: core/trunk/impl/src/main/java/org/jboss/weld/exceptions/IllegalProductException.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: core/trunk/impl/src/main/java/org/jboss/weld/exceptions/InconsistentSpecializationException.java (from rev 5388, core/trunk/impl/src/main/java/org/jboss/weld/InconsistentSpecializationException.java)
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/exceptions/InconsistentSpecializationException.java (rev 0)
+++ core/trunk/impl/src/main/java/org/jboss/weld/exceptions/InconsistentSpecializationException.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -0,0 +1,54 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.exceptions;
+
+
+/**
+ *
+ * @author Pete Muir
+ */
+public class InconsistentSpecializationException extends DeploymentException
+{
+
+ private static final long serialVersionUID = 4359656880524913555L;
+
+ /**
+ * Creates a new exception with the given localized message key and optional
+ * arguments for the message.
+ *
+ * @param <E> The enumeration type for the message keys
+ * @param key The localized message to use
+ * @param args Optional arguments to insert into the message
+ */
+ public <E extends Enum<?>> InconsistentSpecializationException(E key, Object... args)
+ {
+ super(key, args);
+ }
+
+ /**
+ * Creates a new exception with the given cause.
+ *
+ * @param throwable The cause of the exception
+ */
+ public InconsistentSpecializationException(Throwable throwable)
+ {
+ super(throwable);
+ }
+
+
+
+}
Property changes on: core/trunk/impl/src/main/java/org/jboss/weld/exceptions/InconsistentSpecializationException.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Copied: core/trunk/impl/src/main/java/org/jboss/weld/exceptions/InjectionException.java (from rev 5388, core/trunk/impl/src/main/java/org/jboss/weld/InjectionException.java)
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/exceptions/InjectionException.java (rev 0)
+++ core/trunk/impl/src/main/java/org/jboss/weld/exceptions/InjectionException.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -0,0 +1,81 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat, Inc. and/or its affiliates, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.weld.exceptions;
+
+/**
+ * Provides message localization service for the
+ * {@link javax.enterprise.inject.InjectionException}.
+ *
+ * @author David Allen
+ */
+public class InjectionException extends javax.enterprise.inject.InjectionException
+{
+ private static final long serialVersionUID = 2L;
+
+ private WeldExceptionMessage message;
+
+ /**
+ * Creates a new exception with the given cause.
+ *
+ * @param throwable The cause of the exception
+ */
+ public InjectionException(Throwable throwable)
+ {
+ super(throwable);
+ message = new WeldExceptionMessage(throwable.getLocalizedMessage());
+ }
+
+ /**
+ * Creates a new exception with an arbitrary message and the cause of the
+ * exception. It is not recommended to use this constructor since the message
+ * cannot be localized.
+ *
+ * @param message The error message
+ * @param throwable The cause of the exception or wrapped throwable
+ */
+ public InjectionException(String message, Throwable throwable)
+ {
+ super(throwable);
+ this.message = new WeldExceptionMessage(message);
+ }
+
+ /**
+ * Creates a new exception with the given localized message key and optional
+ * arguments for the message.
+ *
+ * @param <E> The enumeration type for the message keys
+ * @param key The localized message to use
+ * @param args Optional arguments to insert into the message
+ */
+ public <E extends Enum<?>> InjectionException(E key, Object... args)
+ {
+ message = new WeldExceptionMessage(key, args);
+ }
+
+ @Override
+ public String getLocalizedMessage()
+ {
+ return getMessage();
+ }
+
+ @Override
+ public String getMessage()
+ {
+ return message.getAsString();
+ }
+}
Property changes on: core/trunk/impl/src/main/java/org/jboss/weld/exceptions/InjectionException.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: core/trunk/impl/src/main/java/org/jboss/weld/exceptions/InvalidObjectException.java (from rev 5388, core/trunk/impl/src/main/java/org/jboss/weld/InvalidObjectException.java)
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/exceptions/InvalidObjectException.java (rev 0)
+++ core/trunk/impl/src/main/java/org/jboss/weld/exceptions/InvalidObjectException.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -0,0 +1,59 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat, Inc. and/or its affiliates, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.weld.exceptions;
+
+/**
+ * An extended version of {@link java.io.InvalidObjectException} that supports
+ * localization.
+ *
+ * @author David Allen
+ */
+public class InvalidObjectException extends java.io.InvalidObjectException
+{
+
+ private static final long serialVersionUID = 2L;
+
+ private WeldExceptionMessage message;
+
+ /**
+ * Creates a new exception with the given localized message key and optional
+ * arguments for the message.
+ *
+ * @param <E> The enumeration type for the message keys
+ * @param key The localized message to use
+ * @param args Optional arguments to insert into the message
+ */
+ public <E extends Enum<?>> InvalidObjectException(E key, Object... args)
+ {
+ super(null);
+ message = new WeldExceptionMessage(key, args);
+ }
+
+ @Override
+ public String getLocalizedMessage()
+ {
+ return getMessage();
+ }
+
+ @Override
+ public String getMessage()
+ {
+ return message.getAsString();
+ }
+
+}
Property changes on: core/trunk/impl/src/main/java/org/jboss/weld/exceptions/InvalidObjectException.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: core/trunk/impl/src/main/java/org/jboss/weld/exceptions/InvalidOperationException.java (from rev 5388, core/trunk/impl/src/main/java/org/jboss/weld/InvalidOperationException.java)
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/exceptions/InvalidOperationException.java (rev 0)
+++ core/trunk/impl/src/main/java/org/jboss/weld/exceptions/InvalidOperationException.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -0,0 +1,67 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat, Inc. and/or its affiliates, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.weld.exceptions;
+
+/**
+ * An exception used for unsupported operations or invocations of operations
+ * that are invalid in certain contexts.
+ *
+ * @author David Allen
+ */
+public class InvalidOperationException extends UnsupportedOperationException
+{
+
+ private static final long serialVersionUID = 2L;
+
+ private WeldExceptionMessage message;
+
+ /**
+ * Creates a new exception with no message. Here the stacktrace serves as the
+ * main information since it has the method which was invoked causing this
+ * exception.
+ */
+ public InvalidOperationException()
+ {
+ super();
+ }
+
+ /**
+ * Creates a new exception with the given localized message key and optional
+ * arguments for the message.
+ *
+ * @param <E> The enumeration type for the message keys
+ * @param key The localized message to use
+ * @param args Optional arguments to insert into the message
+ */
+ public <E extends Enum<?>> InvalidOperationException(E key, Object... args)
+ {
+ message = new WeldExceptionMessage(key, args);
+ }
+
+ @Override
+ public String getLocalizedMessage()
+ {
+ return getMessage();
+ }
+
+ @Override
+ public String getMessage()
+ {
+ return message.getAsString();
+ }
+}
Property changes on: core/trunk/impl/src/main/java/org/jboss/weld/exceptions/InvalidOperationException.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: core/trunk/impl/src/main/java/org/jboss/weld/exceptions/NullInstanceException.java (from rev 5388, core/trunk/impl/src/main/java/org/jboss/weld/NullInstanceException.java)
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/exceptions/NullInstanceException.java (rev 0)
+++ core/trunk/impl/src/main/java/org/jboss/weld/exceptions/NullInstanceException.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -0,0 +1,46 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat, Inc. and/or its affiliates, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.weld.exceptions;
+
+/**
+ * This exception occurs in cases where an object instance was expected, but
+ * the reference was null. A typical example is with a producer method that
+ * is not allowed to return null.
+ *
+ * @author David Allen
+ *
+ */
+public class NullInstanceException extends WeldException
+{
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Creates a new exception with the given localized message key and optional
+ * arguments for the message.
+ *
+ * @param <E> The enumeration type for the message keys
+ * @param key The localized message to use
+ * @param args Optional arguments to insert into the message
+ */
+ public <E extends Enum<?>> NullInstanceException(E key, Object... args)
+ {
+ super(key, args);
+ }
+
+}
Property changes on: core/trunk/impl/src/main/java/org/jboss/weld/exceptions/NullInstanceException.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: core/trunk/impl/src/main/java/org/jboss/weld/exceptions/NullableDependencyException.java (from rev 5388, core/trunk/impl/src/main/java/org/jboss/weld/NullableDependencyException.java)
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/exceptions/NullableDependencyException.java (rev 0)
+++ core/trunk/impl/src/main/java/org/jboss/weld/exceptions/NullableDependencyException.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -0,0 +1,56 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.exceptions;
+
+
+/**
+ * Thrown if an injection point of primitive type resolves to a bean which may
+ * be null
+ *
+ * @author Pete Muir
+ */
+public class NullableDependencyException extends DeploymentException
+{
+
+ private static final long serialVersionUID = 6877485218767005761L;
+
+ /**
+ * Creates a new exception with the given localized message key and optional
+ * arguments for the message.
+ *
+ * @param <E> The enumeration type for the message keys
+ * @param key The localized message to use
+ * @param args Optional arguments to insert into the message
+ */
+ public <E extends Enum<?>> NullableDependencyException(E key, Object... args)
+ {
+ super(key, args);
+ }
+
+ /**
+ * Creates a new exception with the given cause.
+ *
+ * @param throwable The cause of the exception
+ */
+ public NullableDependencyException(Throwable throwable)
+ {
+ super(throwable);
+ }
+
+
+
+}
Property changes on: core/trunk/impl/src/main/java/org/jboss/weld/exceptions/NullableDependencyException.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Copied: core/trunk/impl/src/main/java/org/jboss/weld/exceptions/UnproxyableResolutionException.java (from rev 5388, core/trunk/impl/src/main/java/org/jboss/weld/UnproxyableResolutionException.java)
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/exceptions/UnproxyableResolutionException.java (rev 0)
+++ core/trunk/impl/src/main/java/org/jboss/weld/exceptions/UnproxyableResolutionException.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -0,0 +1,68 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat, Inc. and/or its affiliates, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.weld.exceptions;
+
+/**
+ * Provides message localization service for the
+ * {@link javax.enterprise.inject.UnproxyableResolutionException}.
+ *
+ * @author David Allen
+ */
+public class UnproxyableResolutionException extends javax.enterprise.inject.UnproxyableResolutionException
+{
+ private static final long serialVersionUID = 2L;
+
+ private WeldExceptionMessage message;
+
+ /**
+ * Creates a new exception with the given cause.
+ *
+ * @param throwable The cause of the exception
+ */
+ public UnproxyableResolutionException(Throwable throwable)
+ {
+ super(throwable);
+ message = new WeldExceptionMessage(throwable.getLocalizedMessage());
+ }
+
+ /**
+ * Creates a new exception with the given localized message key and optional
+ * arguments for the message.
+ *
+ * @param <E> The enumeration type for the message keys
+ * @param key The localized message to use
+ * @param args Optional arguments to insert into the message
+ */
+ public <E extends Enum<?>> UnproxyableResolutionException(E key, Object... args)
+ {
+ message = new WeldExceptionMessage(key, args);
+ }
+
+ @Override
+ public String getLocalizedMessage()
+ {
+ return getMessage();
+ }
+
+ @Override
+ public String getMessage()
+ {
+ return message.getAsString();
+ }
+
+}
Property changes on: core/trunk/impl/src/main/java/org/jboss/weld/exceptions/UnproxyableResolutionException.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: core/trunk/impl/src/main/java/org/jboss/weld/exceptions/UnsatisfiedResolutionException.java (from rev 5388, core/trunk/impl/src/main/java/org/jboss/weld/UnsatisfiedResolutionException.java)
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/exceptions/UnsatisfiedResolutionException.java (rev 0)
+++ core/trunk/impl/src/main/java/org/jboss/weld/exceptions/UnsatisfiedResolutionException.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -0,0 +1,68 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat, Inc. and/or its affiliates, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.weld.exceptions;
+
+/**
+ * Provides message localization service for the
+ * {@link javax.enterprise.inject.UnsatisfiedResolutionException}.
+ *
+ * @author David Allen
+ */
+public class UnsatisfiedResolutionException extends javax.enterprise.inject.UnsatisfiedResolutionException
+{
+ private static final long serialVersionUID = 2L;
+
+ private WeldExceptionMessage message;
+
+ /**
+ * Creates a new exception with the given cause.
+ *
+ * @param throwable The cause of the exception
+ */
+ public UnsatisfiedResolutionException(Throwable throwable)
+ {
+ super(throwable);
+ message = new WeldExceptionMessage(throwable.getLocalizedMessage());
+ }
+
+ /**
+ * Creates a new exception with the given localized message key and optional
+ * arguments for the message.
+ *
+ * @param <E> The enumeration type for the message keys
+ * @param key The localized message to use
+ * @param args Optional arguments to insert into the message
+ */
+ public <E extends Enum<?>> UnsatisfiedResolutionException(E key, Object... args)
+ {
+ message = new WeldExceptionMessage(key, args);
+ }
+
+ @Override
+ public String getLocalizedMessage()
+ {
+ return getMessage();
+ }
+
+ @Override
+ public String getMessage()
+ {
+ return message.getAsString();
+ }
+
+}
Property changes on: core/trunk/impl/src/main/java/org/jboss/weld/exceptions/UnsatisfiedResolutionException.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: core/trunk/impl/src/main/java/org/jboss/weld/exceptions/UnserializableDependencyException.java (from rev 5388, core/trunk/impl/src/main/java/org/jboss/weld/UnserializableDependencyException.java)
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/exceptions/UnserializableDependencyException.java (rev 0)
+++ core/trunk/impl/src/main/java/org/jboss/weld/exceptions/UnserializableDependencyException.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -0,0 +1,59 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.exceptions;
+
+
+
+/**
+ * Thrown if a simple bean is dependent scoped and injected into a stateful
+ * session bean, into a non-transient field, bean constructor parameter or
+ * initializer method parameter of a bean which declares a passivating scope, or
+ * into a parameter of a producer method which declares a passivating scope
+ *
+ * @author Pete Muir
+ */
+public class UnserializableDependencyException extends DeploymentException
+{
+
+ private static final long serialVersionUID = -6287506607413810688L;
+
+ /**
+ * Creates a new exception with the given localized message key and optional
+ * arguments for the message.
+ *
+ * @param <E> The enumeration type for the message keys
+ * @param key The localized message to use
+ * @param args Optional arguments to insert into the message
+ */
+ public <E extends Enum<?>> UnserializableDependencyException(E key, Object... args)
+ {
+ super(key, args);
+ }
+
+ /**
+ * Creates a new exception with the given cause.
+ *
+ * @param throwable The cause of the exception
+ */
+ public UnserializableDependencyException(Throwable throwable)
+ {
+ super(throwable);
+ }
+
+
+
+}
Property changes on: core/trunk/impl/src/main/java/org/jboss/weld/exceptions/UnserializableDependencyException.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Copied: core/trunk/impl/src/main/java/org/jboss/weld/exceptions/WeldException.java (from rev 5388, core/trunk/impl/src/main/java/org/jboss/weld/WeldException.java)
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/exceptions/WeldException.java (rev 0)
+++ core/trunk/impl/src/main/java/org/jboss/weld/exceptions/WeldException.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -0,0 +1,107 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat, Inc. and/or its affiliates, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.weld.exceptions;
+
+import java.util.List;
+
+/**
+ * A general run-time exception used by the JSR-299 reference implementation Weld.
+ *
+ * @author David Allen
+ */
+public class WeldException extends RuntimeException
+{
+ private static final long serialVersionUID = 2L;
+
+ private WeldExceptionMessage message;
+
+ /**
+ * Creates a new exception with the given cause.
+ *
+ * @param throwable The cause of the exception
+ */
+ public WeldException(Throwable throwable)
+ {
+ super(throwable);
+ this.message = new WeldExceptionMessage(throwable.getLocalizedMessage());
+ }
+
+ /**
+ * Creates a new exception with the given localized message key and optional
+ * arguments for the message.
+ *
+ * @param <E> The enumeration type for the message keys
+ * @param key The localized message to use
+ * @param args Optional arguments to insert into the message
+ */
+ public <E extends Enum<?>> WeldException(E key, Object... args)
+ {
+ this.message = new WeldExceptionMessage(key, args);
+ }
+
+ /**
+ * Creates a new exception with the given localized message key, the cause
+ * for this exception and optional arguments for the message.
+ *
+ * @param <E> The enumeration type for the message keys
+ * @param key The localized message to use
+ * @param throwable The cause for this exception
+ * @param args Optional arguments to insert into the message
+ */
+ public <E extends Enum<?>> WeldException(E key, Throwable throwable, Object... args)
+ {
+ super(throwable);
+ this.message = new WeldExceptionMessage(key, args);
+ }
+
+ /**
+ * Creates a new exception based on a list of throwables. The throwables are not
+ * used as the cause, but the message from each throwable is included as the message
+ * for this exception.
+ *
+ * @param errors A list of throwables to use in the message
+ */
+ public WeldException(List<Throwable> errors)
+ {
+ super();
+ StringBuilder errorMessage = new StringBuilder();
+ boolean firstError = true;
+ for (Throwable throwable : errors)
+ {
+ if (!firstError)
+ {
+ errorMessage.append('\n');
+ }
+ errorMessage.append(throwable.getLocalizedMessage());
+ }
+ this.message = new WeldExceptionMessage(errorMessage.toString());
+ }
+
+ @Override
+ public String getLocalizedMessage()
+ {
+ return getMessage();
+ }
+
+ @Override
+ public String getMessage()
+ {
+ return message.getAsString();
+ }
+
+}
Property changes on: core/trunk/impl/src/main/java/org/jboss/weld/exceptions/WeldException.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: core/trunk/impl/src/main/java/org/jboss/weld/exceptions/WeldExceptionMessage.java (from rev 5388, core/trunk/impl/src/main/java/org/jboss/weld/WeldExceptionMessage.java)
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/exceptions/WeldExceptionMessage.java (rev 0)
+++ core/trunk/impl/src/main/java/org/jboss/weld/exceptions/WeldExceptionMessage.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -0,0 +1,117 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat, Inc. and/or its affiliates, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.weld.exceptions;
+
+import static org.jboss.weld.logging.LoggerFactory.loggerFactory;
+
+import java.io.Serializable;
+
+/**
+ * <p>
+ * The message for exceptions generated by Weld. Each exception contains one
+ * message object which will handle the generation of the string message at the
+ * time the message is needed. This includes localization of the message based
+ * on the settings in the JVM where the {@link java.lang.Throwable#getMessage()}
+ * or {@link java.lang.Throwable#getLocalizedMessage()} methods are invoked.
+ * </p>
+ *
+ * @author David Allen
+ */
+public class WeldExceptionMessage implements Serializable
+{
+
+ private static final long serialVersionUID = 2L;
+
+ /**
+ * The string version of the message. This is only used when the original
+ * message from a wrapped exception is being used. Since it is already
+ * localized, it will simply be stored here and used as the message.
+ */
+ private String message;
+
+ private Enum<?> messageKey;
+ private Object messageArguments[];
+
+ /**
+ * <p>
+ * Creates a new exception message initialized to a static message. Use this
+ * only for messages generated by third-party software, i.e., those which do
+ * not use enumerated message keys.
+ * </p>
+ *
+ * @param message the static message
+ */
+ public WeldExceptionMessage(String message)
+ {
+ // This will not be further localized
+ this.message = message;
+ }
+
+ /**
+ * <p>
+ * Creates a new exception message based on an enumerated message key. This
+ * message will not be localized until it is actually logged or other
+ * software invokes the {@link #getMessage()} method.
+ * </p>
+ *
+ * @param <E> the message key enumeration
+ * @param key the message key from the above enumeration
+ * @param args optional arguments for the message
+ */
+ public <E extends Enum<?>> WeldExceptionMessage(E key, Object... args)
+ {
+ this.messageKey = key;
+ if ((args != null) && (args.length > 0))
+ {
+ this.messageArguments = new String[args.length];
+ int index = 0;
+ for (Object arg : args)
+ {
+ messageArguments[index++] = arg.toString();
+ }
+ }
+ }
+
+ /**
+ * Generates the localized message for the exception.
+ *
+ * @return exception message as a string
+ */
+ public String getAsString()
+ {
+ String result = message;
+ if (result == null)
+ {
+ try
+ {
+ result = loggerFactory().getMessageConveyor().getMessage(messageKey, messageArguments);
+ }
+ catch (Exception e)
+ {
+ // We want the using exception to be processed, but also include
+ // this one in its message
+ result = "Exception message for key " + messageKey + " not found due to " + e.getLocalizedMessage();
+ }
+ if (result == null)
+ {
+ result = "Exception message for key " + messageKey + " not found";
+ }
+ }
+ return result;
+ }
+}
Property changes on: core/trunk/impl/src/main/java/org/jboss/weld/exceptions/WeldExceptionMessage.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: core/trunk/impl/src/main/java/org/jboss/weld/injection/ConstructorInjectionPoint.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/injection/ConstructorInjectionPoint.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/injection/ConstructorInjectionPoint.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -36,14 +36,14 @@
import javax.enterprise.inject.spi.Annotated;
import javax.enterprise.inject.spi.Bean;
-import org.jboss.weld.BeanManagerImpl;
-import org.jboss.weld.InvalidObjectException;
-import org.jboss.weld.InvalidOperationException;
+import org.jboss.weld.exceptions.InvalidObjectException;
+import org.jboss.weld.exceptions.InvalidOperationException;
import org.jboss.weld.introspector.ConstructorSignature;
import org.jboss.weld.introspector.ForwardingWeldConstructor;
import org.jboss.weld.introspector.WeldClass;
import org.jboss.weld.introspector.WeldConstructor;
import org.jboss.weld.introspector.WeldParameter;
+import org.jboss.weld.manager.BeanManagerImpl;
public class ConstructorInjectionPoint<T> extends ForwardingWeldConstructor<T> implements WeldInjectionPoint<T, Constructor<T>>, Serializable
{
Modified: core/trunk/impl/src/main/java/org/jboss/weld/injection/Exceptions.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/injection/Exceptions.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/injection/Exceptions.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -20,7 +20,7 @@
import javax.enterprise.inject.CreationException;
-import org.jboss.weld.WeldException;
+import org.jboss.weld.exceptions.WeldException;
import org.jboss.weld.util.reflection.SecureReflections;
class Exceptions
Modified: core/trunk/impl/src/main/java/org/jboss/weld/injection/FieldInjectionPoint.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/injection/FieldInjectionPoint.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/injection/FieldInjectionPoint.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -36,10 +36,10 @@
import javax.inject.Inject;
import org.jboss.interceptor.util.InterceptionUtils;
-import org.jboss.weld.BeanManagerImpl;
-import org.jboss.weld.InvalidObjectException;
+import org.jboss.weld.exceptions.InvalidObjectException;
import org.jboss.weld.introspector.ForwardingWeldField;
import org.jboss.weld.introspector.WeldField;
+import org.jboss.weld.manager.BeanManagerImpl;
public class FieldInjectionPoint<T, X> extends ForwardingWeldField<T, X> implements WeldInjectionPoint<T, Field>, Serializable
{
Modified: core/trunk/impl/src/main/java/org/jboss/weld/injection/InjectionContextImpl.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/injection/InjectionContextImpl.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/injection/InjectionContextImpl.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -18,9 +18,9 @@
import javax.enterprise.inject.spi.InjectionTarget;
-import org.jboss.weld.BeanManagerImpl;
import org.jboss.weld.injection.spi.InjectionContext;
import org.jboss.weld.injection.spi.InjectionServices;
+import org.jboss.weld.manager.BeanManagerImpl;
/**
* @author pmuir
Modified: core/trunk/impl/src/main/java/org/jboss/weld/injection/MethodInjectionPoint.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/injection/MethodInjectionPoint.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/injection/MethodInjectionPoint.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -35,12 +35,12 @@
import javax.enterprise.inject.spi.Annotated;
import javax.enterprise.inject.spi.Bean;
-import org.jboss.weld.BeanManagerImpl;
-import org.jboss.weld.InvalidObjectException;
+import org.jboss.weld.exceptions.InvalidObjectException;
import org.jboss.weld.introspector.ForwardingWeldMethod;
import org.jboss.weld.introspector.MethodSignature;
import org.jboss.weld.introspector.WeldMethod;
import org.jboss.weld.introspector.WeldParameter;
+import org.jboss.weld.manager.BeanManagerImpl;
public class MethodInjectionPoint<T, X> extends ForwardingWeldMethod<T, X> implements WeldInjectionPoint<T, Method>
{
Modified: core/trunk/impl/src/main/java/org/jboss/weld/injection/ParameterInjectionPoint.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/injection/ParameterInjectionPoint.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/injection/ParameterInjectionPoint.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -35,16 +35,16 @@
import javax.enterprise.inject.spi.Bean;
import javax.enterprise.inject.spi.Decorator;
-import org.jboss.weld.BeanManagerImpl;
-import org.jboss.weld.ForbiddenStateException;
-import org.jboss.weld.InvalidObjectException;
-import org.jboss.weld.InvalidOperationException;
+import org.jboss.weld.exceptions.ForbiddenStateException;
+import org.jboss.weld.exceptions.InvalidObjectException;
+import org.jboss.weld.exceptions.InvalidOperationException;
import org.jboss.weld.introspector.ConstructorSignature;
import org.jboss.weld.introspector.ForwardingWeldParameter;
import org.jboss.weld.introspector.MethodSignature;
import org.jboss.weld.introspector.WeldConstructor;
import org.jboss.weld.introspector.WeldMethod;
import org.jboss.weld.introspector.WeldParameter;
+import org.jboss.weld.manager.BeanManagerImpl;
public class ParameterInjectionPoint<T, X> extends ForwardingWeldParameter<T, X> implements WeldInjectionPoint<T, Object>, Serializable
{
Modified: core/trunk/impl/src/main/java/org/jboss/weld/injection/ProxyClassConstructorInjectionPointWrapper.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/injection/ProxyClassConstructorInjectionPointWrapper.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/injection/ProxyClassConstructorInjectionPointWrapper.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -23,8 +23,8 @@
import java.lang.annotation.Annotation;
import java.util.List;
-import org.jboss.weld.BeanManagerImpl;
import org.jboss.weld.introspector.WeldConstructor;
+import org.jboss.weld.manager.BeanManagerImpl;
/**
* A wrapper on a {@link ConstructorInjectionPoint}, to be used if a proxy subclass is instantiated instead of the
Modified: core/trunk/impl/src/main/java/org/jboss/weld/introspector/AnnotationStore.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/introspector/AnnotationStore.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/introspector/AnnotationStore.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -32,7 +32,7 @@
import javax.inject.Qualifier;
-import org.jboss.weld.WeldException;
+import org.jboss.weld.exceptions.WeldException;
import org.jboss.weld.literal.DefaultLiteral;
import org.jboss.weld.logging.messages.ReflectionMessage;
import org.jboss.weld.metadata.TypeStore;
Modified: core/trunk/impl/src/main/java/org/jboss/weld/introspector/jlr/WeldConstructorImpl.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/introspector/jlr/WeldConstructorImpl.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/introspector/jlr/WeldConstructorImpl.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -31,12 +31,12 @@
import javax.enterprise.inject.spi.AnnotatedConstructor;
import javax.enterprise.inject.spi.AnnotatedParameter;
-import org.jboss.weld.BeanManagerImpl;
import org.jboss.weld.introspector.AnnotationStore;
import org.jboss.weld.introspector.ConstructorSignature;
import org.jboss.weld.introspector.WeldClass;
import org.jboss.weld.introspector.WeldConstructor;
import org.jboss.weld.introspector.WeldParameter;
+import org.jboss.weld.manager.BeanManagerImpl;
import org.jboss.weld.resources.ClassTransformer;
import org.jboss.weld.util.reflection.HierarchyDiscovery;
import org.jboss.weld.util.reflection.Reflections;
Modified: core/trunk/impl/src/main/java/org/jboss/weld/introspector/jlr/WeldFieldImpl.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/introspector/jlr/WeldFieldImpl.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/introspector/jlr/WeldFieldImpl.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -22,7 +22,7 @@
import static org.jboss.weld.logging.messages.UtilMessage.ACCESS_ERROR_ON_FIELD;
import javax.enterprise.inject.spi.AnnotatedField;
-import org.jboss.weld.WeldException;
+import org.jboss.weld.exceptions.WeldException;
import org.jboss.weld.introspector.AnnotationStore;
import org.jboss.weld.introspector.WeldClass;
import org.jboss.weld.introspector.WeldField;
Modified: core/trunk/impl/src/main/java/org/jboss/weld/introspector/jlr/WeldParameterImpl.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/introspector/jlr/WeldParameterImpl.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/introspector/jlr/WeldParameterImpl.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -24,7 +24,7 @@
import javax.enterprise.inject.spi.AnnotatedCallable;
-import org.jboss.weld.ForbiddenArgumentException;
+import org.jboss.weld.exceptions.ForbiddenArgumentException;
import org.jboss.weld.introspector.AnnotationStore;
import org.jboss.weld.introspector.WeldCallable;
import org.jboss.weld.introspector.WeldParameter;
Modified: core/trunk/impl/src/main/java/org/jboss/weld/jsf/JsfHelper.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/jsf/JsfHelper.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/jsf/JsfHelper.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -27,10 +27,10 @@
import javax.servlet.ServletContext;
import javax.servlet.http.HttpSession;
-import org.jboss.weld.BeanManagerImpl;
import org.jboss.weld.Container;
-import org.jboss.weld.ForbiddenStateException;
import org.jboss.weld.conversation.ConversationIdName;
+import org.jboss.weld.exceptions.ForbiddenStateException;
+import org.jboss.weld.manager.BeanManagerImpl;
import org.jboss.weld.servlet.ServletHelper;
import org.jboss.weld.util.reflection.SecureReflections;
import org.slf4j.cal10n.LocLogger;
Modified: core/trunk/impl/src/main/java/org/jboss/weld/jsf/WeldPhaseListener.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/jsf/WeldPhaseListener.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/jsf/WeldPhaseListener.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -37,13 +37,13 @@
import javax.faces.event.PhaseListener;
import javax.servlet.http.HttpSession;
-import org.jboss.weld.BeanManagerImpl;
import org.jboss.weld.Container;
import org.jboss.weld.context.ContextLifecycle;
import org.jboss.weld.context.ConversationContext;
import org.jboss.weld.context.SessionContext;
import org.jboss.weld.conversation.ConversationImpl;
import org.jboss.weld.conversation.ConversationManager;
+import org.jboss.weld.manager.BeanManagerImpl;
import org.jboss.weld.servlet.ConversationBeanStore;
import org.jboss.weld.servlet.HttpSessionManager;
import org.slf4j.cal10n.LocLogger;
Modified: core/trunk/impl/src/main/java/org/jboss/weld/logging/messages/ReflectionMessage.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/logging/messages/ReflectionMessage.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/logging/messages/ReflectionMessage.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -27,6 +27,7 @@
@MessageId("000605") MISSING_TARGET_METHOD_FIELD_TYPE_PARAMETER_OR_TARGET_METHOD_TYPE_OR_TARGET_METHOD_OR_TARGET_TYPE_OR_TARGET_FIELD,
@MessageId("000606") UNABLE_TO_GET_PARAMETER_NAME,
@MessageId("000607") ANNOTATION_MAP_NULL,
- @MessageId("000608") DECLARED_ANNOTATION_MAP_NULL;
+ @MessageId("000608") DECLARED_ANNOTATION_MAP_NULL,
+ @MessageId("000609") CLEANING_JAVASSIST_PROXY_CLASS;
}
Copied: core/trunk/impl/src/main/java/org/jboss/weld/manager/BeanManagerImpl.java (from rev 5388, core/trunk/impl/src/main/java/org/jboss/weld/BeanManagerImpl.java)
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/manager/BeanManagerImpl.java (rev 0)
+++ core/trunk/impl/src/main/java/org/jboss/weld/manager/BeanManagerImpl.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -0,0 +1,1571 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.manager;
+
+import static org.jboss.weld.logging.messages.BeanManagerMessage.AMBIGUOUS_BEANS_FOR_DEPENDENCY;
+import static org.jboss.weld.logging.messages.BeanManagerMessage.CONTEXT_NOT_ACTIVE;
+import static org.jboss.weld.logging.messages.BeanManagerMessage.DUPLICATE_ACTIVE_CONTEXTS;
+import static org.jboss.weld.logging.messages.BeanManagerMessage.DUPLICATE_INTERCEPTOR_BINDING;
+import static org.jboss.weld.logging.messages.BeanManagerMessage.DUPLICATE_QUALIFIERS;
+import static org.jboss.weld.logging.messages.BeanManagerMessage.INTERCEPTOR_BINDINGS_EMPTY;
+import static org.jboss.weld.logging.messages.BeanManagerMessage.INTERCEPTOR_RESOLUTION_WITH_NONBINDING_TYPE;
+import static org.jboss.weld.logging.messages.BeanManagerMessage.INVALID_QUALIFIER;
+import static org.jboss.weld.logging.messages.BeanManagerMessage.NON_NORMAL_SCOPE;
+import static org.jboss.weld.logging.messages.BeanManagerMessage.NOT_INTERCEPTOR_BINDING_TYPE;
+import static org.jboss.weld.logging.messages.BeanManagerMessage.NOT_PROXYABLE;
+import static org.jboss.weld.logging.messages.BeanManagerMessage.NOT_STEREOTYPE;
+import static org.jboss.weld.logging.messages.BeanManagerMessage.NO_DECORATOR_TYPES;
+import static org.jboss.weld.logging.messages.BeanManagerMessage.SPECIFIED_TYPE_NOT_BEAN_TYPE;
+import static org.jboss.weld.logging.messages.BeanManagerMessage.TOO_MANY_ACTIVITIES;
+import static org.jboss.weld.logging.messages.BeanManagerMessage.UNPROXYABLE_RESOLUTION;
+import static org.jboss.weld.logging.messages.BeanManagerMessage.UNRESOLVABLE_ELEMENT;
+import static org.jboss.weld.logging.messages.BeanManagerMessage.UNRESOLVABLE_TYPE;
+
+import java.io.Serializable;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Member;
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.Stack;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.concurrent.CopyOnWriteArraySet;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import javax.el.ELResolver;
+import javax.el.ExpressionFactory;
+import javax.enterprise.context.spi.Context;
+import javax.enterprise.context.spi.Contextual;
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.Annotated;
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.Decorator;
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.enterprise.inject.spi.InjectionTarget;
+import javax.enterprise.inject.spi.InterceptionType;
+import javax.enterprise.inject.spi.Interceptor;
+import javax.enterprise.inject.spi.ObserverMethod;
+import javax.enterprise.inject.spi.PassivationCapable;
+import javax.inject.Qualifier;
+
+import org.jboss.interceptor.registry.InterceptorRegistry;
+import org.jboss.weld.Container;
+import org.jboss.weld.bean.NewBean;
+import org.jboss.weld.bean.RIBean;
+import org.jboss.weld.bean.SessionBean;
+import org.jboss.weld.bean.builtin.AbstractBuiltInBean;
+import org.jboss.weld.bean.builtin.ExtensionBean;
+import org.jboss.weld.bean.proxy.ClientProxyProvider;
+import org.jboss.weld.bootstrap.Validator;
+import org.jboss.weld.bootstrap.api.ServiceRegistry;
+import org.jboss.weld.bootstrap.events.AbstractProcessInjectionTarget;
+import org.jboss.weld.context.ContextNotActiveException;
+import org.jboss.weld.context.CreationalContextImpl;
+import org.jboss.weld.context.WeldCreationalContext;
+import org.jboss.weld.ejb.EjbDescriptors;
+import org.jboss.weld.ejb.spi.EjbDescriptor;
+import org.jboss.weld.el.Namespace;
+import org.jboss.weld.el.WeldELResolver;
+import org.jboss.weld.el.WeldExpressionFactory;
+import org.jboss.weld.exceptions.AmbiguousResolutionException;
+import org.jboss.weld.exceptions.DeploymentException;
+import org.jboss.weld.exceptions.ForbiddenArgumentException;
+import org.jboss.weld.exceptions.ForbiddenStateException;
+import org.jboss.weld.exceptions.InjectionException;
+import org.jboss.weld.exceptions.UnproxyableResolutionException;
+import org.jboss.weld.exceptions.UnsatisfiedResolutionException;
+import org.jboss.weld.introspector.WeldAnnotated;
+import org.jboss.weld.literal.AnyLiteral;
+import org.jboss.weld.manager.api.WeldManager;
+import org.jboss.weld.metadata.cache.MetaAnnotationStore;
+import org.jboss.weld.metadata.cache.ScopeModel;
+import org.jboss.weld.resolution.NameBasedResolver;
+import org.jboss.weld.resolution.Resolvable;
+import org.jboss.weld.resolution.ResolvableFactory;
+import org.jboss.weld.resolution.ResolvableWeldClass;
+import org.jboss.weld.resolution.TypeSafeBeanResolver;
+import org.jboss.weld.resolution.TypeSafeDecoratorResolver;
+import org.jboss.weld.resolution.TypeSafeInterceptorResolver;
+import org.jboss.weld.resolution.TypeSafeObserverResolver;
+import org.jboss.weld.resolution.TypeSafeResolver;
+import org.jboss.weld.resources.ClassTransformer;
+import org.jboss.weld.serialization.spi.ContextualStore;
+import org.jboss.weld.serialization.spi.helpers.SerializableContextual;
+import org.jboss.weld.util.Beans;
+import org.jboss.weld.util.Observers;
+import org.jboss.weld.util.Proxies;
+import org.jboss.weld.util.reflection.HierarchyDiscovery;
+import org.jboss.weld.util.reflection.Reflections;
+
+import com.google.common.base.Function;
+import com.google.common.base.Supplier;
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Iterators;
+import com.google.common.collect.ListMultimap;
+import com.google.common.collect.Multimaps;
+
+/**
+ * Implementation of the Bean Manager.
+ *
+ * Essentially a singleton for registering Beans, Contexts, Observers,
+ * Interceptors etc. as well as providing resolution
+ *
+ * @author Pete Muir
+ * @author Marius Bogoevici
+ */
+public class BeanManagerImpl implements WeldManager, Serializable
+{
+
+
+ private static class CurrentActivity
+ {
+
+ private final Context context;
+ private final BeanManagerImpl manager;
+
+ public CurrentActivity(Context context, BeanManagerImpl manager)
+ {
+ this.context = context;
+ this.manager = manager;
+ }
+
+ public Context getContext()
+ {
+ return context;
+ }
+
+ public BeanManagerImpl getManager()
+ {
+ return manager;
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (obj instanceof CurrentActivity)
+ {
+ return this.getContext().equals(((CurrentActivity) obj).getContext());
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return getContext().hashCode();
+ }
+
+ @Override
+ public String toString()
+ {
+ return getContext() + " -> " + getManager();
+ }
+ }
+
+ private static final long serialVersionUID = 3021562879133838561L;
+
+ public static final InjectionPoint DUMMY_INJECTION_POINT = new InjectionPoint()
+ {
+
+ public boolean isTransient()
+ {
+ return true;
+ }
+
+ public boolean isDelegate()
+ {
+ return false;
+ }
+
+ public Type getType()
+ {
+ return InjectionPoint.class;
+ }
+
+ public Set<Annotation> getQualifiers()
+ {
+ return Collections.emptySet();
+ }
+
+ public Member getMember()
+ {
+ return null;
+ }
+
+ public Bean<?> getBean()
+ {
+ return null;
+ }
+
+ public Annotated getAnnotated()
+ {
+ return null;
+ }
+ };
+
+ /*
+ * Application scoped services
+ * ***************************
+ */
+ private transient final ServiceRegistry services;
+
+ /*
+ * Application scoped data structures
+ * ***********************************
+ */
+
+ // Contexts are shared across the application
+ private transient final ListMultimap<Class<? extends Annotation>, Context> contexts;
+
+ // Client proxies can be used application wide
+ private transient final ClientProxyProvider clientProxyProvider;
+
+ // TODO review this structure
+ private transient final Map<EjbDescriptor<?>, SessionBean<?>> enterpriseBeans;
+
+ // TODO This isn't right, specialization should follow accessibility rules, but I think we can enforce these in resolve()
+ private transient final Map<Contextual<?>, Contextual<?>> specializedBeans;
+
+ /*
+ * Archive scoped data structures
+ * ******************************
+ */
+
+ /* These data structures are all non-transitive in terms of bean deployment
+ * archive accessibility, and the configuration for this bean deployment
+ * archive
+ */
+ private transient Collection<Class<?>> enabledAlternativeClasses;
+ private transient Collection<Class<? extends Annotation>> enabledAlternativeStereotypes;
+ private transient List<Class<?>> enabledDecoratorClasses;
+ private transient List<Class<?>> enabledInterceptorClasses;
+ private transient final Set<CurrentActivity> currentActivities;
+
+ /*
+ * Activity scoped services
+ * *************************
+ */
+
+ /* These services are scoped to this activity only, but use data
+ * structures that are transitive accessible from other bean deployment
+ * archives
+ */
+ private transient final TypeSafeBeanResolver<Bean<?>> beanResolver;
+ private transient final TypeSafeResolver<? extends Resolvable, Decorator<?>> decoratorResolver;
+ private transient final TypeSafeResolver<? extends Resolvable, Interceptor<?>> interceptorResolver;
+ private transient final TypeSafeResolver<? extends Resolvable, ObserverMethod<?>> observerResolver;
+ private transient final NameBasedResolver nameBasedResolver;
+ private transient final ELResolver weldELResolver;
+ private transient Namespace rootNamespace;
+
+ /*
+ * Activity scoped data structures
+ * ********************************
+ */
+
+ /* These data structures are scoped to this bean deployment archive activity
+ * only and represent the beans, decorators, interceptors, namespaces and
+ * observers deployed in this bean deployment archive activity
+ */
+ private transient final List<Bean<?>> beans;
+ private transient final List<Bean<?>> transitiveBeans;
+ private transient final List<Decorator<?>> decorators;
+ private transient final List<Interceptor<?>> interceptors;
+ private transient final List<String> namespaces;
+ private transient final List<ObserverMethod<?>> observers;
+
+ /*
+ * These data structures represent the managers *accessible* from this bean
+ * deployment archive activity
+ */
+ private transient final HashSet<BeanManagerImpl> accessibleManagers;
+
+ /*
+ * This data structures represents child activities for this activity, it is
+ * not transitively accessible
+ */
+ private transient final Set<BeanManagerImpl> childActivities;
+
+ private final AtomicInteger childIds;
+ private final String id;
+
+ /*
+ * Runtime data transfer
+ * *********************
+ */
+ private transient final ThreadLocal<Stack<InjectionPoint>> currentInjectionPoint;
+
+ /**
+ * Interception model
+ */
+ private transient final InterceptorRegistry<Class<?>, SerializableContextual<Interceptor<?>, ?>> boundInterceptorsRegistry = new InterceptorRegistry<Class<?>, SerializableContextual<Interceptor<?>,?>>();
+ private transient final InterceptorRegistry<Class<?>, Class<?>> declaredInterceptorsRegistry = new InterceptorRegistry<Class<?>, Class<?>>();
+
+ /**
+ * Create a new, root, manager
+ *
+ * @param serviceRegistry
+ * @return
+ */
+ public static BeanManagerImpl newRootManager(String id, ServiceRegistry serviceRegistry)
+ {
+ ListMultimap<Class<? extends Annotation>, Context> contexts = Multimaps.newListMultimap(new ConcurrentHashMap<Class<? extends Annotation>, Collection<Context>>(), new Supplier<List<Context>>()
+ {
+
+ public List<Context> get()
+ {
+ return new CopyOnWriteArrayList<Context>();
+ }
+
+ });
+
+ return new BeanManagerImpl(
+ serviceRegistry,
+ new CopyOnWriteArrayList<Bean<?>>(),
+ new CopyOnWriteArrayList<Bean<?>>(),
+ new CopyOnWriteArrayList<Decorator<?>>(),
+ new CopyOnWriteArrayList<Interceptor<?>>(),
+ new CopyOnWriteArrayList<ObserverMethod<?>>(),
+ new CopyOnWriteArrayList<String>(),
+ new ConcurrentHashMap<EjbDescriptor<?>, SessionBean<?>>(),
+ new ClientProxyProvider(),
+ contexts,
+ new CopyOnWriteArraySet<CurrentActivity>(),
+ new HashMap<Contextual<?>, Contextual<?>>(),
+ new ArrayList<Class<?>>(),
+ new ArrayList<Class<? extends Annotation>>(),
+ new ArrayList<Class<?>>(),
+ new ArrayList<Class<?>>(),
+ id,
+ new AtomicInteger());
+ }
+
+ /**
+ * Create a new, root, manager
+ *
+ * @param serviceRegistry
+ * @return
+ */
+ public static BeanManagerImpl newManager(BeanManagerImpl rootManager, String id, ServiceRegistry services)
+ {
+ return new BeanManagerImpl(
+ services,
+ new CopyOnWriteArrayList<Bean<?>>(),
+ new CopyOnWriteArrayList<Bean<?>>(),
+ new CopyOnWriteArrayList<Decorator<?>>(),
+ new CopyOnWriteArrayList<Interceptor<?>>(),
+ new CopyOnWriteArrayList<ObserverMethod<?>>(),
+ new CopyOnWriteArrayList<String>(),
+ rootManager.getEnterpriseBeans(),
+ rootManager.getClientProxyProvider(),
+ rootManager.getContexts(),
+ new CopyOnWriteArraySet<CurrentActivity>(),
+ new HashMap<Contextual<?>, Contextual<?>>(),
+ new ArrayList<Class<?>>(),
+ new ArrayList<Class<? extends Annotation>>(),
+ new ArrayList<Class<?>>(),
+ new ArrayList<Class<?>>(),
+ id,
+ new AtomicInteger());
+ }
+
+ /**
+ * Create a new child manager
+ *
+ * @param parentManager
+ * @return
+ */
+ public static BeanManagerImpl newChildActivityManager(BeanManagerImpl parentManager)
+ {
+ List<Bean<?>> beans = new CopyOnWriteArrayList<Bean<?>>();
+ beans.addAll(parentManager.getBeans());
+ List<Bean<?>> transitiveBeans = new CopyOnWriteArrayList<Bean<?>>();
+ beans.addAll(parentManager.getTransitiveBeans());
+
+ List<ObserverMethod<?>> registeredObservers = new CopyOnWriteArrayList<ObserverMethod<?>>();
+ registeredObservers.addAll(parentManager.getObservers());
+ List<String> namespaces = new CopyOnWriteArrayList<String>();
+ namespaces.addAll(parentManager.getNamespaces());
+
+ return new BeanManagerImpl(
+ parentManager.getServices(),
+ beans,
+ transitiveBeans,
+ parentManager.getDecorators(),
+ parentManager.getInterceptors(),
+ registeredObservers,
+ namespaces,
+ parentManager.getEnterpriseBeans(),
+ parentManager.getClientProxyProvider(),
+ parentManager.getContexts(),
+ parentManager.getCurrentActivities(),
+ parentManager.getSpecializedBeans(),
+ parentManager.getEnabledAlternativeClasses(),
+ parentManager.getEnabledAlternativeStereotypes(),
+ parentManager.getEnabledDecoratorClasses(),
+ parentManager.getEnabledInterceptorClasses(),
+ new StringBuilder().append(parentManager.getChildIds().incrementAndGet()).toString(),
+ parentManager.getChildIds());
+ }
+
+ /**
+ * Create a new manager
+ * @param enabledDecoratorClasses
+ *
+ * @param ejbServices the ejbResolver to use
+ */
+ private BeanManagerImpl(
+ ServiceRegistry serviceRegistry,
+ List<Bean<?>> beans,
+ List<Bean<?>> transitiveBeans,
+ List<Decorator<?>> decorators,
+ List<Interceptor<?>> interceptors,
+ List<ObserverMethod<?>> observers,
+ List<String> namespaces,
+ Map<EjbDescriptor<?>, SessionBean<?>> enterpriseBeans,
+ ClientProxyProvider clientProxyProvider,
+ ListMultimap<Class<? extends Annotation>, Context> contexts,
+ Set<CurrentActivity> currentActivities,
+ Map<Contextual<?>, Contextual<?>> specializedBeans,
+ Collection<Class<?>> enabledAlternativeClasses,
+ Collection<Class<? extends Annotation>> enabledAlternativeStereotypes,
+ List<Class<?>> enabledDecoratorClasses,
+ List<Class<?>> enabledInterceptorClasses,
+ String id,
+ AtomicInteger childIds)
+ {
+ this.services = serviceRegistry;
+ this.beans = beans;
+ this.transitiveBeans = transitiveBeans;
+ this.decorators = decorators;
+ this.interceptors = interceptors;
+ this.enterpriseBeans = enterpriseBeans;
+ this.clientProxyProvider = clientProxyProvider;
+ this.contexts = contexts;
+ this.currentActivities = currentActivities;
+ this.specializedBeans = specializedBeans;
+ this.observers = observers;
+ this.enabledAlternativeClasses = enabledAlternativeClasses;
+ this.enabledAlternativeStereotypes = enabledAlternativeStereotypes;
+ setEnabledDecoratorClasses(enabledDecoratorClasses);
+ setEnabledInterceptorClasses(enabledInterceptorClasses);
+ this.namespaces = namespaces;
+ this.id = id;
+ this.childIds = new AtomicInteger();
+
+ // Set up the structure to store accessible managers in
+ this.accessibleManagers = new HashSet<BeanManagerImpl>();
+
+
+
+ // TODO Currently we build the accessible bean list on the fly, we need to set it in stone once bootstrap is finished...
+ Transform<Bean<?>> beanTransform = new Transform.BeanTransform(this);
+ this.beanResolver = new TypeSafeBeanResolver<Bean<?>>(this, createDynamicAccessibleIterable(beanTransform));
+ this.decoratorResolver = new TypeSafeDecoratorResolver(this, createDynamicAccessibleIterable(Transform.DECORATOR_BEAN));
+ this.interceptorResolver = new TypeSafeInterceptorResolver(this, createDynamicAccessibleIterable(Transform.INTERCEPTOR_BEAN));
+ this.observerResolver = new TypeSafeObserverResolver(this, createDynamicAccessibleIterable(Transform.EVENT_OBSERVER));
+ this.nameBasedResolver = new NameBasedResolver(this, createDynamicAccessibleIterable(beanTransform));
+ this.weldELResolver = new WeldELResolver(this);
+ this.childActivities = new CopyOnWriteArraySet<BeanManagerImpl>();
+
+ this.currentInjectionPoint = new ThreadLocal<Stack<InjectionPoint>>()
+ {
+ @Override
+ protected Stack<InjectionPoint> initialValue()
+ {
+ return new Stack<InjectionPoint>();
+ }
+ };
+ }
+
+ private <T> Set<Iterable<T>> buildAccessibleClosure(Collection<BeanManagerImpl> hierarchy, Transform<T> transform)
+ {
+ Set<Iterable<T>> result = new HashSet<Iterable<T>>();
+ hierarchy.add(this);
+ result.add(transform.transform(this));
+ for (BeanManagerImpl beanManager : accessibleManagers)
+ {
+ // Only add if we aren't already in the tree (remove cycles)
+ if (!hierarchy.contains(beanManager))
+ {
+ result.addAll(beanManager.buildAccessibleClosure(new ArrayList<BeanManagerImpl>(hierarchy), transform));
+ }
+ }
+ return result;
+ }
+
+ private <T> Iterable<T> createDynamicAccessibleIterable(final Transform<T> transform)
+ {
+ return new Iterable<T>()
+ {
+
+ private Function<Iterable<T>, Iterator<T>> function = new Function<Iterable<T>, Iterator<T>>()
+ {
+
+ public Iterator<T> apply(Iterable<T> iterable)
+ {
+ return iterable.iterator();
+ }
+
+ };
+
+ public Iterator<T> iterator()
+ {
+ Set<Iterable<T>> iterable = buildAccessibleClosure(new ArrayList<BeanManagerImpl>(), transform);
+ return Iterators.concat(Iterators.transform(iterable.iterator(), function));
+ }
+
+ };
+ }
+
+ private <T> Iterable<T> createStaticAccessibleIterable(final Transform<T> transform)
+ {
+ Set<Iterable<T>> iterable = buildAccessibleClosure(new ArrayList<BeanManagerImpl>(), transform);
+ return Iterables.concat(iterable);
+ }
+
+ private static interface Transform<T>
+ {
+
+ public static class BeanTransform implements Transform<Bean<?>>
+ {
+
+ private final BeanManagerImpl declaringBeanManager;
+
+ public BeanTransform(BeanManagerImpl declaringBeanManager)
+ {
+ this.declaringBeanManager = declaringBeanManager;
+ }
+
+ public Iterable<Bean<?>> transform(BeanManagerImpl beanManager)
+ {
+ // New beans and built in beans aren't resolvable transitively
+ if (beanManager.equals(declaringBeanManager))
+ {
+ return beanManager.getBeans();
+ }
+ else
+ {
+ return beanManager.getTransitiveBeans();
+ }
+ }
+
+ };
+
+ public static Transform<Decorator<?>> DECORATOR_BEAN = new Transform<Decorator<?>>()
+ {
+
+ public Iterable<Decorator<?>> transform(BeanManagerImpl beanManager)
+ {
+ return beanManager.getDecorators();
+ }
+
+ };
+
+ public static Transform<Interceptor<?>> INTERCEPTOR_BEAN = new Transform<Interceptor<?>>()
+ {
+
+ public Iterable<Interceptor<?>> transform(BeanManagerImpl beanManager)
+ {
+ return beanManager.getInterceptors();
+ }
+
+ };
+
+ public static Transform<ObserverMethod<?>> EVENT_OBSERVER = new Transform<ObserverMethod<?>>()
+ {
+
+ public Iterable<ObserverMethod<?>> transform(BeanManagerImpl beanManager)
+ {
+ return beanManager.getObservers();
+ }
+
+ };
+
+ public static Transform<String> NAMESPACE = new Transform<String>()
+ {
+
+ public Iterable<String> transform(BeanManagerImpl beanManager)
+ {
+ return beanManager.getNamespaces();
+ }
+
+ };
+
+ public Iterable<T> transform(BeanManagerImpl beanManager);
+
+ }
+
+ public void addAccessibleBeanManager(BeanManagerImpl accessibleBeanManager)
+ {
+ accessibleManagers.add(accessibleBeanManager);
+ beanResolver.clear();
+ }
+
+ public void addBean(Bean<?> bean)
+ {
+ if (beans.contains(bean))
+ {
+ return;
+ }
+ if (bean.getClass().equals(SessionBean.class))
+ {
+ SessionBean<?> enterpriseBean = (SessionBean<?>) bean;
+ enterpriseBeans.put(enterpriseBean.getEjbDescriptor(), enterpriseBean);
+ }
+ if (bean instanceof PassivationCapable)
+ {
+ Container.instance().deploymentServices().get(ContextualStore.class).putIfAbsent(bean);
+ }
+ registerBeanNamespace(bean);
+ for (BeanManagerImpl childActivity : childActivities)
+ {
+ childActivity.addBean(bean);
+ }
+ // New beans and most built in beans aren't resolvable transtively
+ if (bean instanceof ExtensionBean || (!(bean instanceof NewBean) && !(bean instanceof AbstractBuiltInBean<?>)))
+ {
+ this.transitiveBeans.add(bean);
+ }
+ this.beans.add(bean);
+ beanResolver.clear();
+ }
+
+ public void addDecorator(Decorator<?> bean)
+ {
+ decorators.add(bean);
+ getServices().get(ContextualStore.class).putIfAbsent(bean);
+ decoratorResolver.clear();
+ }
+
+ public <T> Set<ObserverMethod<? super T>> resolveObserverMethods(T event, Annotation... bindings)
+ {
+ Observers.checkEventObjectType(event);
+ return this.<T>resolveObserverMethods(event.getClass(), bindings);
+ }
+
+ public void addInterceptor(Interceptor<?> bean)
+ {
+ interceptors.add(bean);
+ getServices().get(ContextualStore.class).putIfAbsent(bean);
+ interceptorResolver.clear();
+ }
+
+
+ @SuppressWarnings("unchecked")
+ public <T> Set<ObserverMethod<? super T>> resolveObserverMethods(Type eventType, Annotation... bindings)
+ {
+ checkBindingTypes(Arrays.asList(bindings));
+ HashSet<Annotation> bindingAnnotations = new HashSet<Annotation>(Arrays.asList(bindings));
+ bindingAnnotations.add(new AnyLiteral());
+ Set<ObserverMethod<? super T>> observers = new HashSet<ObserverMethod<? super T>>();
+ Set<ObserverMethod<?>> eventObservers = observerResolver.resolve(ResolvableFactory.of(new HierarchyDiscovery(eventType).getTypeClosure(), bindingAnnotations, null));
+ for (ObserverMethod<?> observer : eventObservers)
+ {
+ observers.add((ObserverMethod<T>) observer);
+ }
+ return observers;
+ }
+
+ private void checkBindingTypes(Collection<Annotation> bindings)
+ {
+ HashSet<Annotation> bindingAnnotations = new HashSet<Annotation>(bindings);
+ for (Annotation annotation : bindings)
+ {
+ if (!getServices().get(MetaAnnotationStore.class).getBindingTypeModel(annotation.annotationType()).isValid())
+ {
+ throw new ForbiddenArgumentException(INVALID_QUALIFIER, annotation);
+ }
+ }
+ if (bindingAnnotations.size() < bindings.size())
+ {
+ throw new ForbiddenArgumentException(DUPLICATE_QUALIFIERS, bindings);
+ }
+
+ }
+
+ /**
+ * A collection of enabled alternative classes
+ *
+ */
+ public Collection<Class<?>> getEnabledAlternativeClasses()
+ {
+ return Collections.unmodifiableCollection(enabledAlternativeClasses);
+ }
+
+ /**
+ * @return the enabled alternative stereotypes
+ */
+ public Collection<Class<? extends Annotation>> getEnabledAlternativeStereotypes()
+ {
+ return Collections.unmodifiableCollection(enabledAlternativeStereotypes);
+ }
+
+ public boolean isBeanEnabled(Bean<?> bean)
+ {
+ return Beans.isBeanEnabled(bean, getEnabledAlternativeClasses(), getEnabledAlternativeStereotypes());
+ }
+
+ /**
+ * @return the enabledDecoratorClasses
+ */
+ public List<Class<?>> getEnabledDecoratorClasses()
+ {
+ return Collections.unmodifiableList(enabledDecoratorClasses);
+ }
+
+ /**
+ * @return the enabledInterceptorClasses
+ */
+ public List<Class<?>> getEnabledInterceptorClasses()
+ {
+ return Collections.unmodifiableList(enabledInterceptorClasses);
+ }
+
+ public void setEnabledAlternativeClasses(Collection<Class<?>> enabledAlternativeClasses)
+ {
+ this.enabledAlternativeClasses = enabledAlternativeClasses;
+ }
+
+ public void setEnabledAlternativeStereotypes(Collection<Class<? extends Annotation>> enabledAlternativeSterotypes)
+ {
+ this.enabledAlternativeStereotypes = enabledAlternativeSterotypes;
+ }
+
+ public void setEnabledDecoratorClasses(List<Class<?>> enabledDecoratorClasses)
+ {
+ this.enabledDecoratorClasses = enabledDecoratorClasses;
+ }
+
+ public void setEnabledInterceptorClasses(List<Class<?>> enabledInterceptorClasses)
+ {
+ this.enabledInterceptorClasses = enabledInterceptorClasses;
+ }
+
+ public Set<Bean<?>> getBeans(Type beanType, Annotation... bindings)
+ {
+ return getBeans(ResolvableWeldClass.of(beanType, bindings, this), bindings);
+ }
+
+ public Set<Bean<?>> getBeans(WeldAnnotated<?, ?> element, Annotation... bindings)
+ {
+ for (Annotation annotation : element.getAnnotations())
+ {
+ if (!getServices().get(MetaAnnotationStore.class).getBindingTypeModel(annotation.annotationType()).isValid())
+ {
+ throw new ForbiddenArgumentException(INVALID_QUALIFIER, annotation);
+ }
+ }
+// for (Type type : element.getActualTypeArguments())
+// {
+// if (type instanceof WildcardType)
+// {
+// throw new IllegalArgumentException("Cannot resolve a type parameterized with a wildcard " + element);
+// }
+// if (type instanceof TypeVariable<?>)
+// {
+// throw new IllegalArgumentException("Cannot resolve a type parameterized with a type parameter " + element);
+// }
+// }
+ if (bindings != null && bindings.length > element.getMetaAnnotations(Qualifier.class).size())
+ {
+ throw new ForbiddenArgumentException(DUPLICATE_QUALIFIERS, Arrays.asList(bindings));
+ }
+ return beanResolver.resolve(ResolvableFactory.of(element));
+ }
+
+ public Set<Bean<?>> getInjectableBeans(InjectionPoint injectionPoint)
+ {
+ boolean registerInjectionPoint = !injectionPoint.getType().equals(InjectionPoint.class);
+ try
+ {
+ if (registerInjectionPoint)
+ {
+ currentInjectionPoint.get().push(injectionPoint);
+ }
+ // TODO Do this properly
+ Set<Bean<?>> beans = getBeans(ResolvableWeldClass.of(injectionPoint.getType(), injectionPoint.getQualifiers().toArray(new Annotation[0]), this));
+ Set<Bean<?>> injectableBeans = new HashSet<Bean<?>>();
+ for (Bean<?> bean : beans)
+ {
+ if (!(bean instanceof Decorator || bean instanceof Interceptor))
+ {
+ injectableBeans.add(bean);
+ }
+ }
+ return injectableBeans;
+ }
+ finally
+ {
+ if (registerInjectionPoint)
+ {
+ currentInjectionPoint.get().pop();
+ }
+ }
+ }
+
+ protected void registerBeanNamespace(Bean<?> bean)
+ {
+ if (bean.getName() != null && bean.getName().indexOf('.') > 0)
+ {
+ namespaces.add(bean.getName().substring(0, bean.getName().lastIndexOf('.')));
+ }
+ }
+
+ /**
+ * Gets the class-mapped beans. For internal use.
+ *
+ * @return The bean map
+ */
+ public Map<EjbDescriptor<?>, SessionBean<?>> getEnterpriseBeans()
+ {
+ return enterpriseBeans;
+ }
+
+ /**
+ * The beans registered with the Web Bean manager which are resolvable. Does
+ * not include interceptor and decorator beans
+ *
+ * @return The list of known beans
+ */
+ public List<Bean<?>> getBeans()
+ {
+ return Collections.unmodifiableList(beans);
+ }
+
+ private List<Bean<?>> getTransitiveBeans()
+ {
+ return Collections.unmodifiableList(transitiveBeans);
+ }
+
+ public List<Decorator<?>> getDecorators()
+ {
+ return Collections.unmodifiableList(decorators);
+ }
+
+ public List<Interceptor<?>> getInterceptors()
+ {
+ return Collections.unmodifiableList(interceptors);
+ }
+
+ public Iterable<Bean<?>> getAccessibleBeans()
+ {
+ return createDynamicAccessibleIterable(new Transform.BeanTransform(this));
+ }
+
+ public void addContext(Context context)
+ {
+ contexts.put(context.getScope(), context);
+ }
+
+ /**
+ * Does the actual observer registration
+ *
+ * @param observer
+= */
+ public void addObserver(ObserverMethod<?> observer)
+ {
+ //checkEventType(observer.getObservedType());
+ observers.add(observer);
+ for (BeanManagerImpl childActivity : childActivities)
+ {
+ childActivity.addObserver(observer);
+ }
+ }
+
+ /**
+ * Fires an event object with given event object for given bindings
+ *
+ * @param event The event object to pass along
+ * @param bindings The binding types to match
+ *
+ * @see javax.enterprise.inject.spi.BeanManager#fireEvent(java.lang.Object,
+ * java.lang.annotation.Annotation[])
+ */
+ public void fireEvent(Object event, Annotation... qualifiers)
+ {
+ fireEvent(event.getClass(), event, qualifiers);
+ }
+
+ public void fireEvent(Type eventType, Object event, Annotation... qualifiers)
+ {
+ Observers.checkEventObjectType(event);
+ notifyObservers(event, resolveObserverMethods(eventType, qualifiers));
+ }
+
+ private <T> void notifyObservers(final T event, final Set<ObserverMethod<? super T>> observers)
+ {
+ for (ObserverMethod<? super T> observer : observers)
+ {
+ observer.notify(event);
+ }
+ }
+
+ /**
+ * Gets an active context of the given scope. Throws an exception if there
+ * are no active contexts found or if there are too many matches
+ *
+ * @param scopeType The scope to match
+ * @return A single active context of the given scope
+ *
+ * @see javax.enterprise.inject.spi.BeanManager#getContext(java.lang.Class)
+ */
+ public Context getContext(Class<? extends Annotation> scopeType)
+ {
+ List<Context> activeContexts = new ArrayList<Context>();
+ for (Context context : contexts.get(scopeType))
+ {
+ if (context.isActive())
+ {
+ activeContexts.add(context);
+ }
+ }
+ if (activeContexts.isEmpty())
+ {
+ throw new ContextNotActiveException(CONTEXT_NOT_ACTIVE, scopeType.getName());
+ }
+ if (activeContexts.size() > 1)
+ {
+ throw new ForbiddenStateException(DUPLICATE_ACTIVE_CONTEXTS, scopeType.getName());
+ }
+ return activeContexts.iterator().next();
+
+ }
+
+ public Object getReference(Bean<?> bean, CreationalContext<?> creationalContext, boolean delegate)
+ {
+ bean = getMostSpecializedBean(bean);
+ if (creationalContext instanceof WeldCreationalContext<?>)
+ {
+ creationalContext = ((WeldCreationalContext<?>) creationalContext).getCreationalContext(bean);
+ }
+ if (!delegate && isProxyRequired(bean))
+ {
+ if (creationalContext != null || getContext(bean.getScope()).get(bean) != null)
+ {
+ return clientProxyProvider.getClientProxy(this, bean);
+ }
+ else
+ {
+ return null;
+ }
+ }
+ else
+ {
+ return getContext(bean.getScope()).get((Contextual) bean, creationalContext);
+ }
+ }
+
+ private boolean isProxyRequired(Bean<?> bean)
+ {
+ if (getServices().get(MetaAnnotationStore.class).getScopeModel(bean.getScope()).isNormal())
+ {
+ return true;
+ }
+ else if (bean instanceof RIBean<?>)
+ {
+ return ((RIBean<?>) bean).isProxyRequired();
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ public Object getReference(Bean<?> bean, Type beanType, CreationalContext<?> creationalContext)
+ {
+ if (!Reflections.isAssignableFrom(bean.getTypes(), beanType))
+ {
+ throw new ForbiddenArgumentException(SPECIFIED_TYPE_NOT_BEAN_TYPE, beanType, bean );
+ }
+ return getReference(bean, creationalContext, false);
+ }
+
+
+ /**
+ * Get a reference, registering the injection point used.
+ *
+ * @param injectionPoint the injection point to register
+ * @param resolvedBean the bean to get a reference to
+ * @param creationalContext the creationalContext
+ * @return
+ */
+ public Object getReference(InjectionPoint injectionPoint, Bean<?> resolvedBean, CreationalContext<?> creationalContext)
+ {
+ boolean registerInjectionPoint = (injectionPoint != null && !injectionPoint.getType().equals(InjectionPoint.class));
+ boolean delegateInjectionPoint = injectionPoint != null && injectionPoint.isDelegate();
+ try
+ {
+ if (registerInjectionPoint)
+ {
+ currentInjectionPoint.get().push(injectionPoint);
+ }
+ if (getServices().get(MetaAnnotationStore.class).getScopeModel(resolvedBean.getScope()).isNormal() && !Proxies.isTypeProxyable(injectionPoint.getType()))
+ {
+ throw new UnproxyableResolutionException(UNPROXYABLE_RESOLUTION, resolvedBean, injectionPoint);
+ }
+ // TODO Can we move this logic to getReference?
+ if (creationalContext instanceof WeldCreationalContext<?>)
+ {
+ WeldCreationalContext<?> wbCreationalContext = (WeldCreationalContext<?>) creationalContext;
+ if (wbCreationalContext.containsIncompleteInstance(resolvedBean))
+ {
+ return wbCreationalContext.getIncompleteInstance(resolvedBean);
+ }
+ else
+ {
+ return getReference(resolvedBean, wbCreationalContext, delegateInjectionPoint);
+ }
+ }
+ else
+ {
+ return getReference(resolvedBean, creationalContext, delegateInjectionPoint);
+ }
+ }
+ finally
+ {
+ if (registerInjectionPoint)
+ {
+ currentInjectionPoint.get().pop();
+ }
+ }
+ }
+
+
+ public Object getInjectableReference(InjectionPoint injectionPoint, CreationalContext<?> creationalContext)
+ {
+ WeldAnnotated<?, ?> element = ResolvableWeldClass.of(injectionPoint.getType(), injectionPoint.getQualifiers().toArray(new Annotation[0]), this);
+ Bean<?> resolvedBean = getBean(element, element.getBindingsAsArray());
+ return getReference(injectionPoint, resolvedBean, creationalContext);
+ }
+
+ /**
+ * Returns an instance by API type and binding types
+ *
+ * @param beanType The API type to match
+ * @param bindings The binding types to match
+ * @return An instance of the bean
+ *
+ */
+ @Deprecated
+ public <T> T getInstanceByType(Class<T> beanType, Annotation... bindings)
+ {
+ Set<Bean<?>> beans = getBeans(beanType, bindings);
+ Bean<?> bean = resolve(beans);
+ if (bean == null)
+ {
+ throw new UnsatisfiedResolutionException(UNRESOLVABLE_TYPE, beanType, Arrays.toString(bindings));
+ }
+ Object reference = getReference(bean, beanType, createCreationalContext(bean));
+
+ @SuppressWarnings("unchecked")
+ T instance = (T) reference;
+
+ return instance;
+ }
+
+ public <T> Bean<T> getBean(WeldAnnotated<T, ?> element, Annotation... bindings)
+ {
+ Bean<T> bean = (Bean<T>) resolve(getBeans(element, bindings));
+ if (bean == null)
+ {
+ throw new UnsatisfiedResolutionException(UNRESOLVABLE_ELEMENT, element);
+ }
+
+ boolean normalScoped = getServices().get(MetaAnnotationStore.class).getScopeModel(bean.getScope()).isNormal();
+ if (normalScoped && !Beans.isBeanProxyable(bean))
+ {
+ throw new UnproxyableResolutionException(NOT_PROXYABLE, bean);
+ }
+ return bean;
+ }
+
+ public Set<Bean<?>> getBeans(String name)
+ {
+ return nameBasedResolver.resolve(name);
+ }
+
+ /**
+ * Resolves a list of decorators based on API types and binding types
+ *
+ * @param types The set of API types to match
+ * @param bindings The binding types to match
+ * @return A list of matching decorators
+ *
+ * @see javax.enterprise.inject.spi.BeanManager#resolveDecorators(java.util.Set,
+ * java.lang.annotation.Annotation[])
+ */
+ public List<Decorator<?>> resolveDecorators(Set<Type> types, Annotation... bindings)
+ {
+ checkResolveDecoratorsArguments(types, Arrays.asList(bindings));
+ // TODO Fix this cast and make the resolver return a list
+ return new ArrayList<Decorator<?>>(decoratorResolver.resolve(ResolvableFactory.of(types, null, bindings)));
+ }
+
+ public List<Decorator<?>> resolveDecorators(Set<Type> types, Set<Annotation> bindings)
+ {
+ checkResolveDecoratorsArguments(types, bindings);
+ // TODO Fix this cast and make the resolver return a list
+ return new ArrayList<Decorator<?>>(decoratorResolver.resolve(ResolvableFactory.of(types, bindings, null)));
+ }
+
+ private void checkResolveDecoratorsArguments(Set<Type> types, Collection<Annotation> bindings)
+ {
+ if (types.isEmpty())
+ {
+ throw new ForbiddenArgumentException(NO_DECORATOR_TYPES);
+ }
+ checkBindingTypes(bindings);
+ }
+
+ /**
+ * Resolves a list of interceptors based on interception type and interceptor
+ * bindings
+ *
+ * @param type The interception type to resolve
+ * @param interceptorBindings The binding types to match
+ * @return A list of matching interceptors
+ *
+ * @see javax.enterprise.inject.spi.BeanManager#resolveInterceptors(javax.enterprise.inject.spi.InterceptionType,
+ * java.lang.annotation.Annotation[])
+ */
+ public List<Interceptor<?>> resolveInterceptors(InterceptionType type, Annotation... interceptorBindings)
+ {
+ if (interceptorBindings.length == 0)
+ throw new ForbiddenArgumentException(INTERCEPTOR_BINDINGS_EMPTY);
+ Set<Class<?>> uniqueInterceptorBindings = new HashSet<Class<?>>();
+ for (Annotation interceptorBinding: interceptorBindings)
+ {
+ if (uniqueInterceptorBindings.contains(interceptorBinding.annotationType()))
+ throw new ForbiddenArgumentException(DUPLICATE_INTERCEPTOR_BINDING, interceptorBinding.annotationType());
+ if (!isInterceptorBinding(interceptorBinding.annotationType()))
+ throw new ForbiddenArgumentException(INTERCEPTOR_RESOLUTION_WITH_NONBINDING_TYPE, interceptorBinding.annotationType());
+ uniqueInterceptorBindings.add(interceptorBinding.annotationType());
+ }
+ return new ArrayList<Interceptor<?>>(interceptorResolver.resolve(ResolvableFactory.of(type,interceptorBindings)));
+ }
+
+ /**
+ * Get the web bean resolver. For internal use
+ *
+ * @return The resolver
+ */
+ public TypeSafeBeanResolver<Bean<?>> getBeanResolver()
+ {
+ return beanResolver;
+ }
+
+ /**
+ * Gets a string representation
+ *
+ * @return A string representation
+ */
+ @Override
+ public String toString()
+ {
+ StringBuilder buffer = new StringBuilder();
+ buffer.append("Manager\n");
+ buffer.append("Enabled alternatives: " + getEnabledAlternativeClasses() + " " + getEnabledAlternativeStereotypes() + "\n");
+ buffer.append("Registered contexts: " + contexts.keySet() + "\n");
+ buffer.append("Registered beans: " + getBeans().size() + "\n");
+ buffer.append("Specialized beans: " + specializedBeans.size() + "\n");
+ return buffer.toString();
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (obj instanceof BeanManagerImpl)
+ {
+ BeanManagerImpl that = (BeanManagerImpl) obj;
+ return this.getId().equals(that.getId());
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return getId().hashCode();
+ }
+
+ public BeanManagerImpl createActivity()
+ {
+ BeanManagerImpl childActivity = newChildActivityManager(this);
+ childActivities.add(childActivity);
+ Container.instance().addActivity(childActivity);
+ return childActivity;
+ }
+
+ public BeanManagerImpl setCurrent(Class<? extends Annotation> scopeType)
+ {
+ if (!getServices().get(MetaAnnotationStore.class).getScopeModel(scopeType).isNormal())
+ {
+ throw new ForbiddenArgumentException(NON_NORMAL_SCOPE, scopeType);
+ }
+ currentActivities.add(new CurrentActivity(getContext(scopeType), this));
+ return this;
+ }
+
+ public BeanManagerImpl getCurrent()
+ {
+ List<CurrentActivity> activeCurrentActivities = new ArrayList<CurrentActivity>();
+ for (CurrentActivity currentActivity : currentActivities)
+ {
+ if (currentActivity.getContext().isActive())
+ {
+ activeCurrentActivities.add(currentActivity);
+ }
+ }
+ if (activeCurrentActivities.size() == 0)
+ {
+ return this;
+ }
+ else if (activeCurrentActivities.size() == 1)
+ {
+ return activeCurrentActivities.get(0).getManager();
+ }
+ throw new ForbiddenStateException(TOO_MANY_ACTIVITIES, currentActivities);
+ }
+
+ public ServiceRegistry getServices()
+ {
+ return services;
+ }
+
+ /**
+ * The injection point being operated on for this thread
+ *
+ * @return the current injection point
+ */
+ public InjectionPoint getCurrentInjectionPoint()
+ {
+ if (!currentInjectionPoint.get().empty())
+ {
+ return currentInjectionPoint.get().peek();
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ /**
+ * Replaces (or adds) the current injection point. If a current injection
+ * point exists, it will be replaced. If no current injection point exists,
+ * one will be added.
+ *
+ * @param injectionPoint the injection point to use
+ * @return the injection point added, or null if non previous existed
+ */
+ public InjectionPoint replaceOrPushCurrentInjectionPoint(InjectionPoint injectionPoint)
+ {
+ InjectionPoint originalInjectionPoint = null;
+ if (!currentInjectionPoint.get().empty())
+ {
+ originalInjectionPoint = currentInjectionPoint.get().pop();
+ }
+ currentInjectionPoint.get().push(injectionPoint);
+ return originalInjectionPoint;
+ }
+
+ public void pushDummyInjectionPoint()
+ {
+ currentInjectionPoint.get().push(DUMMY_INJECTION_POINT);
+ }
+
+ public void popDummyInjectionPoint()
+ {
+ if (!currentInjectionPoint.get().isEmpty() && DUMMY_INJECTION_POINT.equals(currentInjectionPoint.get().peek()))
+ {
+ currentInjectionPoint.get().pop();
+ }
+ }
+
+ /**
+ *
+ * @return
+ */
+ public Map<Contextual<?>, Contextual<?>> getSpecializedBeans()
+ {
+ // TODO make this unmodifiable after deploy!
+ return specializedBeans;
+ }
+
+ // Serialization
+
+ protected Object readResolve()
+ {
+ return Container.instance().activityManager(id);
+ }
+
+ protected ClientProxyProvider getClientProxyProvider()
+ {
+ return clientProxyProvider;
+ }
+
+ protected ListMultimap<Class<? extends Annotation>, Context> getContexts()
+ {
+ return contexts;
+ }
+
+ /**
+ * @return the namespaces
+ */
+ protected List<String> getNamespaces()
+ {
+ return namespaces;
+ }
+
+ public Iterable<String> getAccessibleNamespaces()
+ {
+ // TODO Cache this
+ return createDynamicAccessibleIterable(Transform.NAMESPACE);
+ }
+
+ private Set<CurrentActivity> getCurrentActivities()
+ {
+ return currentActivities;
+ }
+
+ public String getId()
+ {
+ return id;
+ }
+
+ public AtomicInteger getChildIds()
+ {
+ return childIds;
+ }
+
+ public List<ObserverMethod<?>> getObservers()
+ {
+ return observers;
+ }
+
+ public Namespace getRootNamespace()
+ {
+ // TODO I don't like this lazy init
+ if (rootNamespace == null)
+ {
+ rootNamespace = new Namespace(createDynamicAccessibleIterable(Transform.NAMESPACE));
+ }
+ return rootNamespace;
+ }
+
+ public <T> InjectionTarget<T> createInjectionTarget(AnnotatedType<T> type)
+ {
+ return new SimpleInjectionTarget<T>(getServices().get(ClassTransformer.class).loadClass(type), this);
+ }
+
+ public <T> InjectionTarget<T> createInjectionTarget(EjbDescriptor<T> descriptor)
+ {
+ return getBean(descriptor).getInjectionTarget();
+ }
+
+ public <X> Bean<? extends X> getMostSpecializedBean(Bean<X> bean)
+ {
+ Contextual<?> key = bean;
+ while (specializedBeans.containsKey(key))
+ {
+ if (key == null)
+ {
+ System.out.println("null key " + bean);
+ }
+ key = specializedBeans.get(key);
+ }
+ return (Bean<X>) key;
+ }
+
+ public void validate(InjectionPoint ij)
+ {
+ try
+ {
+ getServices().get(Validator.class).validateInjectionPoint(ij, this);
+ }
+ catch (DeploymentException e)
+ {
+ throw new InjectionException(e.getLocalizedMessage(), e.getCause());
+ }
+ }
+
+ public Set<Annotation> getInterceptorBindingDefinition(Class<? extends Annotation> bindingType)
+ {
+ if (getServices().get(MetaAnnotationStore.class).getInterceptorBindingModel(bindingType).isValid())
+ {
+ return getServices().get(MetaAnnotationStore.class).getInterceptorBindingModel(bindingType).getMetaAnnotations();
+ }
+ else
+ {
+ throw new ForbiddenArgumentException(NOT_INTERCEPTOR_BINDING_TYPE, bindingType);
+ }
+ }
+
+ public Bean<?> getPassivationCapableBean(String id)
+ {
+ return getServices().get(ContextualStore.class).<Bean<Object>, Object>getContextual(id);
+ }
+
+ public Set<Annotation> getStereotypeDefinition(Class<? extends Annotation> stereotype)
+ {
+ if (getServices().get(MetaAnnotationStore.class).getStereotype(stereotype).isValid())
+ {
+ return getServices().get(MetaAnnotationStore.class).getStereotype(stereotype).getMetaAnnotations();
+ }
+ else
+ {
+ throw new ForbiddenArgumentException(NOT_STEREOTYPE, stereotype);
+ }
+ }
+
+ public boolean isQualifier(Class<? extends Annotation> annotationType)
+ {
+ return getServices().get(MetaAnnotationStore.class).getBindingTypeModel(annotationType).isValid();
+ }
+
+ public boolean isInterceptorBinding(Class<? extends Annotation> annotationType)
+ {
+ return getServices().get(MetaAnnotationStore.class).getInterceptorBindingModel(annotationType).isValid();
+ }
+
+ public boolean isNormalScope(Class<? extends Annotation> annotationType)
+ {
+ ScopeModel<?> scope = getServices().get(MetaAnnotationStore.class).getScopeModel(annotationType);
+ return scope.isValid() && scope.isNormal();
+ }
+
+ public boolean isPassivatingScope(Class<? extends Annotation> annotationType)
+ {
+ ScopeModel<?> scope = getServices().get(MetaAnnotationStore.class).getScopeModel(annotationType);
+ return scope.isValid() && scope.isPassivating();
+ }
+
+ public boolean isScope(Class<? extends Annotation> annotationType)
+ {
+ return getServices().get(MetaAnnotationStore.class).getScopeModel(annotationType).isValid();
+ }
+
+ public boolean isStereotype(Class<? extends Annotation> annotationType)
+ {
+ return getServices().get(MetaAnnotationStore.class).getStereotype(annotationType).isValid();
+ }
+
+ public ELResolver getELResolver()
+ {
+ return weldELResolver;
+ }
+
+ public ExpressionFactory wrapExpressionFactory(ExpressionFactory expressionFactory)
+ {
+ return new WeldExpressionFactory(expressionFactory);
+ }
+
+ public <T> WeldCreationalContext<T> createCreationalContext(Contextual<T> contextual)
+ {
+ return new CreationalContextImpl<T>(contextual);
+ }
+
+ public <T> AnnotatedType<T> createAnnotatedType(Class<T> type)
+ {
+ return getServices().get(ClassTransformer.class).loadClass(type);
+ }
+
+ public <X> Bean<? extends X> resolve(Set<Bean<? extends X>> beans)
+ {
+ Set<Bean<? extends X>> resolvedBeans = beanResolver.resolve(beans);
+ if (resolvedBeans.size() == 0)
+ {
+ return null;
+ }
+ if (resolvedBeans.size() == 1)
+ {
+ return resolvedBeans.iterator().next();
+ }
+ else
+ {
+ throw new AmbiguousResolutionException(AMBIGUOUS_BEANS_FOR_DEPENDENCY, beans);
+ }
+ }
+
+ public <T> EjbDescriptor<T> getEjbDescriptor(String beanName)
+ {
+ return getServices().get(EjbDescriptors.class).get(beanName);
+ }
+
+ public <T> SessionBean<T> getBean(EjbDescriptor<T> descriptor)
+ {
+ return (SessionBean<T>) getEnterpriseBeans().get(descriptor);
+ }
+
+ public void cleanup()
+ {
+ services.cleanup();
+ this.currentInjectionPoint.remove();
+ this.accessibleManagers.clear();
+ this.beanResolver.clear();
+ this.beans.clear();
+ this.childActivities.clear();
+ this.clientProxyProvider.clear();
+ this.contexts.clear();
+ this.currentActivities.clear();
+ this.decoratorResolver.clear();
+ this.decorators.clear();
+ this.enabledDecoratorClasses.clear();
+ this.enabledInterceptorClasses.clear();
+ this.enabledAlternativeClasses.clear();
+ this.enabledAlternativeStereotypes.clear();
+ this.enterpriseBeans.clear();
+ this.interceptorResolver.clear();
+ this.interceptors.clear();
+ this.nameBasedResolver.clear();
+ this.namespaces.clear();
+ this.observerResolver.clear();
+ this.observers.clear();
+ this.specializedBeans.clear();
+ }
+
+ public InterceptorRegistry<Class<?>, SerializableContextual<Interceptor<?>, ?>> getCdiInterceptorsRegistry()
+ {
+ return boundInterceptorsRegistry;
+ }
+
+ public InterceptorRegistry<Class<?>, Class<?>> getClassDeclaredInterceptorsRegistry()
+ {
+ return declaredInterceptorsRegistry;
+ }
+
+ public <X> InjectionTarget<X> fireProcessInjectionTarget(AnnotatedType<X> annotatedType)
+ {
+ return AbstractProcessInjectionTarget.fire(this, annotatedType, createInjectionTarget(annotatedType));
+ }
+}
Property changes on: core/trunk/impl/src/main/java/org/jboss/weld/manager/BeanManagerImpl.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Copied: core/trunk/impl/src/main/java/org/jboss/weld/manager/SimpleInjectionTarget.java (from rev 5388, core/trunk/impl/src/main/java/org/jboss/weld/SimpleInjectionTarget.java)
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/manager/SimpleInjectionTarget.java (rev 0)
+++ core/trunk/impl/src/main/java/org/jboss/weld/manager/SimpleInjectionTarget.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -0,0 +1,169 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.manager;
+
+import static org.jboss.weld.logging.messages.BeanManagerMessage.ERROR_INVOKING_POST_CONSTRUCT;
+import static org.jboss.weld.logging.messages.BeanManagerMessage.ERROR_INVOKING_PRE_DESTROY;
+import static org.jboss.weld.logging.messages.BeanManagerMessage.INJECTION_ON_NON_CONTEXTUAL;
+import static org.jboss.weld.logging.messages.BeanManagerMessage.MISSING_BEAN_CONSTRUCTOR_FOUND;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.enterprise.inject.spi.InjectionTarget;
+
+import org.jboss.weld.exceptions.DefinitionException;
+import org.jboss.weld.exceptions.ForbiddenStateException;
+import org.jboss.weld.exceptions.WeldException;
+import org.jboss.weld.injection.ConstructorInjectionPoint;
+import org.jboss.weld.injection.FieldInjectionPoint;
+import org.jboss.weld.injection.InjectionContextImpl;
+import org.jboss.weld.injection.MethodInjectionPoint;
+import org.jboss.weld.injection.WeldInjectionPoint;
+import org.jboss.weld.introspector.WeldClass;
+import org.jboss.weld.introspector.WeldMethod;
+import org.jboss.weld.util.Beans;
+
+/**
+ * @author pmuir
+ *
+ */
+public class SimpleInjectionTarget<T> implements InjectionTarget<T>
+{
+
+ private final BeanManagerImpl beanManager;
+ private final WeldClass<T> type;
+ private final ConstructorInjectionPoint<T> constructor;
+ private final List<Set<FieldInjectionPoint<?, ?>>> injectableFields;
+ private final List<Set<MethodInjectionPoint<?, ?>>> initializerMethods;
+ private final WeldMethod<?, ?> postConstruct;
+ private final WeldMethod<?, ?> preDestroy;
+ private final Set<InjectionPoint> injectionPoints;
+ private final Set<WeldInjectionPoint<?, ?>> ejbInjectionPoints;
+ private final Set<WeldInjectionPoint<?, ?>> persistenceContextInjectionPoints;
+ private final Set<WeldInjectionPoint<?, ?>> persistenceUnitInjectionPoints;
+ private final Set<WeldInjectionPoint<?, ?>> resourceInjectionPoints;
+
+ public SimpleInjectionTarget(WeldClass<T> type, BeanManagerImpl beanManager)
+ {
+ this.beanManager = beanManager;
+ this.type = type;
+ this.injectionPoints = new HashSet<InjectionPoint>();
+ ConstructorInjectionPoint<T> constructor = null;
+ try
+ {
+ constructor = Beans.getBeanConstructor(null, type);
+ this.injectionPoints.addAll(Beans.getParameterInjectionPoints(null, constructor));
+ }
+ catch (Exception e)
+ {
+ // this means the bean of a type that cannot be produce()d, but that is non-fatal
+ // unless someone calls produce()
+ }
+ this.constructor = constructor;
+ this.injectableFields = Beans.getFieldInjectionPoints(null, type);
+ this.injectionPoints.addAll(Beans.getFieldInjectionPoints(null, this.injectableFields));
+ this.initializerMethods = Beans.getInitializerMethods(null, type);
+ this.injectionPoints.addAll(Beans.getParameterInjectionPoints(null, initializerMethods));
+ this.postConstruct = Beans.getPostConstruct(type);
+ this.preDestroy = Beans.getPreDestroy(type);
+ this.ejbInjectionPoints = Beans.getEjbInjectionPoints(null, type, beanManager);
+ this.persistenceContextInjectionPoints = Beans.getPersistenceContextInjectionPoints(null, type, beanManager);
+ this.persistenceUnitInjectionPoints = Beans.getPersistenceUnitInjectionPoints(null, type, beanManager);
+ this.resourceInjectionPoints = Beans.getResourceInjectionPoints(null, type, beanManager);
+ for (InjectionPoint ip : this.injectionPoints)
+ {
+ if (ip.getType().equals(InjectionPoint.class))
+ {
+ throw new DefinitionException(INJECTION_ON_NON_CONTEXTUAL, type, ip);
+ }
+ }
+ }
+
+ public T produce(CreationalContext<T> ctx)
+ {
+ if (constructor == null)
+ {
+ // this means we couldn't find a constructor on instantiation, which
+ // means there isn't one that's spec-compliant
+ // try again so the correct DefinitionException is thrown
+ Beans.getBeanConstructor(null, type);
+ // should not be reached
+ throw new ForbiddenStateException(MISSING_BEAN_CONSTRUCTOR_FOUND);
+ }
+ return constructor.newInstance(beanManager, ctx);
+ }
+
+ public void inject(final T instance, final CreationalContext<T> ctx)
+ {
+ new InjectionContextImpl<T>(beanManager, this, instance)
+ {
+
+ public void proceed()
+ {
+ Beans.injectEEFields(instance, beanManager, ejbInjectionPoints, persistenceContextInjectionPoints, persistenceUnitInjectionPoints, resourceInjectionPoints);
+ Beans.injectFieldsAndInitializers(instance, ctx, beanManager, injectableFields, initializerMethods);
+ }
+
+ }.run();
+
+ }
+
+ public void postConstruct(T instance)
+ {
+ if (postConstruct == null)
+ return;
+
+ try
+ {
+ postConstruct.invoke(instance);
+ }
+ catch (Exception e)
+ {
+ throw new WeldException(ERROR_INVOKING_POST_CONSTRUCT, e, postConstruct);
+ }
+ }
+
+ public void preDestroy(T instance)
+ {
+ if (preDestroy == null)
+ return;
+
+ try
+ {
+ preDestroy.invoke(instance);
+ }
+ catch (Exception e)
+ {
+ throw new WeldException(ERROR_INVOKING_PRE_DESTROY, e, preDestroy);
+ }
+ }
+
+ public void dispose(T instance)
+ {
+ // No-op
+ }
+
+ public Set<InjectionPoint> getInjectionPoints()
+ {
+ return injectionPoints;
+ }
+
+}
Property changes on: core/trunk/impl/src/main/java/org/jboss/weld/manager/SimpleInjectionTarget.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Copied: core/trunk/impl/src/main/java/org/jboss/weld/manager/SingleThreadExecutorServices.java (from rev 5388, core/trunk/impl/src/main/java/org/jboss/weld/SingleThreadExecutorServices.java)
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/manager/SingleThreadExecutorServices.java (rev 0)
+++ core/trunk/impl/src/main/java/org/jboss/weld/manager/SingleThreadExecutorServices.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -0,0 +1,70 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.manager;
+
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.TimeUnit;
+
+import org.jboss.weld.manager.api.ExecutorServices;
+
+/**
+ * @author pmuir
+ *
+ */
+public class SingleThreadExecutorServices implements ExecutorServices
+{
+
+ private transient final ExecutorService taskExecutor = Executors.newSingleThreadExecutor();
+
+
+ /**
+ * Provides access to the executor service used for asynchronous tasks.
+ *
+ * @return the ExecutorService for this manager
+ */
+ public ExecutorService getTaskExecutor()
+ {
+ return taskExecutor;
+ }
+
+ public void cleanup()
+ {
+ taskExecutor.shutdown();
+ try
+ {
+ // Wait a while for existing tasks to terminate
+ if (!taskExecutor.awaitTermination(60, TimeUnit.SECONDS))
+ {
+ taskExecutor.shutdownNow(); // Cancel currently executing tasks
+ // Wait a while for tasks to respond to being cancelled
+ if (!taskExecutor.awaitTermination(60, TimeUnit.SECONDS))
+ {
+ // Log the error here
+ }
+ }
+ }
+ catch (InterruptedException ie)
+ {
+ // (Re-)Cancel if current thread also interrupted
+ taskExecutor.shutdownNow();
+ // Preserve interrupt status
+ Thread.currentThread().interrupt();
+ }
+ }
+
+}
Property changes on: core/trunk/impl/src/main/java/org/jboss/weld/manager/SingleThreadExecutorServices.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Modified: core/trunk/impl/src/main/java/org/jboss/weld/metadata/cache/AnnotationModel.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/metadata/cache/AnnotationModel.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/metadata/cache/AnnotationModel.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -25,7 +25,7 @@
import java.lang.annotation.RetentionPolicy;
import java.util.Set;
-import org.jboss.weld.DefinitionException;
+import org.jboss.weld.exceptions.DefinitionException;
import org.jboss.weld.introspector.WeldAnnotation;
import org.jboss.weld.logging.messages.MetadataMessage;
import org.jboss.weld.resources.ClassTransformer;
Modified: core/trunk/impl/src/main/java/org/jboss/weld/metadata/cache/BindingTypeModel.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/metadata/cache/BindingTypeModel.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/metadata/cache/BindingTypeModel.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -27,7 +27,7 @@
import javax.enterprise.util.Nonbinding;
import javax.inject.Qualifier;
-import org.jboss.weld.WeldException;
+import org.jboss.weld.exceptions.WeldException;
import org.jboss.weld.introspector.WeldMethod;
import org.jboss.weld.resources.ClassTransformer;
import org.jboss.weld.util.collections.Arrays2;
Modified: core/trunk/impl/src/main/java/org/jboss/weld/metadata/cache/InterceptorBindingModel.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/metadata/cache/InterceptorBindingModel.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/metadata/cache/InterceptorBindingModel.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -33,8 +33,8 @@
import javax.enterprise.util.Nonbinding;
import javax.interceptor.InterceptorBinding;
-import org.jboss.weld.DefinitionException;
-import org.jboss.weld.WeldException;
+import org.jboss.weld.exceptions.DefinitionException;
+import org.jboss.weld.exceptions.WeldException;
import org.jboss.weld.introspector.WeldMethod;
import org.jboss.weld.resources.ClassTransformer;
import org.jboss.weld.util.collections.Arrays2;
Modified: core/trunk/impl/src/main/java/org/jboss/weld/metadata/cache/MergedStereotypes.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/metadata/cache/MergedStereotypes.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/metadata/cache/MergedStereotypes.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -22,8 +22,8 @@
import java.util.HashSet;
import java.util.Set;
-import org.jboss.weld.BeanManagerImpl;
-import org.jboss.weld.ForbiddenStateException;
+import org.jboss.weld.exceptions.ForbiddenStateException;
+import org.jboss.weld.manager.BeanManagerImpl;
/**
* Meta model for the merged stereotype for a bean
Modified: core/trunk/impl/src/main/java/org/jboss/weld/metadata/cache/StereotypeModel.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/metadata/cache/StereotypeModel.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/metadata/cache/StereotypeModel.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -40,7 +40,7 @@
import javax.inject.Scope;
import javax.interceptor.InterceptorBinding;
-import org.jboss.weld.DefinitionException;
+import org.jboss.weld.exceptions.DefinitionException;
import org.jboss.weld.resources.ClassTransformer;
import org.jboss.weld.util.collections.Arrays2;
import org.slf4j.cal10n.LocLogger;
Modified: core/trunk/impl/src/main/java/org/jboss/weld/resolution/NameBasedResolver.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/resolution/NameBasedResolver.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/resolution/NameBasedResolver.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -22,7 +22,7 @@
import javax.enterprise.inject.spi.Bean;
-import org.jboss.weld.BeanManagerImpl;
+import org.jboss.weld.manager.BeanManagerImpl;
import org.jboss.weld.util.Beans;
import org.jboss.weld.util.collections.ConcurrentCache;
Modified: core/trunk/impl/src/main/java/org/jboss/weld/resolution/ResolvableWeldClass.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/resolution/ResolvableWeldClass.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/resolution/ResolvableWeldClass.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -34,14 +34,14 @@
import javax.enterprise.inject.spi.InjectionPoint;
import javax.enterprise.util.TypeLiteral;
-import org.jboss.weld.BeanManagerImpl;
-import org.jboss.weld.ForbiddenArgumentException;
-import org.jboss.weld.InvalidOperationException;
import org.jboss.weld.bean.AbstractClassBean;
+import org.jboss.weld.exceptions.ForbiddenArgumentException;
+import org.jboss.weld.exceptions.InvalidOperationException;
import org.jboss.weld.injection.WeldInjectionPoint;
import org.jboss.weld.introspector.AnnotationStore;
import org.jboss.weld.introspector.WeldAnnotated;
import org.jboss.weld.introspector.jlr.AbstractWeldAnnotated;
+import org.jboss.weld.manager.BeanManagerImpl;
import org.jboss.weld.metadata.TypeStore;
import org.jboss.weld.util.Names;
import org.jboss.weld.util.reflection.Reflections;
Modified: core/trunk/impl/src/main/java/org/jboss/weld/resolution/TypeSafeBeanResolver.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/resolution/TypeSafeBeanResolver.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/resolution/TypeSafeBeanResolver.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -23,9 +23,9 @@
import javax.enterprise.inject.spi.Bean;
-import org.jboss.weld.BeanManagerImpl;
import org.jboss.weld.bean.builtin.EventBean;
import org.jboss.weld.bean.builtin.InstanceBean;
+import org.jboss.weld.manager.BeanManagerImpl;
import org.jboss.weld.util.Beans;
import org.jboss.weld.util.collections.ConcurrentCache;
import org.jboss.weld.util.reflection.Reflections;
Modified: core/trunk/impl/src/main/java/org/jboss/weld/resolution/TypeSafeDecoratorResolver.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/resolution/TypeSafeDecoratorResolver.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/resolution/TypeSafeDecoratorResolver.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -24,8 +24,8 @@
import javax.enterprise.inject.spi.Decorator;
-import org.jboss.weld.BeanManagerImpl;
import org.jboss.weld.bean.DecoratorImpl;
+import org.jboss.weld.manager.BeanManagerImpl;
import org.jboss.weld.util.Beans;
import org.jboss.weld.util.reflection.Reflections;
Modified: core/trunk/impl/src/main/java/org/jboss/weld/resolution/TypeSafeDisposerResolver.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/resolution/TypeSafeDisposerResolver.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/resolution/TypeSafeDisposerResolver.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -19,8 +19,8 @@
import java.util.Collections;
import java.util.Set;
-import org.jboss.weld.BeanManagerImpl;
import org.jboss.weld.bean.DisposalMethod;
+import org.jboss.weld.manager.BeanManagerImpl;
import org.jboss.weld.util.Beans;
import org.jboss.weld.util.reflection.Reflections;
Modified: core/trunk/impl/src/main/java/org/jboss/weld/resolution/TypeSafeInterceptorResolver.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/resolution/TypeSafeInterceptorResolver.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/resolution/TypeSafeInterceptorResolver.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -25,8 +25,8 @@
import javax.enterprise.inject.spi.Interceptor;
-import org.jboss.weld.BeanManagerImpl;
import org.jboss.weld.bean.InterceptorImpl;
+import org.jboss.weld.manager.BeanManagerImpl;
import org.jboss.weld.util.Beans;
/**
Modified: core/trunk/impl/src/main/java/org/jboss/weld/resolution/TypeSafeObserverResolver.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/resolution/TypeSafeObserverResolver.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/resolution/TypeSafeObserverResolver.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -21,7 +21,7 @@
import javax.enterprise.inject.spi.ObserverMethod;
-import org.jboss.weld.BeanManagerImpl;
+import org.jboss.weld.manager.BeanManagerImpl;
import org.jboss.weld.util.Beans;
import org.jboss.weld.util.reflection.Reflections;
Modified: core/trunk/impl/src/main/java/org/jboss/weld/resources/ManagerObjectFactory.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/resources/ManagerObjectFactory.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/resources/ManagerObjectFactory.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -27,9 +27,9 @@
import javax.naming.NamingException;
import javax.naming.spi.ObjectFactory;
-import org.jboss.weld.BeanManagerImpl;
import org.jboss.weld.Container;
import org.jboss.weld.bootstrap.spi.BeanDeploymentArchive;
+import org.jboss.weld.manager.BeanManagerImpl;
import ch.qos.cal10n.IMessageConveyor;
Modified: core/trunk/impl/src/main/java/org/jboss/weld/servlet/ServletHelper.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/servlet/ServletHelper.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/servlet/ServletHelper.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -22,8 +22,8 @@
import javax.enterprise.inject.spi.BeanManager;
import javax.servlet.ServletContext;
-import org.jboss.weld.BeanManagerImpl;
-import org.jboss.weld.ForbiddenArgumentException;
+import org.jboss.weld.exceptions.ForbiddenArgumentException;
+import org.jboss.weld.manager.BeanManagerImpl;
/**
* @author pmuir
Modified: core/trunk/impl/src/main/java/org/jboss/weld/servlet/ServletLifecycle.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/servlet/ServletLifecycle.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/servlet/ServletLifecycle.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -28,11 +28,11 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
-import org.jboss.weld.ForbiddenStateException;
import org.jboss.weld.context.ContextLifecycle;
import org.jboss.weld.context.api.BeanStore;
import org.jboss.weld.context.api.helpers.ConcurrentHashMapBeanStore;
import org.jboss.weld.conversation.ConversationManager;
+import org.jboss.weld.exceptions.ForbiddenStateException;
/**
* Implementation of the Weld lifecycle that can react to servlet events
Modified: core/trunk/impl/src/main/java/org/jboss/weld/servlet/WeldListener.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/servlet/WeldListener.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/servlet/WeldListener.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -37,11 +37,11 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSessionEvent;
-import org.jboss.weld.BeanManagerImpl;
import org.jboss.weld.Container;
-import org.jboss.weld.ForbiddenStateException;
import org.jboss.weld.bootstrap.spi.BeanDeploymentArchive;
import org.jboss.weld.context.ContextLifecycle;
+import org.jboss.weld.exceptions.ForbiddenStateException;
+import org.jboss.weld.manager.BeanManagerImpl;
import org.jboss.weld.servlet.api.ServletServices;
import org.jboss.weld.servlet.api.helpers.AbstractServletListener;
import org.slf4j.cal10n.LocLogger;
Modified: core/trunk/impl/src/main/java/org/jboss/weld/util/ApiAbstraction.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/util/ApiAbstraction.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/util/ApiAbstraction.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -20,7 +20,7 @@
import java.lang.annotation.Annotation;
-import org.jboss.weld.ForbiddenArgumentException;
+import org.jboss.weld.exceptions.ForbiddenArgumentException;
import org.jboss.weld.resources.spi.ResourceLoader;
import org.jboss.weld.resources.spi.ResourceLoadingException;
import org.jboss.weld.util.reflection.SecureReflections;
Modified: core/trunk/impl/src/main/java/org/jboss/weld/util/Beans.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/util/Beans.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/util/Beans.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -66,14 +66,13 @@
import org.jboss.interceptor.model.InterceptionType;
import org.jboss.interceptor.model.InterceptionTypeRegistry;
-import org.jboss.weld.BeanManagerImpl;
import org.jboss.weld.Container;
-import org.jboss.weld.DefinitionException;
-import org.jboss.weld.ForbiddenArgumentException;
import org.jboss.weld.bean.DecoratorImpl;
import org.jboss.weld.bean.RIBean;
import org.jboss.weld.bean.SessionBean;
import org.jboss.weld.ejb.EJBApiAbstraction;
+import org.jboss.weld.exceptions.DefinitionException;
+import org.jboss.weld.exceptions.ForbiddenArgumentException;
import org.jboss.weld.injection.ConstructorInjectionPoint;
import org.jboss.weld.injection.FieldInjectionPoint;
import org.jboss.weld.injection.MethodInjectionPoint;
@@ -90,6 +89,7 @@
import org.jboss.weld.introspector.WeldMember;
import org.jboss.weld.introspector.WeldMethod;
import org.jboss.weld.introspector.WeldParameter;
+import org.jboss.weld.manager.BeanManagerImpl;
import org.jboss.weld.metadata.cache.BindingTypeModel;
import org.jboss.weld.metadata.cache.InterceptorBindingModel;
import org.jboss.weld.metadata.cache.MergedStereotypes;
Added: core/trunk/impl/src/main/java/org/jboss/weld/util/CleanableMethodHandler.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/util/CleanableMethodHandler.java (rev 0)
+++ core/trunk/impl/src/main/java/org/jboss/weld/util/CleanableMethodHandler.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -0,0 +1,41 @@
+package org.jboss.weld.util;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.Serializable;
+import java.lang.reflect.Method;
+
+import javassist.util.proxy.MethodHandler;
+
+import org.jboss.weld.Container;
+
+public class CleanableMethodHandler implements MethodHandler, Serializable
+{
+
+ private static final long serialVersionUID = 2140367342468307705L;
+
+ private MethodHandler delegate;
+
+ public CleanableMethodHandler(MethodHandler delegate)
+ {
+ this.delegate = delegate;
+ Container.instance().deploymentServices().get(JavassistCleaner.class).add(this);
+ }
+
+ public Object invoke(Object self, Method thisMethod, Method proceed, Object[] args) throws Throwable
+ {
+ return delegate.invoke(self, thisMethod, proceed, args);
+ }
+
+ public void clean()
+ {
+ this.delegate = null;
+ }
+
+ private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException
+ {
+ in.defaultReadObject();
+ Container.instance().deploymentServices().get(JavassistCleaner.class).add(this);
+ }
+
+}
Property changes on: core/trunk/impl/src/main/java/org/jboss/weld/util/CleanableMethodHandler.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: core/trunk/impl/src/main/java/org/jboss/weld/util/Deployers.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/util/Deployers.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/util/Deployers.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -17,11 +17,11 @@
package org.jboss.weld.util;
-import org.jboss.weld.BeanManagerImpl;
-import org.jboss.weld.ForbiddenStateException;
+import org.jboss.weld.exceptions.ForbiddenStateException;
import org.jboss.weld.introspector.MethodSignature;
import org.jboss.weld.introspector.WeldClass;
import org.jboss.weld.introspector.WeldMethod;
+import org.jboss.weld.manager.BeanManagerImpl;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
Modified: core/trunk/impl/src/main/java/org/jboss/weld/util/DeploymentStructures.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/util/DeploymentStructures.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/util/DeploymentStructures.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -4,11 +4,11 @@
import java.util.Map;
-import org.jboss.weld.BeanManagerImpl;
-import org.jboss.weld.ForbiddenStateException;
import org.jboss.weld.bootstrap.BeanDeployment;
import org.jboss.weld.bootstrap.spi.BeanDeploymentArchive;
import org.jboss.weld.bootstrap.spi.Deployment;
+import org.jboss.weld.exceptions.ForbiddenStateException;
+import org.jboss.weld.manager.BeanManagerImpl;
public class DeploymentStructures
{
Added: core/trunk/impl/src/main/java/org/jboss/weld/util/JavassistCleaner.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/util/JavassistCleaner.java (rev 0)
+++ core/trunk/impl/src/main/java/org/jboss/weld/util/JavassistCleaner.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -0,0 +1,32 @@
+package org.jboss.weld.util;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.jboss.weld.bootstrap.api.Service;
+
+public class JavassistCleaner implements Service
+{
+
+ private final Collection<CleanableMethodHandler> cleanableMethodHandlers;
+
+ public JavassistCleaner()
+ {
+ this.cleanableMethodHandlers = new ArrayList<CleanableMethodHandler>();
+ }
+
+ public void add(CleanableMethodHandler cleanableMethodHandler)
+ {
+ cleanableMethodHandlers.add(cleanableMethodHandler);
+ }
+
+ public void cleanup()
+ {
+ for (CleanableMethodHandler cleanableMethodHandler : cleanableMethodHandlers)
+ {
+ cleanableMethodHandler.clean();
+ }
+ cleanableMethodHandlers.clear();
+ }
+
+}
\ No newline at end of file
Property changes on: core/trunk/impl/src/main/java/org/jboss/weld/util/JavassistCleaner.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: core/trunk/impl/src/main/java/org/jboss/weld/util/Observers.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/util/Observers.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/util/Observers.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -23,7 +23,7 @@
import java.lang.reflect.Type;
import java.lang.reflect.TypeVariable;
-import org.jboss.weld.ForbiddenArgumentException;
+import org.jboss.weld.exceptions.ForbiddenArgumentException;
import org.jboss.weld.util.reflection.HierarchyDiscovery;
/**
Modified: core/trunk/impl/src/main/java/org/jboss/weld/util/Proxies.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/util/Proxies.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/util/Proxies.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -31,7 +31,8 @@
import javassist.util.proxy.ProxyFactory;
import javassist.util.proxy.ProxyObject;
-import org.jboss.weld.ForbiddenArgumentException;
+import org.jboss.weld.exceptions.ForbiddenArgumentException;
+import org.jboss.weld.exceptions.WeldException;
import org.jboss.weld.util.reflection.Reflections;
import org.jboss.weld.util.reflection.SecureReflections;
@@ -138,27 +139,54 @@
}
+ private static final String DEFAULT_INTERCEPTOR = "default_interceptor";
+
+ /**
+ * Create a proxy with a handler, registering the proxy for cleanup
+ *
+ * @param <T>
+ * @param methodHandler
+ * @param typeInfo
+ * @return
+ * @throws IllegalAccessException
+ * @throws InstantiationException
+ */
public static <T> T createProxy(MethodHandler methodHandler, TypeInfo typeInfo) throws IllegalAccessException, InstantiationException
{
return SecureReflections.newInstance(Proxies.<T>createProxyClass(methodHandler, typeInfo));
}
+ /**
+ * Create a proxy class
+ *
+ * You will need to manually register the proxy instances for cleanup
+ *
+ * @param <T>
+ * @param typeInfo
+ * @return
+ */
public static <T> Class<T> createProxyClass(TypeInfo typeInfo)
{
return createProxyClass(null, typeInfo);
}
+ /**
+ * Create a proxy class
+ *
+ * You will need to manually register the proxy instances for cleanup
+ *
+ * @param <T>
+ * @param methodHandler
+ * @param typeInfo
+ * @return
+ */
public static <T> Class<T> createProxyClass(MethodHandler methodHandler, TypeInfo typeInfo)
{
ProxyFactory proxyFactory = typeInfo.createProxyFactory();
- if (methodHandler != null)
- {
- proxyFactory.setHandler(methodHandler);
- }
+ attachMethodHandler(proxyFactory, methodHandler);
@SuppressWarnings("unchecked")
Class<T> clazz = proxyFactory.createClass();
-
return clazz;
}
@@ -263,11 +291,23 @@
return instance.getClass().getName().indexOf("_$$_javassist_") > 0;
}
+ public static ProxyFactory attachMethodHandler(ProxyFactory proxyFactory, MethodHandler methodHandler)
+ {
+ if (methodHandler != null)
+ {
+ proxyFactory.setHandler(new CleanableMethodHandler(methodHandler));
+ }
+ return proxyFactory;
+ }
+
public static <T> T attachMethodHandler(T instance, MethodHandler methodHandler)
{
if (instance instanceof ProxyObject)
{
- ((ProxyObject) instance).setHandler(methodHandler);
+ if (methodHandler != null)
+ {
+ ((ProxyObject) instance).setHandler(new CleanableMethodHandler(methodHandler));
+ }
return instance;
}
else
@@ -276,6 +316,30 @@
}
}
+
+ public static void clean(Class<?> clazz)
+ {
+ if (!ProxyObject.class.isAssignableFrom(clazz))
+ {
+ throw new ForbiddenArgumentException(INSTANCE_NOT_A_PROXY, clazz);
+ }
+ else
+ {
+ // Clear the default handler
+ try
+ {
+ SecureReflections.getDeclaredField(clazz, DEFAULT_INTERCEPTOR).set(null, null);
+ }
+ catch (IllegalAccessException e)
+ {
+ throw new WeldException(e);
+ }
+ catch (NoSuchFieldException e)
+ {
+ throw new WeldException(e);
+ }
+ }
+ }
}
Modified: core/trunk/impl/src/main/java/org/jboss/weld/util/collections/ConcurrentCache.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/util/collections/ConcurrentCache.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/util/collections/ConcurrentCache.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -23,7 +23,7 @@
import java.util.concurrent.Future;
import java.util.concurrent.FutureTask;
-import org.jboss.weld.ForbiddenStateException;
+import org.jboss.weld.exceptions.ForbiddenStateException;
import com.google.common.collect.ForwardingMap;
Modified: core/trunk/impl/src/main/java/org/jboss/weld/util/dom/NodeListIterator.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/util/dom/NodeListIterator.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/util/dom/NodeListIterator.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -20,7 +20,7 @@
import java.util.Iterator;
-import org.jboss.weld.InvalidOperationException;
+import org.jboss.weld.exceptions.InvalidOperationException;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
Modified: core/trunk/impl/src/main/java/org/jboss/weld/util/reflection/SecureReflections.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/util/reflection/SecureReflections.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/util/reflection/SecureReflections.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -24,7 +24,7 @@
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
-import org.jboss.weld.DeploymentException;
+import org.jboss.weld.exceptions.DeploymentException;
/**
*
Modified: core/trunk/impl/src/main/java/org/jboss/weld/util/serviceProvider/DefaultServiceLoader.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/util/serviceProvider/DefaultServiceLoader.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/util/serviceProvider/DefaultServiceLoader.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -29,8 +29,8 @@
import java.util.Iterator;
import java.util.Set;
-import org.jboss.weld.ForbiddenStateException;
-import org.jboss.weld.InvalidOperationException;
+import org.jboss.weld.exceptions.ForbiddenStateException;
+import org.jboss.weld.exceptions.InvalidOperationException;
import org.jboss.weld.util.reflection.Reflections;
import org.jboss.weld.util.reflection.SecureReflections;
import org.slf4j.Logger;
Modified: core/trunk/impl/src/main/java/org/jboss/weld/xml/WeldXmlException.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/xml/WeldXmlException.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/java/org/jboss/weld/xml/WeldXmlException.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -19,7 +19,7 @@
import javax.enterprise.inject.InjectionException;
-import org.jboss.weld.WeldExceptionMessage;
+import org.jboss.weld.exceptions.WeldExceptionMessage;
/**
* Used for exceptions from the Weld XML parser and provides localization
Modified: core/trunk/impl/src/main/resources/org/jboss/weld/messages/reflection_en.properties
===================================================================
--- core/trunk/impl/src/main/resources/org/jboss/weld/messages/reflection_en.properties 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/impl/src/main/resources/org/jboss/weld/messages/reflection_en.properties 2010-01-08 13:59:36 UTC (rev 5398)
@@ -7,3 +7,4 @@
UNABLE_TO_GET_PARAMETER_NAME=Unable to determine name of parameter
ANNOTATION_MAP_NULL=annotationMap cannot be null
DECLARED_ANNOTATION_MAP_NULL=declaredAnnotationMap cannot be null
+CLEANING_JAVASSIST_PROXY_CLASS=Cleaning Javassist proxy. Class {0}
\ No newline at end of file
Modified: core/trunk/jboss-as/build.properties
===================================================================
--- core/trunk/jboss-as/build.properties 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/jboss-as/build.properties 2010-01-08 13:59:36 UTC (rev 5398)
@@ -6,7 +6,7 @@
# org.jboss.testharness.container.shutdownDelay=15000
# maximum number of TCK tests to deploy before restarting JBoss AS
-# jboss.deployments.restart = 25
+# max.deployments.restart = 25
weld-deployer.version=5.2.0-SNAPSHOT
weld.version=1.0.1-SNAPSHOT
jboss-ejb3.version=1.0.0
Modified: core/trunk/jboss-tck-runner/pom.xml
===================================================================
--- core/trunk/jboss-tck-runner/pom.xml 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/jboss-tck-runner/pom.xml 2010-01-08 13:59:36 UTC (rev 5398)
@@ -94,7 +94,7 @@
<suiteXmlFiles>
<suiteXmlFile>src/test/resources/tck-tests.xml</suiteXmlFile>
</suiteXmlFiles>
- <argLine>-Xmx748m</argLine>
+ <argLine>-Xmx1024m</argLine>
<forkMode>once</forkMode>
</configuration>
</plugin>
Modified: core/trunk/porting-package/src/main/java/org/jboss/weld/tck/ELImpl.java
===================================================================
--- core/trunk/porting-package/src/main/java/org/jboss/weld/tck/ELImpl.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/porting-package/src/main/java/org/jboss/weld/tck/ELImpl.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -5,7 +5,7 @@
import org.jboss.jsr299.tck.api.JSR299Configuration;
import org.jboss.testharness.api.Configurable;
import org.jboss.testharness.api.Configuration;
-import org.jboss.weld.BeanManagerImpl;
+import org.jboss.weld.manager.BeanManagerImpl;
import org.jboss.weld.mock.el.EL;
public class ELImpl implements org.jboss.jsr299.tck.spi.EL, Configurable
Modified: core/trunk/porting-package/src/main/java/org/jboss/weld/tck/ManagersImpl.java
===================================================================
--- core/trunk/porting-package/src/main/java/org/jboss/weld/tck/ManagersImpl.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/porting-package/src/main/java/org/jboss/weld/tck/ManagersImpl.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -4,8 +4,8 @@
import javax.enterprise.inject.spi.BeanManager;
import org.jboss.jsr299.tck.spi.Managers;
-import org.jboss.weld.DefinitionException;
-import org.jboss.weld.DeploymentException;
+import org.jboss.weld.exceptions.DefinitionException;
+import org.jboss.weld.exceptions.DeploymentException;
import org.jboss.weld.test.BeanManagerLocator;
public class ManagersImpl implements Managers
Modified: core/trunk/tests/src/main/java/org/jboss/weld/mock/TestContainer.java
===================================================================
--- core/trunk/tests/src/main/java/org/jboss/weld/mock/TestContainer.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/tests/src/main/java/org/jboss/weld/mock/TestContainer.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -4,8 +4,8 @@
import java.util.Arrays;
import java.util.Collection;
-import org.jboss.weld.BeanManagerImpl;
import org.jboss.weld.bootstrap.spi.Deployment;
+import org.jboss.weld.manager.BeanManagerImpl;
/**
* Control of the container, used for tests. Wraps up common operations.
Modified: core/trunk/tests/src/main/java/org/jboss/weld/mock/cluster/AbstractClusterTest.java
===================================================================
--- core/trunk/tests/src/main/java/org/jboss/weld/mock/cluster/AbstractClusterTest.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/tests/src/main/java/org/jboss/weld/mock/cluster/AbstractClusterTest.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -7,10 +7,10 @@
import java.io.ObjectOutputStream;
import java.util.Collection;
-import org.jboss.weld.BeanManagerImpl;
import org.jboss.weld.bootstrap.api.SingletonProvider;
import org.jboss.weld.context.ContextLifecycle;
import org.jboss.weld.context.api.BeanStore;
+import org.jboss.weld.manager.BeanManagerImpl;
import org.jboss.weld.mock.MockEELifecycle;
import org.jboss.weld.mock.TestContainer;
import org.testng.annotations.AfterClass;
Modified: core/trunk/tests/src/main/java/org/jboss/weld/mock/el/EL.java
===================================================================
--- core/trunk/tests/src/main/java/org/jboss/weld/mock/el/EL.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/tests/src/main/java/org/jboss/weld/mock/el/EL.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -30,9 +30,9 @@
import javax.el.ResourceBundleELResolver;
import javax.el.VariableMapper;
-import org.jboss.weld.BeanManagerImpl;
import org.jboss.weld.el.WeldELContextListener;
import org.jboss.weld.el.WeldExpressionFactory;
+import org.jboss.weld.manager.BeanManagerImpl;
import com.sun.el.ExpressionFactoryImpl;
import com.sun.el.lang.FunctionMapperImpl;
Modified: core/trunk/tests/src/main/java/org/jboss/weld/test/AbstractWeldTest.java
===================================================================
--- core/trunk/tests/src/main/java/org/jboss/weld/test/AbstractWeldTest.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/tests/src/main/java/org/jboss/weld/test/AbstractWeldTest.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -20,7 +20,7 @@
import org.jboss.testharness.AbstractTest;
import org.jboss.testharness.impl.runner.servlet.ServletTestRunner;
-import org.jboss.weld.BeanManagerImpl;
+import org.jboss.weld.manager.BeanManagerImpl;
import org.jboss.weld.mock.el.EL;
import org.jboss.weld.util.collections.EnumerationList;
import org.testng.ITestContext;
Modified: core/trunk/tests/src/main/java/org/jboss/weld/test/BeanManagerLocator.java
===================================================================
--- core/trunk/tests/src/main/java/org/jboss/weld/test/BeanManagerLocator.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/tests/src/main/java/org/jboss/weld/test/BeanManagerLocator.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -1,9 +1,9 @@
package org.jboss.weld.test;
import org.jboss.testharness.impl.runner.servlet.ServletTestRunner;
-import org.jboss.weld.BeanManagerImpl;
import org.jboss.weld.Container;
import org.jboss.weld.bootstrap.spi.BeanDeploymentArchive;
+import org.jboss.weld.manager.BeanManagerImpl;
import org.jboss.weld.servlet.ServletHelper;
public class BeanManagerLocator
Modified: core/trunk/tests/src/test/java/org/jboss/weld/tests/activities/ActivitiesTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/activities/ActivitiesTest.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/activities/ActivitiesTest.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -19,9 +19,9 @@
import javax.enterprise.util.AnnotationLiteral;
import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.weld.BeanManagerImpl;
import org.jboss.weld.bean.ForwardingBean;
import org.jboss.weld.literal.DefaultLiteral;
+import org.jboss.weld.manager.BeanManagerImpl;
import org.jboss.weld.test.AbstractWeldTest;
import org.testng.annotations.Test;
Modified: core/trunk/tests/src/test/java/org/jboss/weld/tests/activities/child/SameBeanTypeInChildActivityTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/activities/child/SameBeanTypeInChildActivityTest.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/activities/child/SameBeanTypeInChildActivityTest.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -15,8 +15,8 @@
import javax.enterprise.util.AnnotationLiteral;
import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.weld.BeanManagerImpl;
import org.jboss.weld.literal.DefaultLiteral;
+import org.jboss.weld.manager.BeanManagerImpl;
import org.jboss.weld.test.AbstractWeldTest;
import org.testng.annotations.Test;
Modified: core/trunk/tests/src/test/java/org/jboss/weld/tests/activities/current/ELCurrentActivityTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/activities/current/ELCurrentActivityTest.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/activities/current/ELCurrentActivityTest.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -16,7 +16,7 @@
import javax.enterprise.util.AnnotationLiteral;
import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.weld.BeanManagerImpl;
+import org.jboss.weld.manager.BeanManagerImpl;
import org.jboss.weld.test.AbstractWeldTest;
import org.testng.annotations.Test;
Modified: core/trunk/tests/src/test/java/org/jboss/weld/tests/activities/current/InstanceCurrentActivityTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/activities/current/InstanceCurrentActivityTest.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/activities/current/InstanceCurrentActivityTest.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -16,7 +16,7 @@
import javax.enterprise.util.AnnotationLiteral;
import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.weld.BeanManagerImpl;
+import org.jboss.weld.manager.BeanManagerImpl;
import org.jboss.weld.test.AbstractWeldTest;
import org.testng.annotations.Test;
Modified: core/trunk/tests/src/test/java/org/jboss/weld/tests/beanManager/serializability/ManagerTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/beanManager/serializability/ManagerTest.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/beanManager/serializability/ManagerTest.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -13,8 +13,8 @@
import org.jboss.testharness.impl.packaging.Artifact;
import org.jboss.testharness.impl.packaging.Packaging;
-import org.jboss.weld.BeanManagerImpl;
import org.jboss.weld.literal.DefaultLiteral;
+import org.jboss.weld.manager.BeanManagerImpl;
import org.jboss.weld.test.AbstractWeldTest;
import org.testng.annotations.Test;
Modified: core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/broken/SimpleAbstractDecoratorWithInvalidAbstractMethodTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/broken/SimpleAbstractDecoratorWithInvalidAbstractMethodTest.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/broken/SimpleAbstractDecoratorWithInvalidAbstractMethodTest.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -20,7 +20,7 @@
import org.jboss.testharness.impl.packaging.Artifact;
import org.jboss.testharness.impl.packaging.ExpectedDeploymentException;
import org.jboss.testharness.impl.packaging.jsr299.BeansXml;
-import org.jboss.weld.DefinitionException;
+import org.jboss.weld.exceptions.DefinitionException;
import org.jboss.weld.test.AbstractWeldTest;
import org.testng.annotations.Test;
Modified: core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/custom/CustomDecoratorTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/custom/CustomDecoratorTest.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/custom/CustomDecoratorTest.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -23,13 +23,13 @@
import javax.enterprise.inject.spi.Bean;
import javax.enterprise.context.spi.CreationalContext;
+import org.jboss.weld.manager.BeanManagerImpl;
import org.jboss.weld.mock.TestContainer;
import org.jboss.weld.mock.MockServletLifecycle;
import org.jboss.weld.mock.MockBeanDeploymentArchive;
import org.jboss.weld.mock.MockDeployment;
import org.jboss.weld.util.serviceProvider.ServiceLoaderFactory;
import org.jboss.weld.util.serviceProvider.PackageServiceLoaderFactory;
-import org.jboss.weld.BeanManagerImpl;
import org.testng.annotations.Test;
Modified: core/trunk/tests/src/test/java/org/jboss/weld/tests/event/SimpleEventTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/event/SimpleEventTest.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/event/SimpleEventTest.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -7,7 +7,7 @@
import javax.inject.Inject;
import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.weld.BeanManagerImpl;
+import org.jboss.weld.manager.BeanManagerImpl;
import org.jboss.weld.test.AbstractWeldTest;
import org.testng.annotations.Test;
Modified: core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/passivation/broken/interceptorWithNonSerializableField/InterceptorWithNonSerializableFieldOnPassivatingBean.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/passivation/broken/interceptorWithNonSerializableField/InterceptorWithNonSerializableFieldOnPassivatingBean.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/passivation/broken/interceptorWithNonSerializableField/InterceptorWithNonSerializableFieldOnPassivatingBean.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -21,7 +21,7 @@
import org.jboss.testharness.impl.packaging.ExpectedDeploymentException;
import org.jboss.testharness.impl.packaging.IntegrationTest;
import org.jboss.testharness.impl.packaging.jsr299.BeansXml;
-import org.jboss.weld.DeploymentException;
+import org.jboss.weld.exceptions.DeploymentException;
import org.jboss.weld.test.AbstractWeldTest;
import org.testng.annotations.Test;
Modified: core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/passivation/broken/nonSerializableInterceptor/NonPassivatingInterceptorOnPassivatingBean.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/passivation/broken/nonSerializableInterceptor/NonPassivatingInterceptorOnPassivatingBean.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/passivation/broken/nonSerializableInterceptor/NonPassivatingInterceptorOnPassivatingBean.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -21,7 +21,7 @@
import org.jboss.testharness.impl.packaging.ExpectedDeploymentException;
import org.jboss.testharness.impl.packaging.IntegrationTest;
import org.jboss.testharness.impl.packaging.jsr299.BeansXml;
-import org.jboss.weld.DeploymentException;
+import org.jboss.weld.exceptions.DeploymentException;
import org.jboss.weld.test.AbstractWeldTest;
import org.testng.annotations.Test;
Modified: core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/cluster/NaiveClusterTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/cluster/NaiveClusterTest.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/cluster/NaiveClusterTest.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -5,7 +5,7 @@
import javax.enterprise.inject.spi.Bean;
-import org.jboss.weld.BeanManagerImpl;
+import org.jboss.weld.manager.BeanManagerImpl;
import org.jboss.weld.mock.TestContainer;
import org.jboss.weld.mock.cluster.AbstractClusterTest;
import org.testng.annotations.Test;
Modified: core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/deployment/structure/extensions/NonBdaExtensionTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/deployment/structure/extensions/NonBdaExtensionTest.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/deployment/structure/extensions/NonBdaExtensionTest.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -2,9 +2,9 @@
import javax.enterprise.inject.spi.Extension;
-import org.jboss.weld.BeanManagerImpl;
import org.jboss.weld.bootstrap.spi.BeanDeploymentArchive;
import org.jboss.weld.bootstrap.spi.Deployment;
+import org.jboss.weld.manager.BeanManagerImpl;
import org.jboss.weld.mock.AbstractMockDeployment;
import org.jboss.weld.mock.MockBeanDeploymentArchive;
import org.jboss.weld.mock.MockServletLifecycle;
Modified: core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/deployment/structure/nonTransitiveResolution/TransitiveResolutionTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/deployment/structure/nonTransitiveResolution/TransitiveResolutionTest.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/deployment/structure/nonTransitiveResolution/TransitiveResolutionTest.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -1,8 +1,8 @@
package org.jboss.weld.tests.unit.deployment.structure.nonTransitiveResolution;
-import org.jboss.weld.BeanManagerImpl;
import org.jboss.weld.bootstrap.spi.BeanDeploymentArchive;
import org.jboss.weld.bootstrap.spi.Deployment;
+import org.jboss.weld.manager.BeanManagerImpl;
import org.jboss.weld.mock.AbstractMockDeployment;
import org.jboss.weld.mock.MockBeanDeploymentArchive;
import org.jboss.weld.mock.MockDeployment;
Modified: core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/deployment/structure/resolution/AccessibleManagerResolutionTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/deployment/structure/resolution/AccessibleManagerResolutionTest.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/deployment/structure/resolution/AccessibleManagerResolutionTest.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -4,7 +4,6 @@
import javax.enterprise.inject.spi.Bean;
-import org.jboss.weld.BeanManagerImpl;
import org.jboss.weld.Container;
import org.jboss.weld.ContextualStoreImpl;
import org.jboss.weld.bean.ManagedBean;
@@ -15,6 +14,7 @@
import org.jboss.weld.ejb.EjbDescriptors;
import org.jboss.weld.introspector.WeldClass;
import org.jboss.weld.introspector.jlr.WeldClassImpl;
+import org.jboss.weld.manager.BeanManagerImpl;
import org.jboss.weld.metadata.TypeStore;
import org.jboss.weld.metadata.cache.MetaAnnotationStore;
import org.jboss.weld.resources.ClassTransformer;
Modified: core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/environments/servlet/ServletEnvironmentTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/environments/servlet/ServletEnvironmentTest.java 2010-01-08 12:25:43 UTC (rev 5397)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/environments/servlet/ServletEnvironmentTest.java 2010-01-08 13:59:36 UTC (rev 5398)
@@ -8,9 +8,9 @@
import javax.enterprise.inject.spi.Bean;
import javax.enterprise.util.AnnotationLiteral;
-import org.jboss.weld.BeanManagerImpl;
import org.jboss.weld.bean.ManagedBean;
import org.jboss.weld.bean.RIBean;
+import org.jboss.weld.manager.BeanManagerImpl;
import org.jboss.weld.mock.MockServletLifecycle;
import org.jboss.weld.mock.TestContainer;
import org.testng.annotations.AfterClass;
15 years
Weld SVN: r5397 - in examples/trunk: jsf/login and 3 other directories.
by weld-commits@lists.jboss.org
Author: kpiwko(a)redhat.com
Date: 2010-01-08 07:25:43 -0500 (Fri, 08 Jan 2010)
New Revision: 5397
Modified:
examples/trunk/jsf/login/pom.xml
examples/trunk/jsf/numberguess/pom.xml
examples/trunk/jsf/permalink/pom.xml
examples/trunk/jsf/translator/ear/pom.xml
examples/trunk/pom.xml
Log:
WELD-368
Modified: examples/trunk/jsf/login/pom.xml
===================================================================
--- examples/trunk/jsf/login/pom.xml 2010-01-08 09:13:54 UTC (rev 5396)
+++ examples/trunk/jsf/login/pom.xml 2010-01-08 12:25:43 UTC (rev 5397)
@@ -77,13 +77,14 @@
</activation>
<properties>
+ <ftest.artifact>ftest-login</ftest.artifact>
<ftest.version>0.1${ftest.version.discriminator}</ftest.version>
</properties>
<dependencies>
<dependency>
<groupId>org.jboss.weld.examples.ftest</groupId>
- <artifactId>ftest-login</artifactId>
+ <artifactId>${ftest.artifact}</artifactId>
<version>${ftest.version}</version>
<scope>test</scope>
</dependency>
@@ -92,6 +93,10 @@
<build>
<plugins>
<plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ </plugin>
+ <plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
</plugin>
@@ -100,6 +105,10 @@
<artifactId>selenium-maven-plugin</artifactId>
</plugin>
<plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>failsafe-maven-plugin</artifactId>
+ </plugin>
+ <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
</plugin>
@@ -113,13 +122,14 @@
</activation>
<properties>
+ <ftest.artifact>ftest-login</ftest.artifact>
<ftest.version>0.1${ftest.version.discriminator}</ftest.version>
</properties>
<dependencies>
<dependency>
<groupId>org.jboss.weld.examples.ftest</groupId>
- <artifactId>ftest-login</artifactId>
+ <artifactId>${ftest.artifact}</artifactId>
<version>${ftest.version}</version>
<scope>test</scope>
</dependency>
@@ -128,6 +138,10 @@
<build>
<plugins>
<plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ </plugin>
+ <plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
</plugin>
@@ -136,13 +150,16 @@
<artifactId>selenium-maven-plugin</artifactId>
</plugin>
<plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>failsafe-maven-plugin</artifactId>
+ </plugin>
+ <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
</plugin>
</plugins>
</build>
</profile>
-
</profiles>
</project>
Modified: examples/trunk/jsf/numberguess/pom.xml
===================================================================
--- examples/trunk/jsf/numberguess/pom.xml 2010-01-08 09:13:54 UTC (rev 5396)
+++ examples/trunk/jsf/numberguess/pom.xml 2010-01-08 12:25:43 UTC (rev 5397)
@@ -439,6 +439,7 @@
</build>
</profile>
+ <!-- functional tests -->
<profile>
<id>ftest-jboss-remote-51</id>
<activation>
@@ -446,13 +447,14 @@
</activation>
<properties>
+ <ftest.artifact>ftest-numberguess</ftest.artifact>
<ftest.version>0.1${ftest.version.discriminator}</ftest.version>
</properties>
<dependencies>
<dependency>
<groupId>org.jboss.weld.examples.ftest</groupId>
- <artifactId>ftest-numberguess</artifactId>
+ <artifactId>${ftest.artifact}</artifactId>
<version>${ftest.version}</version>
<scope>test</scope>
</dependency>
@@ -461,6 +463,10 @@
<build>
<plugins>
<plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ </plugin>
+ <plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
</plugin>
@@ -469,6 +475,10 @@
<artifactId>selenium-maven-plugin</artifactId>
</plugin>
<plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>failsafe-maven-plugin</artifactId>
+ </plugin>
+ <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
</plugin>
@@ -482,13 +492,14 @@
</activation>
<properties>
+ <ftest.artifact>ftest-numberguess</ftest.artifact>
<ftest.version>0.1${ftest.version.discriminator}</ftest.version>
</properties>
<dependencies>
<dependency>
<groupId>org.jboss.weld.examples.ftest</groupId>
- <artifactId>ftest-numberguess</artifactId>
+ <artifactId>${ftest.artifact}</artifactId>
<version>${ftest.version}</version>
<scope>test</scope>
</dependency>
@@ -497,6 +508,10 @@
<build>
<plugins>
<plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ </plugin>
+ <plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
</plugin>
@@ -505,6 +520,10 @@
<artifactId>selenium-maven-plugin</artifactId>
</plugin>
<plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>failsafe-maven-plugin</artifactId>
+ </plugin>
+ <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
</plugin>
Modified: examples/trunk/jsf/permalink/pom.xml
===================================================================
--- examples/trunk/jsf/permalink/pom.xml 2010-01-08 09:13:54 UTC (rev 5396)
+++ examples/trunk/jsf/permalink/pom.xml 2010-01-08 12:25:43 UTC (rev 5397)
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
@@ -424,7 +425,8 @@
<artifactId>maven-jetty-plugin</artifactId>
<configuration>
<connectors>
- <connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
+ <connector
+ implementation="org.mortbay.jetty.nio.SelectChannelConnector">
<port>${jetty.http.port}</port>
<maxIdleTime>3600000</maxIdleTime>
</connector>
@@ -442,7 +444,6 @@
</build>
</profile>
-
<profile>
<id>ftest-jboss-remote-51</id>
<activation>
@@ -450,13 +451,14 @@
</activation>
<properties>
+ <ftest.artifact>ftest-permalink</ftest.artifact>
<ftest.version>0.1${ftest.version.discriminator}</ftest.version>
</properties>
<dependencies>
<dependency>
<groupId>org.jboss.weld.examples.ftest</groupId>
- <artifactId>ftest-permalink</artifactId>
+ <artifactId>${ftest.artifact}</artifactId>
<version>${ftest.version}</version>
<scope>test</scope>
</dependency>
@@ -465,6 +467,10 @@
<build>
<plugins>
<plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ </plugin>
+ <plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
</plugin>
@@ -473,13 +479,16 @@
<artifactId>selenium-maven-plugin</artifactId>
</plugin>
<plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>failsafe-maven-plugin</artifactId>
+ </plugin>
+ <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
</plugin>
</plugins>
</build>
</profile>
-
<profile>
<id>ftest-jboss-remote-60</id>
<activation>
@@ -487,13 +496,14 @@
</activation>
<properties>
+ <ftest.artifact>ftest-permalink</ftest.artifact>
<ftest.version>0.1${ftest.version.discriminator}</ftest.version>
</properties>
<dependencies>
<dependency>
<groupId>org.jboss.weld.examples.ftest</groupId>
- <artifactId>ftest-permalink</artifactId>
+ <artifactId>${ftest.artifact}</artifactId>
<version>${ftest.version}</version>
<scope>test</scope>
</dependency>
@@ -502,6 +512,10 @@
<build>
<plugins>
<plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ </plugin>
+ <plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
</plugin>
@@ -510,6 +524,10 @@
<artifactId>selenium-maven-plugin</artifactId>
</plugin>
<plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>failsafe-maven-plugin</artifactId>
+ </plugin>
+ <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
</plugin>
@@ -532,9 +550,10 @@
<!--
<executions> <execution> <id>touch-web-inf</id>
<phase>validate</phase> <configuration> <tasks>
- <touch file="${webapp.directory}/WEB-INF/web.xml" />
- </tasks> </configuration> <goals> <goal>run</goal>
- </goals> </execution> </executions>
+ <touch file="${webapp.directory}/WEB-INF/web.xml"
+ /> </tasks> </configuration> <goals>
+ <goal>run</goal> </goals> </execution>
+ </executions>
-->
</plugin>
</plugins>
Modified: examples/trunk/jsf/translator/ear/pom.xml
===================================================================
--- examples/trunk/jsf/translator/ear/pom.xml 2010-01-08 09:13:54 UTC (rev 5396)
+++ examples/trunk/jsf/translator/ear/pom.xml 2010-01-08 12:25:43 UTC (rev 5397)
@@ -65,13 +65,14 @@
</activation>
<properties>
+ <ftest.artifact>ftest-translator</ftest.artifact>
<ftest.version>0.1${ftest.version.discriminator}</ftest.version>
</properties>
<dependencies>
<dependency>
<groupId>org.jboss.weld.examples.ftest</groupId>
- <artifactId>ftest-translator</artifactId>
+ <artifactId>${ftest.artifact}</artifactId>
<version>${ftest.version}</version>
<scope>test</scope>
</dependency>
@@ -80,6 +81,10 @@
<build>
<plugins>
<plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ </plugin>
+ <plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
</plugin>
@@ -88,6 +93,10 @@
<artifactId>selenium-maven-plugin</artifactId>
</plugin>
<plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>failsafe-maven-plugin</artifactId>
+ </plugin>
+ <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
</plugin>
@@ -101,13 +110,14 @@
</activation>
<properties>
+ <ftest.artifact>ftest-translator</ftest.artifact>
<ftest.version>0.1${ftest.version.discriminator}</ftest.version>
</properties>
<dependencies>
<dependency>
<groupId>org.jboss.weld.examples.ftest</groupId>
- <artifactId>ftest-translator</artifactId>
+ <artifactId>${ftest.artifact}</artifactId>
<version>${ftest.version}</version>
<scope>test</scope>
</dependency>
@@ -116,6 +126,10 @@
<build>
<plugins>
<plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ </plugin>
+ <plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
</plugin>
@@ -124,13 +138,16 @@
<artifactId>selenium-maven-plugin</artifactId>
</plugin>
<plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>failsafe-maven-plugin</artifactId>
+ </plugin>
+ <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
</plugin>
</plugins>
</build>
</profile>
-
</profiles>
Modified: examples/trunk/pom.xml
===================================================================
--- examples/trunk/pom.xml 2010-01-08 09:13:54 UTC (rev 5396)
+++ examples/trunk/pom.xml 2010-01-08 12:25:43 UTC (rev 5397)
@@ -99,6 +99,7 @@
<selenium.maven.plugin.version>1.0</selenium.maven.plugin.version>
<cargo.maven2.plugin.version>1.0</cargo.maven2.plugin.version>
<maven.antrun.plugin.version>1.3</maven.antrun.plugin.version>
+ <failsafe.maven.plugin.version>2.4.3-alpha-1</failsafe.maven.plugin.version>
<ant.junit.version>1.6.2</ant.junit.version>
<ftest.version.discriminator></ftest.version.discriminator>
<selenium.browser>*firefoxproxy</selenium.browser>
@@ -289,12 +290,37 @@
<build>
<pluginManagement>
<plugins>
- <!-- deploy war/ear file to container -->
+ <!-- get functional tests from ftest artifact -->
<plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>copy-ftest</id>
+ <phase>process-sources</phase>
+ <goals>
+ <goal>copy</goal>
+ </goals>
+ <configuration>
+ <outputDirectory>${project.build.directory}/ftest</outputDirectory>
+ <stripVersion>true</stripVersion>
+ <artifactItems>
+ <artifactItem>
+ <groupId>org.jboss.weld.examples.ftest</groupId>
+ <artifactId>${ftest.artifact}</artifactId>
+ <overWrite>true</overWrite>
+ </artifactItem>
+ </artifactItems>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <!-- deploy/undeploy application archive to/from container -->
+ <plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>${cargo.maven2.plugin.version}</version>
-
<configuration>
<container>
<containerId>jboss5x</containerId>
@@ -304,7 +330,6 @@
<type>runtime</type>
</configuration>
</configuration>
-
<executions>
<execution>
<id>deploy</id>
@@ -313,7 +338,6 @@
<goal>deploy</goal>
</goals>
</execution>
-
<execution>
<id>undeploy</id>
<phase>post-integration-test</phase>
@@ -323,6 +347,7 @@
</execution>
</executions>
</plugin>
+
<!-- start Selenium server -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
@@ -341,10 +366,10 @@
</configuration>
</execution>
<!--
- this can't be used until plugin send the
+ this can't be used until plugin sends the
right command, using Ant GET instead
-->
- <!--
+ <!--
<execution> <id>stop-selenium</id>
<phase>post-integration-test</phase> <goals>
<goal>stop-server</goal> </goals>
@@ -355,70 +380,77 @@
</executions>
</plugin>
- <!-- launch tests -->
+ <!-- run functional tests -->
<plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>failsafe-maven-plugin</artifactId>
+ <version>${failsafe.maven.plugin.version}</version>
+ <configuration>
+ <testClassesDirectory>${project.build.directory}/ftest</testClassesDirectory>
+ <suiteXmlFiles>
+ <suiteXmlFile>src/test/selenium/${ftest.testsuite}</suiteXmlFile>
+ </suiteXmlFiles>
+ <argLine>-Xmx748m</argLine>
+ <forkMode>once</forkMode>
+ <systemProperties>
+ <property>
+ <name>selenium.server.port</name>
+ <value>${selenium.server.port}</value>
+ </property>
+ <property>
+ <name>selenium.server.host</name>
+ <value>${selenium.server.host}</value>
+ </property>
+ <property>
+ <name>selenium.browser</name>
+ <value>${selenium.browser}</value>
+ </property>
+ <property>
+ <name>selenium.browser.url</name>
+ <value>${selenium.browser.url}</value>
+ </property>
+ <property>
+ <name>selenium.speed</name>
+ <value>${selenium.speed}</value>
+ </property>
+ <property>
+ <name>selenium.timeout</name>
+ <value>${selenium.timeout}</value>
+ </property>
+ <property>
+ <name>basedir</name>
+ <value>${basedir}</value>
+ </property>
+ </systemProperties>
+ </configuration>
+ <executions>
+ <execution>
+ <id>integration-test</id>
+ <phase>integration-test</phase>
+ <goals>
+ <goal>integration-test</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>verify</id>
+ <phase>verify</phase>
+ <goals>
+ <goal>verify</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+
+ <!-- stop Selenium -->
+ <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>${maven.antrun.plugin.version}</version>
- <!-- generate JUnit like report -->
- <dependencies>
- <dependency>
- <groupId>ant</groupId>
- <artifactId>ant-junit</artifactId>
- <version>${ant.junit.version}</version>
- </dependency>
- </dependencies>
-
<executions>
<!-- this ant script runs testng natively -->
<execution>
- <id>testng</id>
- <phase>integration-test</phase>
- <configuration>
- <tasks>
- <taskdef resource="testngtasks"
- classpath="testng.jar" classpathref="maven.test.classpath" />
- <testng classpathref="maven.test.classpath"
- outputdir="${project.build.directory}/test-reports"
- haltonfailure="false">
- <xmlfileset dir="src/test/selenium"
- includes="${ftest.testsuite}" />
- <sysproperty key="selenium.server.port"
- value="${selenium.server.port}" />
- <sysproperty key="selenium.server.host"
- value="${selenium.server.host}" />
- <sysproperty key="selenium.browser"
- value="${selenium.browser}" />
- <sysproperty key="selenium.browser.url"
- value="${selenium.browser.url}" />
- <sysproperty key="selenium.speed"
- value="${selenium.speed}" />
- <sysproperty key="selenium.timeout"
- value="${selenium.timeout}" />
- <sysproperty key="basedir"
- value="${basedir}" />
- </testng>
-
- <junitreport
- todir="${project.build.directory}/test-reports">
- <fileset
- dir="${project.build.directory}/test-reports">
- <include name="**/*.xml" />
- <exclude name="**/*testng*.xml" />
- <exclude
- name="**/TESTS-TestSuites.xml" />
- </fileset>
- <report format="noframes"
- todir="${project.build.directory}/test-reports" />
- </junitreport>
- </tasks>
- </configuration>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
- <execution>
<id>stop-selenium</id>
<phase>post-integration-test</phase>
<configuration>
@@ -434,7 +466,7 @@
<goals>
<goal>run</goal>
</goals>
- </execution>
+ </execution>
</executions>
</plugin>
</plugins>
@@ -477,12 +509,37 @@
<build>
<pluginManagement>
<plugins>
- <!-- deploy war/ear file to container -->
+ <!-- get functional tests from ftest artifact -->
<plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>copy-ftest</id>
+ <phase>process-sources</phase>
+ <goals>
+ <goal>copy</goal>
+ </goals>
+ <configuration>
+ <outputDirectory>${project.build.directory}/ftest</outputDirectory>
+ <stripVersion>true</stripVersion>
+ <artifactItems>
+ <artifactItem>
+ <groupId>org.jboss.weld.examples.ftest</groupId>
+ <artifactId>${ftest.artifact}</artifactId>
+ <overWrite>true</overWrite>
+ </artifactItem>
+ </artifactItems>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <!-- deploy/undeploy application archive to/from container -->
+ <plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>${cargo.maven2.plugin.version}</version>
-
<configuration>
<container>
<containerId>jboss5x</containerId>
@@ -492,7 +549,6 @@
<type>runtime</type>
</configuration>
</configuration>
-
<executions>
<execution>
<id>deploy</id>
@@ -501,7 +557,6 @@
<goal>deploy</goal>
</goals>
</execution>
-
<execution>
<id>undeploy</id>
<phase>post-integration-test</phase>
@@ -511,6 +566,7 @@
</execution>
</executions>
</plugin>
+
<!-- start Selenium server -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
@@ -529,7 +585,7 @@
</configuration>
</execution>
<!--
- this can't be used until plugin send the
+ this can't be used until plugin sends the
right command, using Ant GET instead
-->
<!--
@@ -543,70 +599,77 @@
</executions>
</plugin>
- <!-- launch tests -->
+ <!-- run functional tests -->
<plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>failsafe-maven-plugin</artifactId>
+ <version>${failsafe.maven.plugin.version}</version>
+ <configuration>
+ <testClassesDirectory>${project.build.directory}/ftest</testClassesDirectory>
+ <suiteXmlFiles>
+ <suiteXmlFile>src/test/selenium/${ftest.testsuite}</suiteXmlFile>
+ </suiteXmlFiles>
+ <argLine>-Xmx748m</argLine>
+ <forkMode>once</forkMode>
+ <systemProperties>
+ <property>
+ <name>selenium.server.port</name>
+ <value>${selenium.server.port}</value>
+ </property>
+ <property>
+ <name>selenium.server.host</name>
+ <value>${selenium.server.host}</value>
+ </property>
+ <property>
+ <name>selenium.browser</name>
+ <value>${selenium.browser}</value>
+ </property>
+ <property>
+ <name>selenium.browser.url</name>
+ <value>${selenium.browser.url}</value>
+ </property>
+ <property>
+ <name>selenium.speed</name>
+ <value>${selenium.speed}</value>
+ </property>
+ <property>
+ <name>selenium.timeout</name>
+ <value>${selenium.timeout}</value>
+ </property>
+ <property>
+ <name>basedir</name>
+ <value>${basedir}</value>
+ </property>
+ </systemProperties>
+ </configuration>
+ <executions>
+ <execution>
+ <id>integration-test</id>
+ <phase>integration-test</phase>
+ <goals>
+ <goal>integration-test</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>verify</id>
+ <phase>verify</phase>
+ <goals>
+ <goal>verify</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+
+ <!-- stop Selenium -->
+ <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>${maven.antrun.plugin.version}</version>
- <!-- generate JUnit like report -->
- <dependencies>
- <dependency>
- <groupId>ant</groupId>
- <artifactId>ant-junit</artifactId>
- <version>${ant.junit.version}</version>
- </dependency>
- </dependencies>
-
<executions>
<!-- this ant script runs testng natively -->
<execution>
- <id>testng</id>
- <phase>integration-test</phase>
- <configuration>
- <tasks>
- <taskdef resource="testngtasks"
- classpath="testng.jar" classpathref="maven.test.classpath" />
- <testng classpathref="maven.test.classpath"
- outputdir="${project.build.directory}/test-reports"
- haltonfailure="false">
- <xmlfileset dir="src/test/selenium"
- includes="${ftest.testsuite}" />
- <sysproperty key="selenium.server.port"
- value="${selenium.server.port}" />
- <sysproperty key="selenium.server.host"
- value="${selenium.server.host}" />
- <sysproperty key="selenium.browser"
- value="${selenium.browser}" />
- <sysproperty key="selenium.browser.url"
- value="${selenium.browser.url}" />
- <sysproperty key="selenium.speed"
- value="${selenium.speed}" />
- <sysproperty key="selenium.timeout"
- value="${selenium.timeout}" />
- <sysproperty key="basedir"
- value="${basedir}" />
- </testng>
-
- <junitreport
- todir="${project.build.directory}/test-reports">
- <fileset
- dir="${project.build.directory}/test-reports">
- <include name="**/*.xml" />
- <exclude name="**/*testng*.xml" />
- <exclude
- name="**/TESTS-TestSuites.xml" />
- </fileset>
- <report format="noframes"
- todir="${project.build.directory}/test-reports" />
- </junitreport>
- </tasks>
- </configuration>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
- <execution>
<id>stop-selenium</id>
<phase>post-integration-test</phase>
<configuration>
15 years
Weld SVN: r5396 - ftest/trunk.
by weld-commits@lists.jboss.org
Author: mgencur(a)redhat.com
Date: 2010-01-08 04:13:54 -0500 (Fri, 08 Jan 2010)
New Revision: 5396
Modified:
ftest/trunk/pom.xml
Log:
added new module entry for permalink ftest
Modified: ftest/trunk/pom.xml
===================================================================
--- ftest/trunk/pom.xml 2010-01-07 23:48:38 UTC (rev 5395)
+++ ftest/trunk/pom.xml 2010-01-08 09:13:54 UTC (rev 5396)
@@ -20,6 +20,7 @@
<module>numberguess</module>
<module>login</module>
<module>translator</module>
+ <module>permalink</module>
</modules>
<properties>
15 years
Weld SVN: r5395 - core/trunk/impl/src/main/java/org/jboss/weld/context/beanstore.
by weld-commits@lists.jboss.org
Author: dallen6
Date: 2010-01-07 18:48:38 -0500 (Thu, 07 Jan 2010)
New Revision: 5395
Modified:
core/trunk/impl/src/main/java/org/jboss/weld/context/beanstore/AbstractAttributeBackedBeanStore.java
Log:
WELD-366
Modified: core/trunk/impl/src/main/java/org/jboss/weld/context/beanstore/AbstractAttributeBackedBeanStore.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/context/beanstore/AbstractAttributeBackedBeanStore.java 2010-01-07 19:08:13 UTC (rev 5394)
+++ core/trunk/impl/src/main/java/org/jboss/weld/context/beanstore/AbstractAttributeBackedBeanStore.java 2010-01-07 23:48:38 UTC (rev 5395)
@@ -162,6 +162,6 @@
@Override
public String toString()
{
- return "holding " + Names.count(getContextualIds()) + " instances";
+ return this.getClass().getName();
}
}
15 years
Weld SVN: r5394 - doc/trunk/reference/en-US.
by weld-commits@lists.jboss.org
Author: gavin.king(a)jboss.com
Date: 2010-01-07 14:08:13 -0500 (Thu, 07 Jan 2010)
New Revision: 5394
Modified:
doc/trunk/reference/en-US/beans.xml
Log:
bean types of EJBs
Modified: doc/trunk/reference/en-US/beans.xml
===================================================================
--- doc/trunk/reference/en-US/beans.xml 2010-01-07 18:21:11 UTC (rev 5393)
+++ doc/trunk/reference/en-US/beans.xml 2010-01-07 19:08:13 UTC (rev 5394)
@@ -113,8 +113,8 @@
<para>
A bean type is a user-defined class or interface; a type that is client-visible. If the bean is an EJB
- session bean, the bean type is the <literal>@Local</literal> interface or bean-class local view. A bean may
- have multiple bean types. For example, the following bean has four bean types:
+ session bean, the bean type is the <literal>@Local</literal> interface or bean-class local view. A bean
+ may have multiple bean types. For example, the following bean has four bean types:
</para>
<programlisting role="JAVA"><![CDATA[public class BookShop
@@ -144,8 +144,10 @@
<note>
<para>
- Most bean types you can probably figure out. One gotcha is primitive types. All primitive types are assumed
- to be identical to their corresponding wrapper types in <literal>java.lang</literal>.
+ The bean types of a session bean include local interfaces and the bean class local view (if any).
+ EJB remote interfaces are not considered bean types of a session bean. You can't inject an EJB using
+ its remote interface unless you define a <emphasis>resource</emphasis>, which we'll meet in
+ <xref linkend="resources"/>.
</para>
</note>
@@ -345,8 +347,8 @@
</section>
- <!-- TODO the alternative section needs to be spruced up to support the text that comes in subsequent chapters. The
- reader needs to feel confident than they would know how to create an alternative and enable it. -->
+ <!-- TODO the alternative section needs to be spruced up to support the text that comes in subsequent chapters.
+ The reader needs to feel confident than they would know how to create an alternative and enable it. -->
<section>
<title>Alternatives</title>
@@ -701,6 +703,14 @@
</listitem>
</itemizedlist>
+ <note>
+ <para>
+ Producer methods and fields may have a primitive bean type. For the purpose of resolving dependencies,
+ primitive types are considered to be identical to their corresponding wrapper types in
+ <literal>java.lang</literal>.
+ </para>
+ </note>
+
<para>
If the producer method has method parameters, the container will look for a bean that satisfies the type
and qualifiers of each parameter and pass it to the method automatically—another form of
15 years
Weld SVN: r5393 - core/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/ee and 1 other directories.
by weld-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2010-01-07 13:21:11 -0500 (Thu, 07 Jan 2010)
New Revision: 5393
Removed:
cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/resource/persistenceContext/PersistenceContextDesctructionTest.java
core/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/ee/PersistenceContextProducerField.java
Modified:
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/AbstractBeanDeployer.java
Log:
WELD-341
Deleted: cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/resource/persistenceContext/PersistenceContextDesctructionTest.java
===================================================================
--- cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/resource/persistenceContext/PersistenceContextDesctructionTest.java 2010-01-07 16:49:41 UTC (rev 5392)
+++ cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/resource/persistenceContext/PersistenceContextDesctructionTest.java 2010-01-07 18:21:11 UTC (rev 5393)
@@ -1,49 +0,0 @@
-package org.jboss.jsr299.tck.tests.implementation.simple.resource.persistenceContext;
-
-import javax.enterprise.context.spi.CreationalContext;
-import javax.enterprise.inject.spi.Bean;
-import javax.persistence.EntityManager;
-
-import org.jboss.jsr299.tck.AbstractJSR299Test;
-import org.jboss.test.audit.annotations.SpecAssertion;
-import org.jboss.test.audit.annotations.SpecAssertions;
-import org.jboss.test.audit.annotations.SpecVersion;
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.testharness.impl.packaging.IntegrationTest;
-import org.jboss.testharness.impl.packaging.Packaging;
-import org.jboss.testharness.impl.packaging.PackagingType;
-import org.jboss.testharness.impl.packaging.Resource;
-import org.jboss.testharness.impl.packaging.jsr299.BeansXml;
-import org.testng.annotations.Test;
-
-/**
- * Injection of persistence related objects.
- *
- * @author David Allen
- */
-@Artifact
-(a)Packaging(PackagingType.WAR)
-@IntegrationTest
-@Resource(source = "persistence.xml", destination = "WEB-INF/classes/META-INF/persistence.xml")
-//@PersistenceXml("persistence.xml")
-@BeansXml("beans.xml")
-@SpecVersion(spec="cdi", version="20091101")
-public class PersistenceContextDesctructionTest extends AbstractJSR299Test
-{
-
- @Test(groups = { "beanLifecycle", "commonAnnotations", "integration" })
- @SpecAssertions( {
- @SpecAssertion(section="7.3.6", id = "nb")
- })
- public void testDestructionOfPersistenceContext() throws Exception
- {
- Bean<ManagedBean> managedBean = getBeans(ManagedBean.class).iterator().next();
- CreationalContext<ManagedBean> creationalContext = getCurrentManager().createCreationalContext(managedBean);
- ManagedBean instance = managedBean.create(creationalContext);
- EntityManager em = instance.getPersistenceContext();
- assert em.isOpen();
- managedBean.destroy(instance, creationalContext);
- assert !em.isOpen();
- }
-
-}
Deleted: core/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/ee/PersistenceContextProducerField.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/ee/PersistenceContextProducerField.java 2010-01-07 16:49:41 UTC (rev 5392)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/ee/PersistenceContextProducerField.java 2010-01-07 18:21:11 UTC (rev 5393)
@@ -1,61 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.weld.bean.builtin.ee;
-
-import javax.persistence.EntityManager;
-
-import org.jboss.weld.BeanManagerImpl;
-import org.jboss.weld.bean.AbstractClassBean;
-import org.jboss.weld.introspector.WeldField;
-
-/**
- * @author pmuir
- *
- */
-public class PersistenceContextProducerField<X, T extends EntityManager> extends EEResourceProducerField<X, T>
-{
-
- /**
- * Creates an EE resource producer field
- *
- * @param field The underlying method abstraction
- * @param declaringBean The declaring bean abstraction
- * @param manager the current manager
- * @return A producer field
- */
- public static <X, T extends EntityManager> EEResourceProducerField<X, T> of(WeldField<T, X> field, AbstractClassBean<X> declaringBean, BeanManagerImpl manager)
- {
- return new PersistenceContextProducerField<X, T>(field, declaringBean, manager);
- }
-
- /**
- * @param field
- * @param declaringBean
- * @param manager
- */
- protected PersistenceContextProducerField(WeldField<T, X> field, AbstractClassBean<X> declaringBean, BeanManagerImpl manager)
- {
- super(field, declaringBean, manager);
- }
-
- @Override
- protected void defaultDispose(T instance)
- {
- instance.close();
- }
-
-}
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/AbstractBeanDeployer.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/AbstractBeanDeployer.java 2010-01-07 16:49:41 UTC (rev 5392)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/AbstractBeanDeployer.java 2010-01-07 18:21:11 UTC (rev 5393)
@@ -47,7 +47,6 @@
import org.jboss.weld.bean.RIBean;
import org.jboss.weld.bean.SessionBean;
import org.jboss.weld.bean.builtin.ee.EEResourceProducerField;
-import org.jboss.weld.bean.builtin.ee.PersistenceContextProducerField;
import org.jboss.weld.bootstrap.events.ProcessBeanImpl;
import org.jboss.weld.bootstrap.events.ProcessBeanInjectionTarget;
import org.jboss.weld.bootstrap.events.ProcessManagedBeanImpl;
@@ -199,12 +198,8 @@
protected <X, T> void createProducerField(AbstractClassBean<X> declaringBean, WeldField<T, X> field)
{
ProducerField<X, T> bean;
- if (isPersistenceContextProducerField(field))
+ if (isEEResourceProducerField(field))
{
- bean = PersistenceContextProducerField.of(field, declaringBean, manager);
- }
- else if (isEEResourceProducerField(field))
- {
bean = EEResourceProducerField.of(field, declaringBean, manager);
}
else
@@ -306,15 +301,9 @@
EJBApiAbstraction ejbApiAbstraction = manager.getServices().get(EJBApiAbstraction.class);
PersistenceApiAbstraction persistenceApiAbstraction = manager.getServices().get(PersistenceApiAbstraction.class);
WSApiAbstraction wsApiAbstraction = manager.getServices().get(WSApiAbstraction.class);
- return field.isAnnotationPresent(ejbApiAbstraction.EJB_ANNOTATION_CLASS) || field.isAnnotationPresent(ejbApiAbstraction.RESOURCE_ANNOTATION_CLASS) || field.isAnnotationPresent(persistenceApiAbstraction.PERSISTENCE_UNIT_ANNOTATION_CLASS) || field.isAnnotationPresent(wsApiAbstraction.WEB_SERVICE_REF_ANNOTATION_CLASS);
+ return field.isAnnotationPresent(ejbApiAbstraction.EJB_ANNOTATION_CLASS) || field.isAnnotationPresent(ejbApiAbstraction.RESOURCE_ANNOTATION_CLASS) || field.isAnnotationPresent(persistenceApiAbstraction.PERSISTENCE_UNIT_ANNOTATION_CLASS) || field.isAnnotationPresent(persistenceApiAbstraction.PERSISTENCE_CONTEXT_ANNOTATION_CLASS) || field.isAnnotationPresent(wsApiAbstraction.WEB_SERVICE_REF_ANNOTATION_CLASS);
}
- protected boolean isPersistenceContextProducerField(WeldField<?, ?> field)
- {
- PersistenceApiAbstraction persistenceApiAbstraction = manager.getServices().get(PersistenceApiAbstraction.class);
- return field.isAnnotationPresent(persistenceApiAbstraction.PERSISTENCE_CONTEXT_ANNOTATION_CLASS);
- }
-
private static boolean hasSimpleWebBeanConstructor(WeldClass<?> type)
{
return type.getNoArgsWeldConstructor() != null || type.getAnnotatedWeldConstructors(Inject.class).size() > 0;
15 years
Weld SVN: r5392 - cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/enterprise.
by weld-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2010-01-07 11:49:41 -0500 (Thu, 07 Jan 2010)
New Revision: 5392
Modified:
cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/enterprise/MegaPoorHenHouse.java
cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/enterprise/PoorHenHouse.java
cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/enterprise/SessionBeanInjectionOrderingTest.java
Log:
WELD-255
Modified: cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/enterprise/MegaPoorHenHouse.java
===================================================================
--- cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/enterprise/MegaPoorHenHouse.java 2010-01-07 16:35:00 UTC (rev 5391)
+++ cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/enterprise/MegaPoorHenHouse.java 2010-01-07 16:49:41 UTC (rev 5392)
@@ -7,14 +7,15 @@
public class MegaPoorHenHouse extends PoorHenHouse implements MegaPoorHenHouseLocal
{
private boolean postConstructCalledAfterSuperclassInitializer = false;
-
+
public Fox getFox()
{
return fox;
}
-
+
@PostConstruct
- public void postConstruct() {
+ public void postConstruct()
+ {
postConstructCalledAfterSuperclassInitializer = initializerCalledAfterSuperclassInjection;
}
@@ -22,7 +23,7 @@
{
return postConstructCalledAfterSuperclassInitializer;
}
-
+
@Override
public boolean isInitializerCalledAfterSuperclassInjection()
{
Modified: cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/enterprise/PoorHenHouse.java
===================================================================
--- cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/enterprise/PoorHenHouse.java 2010-01-07 16:35:00 UTC (rev 5391)
+++ cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/enterprise/PoorHenHouse.java 2010-01-07 16:49:41 UTC (rev 5392)
@@ -2,12 +2,13 @@
import javax.inject.Inject;
-class PoorHenHouse extends HenHouse
+public class PoorHenHouse extends HenHouse
{
protected boolean initializerCalledAfterSuperclassInjection = false;
-
+
@Inject
- public void initialize() {
+ public void initialize()
+ {
initializerCalledAfterSuperclassInjection = fox != null;
}
Modified: cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/enterprise/SessionBeanInjectionOrderingTest.java
===================================================================
--- cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/enterprise/SessionBeanInjectionOrderingTest.java 2010-01-07 16:35:00 UTC (rev 5391)
+++ cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/enterprise/SessionBeanInjectionOrderingTest.java 2010-01-07 16:49:41 UTC (rev 5392)
@@ -32,7 +32,7 @@
public class SessionBeanInjectionOrderingTest extends AbstractJSR299Test
{
- @Test(groups="jboss-as-broken")
+ @Test
@SpecAssertion(section = "5.5.2", id = "bb")
public void testInitializerCalledAfterFieldInjectionOfSuperclass()
{
@@ -40,7 +40,7 @@
assert house.isInitializerCalledAfterSuperclassInjection();
}
- @Test(groups="jboss-as-broken")
+ @Test
@SpecAssertion(section = "5.5.2", id = "bf")
public void testPostConstructCalledAfterInitializerOfSuperclass()
{
15 years
Weld SVN: r5391 - doc/trunk/reference/pt-BR.
by weld-commits@lists.jboss.org
Author: brunolmfg
Date: 2010-01-07 11:35:00 -0500 (Thu, 07 Jan 2010)
New Revision: 5391
Modified:
doc/trunk/reference/pt-BR/beans.po
doc/trunk/reference/pt-BR/decorators.po
doc/trunk/reference/pt-BR/extensions.po
Log:
WELD-17: Translated one section in chapter about beans and transaled chapters about extensions and decorators.
Modified: doc/trunk/reference/pt-BR/beans.po
===================================================================
--- doc/trunk/reference/pt-BR/beans.po 2010-01-07 14:10:21 UTC (rev 5390)
+++ doc/trunk/reference/pt-BR/beans.po 2010-01-07 16:35:00 UTC (rev 5391)
@@ -6,8 +6,8 @@
"Project-Id-Version: Weld_-_JSR-299_Reference_Implementation VERSION\n"
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
"POT-Creation-Date: 2010-01-06 12:17+0000\n"
-"PO-Revision-Date: 2009-12-19 18:06-0300\n"
-"Last-Translator: João Paulo Viragine <joao.viragine(a)redhat.com>\n"
+"PO-Revision-Date: 2010-01-07 14:27-0300\n"
+"Last-Translator: Bruno Leonardo Gonçalves <brunolmfg(a)gmail.com>\n"
"Language-Team: none\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@@ -17,7 +17,7 @@
#: beans.xml:4
#, no-c-format
msgid "More about beans"
-msgstr ""
+msgstr "Mais sobre beans"
#. Tag: para
#: beans.xml:6
@@ -30,6 +30,12 @@
"emphasis> and <emphasis>contextual</emphasis>. The lifecycle of a bean is "
"always managed by the container."
msgstr ""
+"Um bean é usualmente uma classe de aplicação que contém lógica de negócio. "
+"Pode ser chamado diretamente a partir do código Java, ou pode ser invocado "
+"por meio da Unified EL. Um bean pode acessar recursos transacionais. As "
+"dependências entre beans são gerenciadas automaticamente pelo contêiner. A "
+"maioria dos beans são <emphasis>stateful</emphasis> e <emphasis>contextuais</"
+"emphasis>. O ciclo de vida de um bean é sempre gerenciado pelo contêiner."
#. Tag: para
#: beans.xml:13
@@ -43,6 +49,14 @@
"different states. The client-visible state depends upon which instance of "
"the bean the client has a reference to."
msgstr ""
+"Vamos voltar um segundo. O que realmente significa ser <emphasis>contextual</"
+"emphasis>? Uma vez que os beans podem ser stateful, é importante saber "
+"<emphasis>qual</emphasis> instância do bean eu tenho. Ao contrário de um "
+"modelo de componentes stateless (por exemplo, stateless session beans) ou um "
+"modelo de componentes singleton (como servlets, ou singleton beans), "
+"diferentes clientes de um bean vêem o bean em diferentes estados. O estado "
+"visível ao cliente depende de para qual instância do bean o cliente tem uma "
+"referência."
#. Tag: para
#: beans.xml:21
@@ -53,18 +67,24 @@
"of the instance by explicitly creating and destroying it. Instead, the "
"<emphasis>scope</emphasis> of the bean determines:"
msgstr ""
+"No entanto, como em um modelo stateless ou singleton, mas de modo "
+"<emphasis>diferente</emphasis> em stateful session beans, o cliente não "
+"controla o ciclo de vida da instância pela explícita criação e destruição "
+"dela. Em vez disso, o <emphasis>escopo</emphasis> do bean determina:"
#. Tag: para
#: beans.xml:29
#, no-c-format
msgid "the lifecycle of each instance of the bean and"
-msgstr ""
+msgstr "o ciclo de vida de cada instância do bean e"
#. Tag: para
#: beans.xml:32
#, no-c-format
msgid "which clients share a reference to a particular instance of the bean."
msgstr ""
+"quais clientes compartilham uma referência para uma instância específica do "
+"bean."
#. Tag: para
#: beans.xml:36
@@ -76,6 +96,12 @@
"may be shared with certain other threads (for example, if the bean is "
"session scoped) or even all other threads (if it is application scoped)."
msgstr ""
+"Para uma dada thread em uma aplicação CDI, pode haver um <emphasis>contexto "
+"ativo</emphasis> associado com o escopo do bean. Este contexto pode ser "
+"único para a thread (por exemplo, se o bean possui escopo de solicitação), "
+"ou pode ser compartilhado com algumas outras threads (por exemplo, se o bean "
+"possui escopo de sessão) ou mesmo com todas as outras threads (se ele possui "
+"escopo de aplicação)."
#. Tag: para
#: beans.xml:43
@@ -85,6 +111,9 @@
"the same instance of the bean. But clients in a different context may see a "
"different instance (depending on the relationship between the contexts)."
msgstr ""
+"Os clientes (por exemplo, outros beans) executados no mesmo contexto verão a "
+"mesma instância do bean. Mas os clientes em um diferente contexto podem ver "
+"uma instância diferente (dependendo do relacionamento entre os contextos)."
#. Tag: para
#: beans.xml:49
@@ -97,18 +126,24 @@
"messages, and the bean implementations define the lifecycle of their own "
"state. The beans are loosely coupled because:"
msgstr ""
+"Uma grande vantagem do modelo contextual é que ele permite que stateful "
+"beans sejam tratados como serviços! O cliente não precisa se preocupar com "
+"o gerenciamento do ciclo de vida do bean que ele está usando, <emphasis>nem "
+"mesmo precisam saber o que é ciclo de vida.</emphasis> Os beans interagem "
+"passando mensagens, e as implementações do bean definem o ciclo de vida de "
+"seu próprio estado. Os beans são de baixo acoplamento porque:"
#. Tag: para
#: beans.xml:58
#, no-c-format
msgid "they interact via well-defined public APIs"
-msgstr ""
+msgstr "eles interagem por meio de APIs bem definidas e públicas"
#. Tag: para
#: beans.xml:61
#, no-c-format
msgid "their lifecycles are completely decoupled"
-msgstr ""
+msgstr "seus ciclos de vida são completamente desacoplados"
#. Tag: para
#: beans.xml:65
@@ -120,6 +155,11 @@
"facility for overriding bean implementations at deployment time, as we will "
"see in <xref linkend=\"alternatives\"/>."
msgstr ""
+"Podemos substituir um bean por outro bean diferente que implementa a mesma "
+"interface e tem um ciclo de vida diferente (um escopo diferente) sem afetar "
+"a outra implementação do bean. Na verdade, CDI define um mecanismo simples "
+"para sobrepor implementações de bean em tempo de implantação, como veremos "
+"na <xref linkend=\"alternatives\"/>."
#. Tag: para
#: beans.xml:71
@@ -130,12 +170,16 @@
"injectable, contextual objects—may also obtain references to beans by "
"injection."
msgstr ""
+"Note que nem todos os clientes de um bean são eles próprios também beans. "
+"Outros objetos como servlets ou message-driven beans—que são por "
+"natureza objetos não injetáveis e não contextuais —podem também obter "
+"referências para beans por meio de injeção."
#. Tag: title
#: beans.xml:78
#, no-c-format
msgid "The anatomy of a bean"
-msgstr ""
+msgstr "A anatomia de um bean"
#. Tag: para
#: beans.xml:80
@@ -144,66 +188,68 @@
"Enough hand-waving. More formally, the anatomy of a bean, according to the "
"spec:"
msgstr ""
+"Já chega de acenar as mãos. Mais formalmente, a anatomia de um bean, de "
+"acordo com a especificação:"
#. Tag: para
#: beans.xml:84
#, no-c-format
msgid "A bean comprises the following attributes:"
-msgstr ""
+msgstr "Um bean abrange os seguintes atributos:"
#. Tag: para
#: beans.xml:87
#, no-c-format
msgid "A (nonempty) set of bean types"
-msgstr ""
+msgstr "Um conjunto (não vazio) de tipos de bean"
#. Tag: para
#: beans.xml:88
#, no-c-format
msgid "A (nonempty) set of qualifiers"
-msgstr ""
+msgstr "Um conjunto (não vazio) de qualificadores"
#. Tag: para
#: beans.xml:89
#, no-c-format
msgid "A scope"
-msgstr ""
+msgstr "Um escopo"
#. Tag: para
#: beans.xml:90
#, no-c-format
msgid "Optionally, a bean EL name"
-msgstr ""
+msgstr "Opcionalmente, um nome EL do bean"
#. Tag: para
#: beans.xml:91
#, no-c-format
msgid "A set of interceptor bindings"
-msgstr ""
+msgstr "Um conjunto de vinculações com interceptadores"
#. Tag: para
#: beans.xml:92
#, no-c-format
msgid "A bean implementation"
-msgstr ""
+msgstr "Uma implementação do bean"
#. Tag: para
#: beans.xml:95
#, no-c-format
msgid "Furthermore, a bean may or may not be an alternative."
-msgstr ""
+msgstr "Além disso, um bean pode ou não pode ser um bean alternativo."
#. Tag: para
#: beans.xml:99
#, no-c-format
msgid "Let's see what all this new terminology means."
-msgstr ""
+msgstr "Vamos ver o que toda esta nova terminologia significa."
#. Tag: title
#: beans.xml:102
#, no-c-format
msgid "Bean types, qualifiers and dependency injection"
-msgstr ""
+msgstr "Tipos e qualificadores de bean e injeção de dependência"
#. Tag: para
#: beans.xml:104
@@ -213,18 +259,21 @@
"Any injected attribute specifies a \"contract\" that must be satisfied by "
"the bean to be injected. The contract is:"
msgstr ""
+"Beans usualmente adquirem referências para outros beans por meio de injeção "
+"de dependência. Qualquer atributo injetado especifica um \"contrato\" que "
+"deve ser satisfeito pelo bean para ser injetado. O contrato é:"
#. Tag: para
#: beans.xml:110
#, no-c-format
msgid "a bean type, together with"
-msgstr ""
+msgstr "um tipo de bean, juntamente com"
#. Tag: para
#: beans.xml:111
#, no-c-format
msgid "a set of qualifiers."
-msgstr ""
+msgstr "um conjunto de qualificadores."
#. Tag: para
#: beans.xml:114
@@ -236,6 +285,11 @@
"have multiple bean types. For example, the following bean has four bean "
"types:"
msgstr ""
+"Um tipo de bean é uma classe ou interface definida pelo usuário; um tipo que "
+"é visível ao cliente. Se o bean é um EJB session bean, o tipo do bean é a "
+"interface <literal>@Local</literal> ou a classe do bean da visão local. Um "
+"bean pode possuir múltiplos tipos. Por exemplo, o seguinte bean possui "
+"quatro tipos de bean:"
#. Tag: programlisting
#: beans.xml:120
@@ -262,6 +316,10 @@
"<literal>java.lang.Object</literal>. (Notice that a parameterized type is a "
"legal bean type)."
msgstr ""
+"Os tipos de bean são <literal>BookShop</literal>, <literal>Business</"
+"literal> e <literal>Shop<Book></literal>, bem como o tipo implícito "
+"<literal>java.lang.Object</literal>. (Observe que um tipo parametrizado é um "
+"tipo de bean válido)."
#. Tag: para
#: beans.xml:128
@@ -272,6 +330,10 @@
"lang.Object</literal> as bean types, since the bean class, "
"<literal>BookShopBean</literal> is not a client-visible type."
msgstr ""
+"Entretanto, este session bean possui somente as interfaces locais "
+"<literal>BookShop</literal>, <literal>Auditable</literal> e <literal>java."
+"lang.Object</literal> como tipos de bean, uma vez que a classe do bean, "
+"<literal>BookShopBean</literal>, não é um tipo visível ao cliente."
#. Tag: programlisting
#: beans.xml:134
@@ -299,6 +361,10 @@
"All primitive types are assumed to be identical to their corresponding "
"wrapper types in <literal>java.lang</literal>."
msgstr ""
+"A maioria dos tipos de bean você pode provavelmente descobrir. Uma pegadinha "
+"são os tipos primitivos. Todos os tipos primitivos são assumidos como "
+"idênticos aos seus correspondentes tipos adaptadores em <literal>java.lang</"
+"literal>."
#. Tag: para
#: beans.xml:143
@@ -310,6 +376,11 @@
"restricted to <literal>Shop<Book></literal>, together with "
"<literal>java.lang.Object</literal>:"
msgstr ""
+"Os tipos do bean podem ser limitados a um conjunto explícito, anotando o "
+"bean com a anotação <literal>@Typed</literal> e listando as classes que "
+"devem ser os tipos do bean. Por exemplo, os tipos de bean desde bean foram "
+"restritos a <literal>Shop<Book></literal>, juntamente com "
+"<literal>java.lang.Object</literal>:"
#. Tag: programlisting
#: beans.xml:149
@@ -343,6 +414,15 @@
"implementation it is interested in. We model this kind of \"quality\" using "
"a qualifier."
msgstr ""
+"Algumas vezes um tipo de bean sozinho não fornece informação suficiente para "
+"o contêiner saber qual bean injetar. Por exemplo, suponha que temos duas "
+"implementações da interface <literal>PaymentProcessor</literal>: "
+"<literal>CreditCardPaymentProcessor</literal> e "
+"<literal>DebitPaymentProcessor</literal>. Injetar em um campo do tipo "
+"<literal>PaymentProcessor</literal> introduz uma condição ambígua. Nestes "
+"casos, o cliente deve especificar algum qualidade adicional da implementação "
+"que ele está interessado. Modelamos esta categoria de \"qualidade\" usando "
+"um qualificador."
#. Tag: para
#: beans.xml:160
@@ -353,6 +433,11 @@
"type system. It lets us disambiguate a type without having to fall back to "
"string-based names. Here's an example of a qualifier annotation:"
msgstr ""
+"Um qualificador é uma anotação definida pelo usuário que é ela própria "
+"anotada com <literal>@Qualifer</literal>. Uma anotação de qualificador é uma "
+"extensão do sitema de tipos. Ela nos permite desambiguar um tipo sem ter que "
+"recorrer a nomes baseados em strings. Aqui está um exemplo de uma anotação "
+"de qualificador:"
#. Tag: programlisting
#: beans.xml:166
@@ -377,6 +462,10 @@
"definitions will become a familiar artifact as you'll be creating them from "
"time to time."
msgstr ""
+"Você pode não estar acostumado a ver a definição de uma anotação. Na "
+"verdade, essa poderia ser a primeira vez que você encontrou uma. Com CDI, "
+"definições de anotação se tornará um artefato familiar conforme você for "
+"criando-os de vez em quando."
#. Tag: para
#: beans.xml:175
@@ -387,6 +476,10 @@
"this convention when creating your custom annotations, since they serve to "
"describe the behaviors and roles of the class."
msgstr ""
+"Preste atenção nos nomes das anotações embutidas em CDI e EJB. Você "
+"perceberá que elas são muitas vezes adjetivos. Nós encorajamos você a seguir "
+"esta convenção ao criar suas próprias anotações, uma vez que elas servem "
+"para descrever os comportamentos e papéis da classe."
#. Tag: para
#: beans.xml:182
@@ -397,6 +490,10 @@
"type <literal>PaymentProcessor</literal> and qualifier <literal>@CreditCard</"
"literal>:"
msgstr ""
+"Agora que temos definido uma anotação de qualificador, podemos utilizá-la "
+"para resolver a ambiguidade no ponto de injeção. O seguinte ponto de injeção "
+"possui o tipo de bean <literal>PaymentProcessor</literal> e o qualificador "
+"<literal>@CreditCard</literal>:"
#. Tag: programlisting
#: beans.xml:188
@@ -411,6 +508,8 @@
"If an injection point does not explicitly specify a qualifier, it has the "
"default qualifier, <literal>@Default</literal>."
msgstr ""
+"Se um ponto de injeção não define explicitamente um qualificador, ele terá o "
+"qualificador padrão, <literal>@Default</literal>."
#. Tag: para
#: beans.xml:197
@@ -421,6 +520,10 @@
"finds exactly one matching bean, it injects an instance of that bean. If it "
"doesn't, it reports an error to the user."
msgstr ""
+"Para cada ponto de injeção, o contêiner pesquisa por um bean que satisfaça o "
+"contrato, um que tenha o tipo de bean e todos os qualificadores. Se ele "
+"encontrar exatamente um bean, ele injeta uma instância deste bean. Se ele "
+"não encontrar, ele reporta um erro ao usuário."
#. Tag: para
#: beans.xml:203
@@ -431,6 +534,10 @@
"literal> and implements the bean type <literal>PaymentProcessor</literal>. "
"Therefore, it satisfies our qualified injection point:"
msgstr ""
+"Como especificamos os qualificadores de um bean? Anotando a classe de bean, "
+"é claro! O seguinte bean possui o qualificador <literal>@CreditCard</"
+"literal> e implementa o tipo de bean <literal>PaymentProcessor</literal>. "
+"Portanto, ele satisfaz nosso ponto de injeção qualificado:"
#. Tag: programlisting
#: beans.xml:209
@@ -451,6 +558,8 @@
"If a bean does not explicitly specify a qualifier, it has the default "
"qualifier, <literal>@Default</literal>."
msgstr ""
+"Se um bean não define explicitamente um qualificador, ele terá o "
+"qualificador padrão, <literal>@Default</literal>."
#. Tag: para
#: beans.xml:225
@@ -461,12 +570,16 @@
"do if there is more than one bean that satisfies a particular contract. "
"We'll get into the details in <xref linkend=\"injection\"/>."
msgstr ""
+"Esse não é bem o fim da história. CDI também define uma simples "
+"<emphasis>regra de resolução</emphasis> que ajuda o contêiner decidir o que "
+"fazer se houver mais de um bean que satisfaz um contrato específico. Vamos "
+"entrar em mais detalhes no <xref linkend=\"injection\"/>."
#. Tag: title
#: beans.xml:245
#, no-c-format
msgid "Scope"
-msgstr ""
+msgstr "Escopo"
#. Tag: para
#: beans.xml:248
@@ -478,6 +591,11 @@
"into the specification, and provided by the container. Each scope is "
"represented by an annotation type."
msgstr ""
+"O <emphasis>escopo</emphasis> de um bean define o ciclo de vida e a "
+"visibilidade de suas instâncias. O modelo de contexto da CDI é extensível, "
+"acomodando escopos arbitrários. No entanto, certos escopos importantes estão "
+"encorporados na especificação, e fornecidos pelo contêiner. Cada escopo é "
+"representado por um tipo de anotação."
#. Tag: para
#: beans.xml:255
@@ -486,6 +604,8 @@
"For example, any web application may have <emphasis>session scoped</"
"emphasis> bean:"
msgstr ""
+"Por exemplo, qualquer aplicação web pode possuir beans com <emphasis>escopo "
+"de sessão</emphasis>:"
#. Tag: programlisting
#: beans.xml:259
@@ -504,6 +624,9 @@
"An instance of a session-scoped bean is bound to a user session and is "
"shared by all requests that execute in the context of that session."
msgstr ""
+"Uma instância de um bean com escopo de sessão está vinculada à sessão do "
+"usuário e é compartilhada por todas as solicitações executadas no contexto "
+"desta sessão."
#. Tag: para
#: beans.xml:265
@@ -515,6 +638,12 @@
"indefinitely, consider using another scope with a shorted lifespan, such as "
"the request or conversation scope."
msgstr ""
+"Mantenha em mente que uma vez que um bean está vinculado a um contexto, ele "
+"permanece neste contexto até que o contexto seja destruído. Não existe modo "
+"algum para remover manualmente um bean daquele contexto. Se você não quer "
+"que o bean fique na sessão indefinitivamente, considere o uso de um outro "
+"escopo com um tempo de vida mais curto, como os escopos de solicitação e "
+"conversação."
#. Tag: para
#: beans.xml:273
@@ -525,18 +654,24 @@
"this scope live to serve the object into which they were injected, which "
"means their lifecycle is bound to the lifecycle of that object."
msgstr ""
+"Se um escopo não está explicitamente especificado, então o bean pertence a "
+"um escopo especial chamado de <emphasis>pseudo-escopo dependente</emphasis>. "
+"Os beans com este escopo vivem para servir o objeto no qual eles foram "
+"injetados, o que significa que seu ciclo de vida está vinculado ao ciclo de "
+"vida deste objeto."
#. Tag: para
#: beans.xml:279
#, no-c-format
msgid "We'll talk more about scopes in <xref linkend=\"scopescontexts\"/>."
msgstr ""
+"Nós falaremos mais sobre escopos no <xref linkend=\"scopescontexts\"/>."
#. Tag: title
#: beans.xml:284
#, no-c-format
msgid "EL name"
-msgstr ""
+msgstr "Nome EL"
#. Tag: para
#: beans.xml:286
@@ -546,6 +681,9 @@
"expressions, for example, in a JSP or JSF page, you must assign the bean an "
"<emphasis>EL name</emphasis>."
msgstr ""
+"Se você quer referenciar um bean em um código não-Java que suporta "
+"expressões Unified EL, por exemplo, em uma página JSP ou JSF, você deve "
+"assinar o bean com um <emphasis>nome EL</emphasis>."
#. Tag: para
#: beans.xml:291
@@ -554,6 +692,8 @@
"The EL name is specified using the <literal>@Named</literal> annotation, as "
"shown here:"
msgstr ""
+"O nome EL é especificado usando a anotação <literal>@Named</literal>, como "
+"mostrado aqui:"
#. Tag: programlisting
#: beans.xml:295
@@ -569,7 +709,7 @@
#: beans.xml:297
#, no-c-format
msgid "Now we can easily use the bean in any JSF or JSP page:"
-msgstr ""
+msgstr "Agora podemos facilmente usar o bean em qualquer página JSF ou JSP:"
#. Tag: programlisting
#: beans.xml:299
@@ -579,6 +719,9 @@
" ...\n"
"</h:dataTable>]]>"
msgstr ""
+"<![CDATA[<h:dataTable value=\"#{cart.lineItems}\" var=\"item\">\n"
+" ...\n"
+"</h:dataTable>]]>"
#. Tag: para
#: beans.xml:302
@@ -589,6 +732,10 @@
"<literal>@Named</literal> annotation just makes it possible to reference the "
"bean from the EL, most commonly from a JSF view."
msgstr ""
+"A anotação <literal>@Named</literal> não é o que torna a classe um bean. A "
+"maioria das classes em um arquivo de beans já são reconhecidas como beans. A "
+"anotação <literal>@Named</literal> apenas torna possível referenciar o bean "
+"a partir da EL, mais comumente a partir de uma visão JSF."
#. Tag: para
#: beans.xml:309
@@ -597,6 +744,8 @@
"We can let CDI choose a name for us by leaving off the value of the "
"<literal>@Named</literal> annotation:"
msgstr ""
+"Nós podemos deixar o CDI escolher um nome para nós, deixando de fora o valor "
+"da anotação <literal>@Named</literal>:"
#. Tag: programlisting
#: beans.xml:313
@@ -615,12 +764,14 @@
"The name defaults to the unqualified class name, decapitalized; in this "
"case, <literal>shoppingCart</literal>."
msgstr ""
+"O nome padrão vem do nome não-qualificado da classe, descapitalizado; neste "
+"caso, <literal>shoppingCart</literal>."
#. Tag: title
#: beans.xml:325
#, no-c-format
msgid "Alternatives"
-msgstr ""
+msgstr "Alternativos"
#. Tag: para
#: beans.xml:327
@@ -634,6 +785,13 @@
"may be declared by annotating the bean class with the <literal>@Alternative</"
"literal> annotation."
msgstr ""
+"Nós já vimos como os qualificadores nos permite escolher entre múltiplas "
+"implementações de uma interface durante o desenvolvimento. Mas algumas vezes "
+"temos uma interface (ou outro tipo de bean), cuja implementação varia "
+"dependendo do ambiente de implantação. Por exemplo, podemos querer usar uma "
+"implementação de imitação em um ambiente de teste. Uma "
+"<emphasis>alternativa</emphasis> seria declarar a classe de bean com a "
+"anotação <literal>@Alternative</literal>."
#. Tag: programlisting
#: beans.xml:335
@@ -657,6 +815,13 @@
"module that uses it. Different modules can specify that they use different "
"alternatives."
msgstr ""
+"Normalmente anotamos um bean com <literal>@Alternative</literal> somente "
+"quando existe alguma outra implementação de uma interface que ele implementa "
+"(ou de qualquer de seus tipos de bean). Podemos escolher entre as "
+"alternativas no momento da implantação <emphasis>selecionando</emphasis> uma "
+"alternativa no descritor de implantação do CDI <literal>META-INF/beans.xml</"
+"literal> dentro do JAR ou módulo Java EE que utiliza-o. Diferentes módulos "
+"podem especificar que eles usam diferentes alternativas."
#. Tag: para
#: beans.xml:345
@@ -664,12 +829,14 @@
msgid ""
"We cover alternatives in more detail in <xref linkend=\"alternatives\"/>."
msgstr ""
+"Nós cobriremos os alternativos em mais detalhes na <xref linkend="
+"\"alternatives\"/>."
#. Tag: title
#: beans.xml:352
#, no-c-format
msgid "Interceptor binding types"
-msgstr ""
+msgstr "Tipos para vinculação de interceptador"
#. Tag: para
#: beans.xml:354
@@ -681,6 +848,11 @@
"its methods. Holler. So what does CDI have to offer above and beyond that? "
"Well, quite a lot actually. Let's cover some background."
msgstr ""
+"Você pode estar familiarizado com o uso de interceptadores em EJB 3.0. Em "
+"Java EE 6, esta funcionalidade foi generalizada para trabalhar com outros "
+"beans gerenciados. Está bem, você não precisa tornar seu bean um EJB apenas "
+"para interceptar seus métodos. (Berro). Então, o que CDI tem a oferecer além "
+"disso? Bem, bastante realmente. Vamos dar algumas explicações."
#. Tag: para
#: beans.xml:361
@@ -698,6 +870,18 @@
"repeatedly, then there's a good chance that you'll inadvertently define a "
"different order for different beans. Now that's a problem."
msgstr ""
+"A maneira em que interceptadores foram definidos em Java EE 5 não foi muito "
+"intuitivo. Era necessário especificar a <emphasis>implementação</emphasis> "
+"do interceptador diretamente na <emphasis>implementação</emphasis> do EJB, "
+"seja pela anotação <literal>@Interceptors</literal> ou no descritor XML. "
+"Você pode muito bem apenas colocar o código do interceptador "
+"<emphasis>dentro</emphasis> da implementação! Em segundo lugar, a ordem na "
+"qual os interceptadores são aplicados é obtida a partir da ordem na qual "
+"eles são declarados na anotação ou no descritor XML. Talvez isto não seja "
+"tão ruim se você está aplicando os interceptadores a um único bean. Mas, se "
+"você está aplicando eles repetidamente, então há uma boa chance de você "
+"definir por descuido uma ordem diferente para diferentes beans. Agora isso é "
+"um problema."
#. Tag: para
#: beans.xml:372
@@ -708,6 +892,10 @@
"<emphasis>interceptor binding type</emphasis> to describe the behavior "
"implemented by the interceptor."
msgstr ""
+"CDI fornece uma nova abordagem para vincular interceptadores a beans que "
+"introduz um nível de indirecionamento (e, portanto, de controle). Nós temos "
+"que definir um <emphasis>tipo para vinculação de interceptador</emphasis> "
+"que descreve o comportamento implementado pelo interceptador."
#. Tag: para
#: beans.xml:378
@@ -718,6 +906,10 @@
"interceptor classes to bean classes with no direct dependency between the "
"two classes."
msgstr ""
+"Um tipo para vinculação de interceptador é uma anotação definida pelo "
+"usuário que é ela mesma anotada com <literal>@InterceptorBinding</literal>. "
+"Isto nos permite vincular as classes de interceptador a classes de bean com "
+"nenhuma dependência direta entre as duas classes."
#. Tag: programlisting
#: beans.xml:383
@@ -742,6 +934,8 @@
"The interceptor that implements transaction management declares this "
"annotation:"
msgstr ""
+"O interceptador que implementa o gerenciamento de transação declara esta "
+"anotação:"
#. Tag: programlisting
#: beans.xml:389
@@ -760,6 +954,8 @@
"We can apply the interceptor to a bean by annotating the bean class with the "
"same interceptor binding type:"
msgstr ""
+"Podemos aplicar o interceptador em um bean anotando a classe de bean com o "
+"mesmo tipo para vinculação de interceptador."
#. Tag: programlisting
#: beans.xml:395
@@ -768,6 +964,8 @@
"<![CDATA[public @SessionScoped @Transactional\n"
"class ShoppingCart implements Serializable { ... }]]>"
msgstr ""
+"<![CDATA[public @SessionScoped @Transactional\n"
+"class ShoppingCart implements Serializable { ... }]]>"
#. Tag: para
#: beans.xml:397
@@ -777,6 +975,8 @@
"<literal>TransactionInterceptor</literal> don't know anything about each "
"other."
msgstr ""
+"Observe que <literal>ShoppingCart</literal> e "
+"<literal>TransactionInterceptor</literal> não sabem nada sobre o outro."
#. Tag: para
#: beans.xml:402
@@ -788,6 +988,11 @@
"deployment descriptor <literal>META-INF/beans.xml</literal> of the JAR or "
"Java EE module. This is also where we specify the interceptor ordering."
msgstr ""
+"Interceptadores são específicos de implantação. (Não precisamos de um "
+"<literal>TransactionInterceptor</literal> em nossos testes de unidade!) Por "
+"padrão, um interceptador está disabilitado. Podemos habilitar um "
+"interceptador usando o descritor de implantação do CDI <literal>META-INF/"
+"beans.xml</literal> do JAR ou módulo Java EE."
#. Tag: para
#: beans.xml:409
@@ -796,6 +1001,8 @@
"We'll discuss interceptors, and their cousins, decorators, in <xref linkend="
"\"interceptors\"/> and <xref linkend=\"decorators\"/>."
msgstr ""
+"Discutiremos sobre interceptadores, e seus primos decoradores, no <xref "
+"linkend=\"interceptors\"/> e <xref linkend=\"decorators\"/>."
#. Tag: title
#: beans.xml:419
Modified: doc/trunk/reference/pt-BR/decorators.po
===================================================================
--- doc/trunk/reference/pt-BR/decorators.po 2010-01-07 14:10:21 UTC (rev 5390)
+++ doc/trunk/reference/pt-BR/decorators.po 2010-01-07 16:35:00 UTC (rev 5391)
@@ -6,8 +6,8 @@
"Project-Id-Version: Introduction_to_Web_Beans VERSION\n"
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
"POT-Creation-Date: 2009-11-11 15:00+0000\n"
-"PO-Revision-Date: 2009-12-19 18:10-0300\n"
-"Last-Translator: João Paulo Viragine <joao.viragine(a)redhat.com>\n"
+"PO-Revision-Date: 2010-01-07 10:22-0300\n"
+"Last-Translator: Bruno Leonardo Gonçalves <brunolmfg(a)gmail.com>\n"
"Language-Team: none\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@@ -21,15 +21,49 @@
#. Tag: para
#: decorators.xml:7
-#, fuzzy, no-c-format
-msgid "Interceptors are a powerful way to capture and separate concerns which are <emphasis>orthogonal</emphasis> to the application (and type system). Any interceptor is able to intercept invocations of any Java type. This makes them perfect for solving technical concerns such as transaction management, security and call logging. However, by nature, interceptors are unaware of the actual semantics of the events they intercept. Thus, interceptors aren't an appropriate tool for separating business-related concerns."
-msgstr "Interceptadores são um meio poderoso para capturar e separar preocupações <emphasis>ortogonais</emphasis> para o tipo de sistema. Qualquer interceptador é capaz de interceptar invocações de qualquer tipo Java. Isso os torna ideais para resolver questões técnicas, tais como gerenciamento de transação e segurança. No entanto, por natureza, interceptadores desconhecem a real semântica dos eventos que interceptam. Assim, interceptadores não são um instrumento adequado para a separação de questões relacionadas a negócios."
+#, no-c-format
+msgid ""
+"Interceptors are a powerful way to capture and separate concerns which are "
+"<emphasis>orthogonal</emphasis> to the application (and type system). Any "
+"interceptor is able to intercept invocations of any Java type. This makes "
+"them perfect for solving technical concerns such as transaction management, "
+"security and call logging. However, by nature, interceptors are unaware of "
+"the actual semantics of the events they intercept. Thus, interceptors aren't "
+"an appropriate tool for separating business-related concerns."
+msgstr ""
+"Interceptadores são um meio poderoso para capturar e separar preocupações "
+"<emphasis>ortogonais</emphasis> para a aplicação (e sistema de tipos). "
+"Qualquer interceptador é capaz de interceptar invocações de qualquer tipo "
+"Java. Isso os torna ideais para resolver questões técnicas, tais como "
+"gerenciamento de transação, segurança e registro de chamadas. No entanto, "
+"por natureza, interceptadores desconhecem a real semântica dos eventos que "
+"interceptam. Assim, interceptadores não são um instrumento adequado para a "
+"separação de questões relacionadas a negócios."
#. Tag: para
#: decorators.xml:15
-#, fuzzy, no-c-format
-msgid "The reverse is true of <emphasis>decorators</emphasis>. A decorator intercepts invocations only for a certain Java interface, and is therefore aware of all the semantics attached to that interface. Since decorators directly implement operations with business semantics, it makes them the perfect tool for modeling some kinds of business concerns. It also means that a decorator doesn't have the generality of an interceptor. Decorators aren't able to solve technical concerns that cut across many disparate types. Interceptors and decorators, though similar in many ways, are complementary. Let's look at some cases where decorators fit the bill."
-msgstr "O contrário é verdadeiro <emphasis>decoradores</emphasis>. O decorador intercepta invocações apenas para uma determinada interface Java e, portanto, é ciente de toda a semântica que acompanha a interface. Isso torna os decoradores uma ferramenta perfeita para modelar alguns tipos de questões de negócios. Significa também que um decorador não tem a generalidade de um interceptador. Decoradores não são capazes de resolver questões técnicas que atravessam muitos tipos diferentes."
+#, no-c-format
+msgid ""
+"The reverse is true of <emphasis>decorators</emphasis>. A decorator "
+"intercepts invocations only for a certain Java interface, and is therefore "
+"aware of all the semantics attached to that interface. Since decorators "
+"directly implement operations with business semantics, it makes them the "
+"perfect tool for modeling some kinds of business concerns. It also means "
+"that a decorator doesn't have the generality of an interceptor. Decorators "
+"aren't able to solve technical concerns that cut across many disparate "
+"types. Interceptors and decorators, though similar in many ways, are "
+"complementary. Let's look at some cases where decorators fit the bill."
+msgstr ""
+"O contrário é verdadeiro para <emphasis>decoradores</emphasis>. Um decorador "
+"intercepta invocações apenas para uma determinada interface Java e, "
+"portanto, é ciente de toda a semântica que acompanha esta interface. Visto "
+"que decoradores implementam diretamente operações com regras de negócios, "
+"torna eles uma ferramenta perfeita para modelar alguns tipos de questões de "
+"negócios. Significa também que um decorador não tem a generalidade de um "
+"interceptador. Decoradores não são capazes de resolver questões técnicas que "
+"atravessam muitos tipos diferentes. Interceptadores e decoradores, ambora "
+"similares em muitos aspectos, são complementares. Vamos ver alguns casos "
+"onde decoradores são bem convenientes."
#. Tag: para
#: decorators.xml:24
@@ -57,15 +91,29 @@
#. Tag: para
#: decorators.xml:28
-#, fuzzy, no-c-format
-msgid "Several different beans in our system implement the <literal>Account</literal> interface. However, we have a common legal requirement that; for any kind of account, large transactions must be recorded by the system in a special log. This is a perfect job for a decorator."
-msgstr "Vários Web Beans em nosso sistema implementam a interface <literal>Account</literal>. No entanto, temos uma obrigação legal que, para qualquer tipo de conta, as grandes transações devem ser registadas pelo sistema, em um registro especial (log). Esse é um trabalho perfeito para um decorador. "
+#, no-c-format
+msgid ""
+"Several different beans in our system implement the <literal>Account</"
+"literal> interface. However, we have a common legal requirement that; for "
+"any kind of account, large transactions must be recorded by the system in a "
+"special log. This is a perfect job for a decorator."
+msgstr ""
+"Vários beans diferentes em nosso sistema implementam a interface "
+"<literal>Account</literal>. No entanto, temos um requisito legal que, para "
+"qualquer tipo de conta, as grandes transações devem ser registadas pelo "
+"sistema em um registro (log) específico. Esse é um trabalho perfeito para um "
+"decorador."
#. Tag: para
#: decorators.xml:34
-#, fuzzy, no-c-format
-msgid "A decorator is a bean (possibly even an abstract class) that implements the type it decorates and is annotated <literal>@Decorator</literal>."
-msgstr "Um decorador é um Web Bean simples que implementa o tipo que decora e é anotado com <literal>@Decorator</literal>."
+#, no-c-format
+msgid ""
+"A decorator is a bean (possibly even an abstract class) that implements the "
+"type it decorates and is annotated <literal>@Decorator</literal>."
+msgstr ""
+"Um decorador é um bean (possivelmente, até mesmo uma classe abstrata) que "
+"implementa o tipo que ele decora e é anotado com <literal>@Decorator</"
+"literal>."
#. Tag: programlisting
#: decorators.xml:39
@@ -86,8 +134,12 @@
#. Tag: para
#: decorators.xml:41
#, no-c-format
-msgid "The decorator implements the methods of the decorated type that it wants to intercept."
+msgid ""
+"The decorator implements the methods of the decorated type that it wants to "
+"intercept."
msgstr ""
+"O decorador implementa os métodos do tipo decorado que ele deseja "
+"interceptar."
#. Tag: programlisting
#: decorators.xml:45
@@ -127,27 +179,48 @@
#. Tag: para
#: decorators.xml:47
-#, fuzzy, no-c-format
-msgid "Unlike other beans, a decorator may be an abstract class. Therefore, if there's nothing special the decorator needs to do for a particular method of the decorated interface, you don't need to implement that method."
-msgstr "Ao contrário de outros Web Beans simples, um decorador pode ser uma classe abstrata. Se não há nada de especial que o decorador precisa fazer para um determinado método da interface decorada, você não precisa implementar esse método."
+#, no-c-format
+msgid ""
+"Unlike other beans, a decorator may be an abstract class. Therefore, if "
+"there's nothing special the decorator needs to do for a particular method of "
+"the decorated interface, you don't need to implement that method."
+msgstr ""
+"Ao contrário de outros beans, um decorador pode ser uma classe abstrata. "
+"Portanto, se não há nada de especial que o decorador precisa fazer para um "
+"determinado método da interface decorada, você não precisa implementar esse "
+"método."
#. Tag: para
#: decorators.xml:52
-#, fuzzy, no-c-format
-msgid "Interceptors for a method are called before decorators that apply to the method."
-msgstr "Interceptadores para o método são chamados antes dos decoradores que se aplicam a esse método."
+#, no-c-format
+msgid ""
+"Interceptors for a method are called before decorators that apply to the "
+"method."
+msgstr ""
+"Interceptadores para um método são chamados antes dos decoradores que se "
+"aplicam a esse método."
#. Tag: title
#: decorators.xml:57
-#, fuzzy, no-c-format
+#, no-c-format
msgid "Delegate object"
-msgstr "Atributos delegados"
+msgstr "Objeto delegado"
#. Tag: para
#: decorators.xml:59
#, no-c-format
-msgid "Decorators have a special injection point, called the <emphasis>delegate injection point</emphasis>, with the same type as the beans they decorate, and the annotation <literal>@Delegate</literal>. There must be exactly one delegate injection point, which can be a constructor parameter, initializer method parameter or injected field."
+msgid ""
+"Decorators have a special injection point, called the <emphasis>delegate "
+"injection point</emphasis>, with the same type as the beans they decorate, "
+"and the annotation <literal>@Delegate</literal>. There must be exactly one "
+"delegate injection point, which can be a constructor parameter, initializer "
+"method parameter or injected field."
msgstr ""
+"Decoradores possuem um ponto de injeção especial, chamado de <emphasis>ponto "
+"de injeção delegado</emphasis>, com o mesmo tipo dos beans que eles decoram "
+"e a anotação <literal>@Delegate</literal>. Deve haver exatamente um ponto de "
+"injeção delegado, que pode ser um parâmetro de construtor, um parâmetro de "
+"método inicializador ou um campo injetado."
#. Tag: programlisting
#: decorators.xml:65
@@ -169,27 +242,33 @@
#. Tag: para
#: decorators.xml:67
-#, fuzzy, no-c-format
+#, no-c-format
msgid "A decorator is bound to any bean which:"
-msgstr "Um decorador é vinculado a qualquer Web Bean que:"
+msgstr "Um decorador é vinculado a qualquer bean que:"
#. Tag: para
#: decorators.xml:71
-#, fuzzy, no-c-format
+#, no-c-format
msgid "has the type of the delegate injection point as a bean type, and"
-msgstr "tenha como tipo do atributo delegado uma API, e"
+msgstr "tenha o tipo do ponto de injeção delegado como um tipo de bean, e"
#. Tag: para
#: decorators.xml:74
-#, fuzzy, no-c-format
+#, no-c-format
msgid "has all qualifiers that are declared at the delegate injection point."
-msgstr "tenha todos os tipos de vínculo que são declarados pelo atributo delegado."
+msgstr ""
+"tenha todos os qualificadores que estão declarados no ponto de injeção "
+"delegado."
#. Tag: para
#: decorators.xml:78
-#, fuzzy, no-c-format
-msgid "This delegate injection point specifies that the decorator is bound to all beans that implement <literal>Account</literal>:"
-msgstr "Este atributo delegado especifica que o decorador está vinculado a todos os Web Beans que implementam <literal>Account</literal>:"
+#, no-c-format
+msgid ""
+"This delegate injection point specifies that the decorator is bound to all "
+"beans that implement <literal>Account</literal>:"
+msgstr ""
+"Este ponto de injeção delegado especifica que o decorador está vinculado a "
+"todos os beans que implementam <literal>Account</literal>:"
#. Tag: programlisting
#: decorators.xml:83
@@ -199,9 +278,14 @@
#. Tag: para
#: decorators.xml:85
-#, fuzzy, no-c-format
-msgid "A delegate injection point may specify any number of qualifier annotations. The decorator will only be bound to beans with the same qualifiers."
-msgstr "Um atributo delegado pode especificar uma anotação de binding. Então, o decorador só será vinculado ao Web Beans com o mesmo vínculo."
+#, no-c-format
+msgid ""
+"A delegate injection point may specify any number of qualifier annotations. "
+"The decorator will only be bound to beans with the same qualifiers."
+msgstr ""
+"Um ponto de injeção delegado pode especificar qualquer número de anotações "
+"de qualificador. O decorador só será vinculado a beans com os mesmos "
+"qualificadores."
#. Tag: programlisting
#: decorators.xml:90
@@ -211,9 +295,17 @@
#. Tag: para
#: decorators.xml:92
-#, fuzzy, no-c-format
-msgid "The decorator may invoke the delegate object, which has much the same effect as calling <literal>InvocationContext.proceed()</literal> from an interceptor. The main difference is that the decorator can invoke <emphasis>any</emphasis> business method on the delegate object."
-msgstr "O decorador pode invocar o atributo delegado,o que praticamente equivale a chamar <literal>InvocationContext.proceed()</literal> a partir de um interceptador"
+#, no-c-format
+msgid ""
+"The decorator may invoke the delegate object, which has much the same effect "
+"as calling <literal>InvocationContext.proceed()</literal> from an "
+"interceptor. The main difference is that the decorator can invoke "
+"<emphasis>any</emphasis> business method on the delegate object."
+msgstr ""
+"O decorador pode invocar o objeto delegado, o que praticamente equivale a "
+"chamar <literal>InvocationContext.proceed()</literal> a partir de um "
+"interceptador. A principal diferença é que o decorador pode invocar "
+"<emphasis>qualquer</emphasis> método de negócio sobre o objeto delegado."
#. Tag: programlisting
#: decorators.xml:98
@@ -272,8 +364,15 @@
#. Tag: para
#: decorators.xml:105
#, no-c-format
-msgid "By default, all decorators are disabled. We need to <emphasis>enable</emphasis> our decorator in the <literal>beans.xml</literal> descriptor of a bean archive. This activation only applies to the beans in that archive."
+msgid ""
+"By default, all decorators are disabled. We need to <emphasis>enable</"
+"emphasis> our decorator in the <literal>beans.xml</literal> descriptor of a "
+"bean archive. This activation only applies to the beans in that archive."
msgstr ""
+"Por padrão, todos decoradores estão desabilitados. Nós precisamos "
+"<emphasis>habilitar</emphasis> nosso decorador no descritor <literal>beans."
+"xml</literal> de um arquivo de beans. Esta ativação somente se aplica aos "
+"beans neste arquivo."
#. Tag: programlisting
#: decorators.xml:111
@@ -303,36 +402,28 @@
#. Tag: para
#: decorators.xml:113
-#, fuzzy, no-c-format
-msgid "This declaration serves the same purpose for decorators that the <literal><interceptors></literal> declaration serves for interceptors:"
-msgstr "Essa declaração tem o mesmo propósito para decoradores que a <literal><Interceptors></literal> tem para os interceptadores:"
+#, no-c-format
+msgid ""
+"This declaration serves the same purpose for decorators that the "
+"<literal><interceptors></literal> declaration serves for interceptors:"
+msgstr ""
+"Essa declaração tem o mesmo propósito para decoradores que a declaração "
+"<literal><interceptors></literal> tem para os interceptadores:"
#. Tag: para
#: decorators.xml:120
#, no-c-format
-msgid "it enables us to specify a total ordering for all decorators in our system, ensuring deterministic behavior, and"
-msgstr "isso possibilita-nos determinar a ordem total para todos os decoradores em nosso sistema, assegurando um comportamento determinístico"
+msgid ""
+"it enables us to specify a total ordering for all decorators in our system, "
+"ensuring deterministic behavior, and"
+msgstr ""
+"isso possibilita-nos determinar a ordem total para todos os decoradores em "
+"nosso sistema, assegurando um comportamento determinístico, e"
#. Tag: para
#: decorators.xml:126
#, no-c-format
msgid "it lets us enable or disable decorator classes at deployment time."
-msgstr "isso permite habilitarmos ou desabilitarmos as classes decoradas em tempo de implantação."
-
-#~ msgid ""
-#~ "All decorators have a <emphasis>delegate attribute</emphasis>. The type "
-#~ "and binding types of the delegate attribute determine which Web Beans the "
-#~ "decorator is bound to. The delegate attribute type must implement or "
-#~ "extend all interfaces implemented by the decorator."
-#~ msgstr ""
-#~ "Todos os decoradores têm um <emphasis>atributo delegado</emphasis>. O "
-#~ "tipo e os tipos de binding do atributo delegado determinam a qual Web "
-#~ "Beans o decorador está vinculado. O tipo do atributo delegado deve "
-#~ "implementar ou estender todas as interfaces implementadas pelo decorador."
-#~ msgid ""
-#~ "We need to <emphasis>enable</emphasis> our decorator in <literal>web-"
-#~ "beans.xml</literal>."
-#~ msgstr ""
-#~ "Nós precisamos <emphasis>habilitar</emphasis> nosso decorador no "
-#~ "<literal>web-beans.xml</literal>."
-
+msgstr ""
+"isso permite habilitarmos ou desabilitarmos as classes decoradas em tempo de "
+"implantação."
Modified: doc/trunk/reference/pt-BR/extensions.po
===================================================================
--- doc/trunk/reference/pt-BR/extensions.po 2010-01-07 14:10:21 UTC (rev 5390)
+++ doc/trunk/reference/pt-BR/extensions.po 2010-01-07 16:35:00 UTC (rev 5391)
@@ -7,8 +7,8 @@
"VERSION\n"
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
"POT-Creation-Date: 2010-01-06 12:17+0000\n"
-"PO-Revision-Date: 2009-12-19 18:02-0300\n"
-"Last-Translator: João Paulo Viragine <joao.viragine(a)redhat.com>\n"
+"PO-Revision-Date: 2010-01-07 10:42-0300\n"
+"Last-Translator: Bruno Leonardo Gonçalves <brunolmfg(a)gmail.com>\n"
"Language-Team: none\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@@ -16,41 +16,41 @@
#. Tag: title
#: extensions.xml:8
-#, fuzzy, no-c-format
+#, no-c-format
msgid "CDI extensions available as part of Weld"
-msgstr "Extensões da JSR-299 disponíveis como parte da Web Beans"
+msgstr "Extensões do CDI disponíveis como parte do Weld"
#. Tag: para
#: extensions.xml:11
-#, fuzzy, no-c-format
+#, no-c-format
msgid "These modules are usable on any JSR-299 implementation, not just Weld!"
msgstr ""
"Estes módulos são utilizáveis em qualquer implementação da JSR-299, e não "
-"apenas na Web Beans!"
+"apenas no Weld!"
#. Tag: title
#: extensions.xml:17
-#, fuzzy, no-c-format
+#, no-c-format
msgid "Weld Logger"
-msgstr "Web Beans Logger"
+msgstr "Weld Logger"
#. Tag: para
#: extensions.xml:19
-#, fuzzy, no-c-format
+#, no-c-format
msgid ""
"Adding logging to your application is now even easier with simple injection "
"of a logger object into any CDI bean. Simply create an injection point of "
"type <literal>org.slf4j.Logger</literal> and an appropriate logger object "
"will be injected into any instance of the bean."
msgstr ""
-"Adicionar logging na sua aplicação é agora ainda mais fácil com a simples "
-"injeção de um objeto logger em qualquer bean JSR-299. Basta anotar um membro "
-"tipo org.jboss.webbeans.log.Log com <emphasis>@Logger</emphasis> e um "
-"adequado objeto logger será injetado em qualquer instância do bean."
+"Adicionar logging em sua aplicação é agora ainda mais fácil com a simples "
+"injeção de um objeto de logger em qualquer bean CDI. Basta criar um ponto de "
+"injeção do tipo <literal>org.slf4j.Logger</literal> e um objeto de logger "
+"apropriado será injetado em qualquer instância do bean."
#. Tag: programlisting
#: extensions.xml:25
-#, fuzzy, no-c-format
+#, no-c-format
msgid ""
"<![CDATA[import org.slf4j.Logger;\n"
"import javax.inject.Inject;\n"
@@ -65,16 +65,16 @@
" }\n"
"}]]>"
msgstr ""
-"<![CDATA[import org.jboss.weld.annotation.Logger;\n"
-"import org.jboss.weld.log.Log;\n"
+"<![CDATA[import org.slf4j.Logger;\n"
+"import javax.inject.Inject;\n"
"\n"
"public class Checkout {\n"
-" private @Inject @Logger Log log;\n"
+" private @Inject Logger log;\n"
"\n"
" public void invoiceItems() {\n"
" ShoppingCart cart;\n"
" ...\n"
-" log.debug(\"Items invoiced for {0}\", cart);\n"
+" log.debug(\"Items invoiced for {}\", cart);\n"
" }\n"
"}]]>"
@@ -87,34 +87,32 @@
"condition like <literal>if ( log.isDebugEnabled() )</literal> to avoid "
"string concatenation."
msgstr ""
+"O exemplo mostra como objetos podem ser interpolados em uma mensagem. Se "
+"você usa esta abordagem, você não precisa cercar uma chamada ao logger com "
+"uma condição como <literal>if ( log.isDebugEnabled() )</literal> para evitar "
+"concatenação da string."
#. Tag: para
#: extensions.xml:34
-#, fuzzy, no-c-format
+#, no-c-format
msgid ""
"You can add Weld logging to your project by including weld-logger.jar, sl4j-"
"api.jar and sl4j-jdk14.jar to your project. Alternatively, express a "
"dependency on the <literal>org.jboss.weld:weld-logger</literal> Maven "
"artifact."
msgstr ""
-"Você pode adicionar o Web Beans Logger no seu projeto através da inclusão de "
-"webbeans-logger.jar e webbeans-logging.jar no seu projeto. Alternativamente, "
-"expressar uma dependência do artefato Maven <literal>org.jboss.webbeans:"
-"webbeans-logger</literal> ."
+"Você pode adicionar o logging do Weld em seu projeto através da inclusão de "
+"weld-logger.jar, sl4j-api.jar e sl4j-jdk14.jar em seu projeto. "
+"Alternativamente, manifeste uma dependência ao artefato Maven <literal>org."
+"jboss.weld:weld-logger</literal>."
#. Tag: para
#: extensions.xml:39
-#, fuzzy, no-c-format
+#, no-c-format
msgid ""
"If you are using Weld as your JSR-299 implementation, there's no need to "
"include sl4j as it's already included (and used internally)."
msgstr ""
-"Se você estiver utilizando a Web Beans como sua implementação da JSR-299, "
-"não há necessidade de incluir <literal>webbeans-logging.jar</literal> pois "
-"ele já está incluído."
-
-#~ msgid "TODO"
-#~ msgstr "TODO"
-
-#~ msgid "XSD Generator for JSR-299 XML deployment descriptors"
-#~ msgstr "Gerador XSD para descritores de implantação XML da JSR-299 "
+"Se você estiver utilizando o Weld como sua implementação da JSR-299, não há "
+"necessidade de incluir o sl4j, pois ele já está incluído (e usado "
+"internamente)."
15 years
Weld SVN: r5390 - core/trunk/impl/src/main/java/org/jboss/weld/bean.
by weld-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2010-01-07 09:10:21 -0500 (Thu, 07 Jan 2010)
New Revision: 5390
Modified:
core/trunk/impl/src/main/java/org/jboss/weld/bean/AbstractClassBean.java
core/trunk/impl/src/main/java/org/jboss/weld/bean/ManagedBean.java
core/trunk/impl/src/main/java/org/jboss/weld/bean/SessionBean.java
Log:
WELD-329
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bean/AbstractClassBean.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bean/AbstractClassBean.java 2010-01-07 13:42:35 UTC (rev 5389)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/AbstractClassBean.java 2010-01-07 14:10:21 UTC (rev 5390)
@@ -22,6 +22,7 @@
import static org.jboss.weld.logging.messages.BeanMessage.INVOCATION_ERROR;
import static org.jboss.weld.logging.messages.BeanMessage.NON_CONTAINER_DECORATOR;
import static org.jboss.weld.logging.messages.BeanMessage.ONLY_ONE_SCOPE_ALLOWED;
+import static org.jboss.weld.logging.messages.BeanMessage.PARAMETER_ANNOTATION_NOT_ALLOWED_ON_CONSTRUCTOR;
import static org.jboss.weld.logging.messages.BeanMessage.PROXY_INSTANTIATION_BEAN_ACCESS_FAILED;
import static org.jboss.weld.logging.messages.BeanMessage.PROXY_INSTANTIATION_FAILED;
import static org.jboss.weld.logging.messages.BeanMessage.SPECIALIZING_BEAN_MUST_EXTEND_A_BEAN;
@@ -40,6 +41,8 @@
import javax.enterprise.context.Dependent;
import javax.enterprise.context.NormalScope;
import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.Disposes;
import javax.enterprise.inject.spi.AnnotatedMethod;
import javax.enterprise.inject.spi.Decorator;
import javax.enterprise.inject.spi.InjectionPoint;
@@ -63,6 +66,7 @@
import org.jboss.weld.context.SerializableContextualImpl;
import org.jboss.weld.context.SerializableContextualInstanceImpl;
import org.jboss.weld.ejb.EJBApiAbstraction;
+import org.jboss.weld.injection.ConstructorInjectionPoint;
import org.jboss.weld.injection.FieldInjectionPoint;
import org.jboss.weld.injection.MethodInjectionPoint;
import org.jboss.weld.introspector.WeldClass;
@@ -74,7 +78,6 @@
import org.jboss.weld.util.Proxies;
import org.jboss.weld.util.Strings;
import org.jboss.weld.util.Proxies.TypeInfo;
-import org.jboss.weld.util.reflection.Reflections;
import org.jboss.weld.util.reflection.SecureReflections;
import org.slf4j.cal10n.LocLogger;
@@ -116,6 +119,8 @@
// Injection target for the bean
private InjectionTarget<T> injectionTarget;
+ private ConstructorInjectionPoint<T> constructor;
+
/**
* Constructor
*
@@ -168,6 +173,7 @@
}
}
+ @Override
public void checkType()
{
@@ -625,5 +631,37 @@
}
}
+ protected void checkConstructor()
+ {
+ if (!constructor.getAnnotatedWBParameters(Disposes.class).isEmpty())
+ {
+ throw new DefinitionException(PARAMETER_ANNOTATION_NOT_ALLOWED_ON_CONSTRUCTOR, "@Disposes", constructor);
+ }
+ if (!constructor.getAnnotatedWBParameters(Observes.class).isEmpty())
+ {
+ throw new DefinitionException(PARAMETER_ANNOTATION_NOT_ALLOWED_ON_CONSTRUCTOR, "@Observes", constructor);
+ }
+ }
+ /**
+ * Initializes the constructor
+ */
+ protected void initConstructor()
+ {
+ this.constructor = Beans.getBeanConstructor(this, getAnnotatedItem());
+ // TODO We loop unecessarily many times here, I want to probably introduce some callback mechanism. PLM.
+ addInjectionPoints(Beans.getParameterInjectionPoints(this, constructor));
+ }
+
+ /**
+ * Returns the constructor
+ *
+ * @return The constructor
+ */
+ public ConstructorInjectionPoint<T> getConstructor()
+ {
+ return constructor;
+ }
+
+
}
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bean/ManagedBean.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bean/ManagedBean.java 2010-01-07 13:42:35 UTC (rev 5389)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/ManagedBean.java 2010-01-07 14:10:21 UTC (rev 5390)
@@ -24,7 +24,6 @@
import static org.jboss.weld.logging.messages.BeanMessage.FINAL_BEAN_CLASS_WITH_DECORATORS_NOT_ALLOWED;
import static org.jboss.weld.logging.messages.BeanMessage.FINAL_DECORATED_BEAN_METHOD_NOT_ALLOWED;
import static org.jboss.weld.logging.messages.BeanMessage.NON_CONTAINER_DECORATOR;
-import static org.jboss.weld.logging.messages.BeanMessage.PARAMETER_ANNOTATION_NOT_ALLOWED_ON_CONSTRUCTOR;
import static org.jboss.weld.logging.messages.BeanMessage.PASSIVATING_BEAN_NEEDS_SERIALIZABLE_IMPL;
import static org.jboss.weld.logging.messages.BeanMessage.PUBLIC_FIELD_ON_NORMAL_SCOPED_BEAN_NOT_ALLOWED;
import static org.jboss.weld.logging.messages.BeanMessage.SIMPLE_BEAN_AS_NON_STATIC_INNER_CLASS_NOT_ALLOWED;
@@ -36,8 +35,6 @@
import javax.enterprise.context.Dependent;
import javax.enterprise.context.spi.CreationalContext;
-import javax.enterprise.event.Observes;
-import javax.enterprise.inject.Disposes;
import javax.enterprise.inject.spi.Decorator;
import javax.enterprise.inject.spi.InjectionPoint;
import javax.enterprise.inject.spi.InjectionTarget;
@@ -56,7 +53,6 @@
import org.jboss.weld.bean.interceptor.CdiInterceptorHandlerFactory;
import org.jboss.weld.bean.interceptor.ClassInterceptionHandlerFactory;
import org.jboss.weld.bootstrap.BeanDeployerEnvironment;
-import org.jboss.weld.injection.ConstructorInjectionPoint;
import org.jboss.weld.injection.InjectionContextImpl;
import org.jboss.weld.injection.WeldInjectionPoint;
import org.jboss.weld.introspector.WeldClass;
@@ -84,9 +80,6 @@
private static final LocLogger log = loggerFactory().getLogger(BEAN);
private static final XLogger xLog = loggerFactory().getXLogger(BEAN);
- // The constructor
- private ConstructorInjectionPoint<T> constructor;
-
// The Java EE style injection points
private Set<WeldInjectionPoint<?, ?>> ejbInjectionPoints;
private Set<WeldInjectionPoint<?, ?>> persistenceContextInjectionPoints;
@@ -273,7 +266,7 @@
protected T createInstance(CreationalContext<T> ctx)
{
- return constructor.newInstance(manager, ctx);
+ return getConstructor().newInstance(manager, ctx);
}
@Override
@@ -425,18 +418,6 @@
}
}
- protected void checkConstructor()
- {
- if (!constructor.getAnnotatedWBParameters(Disposes.class).isEmpty())
- {
- throw new DefinitionException(PARAMETER_ANNOTATION_NOT_ALLOWED_ON_CONSTRUCTOR, "@Disposes", constructor);
- }
- if (!constructor.getAnnotatedWBParameters(Observes.class).isEmpty())
- {
- throw new DefinitionException(PARAMETER_ANNOTATION_NOT_ALLOWED_ON_CONSTRUCTOR, "@Observes", constructor);
- }
- }
-
@Override
protected void preSpecialize(BeanDeployerEnvironment environment)
{
@@ -466,26 +447,6 @@
/**
- * Initializes the constructor
- */
- protected void initConstructor()
- {
- this.constructor = Beans.getBeanConstructor(this, getAnnotatedItem());
- // TODO We loop unecessarily many times here, I want to probably introduce some callback mechanism. PLM.
- addInjectionPoints(Beans.getParameterInjectionPoints(this, constructor));
- }
-
- /**
- * Returns the constructor
- *
- * @return The constructor
- */
- public ConstructorInjectionPoint<T> getConstructor()
- {
- return constructor;
- }
-
- /**
* Gets a string representation
*
* @return The string representation
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bean/SessionBean.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bean/SessionBean.java 2010-01-07 13:42:35 UTC (rev 5389)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/SessionBean.java 2010-01-07 14:10:21 UTC (rev 5390)
@@ -125,6 +125,7 @@
this.ejbDescriptor = ejbDescriptor;
initTypes();
initBindings();
+ initConstructor();
}
/**
@@ -135,6 +136,7 @@
{
if (!isInitialized())
{
+ checkConstructor();
super.initialize(environment);
initProxyClass();
checkEJBTypeAllowed();
@@ -180,29 +182,17 @@
public T produce(CreationalContext<T> ctx)
{
- try
- {
- T instance = SecureReflections.newInstance(proxyClass);
- ctx.push(instance);
- return Proxies.attachMethodHandler(instance, new EnterpriseBeanProxyMethodHandler<T>(SessionBean.this, ctx));
- }
- catch (InstantiationException e)
- {
- throw new WeldException(PROXY_INSTANTIATION_FAILED, e, this);
- }
- catch (IllegalAccessException e)
- {
- throw new WeldException(PROXY_INSTANTIATION_BEAN_ACCESS_FAILED, e, this);
- }
- catch (Exception e)
- {
- throw new CreationException(EJB_NOT_FOUND, e, proxyClass);
- }
+ return SessionBean.this.createInstance(ctx);
}
});
}
}
+
+ protected T createInstance(CreationalContext<T> ctx)
+ {
+ return getConstructor().newInstance(manager, ctx);
+ }
@Override
protected void initTypes()
@@ -299,12 +289,30 @@
*/
public T create(final CreationalContext<T> creationalContext)
{
- T instance = getInjectionTarget().produce(creationalContext);
- if (hasDecorators())
+ try
{
- instance = applyDecorators(instance, creationalContext, null);
+ T instance = SecureReflections.newInstance(proxyClass);
+ creationalContext.push(instance);
+ Proxies.attachMethodHandler(instance, new EnterpriseBeanProxyMethodHandler<T>(SessionBean.this, creationalContext));
+ if (hasDecorators())
+ {
+ instance = applyDecorators(instance, creationalContext, null);
+ }
+ return instance;
}
- return instance;
+ catch (InstantiationException e)
+ {
+ throw new WeldException(PROXY_INSTANTIATION_FAILED, e, this);
+ }
+ catch (IllegalAccessException e)
+ {
+ throw new WeldException(PROXY_INSTANTIATION_BEAN_ACCESS_FAILED, e, this);
+ }
+ catch (Exception e)
+ {
+ throw new CreationException(EJB_NOT_FOUND, e, proxyClass);
+ }
+
}
public void destroy(T instance, CreationalContext<T> creationalContext)
15 years