Weld SVN: r3879 - in ri/trunk/impl/src/main/java/org/jboss: weld and 33 other directories.
by weld-commits@lists.jboss.org
Author: shane.bryzak(a)jboss.com
Date: 2009-10-07 23:34:46 -0400 (Wed, 07 Oct 2009)
New Revision: 3879
Added:
ri/trunk/impl/src/main/java/org/jboss/weld/
ri/trunk/impl/src/main/java/org/jboss/weld/BeanManagerImpl.java
ri/trunk/impl/src/main/java/org/jboss/weld/Container.java
ri/trunk/impl/src/main/java/org/jboss/weld/ContextualStore.java
ri/trunk/impl/src/main/java/org/jboss/weld/DefinitionException.java
ri/trunk/impl/src/main/java/org/jboss/weld/DeploymentException.java
ri/trunk/impl/src/main/java/org/jboss/weld/InconsistentSpecializationException.java
ri/trunk/impl/src/main/java/org/jboss/weld/Logger.java
ri/trunk/impl/src/main/java/org/jboss/weld/NullableDependencyException.java
ri/trunk/impl/src/main/java/org/jboss/weld/SimpleInjectionTarget.java
ri/trunk/impl/src/main/java/org/jboss/weld/SingleThreadExecutorServices.java
ri/trunk/impl/src/main/java/org/jboss/weld/UnserializableDependencyException.java
ri/trunk/impl/src/main/java/org/jboss/weld/Validator.java
ri/trunk/impl/src/main/java/org/jboss/weld/bean/
ri/trunk/impl/src/main/java/org/jboss/weld/bean/AbstractBean.java
ri/trunk/impl/src/main/java/org/jboss/weld/bean/AbstractClassBean.java
ri/trunk/impl/src/main/java/org/jboss/weld/bean/AbstractProducerBean.java
ri/trunk/impl/src/main/java/org/jboss/weld/bean/AbstractReceiverBean.java
ri/trunk/impl/src/main/java/org/jboss/weld/bean/DecoratorImpl.java
ri/trunk/impl/src/main/java/org/jboss/weld/bean/DisposalMethod.java
ri/trunk/impl/src/main/java/org/jboss/weld/bean/ForwardingBean.java
ri/trunk/impl/src/main/java/org/jboss/weld/bean/ForwardingDecorator.java
ri/trunk/impl/src/main/java/org/jboss/weld/bean/InterceptorImpl.java
ri/trunk/impl/src/main/java/org/jboss/weld/bean/ManagedBean.java
ri/trunk/impl/src/main/java/org/jboss/weld/bean/NewBean.java
ri/trunk/impl/src/main/java/org/jboss/weld/bean/NewManagedBean.java
ri/trunk/impl/src/main/java/org/jboss/weld/bean/NewSessionBean.java
ri/trunk/impl/src/main/java/org/jboss/weld/bean/ProducerField.java
ri/trunk/impl/src/main/java/org/jboss/weld/bean/ProducerMethod.java
ri/trunk/impl/src/main/java/org/jboss/weld/bean/RIBean.java
ri/trunk/impl/src/main/java/org/jboss/weld/bean/SessionBean.java
ri/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/
ri/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/AbstractBuiltInBean.java
ri/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/DefaultValidatorBean.java
ri/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/DefaultValidatorFactoryBean.java
ri/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/ExtensionBean.java
ri/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/InjectionPointBean.java
ri/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/ManagerBean.java
ri/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/PrincipalBean.java
ri/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/UserTransactionBean.java
ri/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/facade/
ri/trunk/impl/src/main/java/org/jboss/weld/bean/ee/
ri/trunk/impl/src/main/java/org/jboss/weld/bean/interceptor/
ri/trunk/impl/src/main/java/org/jboss/weld/bean/proxy/
ri/trunk/impl/src/main/java/org/jboss/weld/bootstrap/
ri/trunk/impl/src/main/java/org/jboss/weld/bootstrap/AbstractBeanDeployer.java
ri/trunk/impl/src/main/java/org/jboss/weld/bootstrap/BeanDeployer.java
ri/trunk/impl/src/main/java/org/jboss/weld/bootstrap/BeanDeployerEnvironment.java
ri/trunk/impl/src/main/java/org/jboss/weld/bootstrap/BeanDeployment.java
ri/trunk/impl/src/main/java/org/jboss/weld/bootstrap/ExtensionBeanDeployer.java
ri/trunk/impl/src/main/java/org/jboss/weld/bootstrap/ExtensionBeanDeployerEnvironment.java
ri/trunk/impl/src/main/java/org/jboss/weld/bootstrap/WebBeansBootstrap.java
ri/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/
ri/trunk/impl/src/main/java/org/jboss/weld/context/
ri/trunk/impl/src/main/java/org/jboss/weld/context/AbstractApplicationContext.java
ri/trunk/impl/src/main/java/org/jboss/weld/context/AbstractContext.java
ri/trunk/impl/src/main/java/org/jboss/weld/context/AbstractMapContext.java
ri/trunk/impl/src/main/java/org/jboss/weld/context/AbstractThreadLocalMapContext.java
ri/trunk/impl/src/main/java/org/jboss/weld/context/ApplicationContext.java
ri/trunk/impl/src/main/java/org/jboss/weld/context/ContextLifecycle.java
ri/trunk/impl/src/main/java/org/jboss/weld/context/ConversationContext.java
ri/trunk/impl/src/main/java/org/jboss/weld/context/CreationalContextImpl.java
ri/trunk/impl/src/main/java/org/jboss/weld/context/DependentContext.java
ri/trunk/impl/src/main/java/org/jboss/weld/context/DependentInstancesStore.java
ri/trunk/impl/src/main/java/org/jboss/weld/context/ForwardingContextual.java
ri/trunk/impl/src/main/java/org/jboss/weld/context/ForwardingWBCreationalContext.java
ri/trunk/impl/src/main/java/org/jboss/weld/context/RequestContext.java
ri/trunk/impl/src/main/java/org/jboss/weld/context/SerializableContextual.java
ri/trunk/impl/src/main/java/org/jboss/weld/context/SerializableContextualInstance.java
ri/trunk/impl/src/main/java/org/jboss/weld/context/SessionContext.java
ri/trunk/impl/src/main/java/org/jboss/weld/context/SingletonContext.java
ri/trunk/impl/src/main/java/org/jboss/weld/context/WBCreationalContext.java
ri/trunk/impl/src/main/java/org/jboss/weld/context/beanstore/
ri/trunk/impl/src/main/java/org/jboss/weld/conversation/
ri/trunk/impl/src/main/java/org/jboss/weld/ejb/
ri/trunk/impl/src/main/java/org/jboss/weld/el/
ri/trunk/impl/src/main/java/org/jboss/weld/event/
ri/trunk/impl/src/main/java/org/jboss/weld/injection/
ri/trunk/impl/src/main/java/org/jboss/weld/introspector/
ri/trunk/impl/src/main/java/org/jboss/weld/introspector/AnnotationStore.java
ri/trunk/impl/src/main/java/org/jboss/weld/introspector/ConstructorSignature.java
ri/trunk/impl/src/main/java/org/jboss/weld/introspector/ForwardingAnnotated.java
ri/trunk/impl/src/main/java/org/jboss/weld/introspector/ForwardingWBAnnotated.java
ri/trunk/impl/src/main/java/org/jboss/weld/introspector/ForwardingWBAnnotation.java
ri/trunk/impl/src/main/java/org/jboss/weld/introspector/ForwardingWBClass.java
ri/trunk/impl/src/main/java/org/jboss/weld/introspector/ForwardingWBConstructor.java
ri/trunk/impl/src/main/java/org/jboss/weld/introspector/ForwardingWBField.java
ri/trunk/impl/src/main/java/org/jboss/weld/introspector/ForwardingWBMember.java
ri/trunk/impl/src/main/java/org/jboss/weld/introspector/ForwardingWBMethod.java
ri/trunk/impl/src/main/java/org/jboss/weld/introspector/ForwardingWBParameter.java
ri/trunk/impl/src/main/java/org/jboss/weld/introspector/MethodSignature.java
ri/trunk/impl/src/main/java/org/jboss/weld/introspector/WBAnnotated.java
ri/trunk/impl/src/main/java/org/jboss/weld/introspector/WBAnnotation.java
ri/trunk/impl/src/main/java/org/jboss/weld/introspector/WBCallable.java
ri/trunk/impl/src/main/java/org/jboss/weld/introspector/WBClass.java
ri/trunk/impl/src/main/java/org/jboss/weld/introspector/WBConstructor.java
ri/trunk/impl/src/main/java/org/jboss/weld/introspector/WBField.java
ri/trunk/impl/src/main/java/org/jboss/weld/introspector/WBMember.java
ri/trunk/impl/src/main/java/org/jboss/weld/introspector/WBMethod.java
ri/trunk/impl/src/main/java/org/jboss/weld/introspector/WBParameter.java
ri/trunk/impl/src/main/java/org/jboss/weld/introspector/jlr/
ri/trunk/impl/src/main/java/org/jboss/weld/jsf/
ri/trunk/impl/src/main/java/org/jboss/weld/jsp/
ri/trunk/impl/src/main/java/org/jboss/weld/literal/
ri/trunk/impl/src/main/java/org/jboss/weld/metadata/
ri/trunk/impl/src/main/java/org/jboss/weld/metadata/TypeStore.java
ri/trunk/impl/src/main/java/org/jboss/weld/metadata/cache/
ri/trunk/impl/src/main/java/org/jboss/weld/persistence/
ri/trunk/impl/src/main/java/org/jboss/weld/resolution/
ri/trunk/impl/src/main/java/org/jboss/weld/resources/
ri/trunk/impl/src/main/java/org/jboss/weld/servlet/
ri/trunk/impl/src/main/java/org/jboss/weld/util/
ri/trunk/impl/src/main/java/org/jboss/weld/util/ApiAbstraction.java
ri/trunk/impl/src/main/java/org/jboss/weld/util/Beans.java
ri/trunk/impl/src/main/java/org/jboss/weld/util/Names.java
ri/trunk/impl/src/main/java/org/jboss/weld/util/Observers.java
ri/trunk/impl/src/main/java/org/jboss/weld/util/Proxies.java
ri/trunk/impl/src/main/java/org/jboss/weld/util/Reflections.java
ri/trunk/impl/src/main/java/org/jboss/weld/util/Strings.java
ri/trunk/impl/src/main/java/org/jboss/weld/util/Types.java
ri/trunk/impl/src/main/java/org/jboss/weld/util/collections/
ri/trunk/impl/src/main/java/org/jboss/weld/util/dom/
ri/trunk/impl/src/main/java/org/jboss/weld/util/el/
ri/trunk/impl/src/main/java/org/jboss/weld/util/reflection/
ri/trunk/impl/src/main/java/org/jboss/weld/util/serviceProvider/
ri/trunk/impl/src/main/java/org/jboss/weld/ws/
ri/trunk/impl/src/main/java/org/jboss/weld/xml/
Removed:
ri/trunk/impl/src/main/java/org/jboss/webbeans/
Modified:
ri/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/facade/AbstractFacade.java
ri/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/facade/AbstractFacadeBean.java
ri/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/facade/EventBean.java
ri/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/facade/FacadeBeanResolvableTransformer.java
ri/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/facade/InstanceBean.java
ri/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/facade/InstanceImpl.java
ri/trunk/impl/src/main/java/org/jboss/weld/bean/ee/EEResourceProducerField.java
ri/trunk/impl/src/main/java/org/jboss/weld/bean/ee/PersistenceContextProducerField.java
ri/trunk/impl/src/main/java/org/jboss/weld/bean/interceptor/ClassInterceptionHandlerFactory.java
ri/trunk/impl/src/main/java/org/jboss/weld/bean/interceptor/InterceptorBindingsAdapter.java
ri/trunk/impl/src/main/java/org/jboss/weld/bean/interceptor/InterceptorInterceptionHandlerFactory.java
ri/trunk/impl/src/main/java/org/jboss/weld/bean/proxy/ClientProxyInstance.java
ri/trunk/impl/src/main/java/org/jboss/weld/bean/proxy/ClientProxyMethodHandler.java
ri/trunk/impl/src/main/java/org/jboss/weld/bean/proxy/ClientProxyProvider.java
ri/trunk/impl/src/main/java/org/jboss/weld/bean/proxy/DecoratorProxyMethodHandler.java
ri/trunk/impl/src/main/java/org/jboss/weld/bean/proxy/EnterpriseBeanInstance.java
ri/trunk/impl/src/main/java/org/jboss/weld/bean/proxy/EnterpriseBeanProxyMethodHandler.java
ri/trunk/impl/src/main/java/org/jboss/weld/bean/proxy/Marker.java
ri/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AbstractBeanDiscoveryEvent.java
ri/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AbstractContainerEvent.java
ri/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AfterBeanDiscoveryImpl.java
ri/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AfterDeploymentValidationImpl.java
ri/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/BeforeBeanDiscoveryImpl.java
ri/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/BeforeShutdownImpl.java
ri/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessAnnotatedTypeImpl.java
ri/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessObserverMethodImpl.java
ri/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessProducerImpl.java
ri/trunk/impl/src/main/java/org/jboss/weld/context/beanstore/AbstractAttributeBackedBeanStore.java
ri/trunk/impl/src/main/java/org/jboss/weld/context/beanstore/HashMapBeanStore.java
ri/trunk/impl/src/main/java/org/jboss/weld/context/beanstore/NamingScheme.java
ri/trunk/impl/src/main/java/org/jboss/weld/conversation/AbstractConversationManager.java
ri/trunk/impl/src/main/java/org/jboss/weld/conversation/ConversationEntry.java
ri/trunk/impl/src/main/java/org/jboss/weld/conversation/ConversationImpl.java
ri/trunk/impl/src/main/java/org/jboss/weld/conversation/JavaSEConversationTerminator.java
ri/trunk/impl/src/main/java/org/jboss/weld/conversation/NumericConversationIdGenerator.java
ri/trunk/impl/src/main/java/org/jboss/weld/conversation/ServletConversationManager.java
ri/trunk/impl/src/main/java/org/jboss/weld/ejb/EJBApiAbstraction.java
ri/trunk/impl/src/main/java/org/jboss/weld/ejb/EjbDescriptors.java
ri/trunk/impl/src/main/java/org/jboss/weld/ejb/InternalEjbDescriptor.java
ri/trunk/impl/src/main/java/org/jboss/weld/ejb/SessionBeanInterceptor.java
ri/trunk/impl/src/main/java/org/jboss/weld/el/AbstractWebBeansELResolver.java
ri/trunk/impl/src/main/java/org/jboss/weld/el/ELCreationalContext.java
ri/trunk/impl/src/main/java/org/jboss/weld/el/ELCreationalContextStack.java
ri/trunk/impl/src/main/java/org/jboss/weld/el/Namespace.java
ri/trunk/impl/src/main/java/org/jboss/weld/el/WebBeansELContextListener.java
ri/trunk/impl/src/main/java/org/jboss/weld/el/WebBeansELResolver.java
ri/trunk/impl/src/main/java/org/jboss/weld/el/WebBeansExpressionFactory.java
ri/trunk/impl/src/main/java/org/jboss/weld/el/WebBeansMethodExpression.java
ri/trunk/impl/src/main/java/org/jboss/weld/el/WebBeansValueExpression.java
ri/trunk/impl/src/main/java/org/jboss/weld/event/AsynchronousTransactionalEventNotification.java
ri/trunk/impl/src/main/java/org/jboss/weld/event/DeferredEventNotification.java
ri/trunk/impl/src/main/java/org/jboss/weld/event/EventImpl.java
ri/trunk/impl/src/main/java/org/jboss/weld/event/ObserverFactory.java
ri/trunk/impl/src/main/java/org/jboss/weld/event/ObserverMethodImpl.java
ri/trunk/impl/src/main/java/org/jboss/weld/event/Status.java
ri/trunk/impl/src/main/java/org/jboss/weld/event/TransactionSynchronizedRunnable.java
ri/trunk/impl/src/main/java/org/jboss/weld/event/TransactionalObserverMethodImpl.java
ri/trunk/impl/src/main/java/org/jboss/weld/injection/ConstructorInjectionPoint.java
ri/trunk/impl/src/main/java/org/jboss/weld/injection/Exceptions.java
ri/trunk/impl/src/main/java/org/jboss/weld/injection/FieldInjectionPoint.java
ri/trunk/impl/src/main/java/org/jboss/weld/injection/InjectionContextImpl.java
ri/trunk/impl/src/main/java/org/jboss/weld/injection/MethodInjectionPoint.java
ri/trunk/impl/src/main/java/org/jboss/weld/injection/ParameterInjectionPoint.java
ri/trunk/impl/src/main/java/org/jboss/weld/injection/WBInjectionPoint.java
ri/trunk/impl/src/main/java/org/jboss/weld/introspector/jlr/AbstractWBAnnotated.java
ri/trunk/impl/src/main/java/org/jboss/weld/introspector/jlr/AbstractWBCallable.java
ri/trunk/impl/src/main/java/org/jboss/weld/introspector/jlr/AbstractWBMember.java
ri/trunk/impl/src/main/java/org/jboss/weld/introspector/jlr/ConstructorSignatureImpl.java
ri/trunk/impl/src/main/java/org/jboss/weld/introspector/jlr/MethodSignatureImpl.java
ri/trunk/impl/src/main/java/org/jboss/weld/introspector/jlr/WBAnnotationImpl.java
ri/trunk/impl/src/main/java/org/jboss/weld/introspector/jlr/WBClassImpl.java
ri/trunk/impl/src/main/java/org/jboss/weld/introspector/jlr/WBConstructorImpl.java
ri/trunk/impl/src/main/java/org/jboss/weld/introspector/jlr/WBFieldImpl.java
ri/trunk/impl/src/main/java/org/jboss/weld/introspector/jlr/WBMethodImpl.java
ri/trunk/impl/src/main/java/org/jboss/weld/introspector/jlr/WBParameterImpl.java
ri/trunk/impl/src/main/java/org/jboss/weld/jsf/ConversationAwareViewHandler.java
ri/trunk/impl/src/main/java/org/jboss/weld/jsf/FacesUrlTransformer.java
ri/trunk/impl/src/main/java/org/jboss/weld/jsf/JsfApiAbstraction.java
ri/trunk/impl/src/main/java/org/jboss/weld/jsf/JsfHelper.java
ri/trunk/impl/src/main/java/org/jboss/weld/jsf/WebBeansPhaseListener.java
ri/trunk/impl/src/main/java/org/jboss/weld/literal/AnyLiteral.java
ri/trunk/impl/src/main/java/org/jboss/weld/literal/BindingTypeLiteral.java
ri/trunk/impl/src/main/java/org/jboss/weld/literal/DefaultLiteral.java
ri/trunk/impl/src/main/java/org/jboss/weld/literal/InjectLiteral.java
ri/trunk/impl/src/main/java/org/jboss/weld/literal/InterceptorBindingTypeLiteral.java
ri/trunk/impl/src/main/java/org/jboss/weld/literal/NewLiteral.java
ri/trunk/impl/src/main/java/org/jboss/weld/literal/NormalScopeLiteral.java
ri/trunk/impl/src/main/java/org/jboss/weld/literal/ScopeLiteral.java
ri/trunk/impl/src/main/java/org/jboss/weld/literal/StereotypeLiteral.java
ri/trunk/impl/src/main/java/org/jboss/weld/metadata/cache/AnnotationModel.java
ri/trunk/impl/src/main/java/org/jboss/weld/metadata/cache/BindingTypeModel.java
ri/trunk/impl/src/main/java/org/jboss/weld/metadata/cache/InterceptorBindingModel.java
ri/trunk/impl/src/main/java/org/jboss/weld/metadata/cache/MergedStereotypes.java
ri/trunk/impl/src/main/java/org/jboss/weld/metadata/cache/MetaAnnotationStore.java
ri/trunk/impl/src/main/java/org/jboss/weld/metadata/cache/ScopeModel.java
ri/trunk/impl/src/main/java/org/jboss/weld/metadata/cache/StereotypeModel.java
ri/trunk/impl/src/main/java/org/jboss/weld/persistence/PersistenceApiAbstraction.java
ri/trunk/impl/src/main/java/org/jboss/weld/resolution/ForwardingResolvable.java
ri/trunk/impl/src/main/java/org/jboss/weld/resolution/InterceptorResolvable.java
ri/trunk/impl/src/main/java/org/jboss/weld/resolution/NameBasedResolver.java
ri/trunk/impl/src/main/java/org/jboss/weld/resolution/NewResolvableTransformer.java
ri/trunk/impl/src/main/java/org/jboss/weld/resolution/Resolvable.java
ri/trunk/impl/src/main/java/org/jboss/weld/resolution/ResolvableFactory.java
ri/trunk/impl/src/main/java/org/jboss/weld/resolution/ResolvableTransformer.java
ri/trunk/impl/src/main/java/org/jboss/weld/resolution/ResolvableWBClass.java
ri/trunk/impl/src/main/java/org/jboss/weld/resolution/TypeSafeBeanResolver.java
ri/trunk/impl/src/main/java/org/jboss/weld/resolution/TypeSafeDecoratorResolver.java
ri/trunk/impl/src/main/java/org/jboss/weld/resolution/TypeSafeDisposerResolver.java
ri/trunk/impl/src/main/java/org/jboss/weld/resolution/TypeSafeInterceptorResolver.java
ri/trunk/impl/src/main/java/org/jboss/weld/resolution/TypeSafeObserverResolver.java
ri/trunk/impl/src/main/java/org/jboss/weld/resolution/TypeSafeResolver.java
ri/trunk/impl/src/main/java/org/jboss/weld/resources/ClassTransformer.java
ri/trunk/impl/src/main/java/org/jboss/weld/resources/DefaultResourceLoader.java
ri/trunk/impl/src/main/java/org/jboss/weld/resources/ManagerObjectFactory.java
ri/trunk/impl/src/main/java/org/jboss/weld/servlet/ApplicationBeanStore.java
ri/trunk/impl/src/main/java/org/jboss/weld/servlet/ConversationBeanStore.java
ri/trunk/impl/src/main/java/org/jboss/weld/servlet/ConversationPropagationFilter.java
ri/trunk/impl/src/main/java/org/jboss/weld/servlet/HttpRequestSessionBeanStore.java
ri/trunk/impl/src/main/java/org/jboss/weld/servlet/HttpSessionBeanStore.java
ri/trunk/impl/src/main/java/org/jboss/weld/servlet/HttpSessionManager.java
ri/trunk/impl/src/main/java/org/jboss/weld/servlet/ServletApiAbstraction.java
ri/trunk/impl/src/main/java/org/jboss/weld/servlet/ServletHelper.java
ri/trunk/impl/src/main/java/org/jboss/weld/servlet/ServletLifecycle.java
ri/trunk/impl/src/main/java/org/jboss/weld/servlet/WebBeansListener.java
ri/trunk/impl/src/main/java/org/jboss/weld/util/collections/Arrays2.java
ri/trunk/impl/src/main/java/org/jboss/weld/util/collections/ConcurrentCache.java
ri/trunk/impl/src/main/java/org/jboss/weld/util/collections/EnumerationList.java
ri/trunk/impl/src/main/java/org/jboss/weld/util/collections/ListComparator.java
ri/trunk/impl/src/main/java/org/jboss/weld/util/dom/NodeListIterable.java
ri/trunk/impl/src/main/java/org/jboss/weld/util/dom/NodeListIterator.java
ri/trunk/impl/src/main/java/org/jboss/weld/util/el/ForwardingELContext.java
ri/trunk/impl/src/main/java/org/jboss/weld/util/el/ForwardingELResolver.java
ri/trunk/impl/src/main/java/org/jboss/weld/util/el/ForwardingExpressionFactory.java
ri/trunk/impl/src/main/java/org/jboss/weld/util/el/ForwardingMethodExpression.java
ri/trunk/impl/src/main/java/org/jboss/weld/util/el/ForwardingValueExpression.java
ri/trunk/impl/src/main/java/org/jboss/weld/util/reflection/ParameterizedTypeImpl.java
ri/trunk/impl/src/main/java/org/jboss/weld/util/serviceProvider/ServiceLoader.java
ri/trunk/impl/src/main/java/org/jboss/weld/ws/WSApiAbstraction.java
ri/trunk/impl/src/main/java/org/jboss/weld/xml/BeansXmlParser.java
Log:
refactored core packages
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/BeanManagerImpl.java (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/BeanManagerImpl.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/weld/BeanManagerImpl.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/BeanManagerImpl.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -0,0 +1,1426 @@
+/*
+ * 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.io.Serializable;
+import java.lang.annotation.Annotation;
+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.ContextNotActiveException;
+import javax.enterprise.context.spi.Context;
+import javax.enterprise.context.spi.Contextual;
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.AmbiguousResolutionException;
+import javax.enterprise.inject.InjectionException;
+import javax.enterprise.inject.UnproxyableResolutionException;
+import javax.enterprise.inject.UnsatisfiedResolutionException;
+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.DecoratorImpl;
+import org.jboss.weld.bean.InterceptorImpl;
+import org.jboss.weld.bean.SessionBean;
+import org.jboss.weld.bean.proxy.ClientProxyProvider;
+import org.jboss.weld.bootstrap.api.ServiceRegistry;
+import org.jboss.weld.context.CreationalContextImpl;
+import org.jboss.weld.context.WBCreationalContext;
+import org.jboss.weld.ejb.EjbDescriptors;
+import org.jboss.weld.ejb.spi.EjbDescriptor;
+import org.jboss.weld.el.Namespace;
+import org.jboss.weld.el.WebBeansELResolver;
+import org.jboss.weld.el.WebBeansExpressionFactory;
+import org.jboss.weld.introspector.WBAnnotated;
+import org.jboss.weld.literal.AnyLiteral;
+import org.jboss.weld.literal.DefaultLiteral;
+import org.jboss.weld.log.Log;
+import org.jboss.weld.log.Logging;
+import org.jboss.weld.manager.api.WebBeansManager;
+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.ResolvableWBClass;
+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.util.Beans;
+import org.jboss.weld.util.Observers;
+import org.jboss.weld.util.Proxies;
+import org.jboss.weld.util.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 Web Beans 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 WebBeansManager, 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 Log log = Logging.getLog(BeanManagerImpl.class);
+
+ private static final long serialVersionUID = 3021562879133838561L;
+
+ // The JNDI key to place the manager under
+ public static final String JNDI_KEY = "java:app/Manager";
+
+ /*
+ * 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<String, Bean<?>> passivationCapableBeans;
+
+ // 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<?>> enabledPolicyClasses;
+ private transient Collection<Class<? extends Annotation>> enabledPolicyStereotypes;
+ 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, DecoratorImpl<?>> decoratorResolver;
+ private transient final TypeSafeResolver<? extends Resolvable, InterceptorImpl<?>> interceptorResolver;
+ private transient final TypeSafeResolver<? extends Resolvable, ObserverMethod<?,?>> observerResolver;
+ private transient final NameBasedResolver nameBasedResolver;
+ private transient final ELResolver webbeansELResolver;
+ 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<DecoratorImpl<?>> decorators;
+ private transient final List<InterceptorImpl<?>> 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<?>, Interceptor<?>> boundInterceptorsRegistry = new InterceptorRegistry<Class<?>, 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<DecoratorImpl<?>>(),
+ new CopyOnWriteArrayList<InterceptorImpl<?>>(),
+ new CopyOnWriteArrayList<ObserverMethod<?,?>>(),
+ new CopyOnWriteArrayList<String>(),
+ new ConcurrentHashMap<EjbDescriptor<?>, SessionBean<?>>(),
+ new ConcurrentHashMap<String, Bean<?>>(),
+ 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<DecoratorImpl<?>>(),
+ new CopyOnWriteArrayList<InterceptorImpl<?>>(),
+ new CopyOnWriteArrayList<ObserverMethod<?,?>>(),
+ new CopyOnWriteArrayList<String>(),
+ rootManager.getEnterpriseBeans(),
+ new ConcurrentHashMap<String, Bean<?>>(),
+ 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<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,
+ parentManager.getDecorators(),
+ parentManager.getInterceptors(),
+ registeredObservers,
+ namespaces,
+ parentManager.getEnterpriseBeans(),
+ parentManager.getPassivationCapableBeans(),
+ parentManager.getClientProxyProvider(),
+ parentManager.getContexts(),
+ parentManager.getCurrentActivities(),
+ parentManager.getSpecializedBeans(),
+ parentManager.getEnabledPolicyClasses(),
+ parentManager.getEnabledPolicyStereotypes(),
+ 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<DecoratorImpl<?>> decorators,
+ List<InterceptorImpl<?>> interceptors,
+ List<ObserverMethod<?,?>> observers,
+ List<String> namespaces,
+ Map<EjbDescriptor<?>, SessionBean<?>> enterpriseBeans,
+ Map<String, Bean<?>> riBeans,
+ ClientProxyProvider clientProxyProvider,
+ ListMultimap<Class<? extends Annotation>, Context> contexts,
+ Set<CurrentActivity> currentActivities,
+ Map<Contextual<?>, Contextual<?>> specializedBeans,
+ Collection<Class<?>> enabledPolicyClasses,
+ Collection<Class<? extends Annotation>> enabledPolicyStereotypes,
+ List<Class<?>> enabledDecoratorClasses,
+ List<Class<?>> enabledInterceptorClasses,
+ String id,
+ AtomicInteger childIds)
+ {
+ this.services = serviceRegistry;
+ this.beans = beans;
+ this.decorators = decorators;
+ this.interceptors = interceptors;
+ this.enterpriseBeans = enterpriseBeans;
+ this.passivationCapableBeans = riBeans;
+ this.clientProxyProvider = clientProxyProvider;
+ this.contexts = contexts;
+ this.currentActivities = currentActivities;
+ this.specializedBeans = specializedBeans;
+ this.observers = observers;
+ this.enabledPolicyClasses = enabledPolicyClasses;
+ this.enabledPolicyStereotypes = enabledPolicyStereotypes;
+ 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...
+ this.beanResolver = new TypeSafeBeanResolver<Bean<?>>(this, createDynamicAccessibleIterable(Transform.BEAN));
+ 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(Transform.BEAN));
+ this.webbeansELResolver = new WebBeansELResolver(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 Transform<Bean<?>> BEAN = new Transform<Bean<?>>()
+ {
+
+ public Iterable<Bean<?>> transform(BeanManagerImpl beanManager)
+ {
+ return beanManager.getBeans();
+ }
+
+ };
+
+ public static Transform<DecoratorImpl<?>> DECORATOR_BEAN = new Transform<DecoratorImpl<?>>()
+ {
+
+ public Iterable<DecoratorImpl<?>> transform(BeanManagerImpl beanManager)
+ {
+ return beanManager.getDecorators();
+ }
+
+ };
+
+ public static Transform<InterceptorImpl<?>> INTERCEPTOR_BEAN = new Transform<InterceptorImpl<?>>()
+ {
+
+ public Iterable<InterceptorImpl<?>> 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();
+ }
+
+ protected Set<BeanManagerImpl> getAccessibleManagers()
+ {
+
+ return accessibleManagers;
+ }
+
+ 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)
+ {
+ passivationCapableBeans.put(((PassivationCapable) bean).getId(), bean);
+ }
+ registerBeanNamespace(bean);
+ for (BeanManagerImpl childActivity : childActivities)
+ {
+ childActivity.addBean(bean);
+ }
+ this.beans.add(bean);
+ beanResolver.clear();
+ }
+
+ public void addDecorator(DecoratorImpl<?> bean)
+ {
+ decorators.add(bean);
+ passivationCapableBeans.put(bean.getId(), bean);
+ decoratorResolver.clear();
+ }
+
+ public <T> Set<ObserverMethod<?, T>> resolveObserverMethods(T event, Annotation... bindings)
+ {
+ Observers.checkEventObjectType(event);
+ return resolveObserverMethods(event.getClass(), bindings);
+ }
+
+ public void addInterceptor(InterceptorImpl<?> bean)
+ {
+ interceptors.add(bean);
+ //TODO decide if interceptor is passivationCapable
+ interceptorResolver.clear();
+ }
+
+
+ @SuppressWarnings("unchecked")
+ private <T> Set<ObserverMethod<?, T>> resolveObserverMethods(Type eventType, Annotation... bindings)
+ {
+ checkBindingTypes(Arrays.asList(bindings));
+
+ // Manually hack in the default annotations here. We need to redo all the annotation defaulting throughout. PLM
+ HashSet<Annotation> bindingAnnotations = new HashSet<Annotation>(Arrays.asList(bindings));
+ if (bindingAnnotations.size() == 0)
+ {
+ bindingAnnotations.add(new DefaultLiteral());
+ }
+ bindingAnnotations.add(new AnyLiteral());
+ Set<ObserverMethod<?, T>> observers = new HashSet<ObserverMethod<?, T>>();
+ Set<ObserverMethod<?,?>> eventObservers = observerResolver.resolve(ResolvableFactory.of(new Reflections.HierarchyDiscovery(eventType).getFlattenedTypes(), 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 IllegalArgumentException("Not a binding type " + annotation);
+ }
+ }
+ if (bindingAnnotations.size() < bindings.size())
+ {
+ throw new IllegalArgumentException("Duplicate binding types: " + bindings);
+ }
+
+ }
+
+ /**
+ * A collection of enabled policy classes
+ *
+ */
+ public Collection<Class<?>> getEnabledPolicyClasses()
+ {
+ return Collections.unmodifiableCollection(enabledPolicyClasses);
+ }
+
+ /**
+ * @return the enabledPolicySterotypes
+ */
+ public Collection<Class<? extends Annotation>> getEnabledPolicyStereotypes()
+ {
+ return Collections.unmodifiableCollection(enabledPolicyStereotypes);
+ }
+
+ public boolean isBeanEnabled(Bean<?> bean)
+ {
+ return Beans.isBeanEnabled(bean, getEnabledPolicyClasses(), getEnabledPolicyStereotypes());
+ }
+
+ /**
+ * @return the enabledDecoratorClasses
+ */
+ public List<Class<?>> getEnabledDecoratorClasses()
+ {
+ return Collections.unmodifiableList(enabledDecoratorClasses);
+ }
+
+ /**
+ * @return the enabledInterceptorClasses
+ */
+ public List<Class<?>> getEnabledInterceptorClasses()
+ {
+ return Collections.unmodifiableList(enabledInterceptorClasses);
+ }
+
+ public void setEnabledPolicyClasses(Collection<Class<?>> enabledPolicyClasses)
+ {
+ this.enabledPolicyClasses = enabledPolicyClasses;
+ }
+
+ public void setEnabledPolicyStereotypes(Collection<Class<? extends Annotation>> enabledPolicySterotypes)
+ {
+ this.enabledPolicyStereotypes = enabledPolicySterotypes;
+ }
+
+ 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(ResolvableWBClass.of(beanType, bindings, this), bindings);
+ }
+
+ public Set<Bean<?>> getBeans(WBAnnotated<?, ?> element, Annotation... bindings)
+ {
+ for (Annotation annotation : element.getAnnotations())
+ {
+ if (!getServices().get(MetaAnnotationStore.class).getBindingTypeModel(annotation.annotationType()).isValid())
+ {
+ throw new IllegalArgumentException("Not a binding type " + 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 IllegalArgumentException("Duplicate bindings (" + Arrays.asList(bindings) + ") type passed " + element.toString());
+ }
+ 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(ResolvableWBClass.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);
+ }
+
+ public List<DecoratorImpl<?>> getDecorators()
+ {
+ return Collections.unmodifiableList(decorators);
+ }
+
+ public List<InterceptorImpl<?>> getInterceptors()
+ {
+ return Collections.unmodifiableList(interceptors);
+ }
+
+ public Iterable<Bean<?>> getAccessibleBeans()
+ {
+ return createDynamicAccessibleIterable(Transform.BEAN);
+ }
+
+ /**
+ * Get all the spec defined beans, including interceptor beans and decorator
+ * beans. This is behavior is different to getBeans() which returns only
+ * resolvable beans.
+ *
+ * TODO Rename method, merge into whatever we use for passivation capable or
+ * split out decorators
+ *
+ * WARNING, method will go away!
+ *
+ * @return
+ */
+ public Map<String, Bean<?>> getPassivationCapableBeans()
+ {
+ return Collections.unmodifiableMap(passivationCapableBeans);
+ }
+
+ 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);
+ log.trace("Added observer " + 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<?, T>> observers)
+ {
+ for (ObserverMethod<?, 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("No active contexts for scope type " + scopeType.getName());
+ }
+ if (activeContexts.size() > 1)
+ {
+ throw new IllegalStateException("More than one context active for scope type " + scopeType.getName());
+ }
+ return activeContexts.iterator().next();
+
+ }
+
+ public Object getReference(Bean<?> bean, CreationalContext<?> creationalContext)
+ {
+ bean = getMostSpecializedBean(bean);
+ if (creationalContext instanceof WBCreationalContext<?>)
+ {
+ creationalContext = ((WBCreationalContext<?>) creationalContext).getCreationalContext(bean);
+ }
+ if (getServices().get(MetaAnnotationStore.class).getScopeModel(bean.getScope()).isNormal())
+ {
+ 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);
+ }
+ }
+
+ public Object getReference(Bean<?> bean, Type beanType, CreationalContext<?> creationalContext)
+ {
+
+ if (!Reflections.isAssignableFrom(bean.getTypes(), beanType))
+ {
+ throw new IllegalArgumentException("The given beanType is not a type " + beanType +" of the bean " + bean );
+ }
+ return getReference(bean, creationalContext);
+ }
+
+
+ /**
+ * 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));
+ try
+ {
+ if (registerInjectionPoint)
+ {
+ currentInjectionPoint.get().push(injectionPoint);
+ }
+ if (getServices().get(MetaAnnotationStore.class).getScopeModel(resolvedBean.getScope()).isNormal() && !Proxies.isTypeProxyable(injectionPoint.getType()))
+ {
+ throw new UnproxyableResolutionException("Attempting to inject an unproxyable normal scoped bean " + resolvedBean + " into " + injectionPoint);
+ }
+ // TODO Can we move this logic to getReference?
+ if (creationalContext instanceof WBCreationalContext<?>)
+ {
+ WBCreationalContext<?> wbCreationalContext = (WBCreationalContext<?>) creationalContext;
+ if (wbCreationalContext.containsIncompleteInstance(resolvedBean))
+ {
+ return wbCreationalContext.getIncompleteInstance(resolvedBean);
+ }
+ else
+ {
+ return getReference(resolvedBean, wbCreationalContext);
+ }
+ }
+ else
+ {
+ return getReference(resolvedBean, creationalContext);
+ }
+ }
+ finally
+ {
+ if (registerInjectionPoint)
+ {
+ currentInjectionPoint.get().pop();
+ }
+ }
+ }
+
+
+ public Object getInjectableReference(InjectionPoint injectionPoint, CreationalContext<?> creationalContext)
+ {
+ WBAnnotated<?, ?> element = ResolvableWBClass.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);
+ Object reference = getReference(bean, beanType, createCreationalContext(bean));
+
+ @SuppressWarnings("unchecked")
+ T instance = (T) reference;
+
+ return instance;
+ }
+
+ public <T> Bean<T> getBean(WBAnnotated<T, ?> element, Annotation... bindings)
+ {
+ Bean<T> bean = (Bean<T>) resolve(getBeans(element, bindings));
+ if (bean == null)
+ {
+ throw new UnsatisfiedResolutionException(element + "Unable to resolve any Web Beans");
+ }
+
+ boolean normalScoped = getServices().get(MetaAnnotationStore.class).getScopeModel(bean.getScope()).isNormal();
+ if (normalScoped && !Beans.isBeanProxyable(bean))
+ {
+ throw new UnproxyableResolutionException("Normal scoped bean " + bean + " is not proxyable");
+ }
+ 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 IllegalArgumentException("No decorator types were specified in the set");
+ }
+ 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)
+ {
+ 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 policies: " + getEnabledPolicyClasses() + " " + getEnabledPolicyStereotypes() + "\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();
+ }
+
+ 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 IllegalArgumentException("Scope must be a normal scope type " + 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 IllegalStateException("More than one current activity for an active context " + 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();
+ }
+ else
+ {
+ log.trace("No current injection point to replace #0", injectionPoint);
+ }
+ currentInjectionPoint.get().push(injectionPoint);
+ return originalInjectionPoint;
+ }
+
+ /**
+ *
+ * @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);
+ }
+
+ 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.getMessage(), e.getCause());
+ }
+ }
+
+ public Set<Annotation> getInterceptorBindingTypeDefinition(Class<? extends Annotation> bindingType)
+ {
+ if (getServices().get(MetaAnnotationStore.class).getInterceptorBindingModel(bindingType).isValid())
+ {
+ return getServices().get(MetaAnnotationStore.class).getInterceptorBindingModel(bindingType).getInheritedInterceptionBindingTypes();
+ }
+ else
+ {
+ throw new IllegalArgumentException("Not a interception binding :" + bindingType);
+ }
+ }
+
+ public Bean<?> getPassivationCapableBean(String id)
+ {
+ throw new UnsupportedOperationException("Not yet implemented");
+ }
+
+ 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 IllegalArgumentException("Not a stereotype " + stereotype);
+ }
+ }
+
+ public boolean isQualifier(Class<? extends Annotation> annotationType)
+ {
+ return getServices().get(MetaAnnotationStore.class).getBindingTypeModel(annotationType).isValid();
+ }
+
+ public boolean isInterceptorBindingType(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 webbeansELResolver;
+ }
+
+ public ExpressionFactory wrapExpressionFactory(ExpressionFactory expressionFactory)
+ {
+ return new WebBeansExpressionFactory(expressionFactory);
+ }
+
+ public <T> WBCreationalContext<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("Cannot resolve an ambiguous dependency between " + 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();
+ }
+
+ public InterceptorRegistry<Class<?>, Interceptor<?>> getBoundInterceptorsRegistry()
+ {
+ return boundInterceptorsRegistry;
+ }
+
+ public InterceptorRegistry<Class<?>, Class<?>> getDeclaredInterceptorsRegistry()
+ {
+ return declaredInterceptorsRegistry;
+ }
+}
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/Container.java (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/Container.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/weld/Container.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/Container.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -0,0 +1,194 @@
+/*
+ * 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.Map;
+import java.util.Map.Entry;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.jboss.weld.bootstrap.BeanDeployment;
+import org.jboss.weld.bootstrap.api.ServiceRegistry;
+import org.jboss.weld.bootstrap.api.Singleton;
+import org.jboss.weld.bootstrap.api.SingletonProvider;
+import org.jboss.weld.bootstrap.spi.BeanDeploymentArchive;
+
+/**
+ * A Web Beans application container
+ *
+ * @author pmuir
+ *
+ */
+public class Container
+{
+
+ private final static Singleton<Container> instance;
+
+ static
+ {
+ instance = SingletonProvider.instance().create(Container.class);
+ }
+
+ /**
+ * Get the container for the current application deployment
+ *
+ * @return
+ */
+ public static Container instance()
+ {
+ return instance.get();
+ }
+
+
+ /**
+ * Initialize the container for the current application deployment
+ *
+ * @param deploymentManager
+ * @param deploymentServices
+ */
+ public static void initialize(BeanManagerImpl deploymentManager, ServiceRegistry deploymentServices)
+ {
+ Container instance = new Container(deploymentManager, deploymentServices);
+ Container.instance.set(instance);
+ }
+
+ // The deployment bean manager
+ private final BeanManagerImpl deploymentManager;
+
+ // A map of managers keyed by ID, used for activities and serialization
+ private final Map<String, BeanManagerImpl> managers;
+
+ // A map of BDA -> bean managers
+ private final Map<BeanDeploymentArchive, BeanManagerImpl> beanDeploymentArchives;
+
+ private final ServiceRegistry deploymentServices;
+
+ private boolean initialized = false;
+
+ public Container(BeanManagerImpl deploymentManager, ServiceRegistry deploymentServices)
+ {
+ this.deploymentManager = deploymentManager;
+ this.managers = new ConcurrentHashMap<String, BeanManagerImpl>();
+ this.managers.put(deploymentManager.getId(), deploymentManager);
+ this.beanDeploymentArchives = new ConcurrentHashMap<BeanDeploymentArchive, BeanManagerImpl>();
+ this.deploymentServices = deploymentServices;
+ }
+
+ /**
+ * Cause the container to be cleaned up, including all registered bean
+ * managers, and all deployment services
+ */
+ public void cleanup()
+ {
+ // TODO We should probably cleanup the bean managers for activities?
+ managers.clear();
+
+ for (BeanManagerImpl beanManager : beanDeploymentArchives.values())
+ {
+ beanManager.cleanup();
+ }
+ beanDeploymentArchives.clear();
+
+ deploymentServices.cleanup();
+ deploymentManager.cleanup();
+ }
+
+ /**
+ * Gets the manager for this application deployment
+ *
+ */
+ public BeanManagerImpl deploymentManager()
+ {
+ return deploymentManager;
+ }
+ public Map<BeanDeploymentArchive, BeanManagerImpl> beanDeploymentArchives()
+ {
+ return beanDeploymentArchives;
+ }
+
+ /**
+ * Get the activity manager for a given key
+ *
+ * @param key
+ * @return
+ */
+ public BeanManagerImpl activityManager(String key)
+ {
+ return managers.get(key);
+ }
+
+ /**
+ * Add an activity
+ *
+ * @param manager
+ * @return
+ */
+ public String addActivity(BeanManagerImpl manager)
+ {
+ String id = manager.getId();
+ if (manager.getId() == null)
+ {
+ throw new IllegalArgumentException("Bean manager must not be null " + manager.toString());
+ }
+ managers.put(id, manager);
+ return id;
+ }
+
+ /**
+ * Get the services for this application deployment
+ *
+ * @return the deploymentServices
+ */
+ public ServiceRegistry deploymentServices()
+ {
+ return deploymentServices;
+ }
+
+ /**
+ * Add sub-deployment units to the container
+ *
+ * @param beanDeployments
+ */
+ public void putBeanDeployments(Map<BeanDeploymentArchive, BeanDeployment> beanDeployments)
+ {
+ for (Entry<BeanDeploymentArchive, BeanDeployment> entry : beanDeployments.entrySet())
+ {
+ beanDeploymentArchives.put(entry.getKey(), entry.getValue().getBeanManager());
+ addActivity(entry.getValue().getBeanManager());
+ }
+ }
+
+ /**
+ * Check if the application container is fully initialized
+ *
+ * @return the initialized
+ */
+ public boolean isInitialized()
+ {
+ return initialized;
+ }
+
+ /**
+ * Put the application container into an initialized state
+ *
+ * @param initialized the initialized to set
+ */
+ public void setInitialized(boolean initialized)
+ {
+ this.initialized = initialized;
+ }
+
+}
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/ContextualStore.java (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/ContextualStore.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/weld/ContextualStore.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/ContextualStore.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -0,0 +1,124 @@
+/*
+ * 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.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import javax.enterprise.context.spi.Contextual;
+import javax.enterprise.inject.spi.PassivationCapable;
+
+import org.jboss.weld.bootstrap.api.Service;
+
+import com.google.common.collect.BiMap;
+import com.google.common.collect.HashBiMap;
+import com.google.common.collect.Maps;
+
+/**
+ * Application wide contextual identifier service which allows a serializable
+ * reference to a contextual to be obtained, and the contextual to be returned
+ * for a given id.
+ *
+ * If the contextual implements PassivationCapable, the id will be obtained
+ * from it, in which case the Contextual can be activated in any container.
+ * If not, the Contextual can only be activated in this container.
+ *
+ * Note that this allows a Bean object to be loaded regardless
+ * of the bean's accessiblity from the current module, and should not be abused
+ * as a way to ignore accessibility rules enforced during resolution.
+ *
+ * @author Pete Muir
+ *
+ *
+ */
+public class ContextualStore implements Service
+{
+
+ private static final String GENERATED_ID_PREFIX = ContextualStore.class.getName();
+
+ // The map containing container-local contextuals
+ private final BiMap<Contextual<?>, String> contextuals;
+
+ // The map containing passivation capable contextuals
+ private final ConcurrentMap<String, Contextual<?>> passivationCapableContextuals;
+
+ private final AtomicInteger idGenerator;
+
+ public ContextualStore()
+ {
+ this.idGenerator = new AtomicInteger(0);
+ BiMap<Contextual<?>, String> map = HashBiMap.create();
+ // TODO Somehow remove this sync if it shows bad in a profiler
+ this.contextuals = Maps.synchronizedBiMap(map);
+ this.passivationCapableContextuals = new ConcurrentHashMap<String, Contextual<?>>();
+ }
+
+ /**
+ * Given a particular id, return the correct contextual. For contextuals
+ * which aren't passivation capable, the contextual can't be found in another
+ * container, and null will be returned.
+ *
+ * @param id An identifier for the contextual
+ * @return the contextual
+ */
+ @SuppressWarnings("unchecked")
+ public <C extends Contextual<I>, I> C getContextual(String id)
+ {
+ if (id.startsWith(GENERATED_ID_PREFIX))
+ {
+ return (C) contextuals.inverse().get(id);
+ }
+ else
+ {
+ return (C) passivationCapableContextuals.get(id);
+ }
+ }
+
+ /**
+ * Add a contextual (if not already present) to the store, and return
+ * it's id. If the contextual is passivation capable, it's id will
+ * be used, otherwise an id will be generated
+ *
+ * @param contextual the contexutal to add
+ * @return the current id for the contextual
+ */
+ public String putIfAbsent(Contextual<?> contextual)
+ {
+ if (contextual instanceof PassivationCapable)
+ {
+ PassivationCapable passivationCapable = (PassivationCapable) contextual;
+ passivationCapableContextuals.putIfAbsent(passivationCapable.getId(), contextual);
+ return passivationCapable.getId();
+ }
+ else if (contextuals.containsKey(contextual))
+ {
+ return contextuals.get(contextual);
+ }
+ else
+ {
+ String id = new StringBuilder().append(GENERATED_ID_PREFIX).append(idGenerator.incrementAndGet()).toString();
+ contextuals.put(contextual, id);
+ return id;
+ }
+ }
+
+ public void cleanup()
+ {
+ contextuals.clear();
+ }
+}
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/DefinitionException.java (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/DefinitionException.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/weld/DefinitionException.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/DefinitionException.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -0,0 +1,48 @@
+/*
+ * 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 the definition of a bean is incorrect
+ *
+ * @author Pete Muir
+ */
+public class DefinitionException extends RuntimeException
+{
+ private static final long serialVersionUID = 8014646336322875707L;
+
+ public DefinitionException()
+ {
+ super();
+ }
+
+ public DefinitionException(String message, Throwable throwable)
+ {
+ super(message, throwable);
+ }
+
+ public DefinitionException(String message)
+ {
+ super(message);
+ }
+
+ public DefinitionException(Throwable throwable)
+ {
+ super(throwable);
+ }
+
+}
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/DeploymentException.java (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/DeploymentException.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/weld/DeploymentException.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/DeploymentException.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -0,0 +1,48 @@
+/*
+ * 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 deployment exception occurs.
+ *
+ * @author Pete Muir
+ */
+public class DeploymentException extends RuntimeException
+{
+ private static final long serialVersionUID = 8014646336322875707L;
+
+ public DeploymentException()
+ {
+ super();
+ }
+
+ public DeploymentException(String message, Throwable throwable)
+ {
+ super(message, throwable);
+ }
+
+ public DeploymentException(String message)
+ {
+ super(message);
+ }
+
+ public DeploymentException(Throwable throwable)
+ {
+ super(throwable);
+ }
+
+}
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/InconsistentSpecializationException.java (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/InconsistentSpecializationException.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/weld/InconsistentSpecializationException.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/InconsistentSpecializationException.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -0,0 +1,50 @@
+/*
+ * 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;
+
+ public InconsistentSpecializationException()
+ {
+ super();
+ }
+
+ public InconsistentSpecializationException(String message, Throwable throwable)
+ {
+ super(message, throwable);
+ }
+
+ public InconsistentSpecializationException(String message)
+ {
+ super(message);
+ }
+
+ public InconsistentSpecializationException(Throwable throwable)
+ {
+ super(throwable);
+ }
+
+
+
+}
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/Logger.java (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/Logger.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/weld/Logger.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/Logger.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -0,0 +1,51 @@
+/*
+ * 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);
+
+}
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/NullableDependencyException.java (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/NullableDependencyException.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/weld/NullableDependencyException.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/NullableDependencyException.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -0,0 +1,52 @@
+/*
+ * 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;
+
+ public NullableDependencyException()
+ {
+ super();
+ }
+
+ public NullableDependencyException(String message, Throwable throwable)
+ {
+ super(message, throwable);
+ }
+
+ public NullableDependencyException(String message)
+ {
+ super(message);
+ }
+
+ public NullableDependencyException(Throwable throwable)
+ {
+ super(throwable);
+ }
+
+
+
+}
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/SimpleInjectionTarget.java (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/SimpleInjectionTarget.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/weld/SimpleInjectionTarget.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/SimpleInjectionTarget.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -0,0 +1,155 @@
+/*
+ * 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.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.WBInjectionPoint;
+import org.jboss.weld.introspector.WBClass;
+import org.jboss.weld.introspector.WBMethod;
+import org.jboss.weld.util.Beans;
+
+/**
+ * @author pmuir
+ *
+ */
+public class SimpleInjectionTarget<T> implements InjectionTarget<T>
+{
+
+ private final BeanManagerImpl beanManager;
+ private final WBClass<T> type;
+ private final ConstructorInjectionPoint<T> constructor;
+ private final List<Set<FieldInjectionPoint<?, ?>>> injectableFields;
+ private final List<Set<MethodInjectionPoint<?, ?>>> initializerMethods;
+ private final WBMethod<?, ?> postConstruct;
+ private final WBMethod<?, ?> preDestroy;
+ private final Set<InjectionPoint> injectionPoints;
+ private final Set<WBInjectionPoint<?, ?>> ejbInjectionPoints;
+ private final Set<WBInjectionPoint<?, ?>> persistenceContextInjectionPoints;
+ private final Set<WBInjectionPoint<?, ?>> persistenceUnitInjectionPoints;
+ private final Set<WBInjectionPoint<?, ?>> resourceInjectionPoints;
+
+ public SimpleInjectionTarget(WBClass<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);
+ }
+
+ 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 IllegalStateException(
+ "We were not previously able to find the bean constructor, but now are?");
+ }
+ 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 RuntimeException("Error invoking postConstruct() " + postConstruct, e);
+ }
+ }
+
+ public void preDestroy(T instance)
+ {
+ if (preDestroy == null)
+ return;
+
+ try
+ {
+ preDestroy.invoke(instance);
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException("Error invoking preDestroy() " + preDestroy, e);
+ }
+ }
+
+ public void dispose(T instance)
+ {
+ // No-op
+ }
+
+ public Set<InjectionPoint> getInjectionPoints()
+ {
+ return injectionPoints;
+ }
+
+}
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/SingleThreadExecutorServices.java (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/SingleThreadExecutorServices.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/weld/SingleThreadExecutorServices.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/SingleThreadExecutorServices.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -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;
+
+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();
+ }
+ }
+
+}
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/UnserializableDependencyException.java (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/UnserializableDependencyException.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/weld/UnserializableDependencyException.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/UnserializableDependencyException.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -0,0 +1,55 @@
+/*
+ * 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;
+
+ public UnserializableDependencyException()
+ {
+ super();
+ }
+
+ public UnserializableDependencyException(String message, Throwable throwable)
+ {
+ super(message, throwable);
+ }
+
+ public UnserializableDependencyException(String message)
+ {
+ super(message);
+ }
+
+ public UnserializableDependencyException(Throwable throwable)
+ {
+ super(throwable);
+ }
+
+
+
+}
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/Validator.java (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/Validator.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/weld/Validator.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/Validator.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -0,0 +1,344 @@
+/*
+ * 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.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.IllegalProductException;
+import javax.enterprise.inject.Instance;
+import javax.enterprise.inject.New;
+import javax.enterprise.inject.UnproxyableResolutionException;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.Decorator;
+import javax.enterprise.inject.spi.InjectionPoint;
+
+import org.jboss.weld.bean.AbstractClassBean;
+import org.jboss.weld.bean.AbstractProducerBean;
+import org.jboss.weld.bean.DecoratorImpl;
+import org.jboss.weld.bean.DisposalMethod;
+import org.jboss.weld.bean.NewManagedBean;
+import org.jboss.weld.bean.NewSessionBean;
+import org.jboss.weld.bean.RIBean;
+import org.jboss.weld.bootstrap.BeanDeployerEnvironment;
+import org.jboss.weld.bootstrap.api.Service;
+import org.jboss.weld.introspector.WBAnnotated;
+import org.jboss.weld.metadata.cache.MetaAnnotationStore;
+import org.jboss.weld.resolution.ResolvableWBClass;
+import org.jboss.weld.util.Beans;
+import org.jboss.weld.util.Proxies;
+import org.jboss.weld.util.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
+ *
+ */
+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("Normal scoped bean " + bean + " is not proxyable");
+ }
+ }
+
+ /**
+ * 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("Two beans cannot specialize the same bean: " + bean);
+ }
+ specializedBeans.add(abstractBean.getSpecializedBean());
+ }
+ if (Beans.isPassivationCapableBean(bean) && bean instanceof AbstractClassBean<?>)
+ {
+ AbstractClassBean<?> classBean = (AbstractClassBean<?>) bean;
+ if (classBean.hasDecorators())
+ {
+ for (Decorator<?> decorator : classBean.getDecorators())
+ {
+ if (!Reflections.isSerializable(decorator.getBeanClass()))
+ {
+ throw new UnserializableDependencyException("The bean " + bean + " declares a passivating scope but has non-serializable decorator: " + 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("The injection point " + ij + " is annotated with @New which cannot be combined with other binding types");
+ }
+ if (ij.getType().equals(InjectionPoint.class) && ij.getBean() == null)
+ {
+ throw new DefinitionException("Cannot inject an Injection point into a class which isn't a bean " + ij);
+ }
+ if (ij.getType().equals(InjectionPoint.class) && !Dependent.class.equals(ij.getBean().getScope()))
+ {
+ throw new DefinitionException("Cannot inject an InjectionPoint into a non @Dependent scoped bean " + ij);
+ }
+ if (ij.getType() instanceof TypeVariable<?>)
+ {
+ throw new DefinitionException("Cannot declare an injection point with a type variable " + ij);
+ }
+ checkFacadeInjectionPoint(ij, Instance.class);
+ checkFacadeInjectionPoint(ij, Event.class);
+ Annotation[] bindings = ij.getQualifiers().toArray(new Annotation[0]);
+ WBAnnotated<?, ?> annotatedItem = ResolvableWBClass.of(ij.getType(), bindings, beanManager);
+ Set<?> resolvedBeans = beanManager.getBeanResolver().resolve(beanManager.getInjectableBeans(ij));
+ if (resolvedBeans.isEmpty())
+ {
+ throw new DeploymentException("Injection point has unstatisfied dependencies. Injection point: " + ij.toString() + "; Qualifiers: " + Arrays.toString(bindings));
+ }
+ if (resolvedBeans.size() > 1)
+ {
+ throw new DeploymentException("Injection point has ambiguous dependencies. Injection point: " + ij.toString() + "; Qualifiers: " + 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("The injection point " + ij + " has non-proxyable dependencies");
+ }
+ if (Reflections.isPrimitive(annotatedItem.getJavaClass()) && resolvedBean.isNullable())
+ {
+ throw new NullableDependencyException("The injection point " + ij + " has nullable dependencies");
+ }
+ 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.isPassivationCapableBean(resolvedBean))
+ {
+ if (resolvedBean.getScope().equals(Dependent.class) && resolvedBean instanceof AbstractProducerBean<?, ?,?>)
+ {
+ throw new IllegalProductException("The bean " + ij.getBean() + " declares a passivating scope but the producer returned a non-serializable bean for injection: " + resolvedBean);
+ }
+ throw new UnserializableDependencyException("The bean " + ij.getBean() + " declares a passivating scope but has non-serializable dependency: " + resolvedBean);
+ }
+ }
+
+ public void validateDeployment(BeanManagerImpl manager, BeanDeployerEnvironment environment)
+ {
+ validateBeans(manager.getDecorators(), new ArrayList<RIBean<?>>(), manager);
+ validateBeans(manager.getBeans(), new ArrayList<RIBean<?>>(), manager);
+ validateEnabledDecoratorClasses(manager);
+ validateEnabledPolicies(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("An unresolvable ambiguous EL name exists for " + name + "; found " + resolvedBeans );
+ }
+ if (accessibleNamespaces.contains(name))
+ {
+ throw new DeploymentException("The bean name " + name + " is used as a prefix for another bean");
+ }
+ }
+ }
+
+ private void validateEnabledDecoratorClasses(BeanManagerImpl beanManager)
+ {
+ // TODO Move building this list to the boot or sth
+ Set<Class<?>> decoratorBeanClasses = new HashSet<Class<?>>();
+ for (DecoratorImpl<?> bean : beanManager.getDecorators())
+ {
+ decoratorBeanClasses.add(bean.getType());
+ }
+ for (Class<?> clazz : beanManager.getEnabledDecoratorClasses())
+ {
+ if (beanManager.getEnabledDecoratorClasses().indexOf(clazz) < beanManager.getEnabledDecoratorClasses().lastIndexOf(clazz))
+ {
+ throw new DeploymentException("Enabled decorator class" + clazz + " specified twice");
+ }
+ if (!decoratorBeanClasses.contains(clazz))
+ {
+ throw new DeploymentException("Enabled decorator class " + clazz + " is not the bean class of at least one decorator bean (detected decorator beans " + decoratorBeanClasses + ")");
+ }
+ }
+ }
+
+ private void validateEnabledPolicies(BeanManagerImpl beanManager)
+ {
+ List<Class<?>> seenPolicies = new ArrayList<Class<?>>();
+ for (Class<? extends Annotation> stereotype : beanManager.getEnabledPolicyStereotypes())
+ {
+ if (!stereotype.isAnnotationPresent(Alternative.class))
+ {
+ throw new DeploymentException("Enabled policy sterotype " + stereotype + " is not annotated @Policy");
+ }
+ if (seenPolicies.contains(stereotype))
+ {
+ throw new DeploymentException("Cannot enable the same policy sterotype " + stereotype + " in beans.xml");
+ }
+ seenPolicies.add(stereotype);
+ }
+ for (Class<?> clazz : beanManager.getEnabledPolicyClasses())
+ {
+ if (!clazz.isAnnotationPresent(Alternative.class))
+ {
+ throw new DeploymentException("Enabled policy bean class " + clazz + " is not annotated @Policy");
+ }
+ if (seenPolicies.contains(clazz))
+ {
+ throw new DeploymentException("Cannot enable the same policy bean class " + clazz + " in beans.xml");
+ }
+ seenPolicies.add(clazz);
+ }
+ }
+
+ private void validateDisposalMethods(BeanDeployerEnvironment environment)
+ {
+ Set<DisposalMethod<?, ?>> beans = environment.getUnresolvedDisposalBeans();
+ if (!beans.isEmpty())
+ {
+ throw new DefinitionException("The following Disposal methods were declared but did not resolved to a producer method " + 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("An injection point of type " + type + " cannot have a type variable type parameter " + injectionPoint);
+ }
+ if (parameterizedType.getActualTypeArguments()[0] instanceof WildcardType)
+ {
+ throw new DefinitionException("An injection point of type " + type + " cannot have a wildcard type parameter " + injectionPoint);
+ }
+ }
+ else
+ {
+ throw new DefinitionException("An injection point of type " + type + " must have a type parameter " + injectionPoint);
+ }
+ }
+
+ }
+
+ public void cleanup() {}
+
+}
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/bean/AbstractBean.java (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractBean.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/weld/bean/AbstractBean.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/bean/AbstractBean.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -0,0 +1,501 @@
+/*
+ * 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;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.decorator.Decorates;
+import javax.enterprise.context.Dependent;
+import javax.enterprise.inject.Alternative;
+import javax.enterprise.inject.Specializes;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.stereotype.Stereotype;
+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.injection.WBInjectionPoint;
+import org.jboss.weld.introspector.WBAnnotated;
+import org.jboss.weld.introspector.WBField;
+import org.jboss.weld.introspector.WBParameter;
+import org.jboss.weld.literal.AnyLiteral;
+import org.jboss.weld.literal.DefaultLiteral;
+import org.jboss.weld.log.Log;
+import org.jboss.weld.log.Logging;
+import org.jboss.weld.metadata.cache.MergedStereotypes;
+import org.jboss.weld.metadata.cache.MetaAnnotationStore;
+import org.jboss.weld.util.Reflections;
+
+/**
+ * An abstract bean representation common for all beans
+ *
+ * @author Pete Muir
+ *
+ * @param <T> the type of bean
+ * @param <E> the Class<?> of the bean type
+ */
+public abstract class AbstractBean<T, E> extends RIBean<T>
+{
+
+ private static final Annotation ANY_LITERAL = new AnyLiteral();
+ private static final Annotation CURRENT_LITERAL = new DefaultLiteral();
+
+ private boolean proxyable;
+
+ // Logger
+ private final Log log = Logging.getLog(AbstractBean.class);
+ // The binding types
+ protected Set<Annotation> bindings;
+ // The name
+ protected String name;
+ // The scope type
+ protected Class<? extends Annotation> scopeType;
+ // The merged stereotypes
+ private MergedStereotypes<T, E> mergedStereotypes;
+ // Is it a policy, either defined by stereotypes or directly?
+ private boolean policy;
+ // The type
+ protected Class<T> type;
+ // The API types
+ protected Set<Type> types;
+ // The injection points
+ private Set<WBInjectionPoint<?, ?>> injectionPoints;
+ private Set<WBInjectionPoint<?, ?>> delegateInjectionPoints;
+ // If the type a primitive?
+ private boolean primitive;
+ // The Web Beans manager
+ protected BeanManagerImpl manager;
+
+ private boolean _serializable;
+
+ private boolean initialized;
+
+
+
+ protected boolean isInitialized()
+ {
+ return initialized;
+ }
+
+ /**
+ * Constructor
+ *
+ * @param manager The Web Beans manager
+ */
+ public AbstractBean(String idSuffix, BeanManagerImpl manager)
+ {
+ super(idSuffix, manager);
+ this.manager = manager;
+ this.injectionPoints = new HashSet<WBInjectionPoint<?, ?>>();
+ this.delegateInjectionPoints = new HashSet<WBInjectionPoint<?,?>>();
+ }
+
+ /**
+ * Initializes the bean and its metadata
+ */
+ @Override
+ public void initialize(BeanDeployerEnvironment environment)
+ {
+ if (isSpecializing())
+ {
+ preSpecialize(environment);
+ specialize(environment);
+ postSpecialize();
+ }
+ initDefaultBindings();
+ initPrimitive();
+ log.trace("Building Web Bean bean metadata for #0", getType());
+ initName();
+ initScopeType();
+ initSerializable();
+ initProxyable();
+ checkDelegateInjectionPoints();
+ }
+
+ protected void initStereotypes()
+ {
+ mergedStereotypes = new MergedStereotypes<T, E>(getAnnotatedItem().getMetaAnnotations(Stereotype.class), manager);
+ }
+
+ protected void checkDelegateInjectionPoints()
+ {
+ if (this.delegateInjectionPoints.size() > 0)
+ {
+ throw new DefinitionException("Cannot place @Decorates at an injection point which is not on a Decorator " + this);
+ }
+ }
+
+ protected void addInjectionPoint(WBInjectionPoint<?, ?> injectionPoint)
+ {
+ if (injectionPoint.isAnnotationPresent(Decorates.class))
+ {
+ this.delegateInjectionPoints.add(injectionPoint);
+ }
+ injectionPoints.add(injectionPoint);
+ }
+
+ protected void addInjectionPoints(Iterable<? extends WBInjectionPoint<?, ?>> injectionPoints)
+ {
+ for (WBInjectionPoint<?, ?> injectionPoint : injectionPoints)
+ {
+ addInjectionPoint(injectionPoint);
+ }
+ }
+
+ protected Set<WBInjectionPoint<?, ?>> getDelegateInjectionPoints()
+ {
+ return delegateInjectionPoints;
+ }
+
+ /**
+ * Initializes the API types
+ */
+ protected void initTypes()
+ {
+ types = getAnnotatedItem().getTypeClosure();
+ }
+
+ /**
+ * Initializes the binding types
+ */
+ protected void initBindings()
+ {
+ this.bindings = new HashSet<Annotation>();
+ this.bindings.addAll(getAnnotatedItem().getMetaAnnotations(Qualifier.class));
+ initDefaultBindings();
+ log.trace("Using binding types " + bindings + " specified by annotations");
+ }
+
+ protected void initDefaultBindings()
+ {
+ if (bindings.size() == 0)
+ {
+ log.trace("Adding default @Current binding type");
+ this.bindings.add(CURRENT_LITERAL);
+ }
+ if (bindings.size() == 1)
+ {
+ if (bindings.iterator().next().annotationType().equals(Named.class))
+ {
+ log.trace("Adding default @Current binding type");
+ this.bindings.add(CURRENT_LITERAL);
+ }
+ }
+ this.bindings.add(ANY_LITERAL);
+ }
+
+ protected void initPolicy()
+ {
+ if (getAnnotatedItem().isAnnotationPresent(Alternative.class))
+ {
+ this.policy = true;
+ }
+ else
+ {
+ this.policy = getMergedStereotypes().isPolicy();
+ }
+ }
+
+ /**
+ * Initializes the name
+ */
+ protected void initName()
+ {
+ boolean beanNameDefaulted = false;
+ if (getAnnotatedItem().isAnnotationPresent(Named.class))
+ {
+ String javaName = getAnnotatedItem().getAnnotation(Named.class).value();
+ if ("".equals(javaName))
+ {
+ log.trace("Using default name (specified by annotations)");
+ beanNameDefaulted = true;
+ }
+ else
+ {
+ if (log.isTraceEnabled())
+ log.trace("Using name " + javaName + " specified by annotations");
+ this.name = javaName;
+ return;
+ }
+ }
+
+ if (beanNameDefaulted || getMergedStereotypes().isBeanNameDefaulted())
+ {
+ this.name = getDefaultName();
+ return;
+ }
+ }
+
+ protected void initProxyable()
+ {
+ proxyable = getAnnotatedItem().isProxyable();
+ }
+
+ /**
+ * Initializes the primitive flag
+ */
+ protected void initPrimitive()
+ {
+ this.primitive = Reflections.isPrimitive(getType());
+ }
+
+ private boolean checkInjectionPointsAreSerializable()
+ {
+ boolean passivating = manager.getServices().get(MetaAnnotationStore.class).getScopeModel(this.getScope()).isPassivating();
+ for (WBInjectionPoint<?, ?> injectionPoint : getAnnotatedInjectionPoints())
+ {
+ Annotation[] bindings = injectionPoint.getMetaAnnotationsAsArray(Qualifier.class);
+ Bean<?> resolvedBean = manager.getBeans(injectionPoint.getJavaClass(), bindings).iterator().next();
+ if (passivating)
+ {
+ if (Dependent.class.equals(resolvedBean.getScope()) && !Reflections.isSerializable(resolvedBean.getBeanClass()) && (((injectionPoint instanceof WBField<?, ?>) && !((WBField<?, ?>) injectionPoint).isTransient()) || (injectionPoint instanceof WBParameter<?, ?>)))
+ {
+ return false;
+ }
+ }
+ }
+ return true;
+ }
+
+ /**
+ * Initializes the scope type
+ */
+ protected abstract void initScopeType();
+
+ protected boolean initScopeTypeFromStereotype()
+ {
+ Set<Annotation> possibleScopeTypes = getMergedStereotypes().getPossibleScopeTypes();
+ if (possibleScopeTypes.size() == 1)
+ {
+ this.scopeType = possibleScopeTypes.iterator().next().annotationType();
+ if (log.isTraceEnabled())
+ log.trace("Scope " + scopeType + " specified by stereotype");
+ return true;
+ }
+ else if (possibleScopeTypes.size() > 1)
+ {
+ throw new DefinitionException("All stereotypes must specify the same scope OR a scope must be specified on " + getAnnotatedItem());
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ protected void postSpecialize()
+ {
+ if (getAnnotatedItem().isAnnotationPresent(Named.class) && getSpecializedBean().getAnnotatedItem().isAnnotationPresent(Named.class))
+ {
+ throw new DefinitionException("Cannot put name on specializing and specialized class " + getAnnotatedItem());
+ }
+ this.bindings.addAll(getSpecializedBean().getQualifiers());
+ if (isSpecializing() && getSpecializedBean().getAnnotatedItem().isAnnotationPresent(Named.class))
+ {
+ this.name = getSpecializedBean().getName();
+ }
+ manager.getSpecializedBeans().put(getSpecializedBean(), this);
+ }
+
+ protected void preSpecialize(BeanDeployerEnvironment environment)
+ {
+
+ }
+
+ protected void specialize(BeanDeployerEnvironment environment)
+ {
+
+ }
+
+ /**
+ * Returns the annotated time the bean represents
+ *
+ * @return The annotated item
+ */
+ protected abstract WBAnnotated<T, E> getAnnotatedItem();
+
+ /**
+ * Gets the binding types
+ *
+ * @return The set of binding types
+ *
+ * @see org.jboss.webbeans.bean.BaseBean#getQualifiers()
+ */
+ public Set<Annotation> getQualifiers()
+ {
+ return bindings;
+ }
+
+ /**
+ * Gets the default name of the bean
+ *
+ * @return The default name
+ */
+ protected abstract String getDefaultName();
+
+ @Override
+ public abstract AbstractBean<?, ?> getSpecializedBean();
+
+ @Override
+ public Set<WBInjectionPoint<?, ?>> getAnnotatedInjectionPoints()
+ {
+ return injectionPoints;
+ }
+
+ /**
+ * Gets the merged stereotypes of the bean
+ *
+ * @return The set of merged stereotypes
+ */
+ protected MergedStereotypes<T, E> getMergedStereotypes()
+ {
+ return mergedStereotypes;
+ }
+
+ /**
+ * Gets the name of the bean
+ *
+ * @return The name
+ *
+ * @see org.jboss.webbeans.bean.BaseBean#getName()
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+ /**
+ * Gets the scope type of the bean
+ *
+ * @return The scope type
+ *
+ * @see org.jboss.webbeans.bean.BaseBean#getScope()
+ */
+ public Class<? extends Annotation> getScope()
+ {
+ return scopeType;
+ }
+
+ /**
+ * Gets the type of the bean
+ *
+ * @return The type
+ */
+ @Override
+ public Class<T> getType()
+ {
+ return type;
+ }
+
+ /**
+ * Gets the API types of the bean
+ *
+ * @return The set of API types
+ *
+ * @see org.jboss.webbeans.bean.BaseBean#getTypeClosure()
+ */
+ public Set<Type> getTypes()
+ {
+ return types;
+ }
+
+ /**
+ * Checks if this beans annotated item is assignable from another annotated
+ * item
+ *
+ * @param annotatedItem The other annotation to check
+ * @return True if assignable, otherwise false
+ */
+ public boolean isAssignableFrom(WBAnnotated<?, ?> annotatedItem)
+ {
+ return this.getAnnotatedItem().isAssignableFrom(annotatedItem);
+ }
+
+ /**
+ * Indicates if bean is nullable
+ *
+ * @return True if nullable, false otherwise
+ *
+ * @see org.jboss.webbeans.bean.BaseBean#isNullable()
+ */
+ public boolean isNullable()
+ {
+ return !isPrimitive();
+ }
+
+ /**
+ * Indicates if bean type is a primitive
+ *
+ * @return True if primitive, false otherwise
+ */
+ @Override
+ public boolean isPrimitive()
+ {
+ return primitive;
+ }
+
+ public boolean isSerializable()
+ {
+ // TODO WTF - why are we not caching the serializability of injection
+ // points!
+ return _serializable && checkInjectionPointsAreSerializable();
+ }
+
+ protected void initSerializable()
+ {
+ _serializable = Reflections.isSerializable(type);
+ }
+
+ @Override
+ public boolean isProxyable()
+ {
+ return proxyable;
+ }
+
+ @Override
+ public boolean isDependent()
+ {
+ return Dependent.class.equals(getScope());
+ }
+
+ public boolean isNormalScoped()
+ {
+ return Container.instance().deploymentServices().get(MetaAnnotationStore.class).getScopeModel(getScope()).isNormal();
+ }
+
+ public boolean isAlternative()
+ {
+ return policy;
+ }
+
+ @Override
+ public boolean isSpecializing()
+ {
+ return getAnnotatedItem().isAnnotationPresent(Specializes.class);
+ }
+
+ public Set<Class<? extends Annotation>> getStereotypes()
+ {
+ return mergedStereotypes.getStereotypes();
+ }
+
+}
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/bean/AbstractClassBean.java (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractClassBean.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/weld/bean/AbstractClassBean.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/bean/AbstractClassBean.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -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.bean;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Set;
+
+import javax.enterprise.context.Dependent;
+import javax.enterprise.context.NormalScope;
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.AnnotatedMethod;
+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.inject.Scope;
+
+import org.jboss.interceptor.model.InterceptionModelBuilder;
+import org.jboss.weld.BeanManagerImpl;
+import org.jboss.weld.DefinitionException;
+import org.jboss.weld.bean.proxy.DecoratorProxyMethodHandler;
+import org.jboss.weld.bootstrap.BeanDeployerEnvironment;
+import org.jboss.weld.context.SerializableContextualInstance;
+import org.jboss.weld.injection.FieldInjectionPoint;
+import org.jboss.weld.injection.MethodInjectionPoint;
+import org.jboss.weld.introspector.WBClass;
+import org.jboss.weld.introspector.WBMethod;
+import org.jboss.weld.log.LogProvider;
+import org.jboss.weld.log.Logging;
+import org.jboss.weld.metadata.cache.MetaAnnotationStore;
+import org.jboss.weld.util.Beans;
+import org.jboss.weld.util.Proxies;
+import org.jboss.weld.util.Strings;
+
+import javassist.util.proxy.ProxyFactory;
+import javassist.util.proxy.ProxyObject;
+
+/**
+ * An abstract bean representation common for class-based beans
+ *
+ * @author Pete Muir
+ *
+ * @param <T>
+ * @param <E>
+ */
+public abstract class AbstractClassBean<T> extends AbstractBean<T, Class<T>> implements InjectionTarget<T>
+{
+ // Logger
+ private static final LogProvider log = Logging.getLogProvider(AbstractClassBean.class);
+ // The item representation
+ protected WBClass<T> annotatedItem;
+ // The injectable fields of each type in the type hierarchy, with the actual type at the bottom
+ private List<Set<FieldInjectionPoint<?, ?>>> injectableFields;
+ // The initializer methods of each type in the type hierarchy, with the actual type at the bottom
+ private List<Set<MethodInjectionPoint<?, ?>>> initializerMethods;
+ private Set<String> dependencies;
+
+ private List<Decorator<?>> decorators;
+
+ private Class<T> proxyClassForDecorators;
+
+ private final ThreadLocal<Integer> decoratorStackPosition;
+ private WBMethod<?, ?> postConstruct;
+ private WBMethod<?, ?> preDestroy;
+
+ /**
+ * Constructor
+ *
+ * @param type The type
+ * @param manager The Web Beans manager
+ */
+ protected AbstractClassBean(WBClass<T> type, String idSuffix, BeanManagerImpl manager)
+ {
+ super(idSuffix, manager);
+ this.annotatedItem = type;
+ this.decoratorStackPosition = new ThreadLocal<Integer>()
+ {
+
+ @Override
+ protected Integer initialValue()
+ {
+ return 0;
+ }
+
+ };
+ initStereotypes();
+ initPolicy();
+ }
+
+ /**
+ * Initializes the bean and its metadata
+ */
+ @Override
+ public void initialize(BeanDeployerEnvironment environment)
+ {
+ initInitializerMethods();
+ initInjectableFields();
+ super.initialize(environment);
+ checkBeanImplementation();
+ initDecorators();
+ checkType();
+ initProxyClassForDecoratedBean();
+ if (isInterceptionCandidate())
+ initInterceptors();
+ }
+
+ protected void checkType()
+ {
+
+ }
+
+ protected void initDecorators()
+ {
+ this.decorators = getManager().resolveDecorators(getTypes(), getQualifiers());
+ }
+
+ public boolean hasDecorators()
+ {
+ return this.decorators != null && this.decorators.size() > 0;
+ }
+
+ protected void initProxyClassForDecoratedBean()
+ {
+ if (hasDecorators())
+ {
+ Set<Type> types = new LinkedHashSet<Type>(getTypes());
+ ProxyFactory proxyFactory = Proxies.getProxyFactory(types);
+
+ @SuppressWarnings("unchecked")
+ Class<T> proxyClass = proxyFactory.createClass();
+
+ this.proxyClassForDecorators = proxyClass;
+ }
+ }
+
+ protected T applyDecorators(T instance, CreationalContext<T> creationalContext, InjectionPoint originalInjectionPoint)
+ {
+ List<SerializableContextualInstance<DecoratorImpl<Object>, Object>> decoratorInstances = new ArrayList<SerializableContextualInstance<DecoratorImpl<Object>,Object>>();
+ InjectionPoint ip = originalInjectionPoint;
+ boolean outside = decoratorStackPosition.get().intValue() == 0;
+ try
+ {
+ int i = decoratorStackPosition.get();
+ while (i < decorators.size())
+ {
+ Decorator<?> decorator = decorators.get(i);
+ if (decorator instanceof DecoratorImpl<?>)
+ {
+ decoratorStackPosition.set(++i);
+
+ @SuppressWarnings("unchecked")
+ DecoratorImpl<Object> decoratorBean = (DecoratorImpl<Object>) decorator;
+
+ Object decoratorInstance = getManager().getReference(ip, decorator, creationalContext);
+ decoratorInstances.add(new SerializableContextualInstance<DecoratorImpl<Object>, Object>(decoratorBean, decoratorInstance, null));
+ ip = decoratorBean.getDelegateInjectionPoint();
+ }
+ else
+ {
+ throw new IllegalStateException("Cannot operate on non container provided decorator " + decorator);
+ }
+ }
+ }
+ finally
+ {
+ if (outside)
+ {
+ decoratorStackPosition.remove();
+ }
+ }
+ try
+ {
+ T proxy = proxyClassForDecorators.newInstance();
+ ((ProxyObject) proxy).setHandler(new DecoratorProxyMethodHandler(decoratorInstances, instance));
+ return proxy;
+ }
+ catch (InstantiationException e)
+ {
+ throw new RuntimeException("Could not instantiate decorator proxy for " + toString(), e);
+ }
+ catch (IllegalAccessException e)
+ {
+ throw new RuntimeException("Could not access bean correctly when creating decorator proxy for " + toString(), e);
+ }
+ }
+
+ public List<Decorator<?>> getDecorators()
+ {
+ return Collections.unmodifiableList(decorators);
+ }
+
+ public void dispose(T instance)
+ {
+ // No-op for class beans
+ }
+
+
+ /**
+ * Initializes the bean type
+ */
+ protected void initType()
+ {
+ log.trace("Bean type specified in Java");
+ this.type = getAnnotatedItem().getJavaClass();
+ this.dependencies = new HashSet<String>();
+ for (Class<?> clazz = type.getSuperclass(); clazz != Object.class; clazz = clazz.getSuperclass())
+ {
+ dependencies.add(clazz.getName());
+ }
+ }
+
+ /**
+ * Initializes the injection points
+ */
+ protected void initInjectableFields()
+ {
+ injectableFields = Beans.getFieldInjectionPoints(this, annotatedItem);
+ addInjectionPoints(Beans.getFieldInjectionPoints(this, injectableFields));
+ }
+
+ /**
+ * Initializes the initializer methods
+ */
+ protected void initInitializerMethods()
+ {
+ initializerMethods = Beans.getInitializerMethods(this, getAnnotatedItem());
+ addInjectionPoints(Beans.getParameterInjectionPoints(this, initializerMethods));
+ }
+
+ @Override
+ protected void initScopeType()
+ {
+ for (WBClass<?> clazz = getAnnotatedItem(); clazz != null; clazz = clazz.getWBSuperclass())
+ {
+ Set<Annotation> scopeTypes = new HashSet<Annotation>();
+ scopeTypes.addAll(clazz.getDeclaredMetaAnnotations(Scope.class));
+ scopeTypes.addAll(clazz.getDeclaredMetaAnnotations(NormalScope.class));
+ if (scopeTypes.size() == 1)
+ {
+ if (getAnnotatedItem().isAnnotationPresent(scopeTypes.iterator().next().annotationType()))
+ {
+ this.scopeType = scopeTypes.iterator().next().annotationType();
+ log.trace("Scope " + scopeType + " specified by annotation");
+ }
+ break;
+ }
+ else if (scopeTypes.size() > 1)
+ {
+ throw new DefinitionException("At most one scope may be specified on " + getAnnotatedItem());
+ }
+ }
+
+ if (this.scopeType == null)
+ {
+ initScopeTypeFromStereotype();
+ }
+
+ if (this.scopeType == null)
+ {
+ this.scopeType = Dependent.class;
+ log.trace("Using default @Dependent scope");
+ }
+ }
+
+ /**
+ * Validates the bean implementation
+ */
+ protected void checkBeanImplementation() {}
+
+ @Override
+ protected void preSpecialize(BeanDeployerEnvironment environment)
+ {
+ super.preSpecialize(environment);
+ if (getAnnotatedItem().getWBSuperclass() == null || getAnnotatedItem().getWBSuperclass().getJavaClass().equals(Object.class))
+ {
+ throw new DefinitionException("Specializing bean must extend another bean " + toString());
+ }
+ }
+
+ /**
+ * Gets the annotated item
+ *
+ * @return The annotated item
+ */
+ @Override
+ public WBClass<T> getAnnotatedItem()
+ {
+ return annotatedItem;
+ }
+
+ /**
+ * Gets the default name
+ *
+ * @return The default name
+ */
+ @Override
+ protected String getDefaultName()
+ {
+ String name = Strings.decapitalize(getAnnotatedItem().getSimpleName());
+ log.trace("Default name of " + type + " is " + name);
+ return name;
+ }
+
+ /**
+ * Gets the annotated methods
+ *
+ * @return The set of annotated methods
+ */
+ public List<? extends Set<? extends MethodInjectionPoint<?, ?>>> getInitializerMethods()
+ {
+ // TODO Make immutable
+ return initializerMethods;
+ }
+
+ /**
+ * @return the injectableFields
+ */
+ public List<? extends Set<FieldInjectionPoint<?, ?>>> getInjectableFields()
+ {
+ // TODO Make immutable
+ return injectableFields;
+ }
+
+ // TODO maybe a better way to expose this?
+ public Set<String> getSuperclasses()
+ {
+ return dependencies;
+ }
+
+ public void postConstruct(T instance)
+ {
+ WBMethod<?, ?> postConstruct = getPostConstruct();
+ if (postConstruct != null)
+ {
+ try
+ {
+ postConstruct.invoke(instance);
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException("Unable to invoke " + postConstruct + " on " + instance, e);
+ }
+ }
+ }
+
+ public void preDestroy(T instance)
+ {
+ WBMethod<?, ?> preDestroy = getPreDestroy();
+ if (preDestroy != null)
+ {
+ try
+ {
+ // note: RI supports injection into @PreDestroy
+ preDestroy.invoke(instance);
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException("Unable to invoke " + preDestroy + " on " + instance, e);
+ }
+ }
+ }
+
+ /**
+ * Initializes the post-construct method
+ */
+ protected void initPostConstruct()
+ {
+ this.postConstruct = Beans.getPostConstruct(getAnnotatedItem());
+ }
+
+ /**
+ * Initializes the pre-destroy method
+ */
+ protected void initPreDestroy()
+ {
+ this.preDestroy = Beans.getPreDestroy(getAnnotatedItem());
+ }
+
+ /**
+ * Returns the post-construct method
+ *
+ * @return The post-construct method
+ */
+ public WBMethod<?, ?> getPostConstruct()
+ {
+ return postConstruct;
+ }
+
+ /**
+ * Returns the pre-destroy method
+ *
+ * @return The pre-destroy method
+ */
+ public WBMethod<?, ?> getPreDestroy()
+ {
+ return preDestroy;
+ }
+
+ protected abstract boolean isInterceptionCandidate();
+
+ /**
+ * Extracts the complete set of interception bindings from a given set of annotations.
+ *
+ * @param manager
+ * @param annotations
+ * @return
+ */
+ protected static Set<Annotation> flattenInterceptorBindings(BeanManagerImpl manager, Set<Annotation> annotations)
+ {
+ Set<Annotation> foundInterceptionBindingTypes = new HashSet<Annotation>();
+ for (Annotation annotation: annotations)
+ {
+ if (manager.isInterceptorBindingType(annotation.annotationType()))
+ {
+ foundInterceptionBindingTypes.add(annotation);
+ foundInterceptionBindingTypes.addAll(manager.getServices().get(MetaAnnotationStore.class).getInterceptorBindingModel(annotation.annotationType()).getInheritedInterceptionBindingTypes());
+ }
+ }
+ return foundInterceptionBindingTypes;
+ }
+
+ protected void initInterceptors()
+ {
+ if (manager.getBoundInterceptorsRegistry().getInterceptionModel(getType()) == null)
+ {
+ InterceptionModelBuilder<Class<?>, Interceptor<?>> builder = InterceptionModelBuilder.newBuilderFor(getType(), (Class) Interceptor.class);
+
+ Set<Annotation> classBindingAnnotations = flattenInterceptorBindings(manager, getAnnotatedItem().getAnnotations());
+ for (Class<? extends Annotation> annotation : getStereotypes())
+ {
+ classBindingAnnotations.addAll(flattenInterceptorBindings(manager, manager.getStereotypeDefinition(annotation)));
+ }
+
+ builder.interceptPostConstruct().with(manager.resolveInterceptors(InterceptionType.POST_CONSTRUCT, classBindingAnnotations.toArray(new Annotation[0])).toArray(new Interceptor<?>[]{}));
+ builder.interceptPreDestroy().with(manager.resolveInterceptors(InterceptionType.PRE_DESTROY, classBindingAnnotations.toArray(new Annotation[0])).toArray(new Interceptor<?>[]{}));
+
+ List<WBMethod<?, ?>> businessMethods = Beans.getInterceptableBusinessMethods(getAnnotatedItem());
+ for (WBMethod<?, ?> method : businessMethods)
+ {
+ List<Annotation> methodBindingAnnotations = new ArrayList<Annotation>(classBindingAnnotations);
+ methodBindingAnnotations.addAll(flattenInterceptorBindings(manager, method.getAnnotations()));
+ List<Interceptor<?>> methodBoundInterceptors = manager.resolveInterceptors(InterceptionType.AROUND_INVOKE, methodBindingAnnotations.toArray(new Annotation[]{}));
+ builder.interceptAroundInvoke(((AnnotatedMethod) method).getJavaMember()).with(methodBoundInterceptors.toArray(new Interceptor[]{}));
+ }
+ manager.getBoundInterceptorsRegistry().registerInterceptionModel(getType(), builder.build());
+ }
+ }
+}
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/bean/AbstractProducerBean.java (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/weld/bean/AbstractProducerBean.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/bean/AbstractProducerBean.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -0,0 +1,292 @@
+/*
+ * 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;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Member;
+import java.lang.reflect.Method;
+import java.lang.reflect.Type;
+import java.lang.reflect.TypeVariable;
+import java.lang.reflect.WildcardType;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.enterprise.context.Dependent;
+import javax.enterprise.context.NormalScope;
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.IllegalProductException;
+import javax.enterprise.inject.Produces;
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.enterprise.inject.spi.Producer;
+import javax.inject.Inject;
+import javax.inject.Scope;
+
+import org.jboss.weld.BeanManagerImpl;
+import org.jboss.weld.DefinitionException;
+import org.jboss.weld.bootstrap.BeanDeployerEnvironment;
+import org.jboss.weld.introspector.WBMember;
+import org.jboss.weld.log.LogProvider;
+import org.jboss.weld.log.Logging;
+import org.jboss.weld.metadata.cache.MetaAnnotationStore;
+import org.jboss.weld.util.Beans;
+import org.jboss.weld.util.Names;
+import org.jboss.weld.util.Reflections;
+
+/**
+ * The implicit producer bean
+ *
+ * @author Gavin King
+ *
+ * @param <T>
+ * @param <S>
+ */
+public abstract class AbstractProducerBean<X, T, S extends Member> extends AbstractReceiverBean<X, T, S> implements Producer<T>
+{
+ private static final LogProvider log = Logging.getLogProvider(AbstractProducerBean.class);
+
+ /**
+ * Constructor
+ * @param declaringBean The declaring bean
+ * @param manager The Web Beans manager
+ */
+ public AbstractProducerBean(String idSuffix, AbstractClassBean<X> declaringBean, BeanManagerImpl manager)
+ {
+ super(idSuffix, declaringBean, manager);
+ }
+
+ @Override
+ public abstract WBMember<T, X, S> getAnnotatedItem();
+
+ @Override
+ // Overriden to provide the class of the bean that declares the producer method/field
+ public Class<?> getBeanClass()
+ {
+ return getDeclaringBean().getBeanClass();
+ }
+
+ /**
+ * Initializes the API types
+ */
+ @Override
+ protected void initTypes()
+ {
+ if (getType().isArray() || getType().isPrimitive())
+ {
+ Set<Type> types = new HashSet<Type>();
+ types.add(getType());
+ types.add(Object.class);
+ super.types = types;
+ }
+ else if (getType().isInterface())
+ {
+ Set<Type> types = new HashSet<Type>();
+ types.add(Object.class);
+ types.addAll(getAnnotatedItem().getTypeClosure());
+ super.types = types;
+ }
+ else
+ {
+ super.initTypes();
+ }
+ }
+
+ /**
+ * Initializes the type
+ */
+ protected void initType()
+ {
+ try
+ {
+ this.type = getAnnotatedItem().getJavaClass();
+ }
+ catch (ClassCastException e)
+ {
+ Type type = Beans.getDeclaredBeanType(getClass());
+ throw new RuntimeException(" Cannot cast producer type " + getAnnotatedItem().getJavaClass() + " to bean type " + (type == null ? " unknown " : type), e);
+ }
+ }
+
+ /**
+ * Validates the producer method
+ */
+ protected void checkProducerReturnType()
+ {
+ if (getAnnotatedItem().getBaseType() instanceof TypeVariable<?>)
+ {
+ throw new DefinitionException("Return type must be concrete " + getAnnotatedItem().getBaseType());
+ }
+ if (getAnnotatedItem().getBaseType() instanceof WildcardType)
+ {
+ throw new DefinitionException("Return type must be concrete " + getAnnotatedItem().getBaseType());
+ }
+ for (Type type : getAnnotatedItem().getActualTypeArguments())
+ {
+ if (!(type instanceof Class))
+ {
+ throw new DefinitionException("Producer type cannot be parameterized with type parameter or wildcard:\n" + this.getAnnotatedItem());
+ }
+ }
+ }
+
+ /**
+ * Initializes the bean and its metadata
+ */
+ @Override
+ public void initialize(BeanDeployerEnvironment environment)
+ {
+ getDeclaringBean().initialize(environment);
+ super.initialize(environment);
+ checkProducerReturnType();
+ }
+
+ /**
+ * Validates the return value
+ *
+ * @param instance The instance to validate
+ */
+ protected void checkReturnValue(T instance)
+ {
+ if (instance == null && !isDependent())
+ {
+ throw new IllegalProductException("Cannot return null from a non-dependent producer method");
+ }
+ else if (instance != null)
+ {
+ boolean passivating = manager.getServices().get(MetaAnnotationStore.class).getScopeModel(getScope()).isPassivating();
+ if (passivating && !Reflections.isSerializable(instance.getClass()))
+ {
+ throw new IllegalProductException("Producers cannot declare passivating scope and return a non-serializable class");
+ }
+ InjectionPoint injectionPoint = manager.getCurrentInjectionPoint();
+ if (injectionPoint == null)
+ {
+ return;
+ }
+ if (!Reflections.isSerializable(instance.getClass()) && Beans.isPassivationCapableBean(injectionPoint.getBean()))
+ {
+ if (injectionPoint.getMember() instanceof Field)
+ {
+ if (!Reflections.isTransient(injectionPoint.getMember()) && instance != null && !Reflections.isSerializable(instance.getClass()))
+ {
+ throw new IllegalProductException("Producers cannot produce non-serializable instances for injection into non-transient fields of passivating beans\n\nProducer: " + this.toString() + "\nInjection Point: " + injectionPoint.toString());
+ }
+ }
+ else if (injectionPoint.getMember() instanceof Method)
+ {
+ Method method = (Method) injectionPoint.getMember();
+ if (method.isAnnotationPresent(Inject.class))
+ {
+ throw new IllegalProductException("Producers cannot produce non-serializable instances for injection into parameters of intializers of beans declaring passivating scope. Bean " + toString() + " being injected into " + injectionPoint.toString());
+ }
+ if (method.isAnnotationPresent(Produces.class))
+ {
+ throw new IllegalProductException("Producers cannot produce non-serializable instances for injection into parameters of producer methods declaring passivating scope. Bean " + toString() + " being injected into " + injectionPoint.toString());
+ }
+ }
+ else if (injectionPoint.getMember() instanceof Constructor)
+ {
+ throw new IllegalProductException("Producers cannot produce non-serializable instances for injection into parameters of constructors of beans declaring passivating scope. Bean " + toString() + " being injected into " + injectionPoint.toString());
+ }
+ }
+ }
+ }
+
+ @Override
+ protected void initScopeType()
+ {
+ Set<Annotation> scopeAnnotations = new HashSet<Annotation>();
+ scopeAnnotations.addAll(getAnnotatedItem().getMetaAnnotations(Scope.class));
+ scopeAnnotations.addAll(getAnnotatedItem().getMetaAnnotations(NormalScope.class));
+ if (scopeAnnotations.size() > 1)
+ {
+ throw new DefinitionException("At most one scope may be specified");
+ }
+ if (scopeAnnotations.size() == 1)
+ {
+ this.scopeType = scopeAnnotations.iterator().next().annotationType();
+ log.trace("Scope " + scopeType + " specified by annotation");
+ return;
+ }
+
+ initScopeTypeFromStereotype();
+
+ if (this.scopeType == null)
+ {
+ this.scopeType = Dependent.class;
+ log.trace("Using default @Dependent scope");
+ }
+ }
+
+ @Override
+ protected void initSerializable()
+ {
+ // No-op
+ }
+
+ @Override
+ public boolean isSerializable()
+ {
+ return true;
+ }
+
+ /**
+ * Creates an instance of the bean
+ *
+ * @returns The instance
+ */
+ public T create(final CreationalContext<T> creationalContext)
+ {
+ try
+ {
+ T instance = produce(creationalContext);
+ checkReturnValue(instance);
+ return instance;
+ }
+ finally
+ {
+ if (getDeclaringBean().isDependent())
+ {
+ creationalContext.release();
+ }
+ }
+ }
+
+ /**
+ * Gets a string representation
+ *
+ * @return The string representation
+ */
+ @Override
+ public String getDescription()
+ {
+ StringBuilder buffer = new StringBuilder();
+ buffer.append("Annotated " + Names.scopeTypeToString(getScope()));
+ if (getName() == null)
+ {
+ buffer.append("unnamed producer bean");
+ }
+ else
+ {
+ buffer.append("simple producer bean '" + getName() + "'");
+ }
+ buffer.append(" [" + getBeanClass().getName() + "] for class type [" + getType().getName() + "] API types " + getTypes() + ", binding types " + getQualifiers());
+ return buffer.toString();
+ }
+
+}
\ No newline at end of file
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/bean/AbstractReceiverBean.java (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractReceiverBean.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/weld/bean/AbstractReceiverBean.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/bean/AbstractReceiverBean.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -0,0 +1,124 @@
+/*
+ * 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;
+
+import java.lang.reflect.Member;
+
+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.WBCreationalContext;
+import org.jboss.weld.introspector.WBMember;
+import org.jboss.weld.log.LogProvider;
+import org.jboss.weld.log.Logging;
+
+/**
+ * @author pmuir
+ *
+ */
+public abstract class AbstractReceiverBean<X, T, S extends Member> extends AbstractBean<T, S>
+{
+
+ private static final LogProvider log = Logging.getLogProvider(AbstractReceiverBean.class);
+
+ private AbstractClassBean<X> declaringBean;
+ private boolean policy;
+
+ public AbstractReceiverBean(String idSuffix, AbstractClassBean<X> declaringBean, BeanManagerImpl manager)
+ {
+ super(idSuffix, manager);
+ this.declaringBean = declaringBean;
+ }
+
+ @Override
+ public void initialize(BeanDeployerEnvironment environment)
+ {
+ super.initialize(environment);
+ }
+
+ /**
+ * Gets the receiver of the product
+ *
+ * @return The receiver
+ */
+ protected Object getReceiver(CreationalContext<?> creationalContext)
+ {
+ // This is a bit dangerous, as it means that producer methods can end of
+ // executing on partially constructed instances. Also, it's not required
+ // by the spec...
+ if (getAnnotatedItem().isStatic())
+ {
+ return null;
+ }
+ else
+ {
+ if (creationalContext instanceof WBCreationalContext<?>)
+ {
+ WBCreationalContext<?> creationalContextImpl = (WBCreationalContext<?>) creationalContext;
+ if (creationalContextImpl.containsIncompleteInstance(getDeclaringBean()))
+ {
+ log.warn("Executing producer field or method " + getAnnotatedItem() + " on incomplete declaring bean " + getDeclaringBean() + " due to circular injection");
+ return creationalContextImpl.getIncompleteInstance(getDeclaringBean());
+ }
+ }
+ return manager.getReference(getDeclaringBean(), Object.class, creationalContext);
+ }
+ }
+
+
+ /**
+ * Returns the declaring bean
+ *
+ * @return The bean representation
+ */
+ public AbstractClassBean<X> getDeclaringBean()
+ {
+ return declaringBean;
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.webbeans.bean.AbstractBean#isPolicy()
+ */
+ @Override
+ public boolean isAlternative()
+ {
+ return policy;
+ }
+
+ @Override
+ protected void initPolicy()
+ {
+ if (getDeclaringBean().isAlternative())
+ {
+ this.policy = true;
+ }
+ else if (getAnnotatedItem().isAnnotationPresent(Alternative.class))
+ {
+ this.policy = true;
+ }
+ else if (getMergedStereotypes().isPolicy())
+ {
+ this.policy = true;
+ }
+ }
+
+ @Override
+ protected abstract WBMember<T, ?, S> getAnnotatedItem();
+
+}
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/bean/DecoratorImpl.java (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/DecoratorImpl.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/weld/bean/DecoratorImpl.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/bean/DecoratorImpl.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -0,0 +1,228 @@
+/*
+ * 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;
+
+import java.io.Serializable;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.enterprise.inject.spi.Decorator;
+import javax.inject.Inject;
+
+import org.jboss.weld.BeanManagerImpl;
+import org.jboss.weld.DefinitionException;
+import org.jboss.weld.bootstrap.BeanDeployerEnvironment;
+import org.jboss.weld.injection.MethodInjectionPoint;
+import org.jboss.weld.injection.WBInjectionPoint;
+import org.jboss.weld.introspector.WBClass;
+
+public class DecoratorImpl<T> extends ManagedBean<T> implements Decorator<T>
+{
+
+ public static <T> Decorator<T> wrapForResolver(final Decorator<T> decorator)
+ {
+ return new ForwardingDecorator<T>()
+ {
+
+ @Override
+ public Set<Annotation> getQualifiers()
+ {
+ return delegate().getDelegateQualifiers();
+ }
+
+ @Override
+ public Set<Type> getTypes()
+ {
+ return delegate().getTypes();
+ }
+
+ @Override
+ protected Decorator<T> delegate()
+ {
+ return decorator;
+ }
+
+ };
+ }
+
+ /**
+ * Creates a decorator bean
+ *
+ * @param <T> The type
+ * @param clazz The class
+ * @param manager the current manager
+ * @return a Bean
+ */
+ public static <T> DecoratorImpl<T> of(WBClass<T> clazz, BeanManagerImpl manager)
+ {
+ return new DecoratorImpl<T>(clazz, manager);
+ }
+
+ private WBInjectionPoint<?, ?> delegateInjectionPoint;
+ private Set<Annotation> delegateBindings;
+ private Type delegateType;
+ private Set<Type> delegateTypes;
+ private Set<Type> decoratedTypes;
+
+ protected DecoratorImpl(WBClass<T> type, BeanManagerImpl manager)
+ {
+ super(type, new StringBuilder().append(Decorator.class.getSimpleName()).append(BEAN_ID_SEPARATOR).append(type.getName()).toString(), manager);
+ }
+
+ @Override
+ public void initialize(BeanDeployerEnvironment environment)
+ {
+ if (!isInitialized())
+ {
+ super.initialize(environment);
+ initDelegateInjectionPoint();
+ initDecoratedTypes();
+ initDelegateBindings();
+ initDelegateType();
+ checkDelegateType();
+ }
+ }
+
+ protected void initDecoratedTypes()
+ {
+ this.decoratedTypes = new HashSet<Type>();
+ this.decoratedTypes.addAll(getAnnotatedItem().getInterfaceOnlyFlattenedTypeHierarchy());
+ this.decoratedTypes.remove(Serializable.class);
+ }
+
+ protected void initDelegateInjectionPoint()
+ {
+ this.delegateInjectionPoint = getDelegateInjectionPoints().iterator().next();
+ }
+
+ @Override
+ protected void checkDelegateInjectionPoints()
+ {
+ for (WBInjectionPoint<?, ?> injectionPoint : getDelegateInjectionPoints())
+ {
+ if (injectionPoint instanceof MethodInjectionPoint<?, ?> && !injectionPoint.isAnnotationPresent(Inject.class))
+ {
+ throw new DefinitionException("Method with @Decorates parameter must be an initializer method " + injectionPoint);
+ }
+ }
+ if (getDelegateInjectionPoints().size() == 0)
+ {
+ throw new DefinitionException("No delegate injection points defined " + this);
+ }
+ else if (getDelegateInjectionPoints().size() > 1)
+ {
+ throw new DefinitionException("Too many delegate injection point defined " + this);
+ }
+ }
+
+ protected void initDelegateBindings()
+ {
+ this.delegateBindings = new HashSet<Annotation>();
+ this.delegateBindings.addAll(this.delegateInjectionPoint.getQualifiers());
+ }
+
+ protected void initDelegateType()
+ {
+ this.delegateType = this.delegateInjectionPoint.getBaseType();
+ this.delegateTypes = new HashSet<Type>();
+ delegateTypes.add(delegateType);
+ }
+
+ protected void checkDelegateType()
+ {
+ for (Type decoratedType : getDecoratedTypes())
+ {
+ if (decoratedType instanceof Class)
+ {
+ if (!((Class<?>) decoratedType).isAssignableFrom(delegateInjectionPoint.getJavaClass()))
+ {
+ throw new DefinitionException("The delegate type must extend or implement every decorated type. Decorated type " + decoratedType + "." + this );
+ }
+ }
+ else if (decoratedType instanceof ParameterizedType)
+ {
+ ParameterizedType parameterizedType = (ParameterizedType) decoratedType;
+ if (!delegateInjectionPoint.isParameterizedType())
+ {
+ throw new DefinitionException("The decorated type is parameterized, but the delegate type isn't. Delegate type " + delegateType + "." + this);
+ }
+ if (!Arrays.equals(delegateInjectionPoint.getActualTypeArguments(), parameterizedType.getActualTypeArguments()))
+ {
+ throw new DefinitionException("The delegate type must have exactly the same type parameters as the decorated type. Decorated type " + decoratedType + "." + this );
+ }
+ Type rawType = ((ParameterizedType) decoratedType).getRawType();
+ if (rawType instanceof Class && !((Class<?>) rawType).isAssignableFrom(delegateInjectionPoint.getJavaClass()))
+ {
+ throw new DefinitionException("The delegate type must extend or implement every decorated type. Decorated type " + decoratedType + "." + this );
+ }
+ else
+ {
+ throw new IllegalStateException("Unable to process " + decoratedType);
+ }
+
+ }
+ }
+ }
+
+ public Set<Annotation> getDelegateQualifiers()
+ {
+ return delegateBindings;
+ }
+
+ public Type getDelegateType()
+ {
+ return delegateType;
+ }
+
+ public Set<Type> getDecoratedTypes()
+ {
+ return decoratedTypes;
+ }
+
+ public WBInjectionPoint<?, ?> getDelegateInjectionPoint()
+ {
+ return delegateInjectionPoint;
+ }
+
+ /**
+ * The type closure of the delegate type
+ *
+ * @return the delegateTypes
+ */
+ public Set<Type> getDelegateTypes()
+ {
+ return delegateTypes;
+ }
+
+ @Override
+ protected void initDecorators()
+ {
+ // No-op, decorators can't have decorators
+ }
+
+ @Override
+ public String getDescription()
+ {
+ // TODO Auto-generated method stub
+ return super.getDescription("decorator");
+ }
+
+}
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/bean/DisposalMethod.java (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/DisposalMethod.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/weld/bean/DisposalMethod.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/bean/DisposalMethod.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -0,0 +1,250 @@
+/*
+ * 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;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
+import java.lang.reflect.Type;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.Disposes;
+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.injection.MethodInjectionPoint;
+import org.jboss.weld.introspector.WBMethod;
+
+public class DisposalMethod<X, T> extends AbstractReceiverBean<X, T, Method>
+{
+
+ protected MethodInjectionPoint<T, ?> disposalMethodInjectionPoint;
+
+ protected DisposalMethod(BeanManagerImpl manager, WBMethod<T, X> disposalMethod, AbstractClassBean<X> declaringBean)
+ {
+ super(new StringBuilder().append(DisposalMethod.class.getSimpleName()).append(BEAN_ID_SEPARATOR).append(declaringBean.getAnnotatedItem().getName()).append(disposalMethod.getSignature().toString()).toString(), declaringBean, manager);
+ this.disposalMethodInjectionPoint = MethodInjectionPoint.of(this, disposalMethod);
+ initBindings();
+ initType();
+ initTypes();
+ initStereotypes();
+ initPolicy();
+ }
+
+ @Override
+ public void initialize(BeanDeployerEnvironment environment)
+ {
+ addInjectionPoint(disposalMethodInjectionPoint);
+ super.initialize(environment);
+ checkDisposalMethod();
+ }
+
+ @SuppressWarnings("unchecked")
+ protected void initType()
+ {
+ this.type = (Class<T>) disposalMethodInjectionPoint.getAnnotatedParameters(Disposes.class).get(0).getJavaClass();
+ }
+
+ @Override
+ public WBMethod<T, ?> getAnnotatedItem()
+ {
+ return disposalMethodInjectionPoint;
+ }
+
+ public static <X, T> DisposalMethod<X, T> of(BeanManagerImpl manager, WBMethod<T, X> disposalMethod, AbstractClassBean<X> declaringBean)
+ {
+ return new DisposalMethod<X, T>(manager, disposalMethod, declaringBean);
+ }
+
+ @Override
+ protected void initBindings()
+ {
+ // At least 1 parameter exists, already checked in constructor
+ this.bindings = new HashSet<Annotation>();
+ this.bindings.addAll(disposalMethodInjectionPoint.getWBParameters().get(0).getQualifiers());
+ initDefaultBindings();
+ }
+
+ /**
+ * Initializes the API types
+ */
+ @Override
+ protected void initTypes()
+ {
+ Set<Type> types = new HashSet<Type>();
+ types.addAll(disposalMethodInjectionPoint.getAnnotatedParameters(Disposes.class).get(0).getTypeClosure());
+ types.add(Object.class);
+ super.types = types;
+ }
+
+ @Override
+ public String getName()
+ {
+ return null;
+ }
+
+ @Override
+ public Class<? extends Annotation> getScope()
+ {
+ return null;
+ }
+
+ @Override
+ public Set<Type> getTypes()
+ {
+ return types;
+ }
+
+ @Override
+ public String getDescription()
+ {
+ return disposalMethodInjectionPoint.toString();
+ }
+
+ @Override
+ public boolean isNullable()
+ {
+ // Not relevant
+ return false;
+ }
+
+ @Override
+ public boolean isSerializable()
+ {
+ // Not relevant
+ return false;
+ }
+
+ @Override
+ public boolean isProxyable()
+ {
+ return true;
+ }
+
+ public T create(CreationalContext<T> creationalContext)
+ {
+ // Not Relevant
+ return null;
+ }
+
+ public void invokeDisposeMethod(Object instance)
+ {
+ CreationalContext<T> creationalContext = manager.createCreationalContext(this);
+ Object receiverInstance = getReceiver(creationalContext);
+ if (receiverInstance == null)
+ {
+ disposalMethodInjectionPoint.invokeWithSpecialValue(null, Disposes.class, instance, manager, creationalContext, IllegalArgumentException.class);
+ }
+ else
+ {
+ disposalMethodInjectionPoint.invokeOnInstanceWithSpecialValue(receiverInstance, Disposes.class, instance, manager, creationalContext, IllegalArgumentException.class);
+ }
+ creationalContext.release();
+ }
+
+ private void checkDisposalMethod()
+ {
+ if (!disposalMethodInjectionPoint.getWBParameters().get(0).isAnnotationPresent(Disposes.class))
+ {
+ throw new DefinitionException(disposalMethodInjectionPoint.toString() + " doesn't have @Dispose as first parameter");
+ }
+ if (disposalMethodInjectionPoint.getAnnotatedParameters(Disposes.class).size() > 1)
+ {
+ throw new DefinitionException(disposalMethodInjectionPoint.toString() + " has more than one @Dispose parameters");
+ }
+ if (disposalMethodInjectionPoint.getAnnotatedParameters(Observes.class).size() > 0)
+ {
+ throw new DefinitionException("@Observes is not allowed on disposal method, see " + disposalMethodInjectionPoint.toString());
+ }
+ if (disposalMethodInjectionPoint.getAnnotation(Inject.class) != null)
+ {
+ throw new DefinitionException("@Intitializer is not allowed on a disposal method, see " + disposalMethodInjectionPoint.toString());
+ }
+ if (disposalMethodInjectionPoint.getAnnotation(Produces.class) != null)
+ {
+ throw new DefinitionException("@Produces is not allowed on a disposal method, see " + disposalMethodInjectionPoint.toString());
+ }
+ if (getDeclaringBean() instanceof SessionBean<?>)
+ {
+ boolean methodDeclaredOnTypes = false;
+ // TODO use annotated item?
+ for (Type type : getDeclaringBean().getTypes())
+ {
+ if (type instanceof Class<?>)
+ {
+ Class<?> clazz = (Class<?>) type;
+ try
+ {
+ clazz.getDeclaredMethod(disposalMethodInjectionPoint.getName(), disposalMethodInjectionPoint.getParameterTypesAsArray());
+ methodDeclaredOnTypes = true;
+ }
+ catch (NoSuchMethodException nsme)
+ {
+ // No - op
+ }
+ }
+ }
+ if (!methodDeclaredOnTypes)
+ {
+ throw new DefinitionException("Producer method " + toString() + " must be declared on a business interface of " + getDeclaringBean());
+ }
+ }
+ }
+
+ @Override
+ public Class<T> getType()
+ {
+ return type;
+ }
+
+ @Override
+ protected String getDefaultName()
+ {
+ return disposalMethodInjectionPoint.getPropertyName();
+ }
+
+ public void destroy(T instance, CreationalContext<T> creationalContext)
+ {
+ // No-op. Producer method dependent objects are destroyed in producer method bean
+ }
+
+ @Override
+ public AbstractBean<?, ?> getSpecializedBean()
+ {
+ // Doesn't support specialization
+ return null;
+ }
+
+ @Override
+ protected void initScopeType()
+ {
+ // Disposal methods aren't scoped
+ }
+
+ @Override
+ public Set<Class<? extends Annotation>> getStereotypes()
+ {
+ return Collections.emptySet();
+ }
+
+}
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/bean/ForwardingBean.java (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ForwardingBean.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/weld/bean/ForwardingBean.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/bean/ForwardingBean.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -0,0 +1,172 @@
+/*
+ * 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;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.Set;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.InjectionPoint;
+
+/**
+ * A delegating bean
+ *
+ * @author Pete Muir
+ *
+ * @param <T>
+ */
+public abstract class ForwardingBean<T> implements Bean<T>
+{
+
+ /**
+ * Creates an instance of the delegate
+ *
+ * @return an instance of the delegate
+ */
+ public T create(CreationalContext<T> creationalContext)
+ {
+ return delegate().create(creationalContext);
+ }
+
+ /**
+ * Abstract getter for the delegate
+ *
+ * @return The delegate
+ */
+ protected abstract Bean<T> delegate();
+
+ /**
+ * Destroys an instance through the delegate
+ *
+ * @param instance The instance to destroy
+ */
+ public void destroy(T instance, CreationalContext<T> creationalContext)
+ {
+ delegate().destroy(instance, creationalContext);
+ }
+
+ /**
+ * Compares an object with the delegate
+ *
+ * @return True if equals, false otherwise
+ */
+ @Override
+ public boolean equals(Object obj)
+ {
+ return delegate().equals(obj);
+ }
+
+ public Class<?> getBeanClass()
+ {
+ return delegate().getBeanClass();
+ }
+
+ /**
+ * Gets the binding types of the delegate
+ *
+ * @return The binding types
+ */
+ public Set<Annotation> getQualifiers()
+ {
+ return delegate().getQualifiers();
+ }
+
+ public Set<InjectionPoint> getInjectionPoints()
+ {
+ return delegate().getInjectionPoints();
+ }
+
+ /**
+ * Gets the name of the delegate
+ *
+ * @return The name
+ */
+ public String getName()
+ {
+ return delegate().getName();
+ }
+
+ /**
+ * The stereotypes applied to this bean
+ *
+ * @return stereotypes if any
+ */
+ public Set<Class<? extends Annotation>> getStereotypes()
+ {
+ return delegate().getStereotypes();
+ }
+
+ /**
+ * Gets the scope type of the delegate
+ *
+ * @return The scope type
+ */
+ public Class<? extends Annotation> getScope()
+ {
+ return delegate().getScope();
+ }
+
+ /**
+ * Gets the API types of the delegate
+ *
+ * @return The API types
+ */
+ public Set<Type> getTypes()
+ {
+ return delegate().getTypes();
+ }
+
+ /**
+ * Gets the hash code of the delegate
+ *
+ * @return The hash code
+ */
+ @Override
+ public int hashCode()
+ {
+ return delegate().hashCode();
+ }
+
+ /**
+ * Indicates if the delegate is nullable
+ *
+ * @return True if nullable, false otherwise
+ */
+ public boolean isNullable()
+ {
+ return delegate().isNullable();
+ }
+
+ public boolean isAlternative()
+ {
+ return delegate().isAlternative();
+ }
+
+ /**
+ * Returns a string representation
+ *
+ * @return The string representation
+ */
+ @Override
+ public String toString()
+ {
+ return "ForwardingBean " + getName() + " for " + delegate().toString();
+ }
+
+}
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/bean/ForwardingDecorator.java (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ForwardingDecorator.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/weld/bean/ForwardingDecorator.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/bean/ForwardingDecorator.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -0,0 +1,46 @@
+/*
+ * 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;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.Set;
+
+import javax.enterprise.inject.spi.Decorator;
+
+public abstract class ForwardingDecorator<T> extends ForwardingBean<T> implements Decorator<T>
+{
+
+ @Override
+ protected abstract Decorator<T> delegate();
+
+ public Set<Type> getDecoratedTypes()
+ {
+ return delegate().getDecoratedTypes();
+ }
+
+ public Set<Annotation> getDelegateQualifiers()
+ {
+ return delegate().getDelegateQualifiers();
+ }
+
+ public Type getDelegateType()
+ {
+ return delegate().getDelegateType();
+ }
+
+}
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/bean/InterceptorImpl.java (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/InterceptorImpl.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/weld/bean/InterceptorImpl.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/bean/InterceptorImpl.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -0,0 +1,87 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, 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.bean;
+
+import org.jboss.interceptor.model.InterceptorClassMetadata;
+import org.jboss.interceptor.registry.InterceptorClassMetadataRegistry;
+import org.jboss.interceptor.proxy.DirectClassInterceptionHandler;
+import org.jboss.weld.BeanManagerImpl;
+import org.jboss.weld.introspector.WBClass;
+import org.jboss.weld.metadata.cache.MetaAnnotationStore;
+
+import javax.enterprise.inject.spi.InterceptionType;
+import javax.enterprise.inject.spi.Interceptor;
+import javax.interceptor.InvocationContext;
+import java.lang.annotation.Annotation;
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * @author Marius Bogoevici
+ */
+public class InterceptorImpl<T> extends ManagedBean<T> implements Interceptor<T>
+{
+ private final InterceptorClassMetadata interceptorClassMetadata;
+
+ private final Set<Annotation> interceptorBindingTypes;
+
+ protected InterceptorImpl(WBClass<T> type, BeanManagerImpl manager)
+ {
+ super(type, new StringBuilder().append(Interceptor.class.getSimpleName()).append(BEAN_ID_SEPARATOR).append(type.getName()).toString(), manager);
+ this.interceptorClassMetadata = InterceptorClassMetadataRegistry.getRegistry().getInterceptorClassMetadata(type.getJavaClass());
+ this.interceptorBindingTypes = flattenInterceptorBindings(manager, getAnnotatedItem().getAnnotations());
+ }
+
+ public static <T> InterceptorImpl<T> of(WBClass<T> type, BeanManagerImpl manager)
+ {
+ return new InterceptorImpl(type, manager);
+ }
+
+ public Set<Annotation> getInterceptorBindingTypes()
+ {
+ return interceptorBindingTypes;
+ }
+
+ public Object intercept(InterceptionType type, T instance, InvocationContext ctx)
+ {
+ try
+ {
+ return new DirectClassInterceptionHandler(instance, getType()).invoke(ctx.getTarget(), org.jboss.interceptor.model.InterceptionType.valueOf(type.name()), ctx);
+ } catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public boolean intercepts(InterceptionType type)
+ {
+ return interceptorClassMetadata.getInterceptorMethods(org.jboss.interceptor.model.InterceptionType.valueOf(type.name())).size() > 0;
+ }
+
+ @Override
+ public void postConstruct(T instance)
+ {
+ // do nothing on PostConstruct
+ }
+
+ @Override
+ public void preDestroy(T instance)
+ {
+ // do nothing on PreDestroy
+ }
+}
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/bean/ManagedBean.java (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ManagedBean.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/weld/bean/ManagedBean.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/bean/ManagedBean.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -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.bean;
+
+import java.util.Set;
+import java.util.List;
+import java.util.ArrayList;
+import java.lang.annotation.Annotation;
+
+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.AnnotatedMethod;
+
+import org.jboss.interceptor.proxy.InterceptorProxyCreatorImpl;
+import org.jboss.interceptor.proxy.InterceptionHandlerFactory;
+import org.jboss.interceptor.util.InterceptionUtils;
+import org.jboss.interceptor.model.InterceptionModelBuilder;
+import org.jboss.interceptor.registry.InterceptorRegistry;
+import org.jboss.weld.BeanManagerImpl;
+import org.jboss.weld.DefinitionException;
+import org.jboss.weld.DeploymentException;
+import org.jboss.weld.bean.interceptor.ClassInterceptionHandlerFactory;
+import org.jboss.weld.bean.interceptor.InterceptorInterceptionHandlerFactory;
+import org.jboss.weld.bootstrap.BeanDeployerEnvironment;
+import org.jboss.weld.injection.ConstructorInjectionPoint;
+import org.jboss.weld.injection.InjectionContextImpl;
+import org.jboss.weld.injection.WBInjectionPoint;
+import org.jboss.weld.introspector.WBClass;
+import org.jboss.weld.introspector.WBConstructor;
+import org.jboss.weld.introspector.WBField;
+import org.jboss.weld.introspector.WBMethod;
+import org.jboss.weld.log.LogProvider;
+import org.jboss.weld.log.Logging;
+import org.jboss.weld.metadata.cache.MetaAnnotationStore;
+import org.jboss.weld.util.Beans;
+import org.jboss.weld.util.Names;
+import org.jboss.weld.util.Reflections;
+
+/**
+ * Represents a simple bean
+ *
+ * @author Pete Muir
+ * @author Marius Bogoevici
+ * @param <T> The type (class) of the bean
+ */
+public class ManagedBean<T> extends AbstractClassBean<T>
+{
+ // Logger
+ private static LogProvider log = Logging.getLogProvider(ManagedBean.class);
+
+ // The constructor
+ private ConstructorInjectionPoint<T> constructor;
+ private Set<WBInjectionPoint<?, ?>> ejbInjectionPoints;
+ private Set<WBInjectionPoint<?, ?>> persistenceContextInjectionPoints;
+ private Set<WBInjectionPoint<?, ?>> persistenceUnitInjectionPoints;
+ private Set<WBInjectionPoint<?, ?>> resourceInjectionPoints;
+
+ private ManagedBean<?> specializedBean;
+
+ /**
+ * Creates a simple, annotation defined Web Bean
+ *
+ * @param <T> The type
+ * @param clazz The class
+ * @param manager the current manager
+ * @return A Web Bean
+ */
+ public static <T> ManagedBean<T> of(WBClass<T> clazz, BeanManagerImpl manager)
+ {
+ return new ManagedBean<T>(clazz, new StringBuilder().append(ManagedBean.class.getSimpleName()).append(BEAN_ID_SEPARATOR).append(clazz.getName()).toString(), manager);
+ }
+
+ /**
+ * Constructor
+ *
+ * @param type The type of the bean
+ * @param manager The Web Beans manager
+ */
+ protected ManagedBean(WBClass<T> type, String idSuffix, BeanManagerImpl manager)
+ {
+ super(type, idSuffix, manager);
+ initType();
+ initTypes();
+ initBindings();
+ }
+
+ /**
+ * Creates an instance of the bean
+ *
+ * @return The instance
+ */
+ public T create(CreationalContext<T> creationalContext)
+ {
+ InjectionPoint originalInjectionPoint = null;
+ if (hasDecorators())
+ {
+ originalInjectionPoint = attachCorrectInjectionPoint();
+ }
+ T instance = produce(creationalContext);
+ inject(instance, creationalContext);
+ if (hasDecorators())
+ {
+ instance = applyDecorators(instance, creationalContext, originalInjectionPoint);
+ }
+ if (isInterceptionCandidate() && (hasBoundInterceptors() || hasDeclaredInterceptors()))
+ {
+ instance = applyInterceptors(instance, creationalContext);
+ InterceptionUtils.executePostConstruct(instance);
+ } else
+ {
+ postConstruct(instance);
+ }
+ return instance;
+ }
+
+ public T produce(CreationalContext<T> ctx)
+ {
+ T instance = constructor.newInstance(manager, ctx);
+ if (!hasDecorators())
+ {
+ // This should be safe, but needs verification PLM
+ // Without this, the chaining of decorators will fail as the incomplete instance will be resolved
+ ctx.push(instance);
+ }
+ return instance;
+ }
+
+ public void inject(final T instance, final CreationalContext<T> ctx)
+ {
+ new InjectionContextImpl<T>(getManager(), this, instance)
+ {
+
+ public void proceed()
+ {
+ Beans.injectEEFields(instance, getManager(), ejbInjectionPoints, persistenceContextInjectionPoints, persistenceUnitInjectionPoints, resourceInjectionPoints);
+ Beans.injectFieldsAndInitializers(instance, ctx, getManager(), getInjectableFields(), getInitializerMethods());
+ }
+
+ }.run();
+
+ }
+
+ protected InjectionPoint attachCorrectInjectionPoint()
+ {
+ Decorator<?> decorator = getDecorators().get(getDecorators().size() - 1);
+ if (decorator instanceof DecoratorImpl<?>)
+ {
+ DecoratorImpl<?> decoratorBean = (DecoratorImpl<?>) decorator;
+ InjectionPoint outerDelegateInjectionPoint = decoratorBean.getDelegateInjectionPoint();
+ return getManager().replaceOrPushCurrentInjectionPoint(outerDelegateInjectionPoint);
+ } else
+ {
+ throw new IllegalStateException("Cannot operate on user defined decorator");
+ }
+ }
+
+ /**
+ * Destroys an instance of the bean
+ *
+ * @param instance The instance
+ */
+ public void destroy(T instance, CreationalContext<T> creationalContext)
+ {
+ try
+ {
+ if (!isInterceptionCandidate() || !hasBoundInterceptors())
+ preDestroy(instance);
+ else
+ {
+ InterceptionUtils.executePredestroy(instance);
+ }
+ creationalContext.release();
+ }
+ catch (Exception e)
+ {
+ log.error("Error destroying " + toString(), e);
+ }
+ }
+
+ /**
+ * Initializes the bean and its metadata
+ */
+ @Override
+ public void initialize(BeanDeployerEnvironment environment)
+ {
+ if (!isInitialized())
+ {
+ initConstructor();
+ checkConstructor();
+ super.initialize(environment);
+ initPostConstruct();
+ initPreDestroy();
+ initEEInjectionPoints();
+ if (isInterceptionCandidate())
+ initDeclaredInterceptors();
+ }
+ }
+
+ private void initEEInjectionPoints()
+ {
+ this.ejbInjectionPoints = Beans.getEjbInjectionPoints(this, getAnnotatedItem(), getManager());
+ this.persistenceContextInjectionPoints = Beans.getPersistenceContextInjectionPoints(this, getAnnotatedItem(), getManager());
+ this.persistenceUnitInjectionPoints = Beans.getPersistenceUnitInjectionPoints(this, getAnnotatedItem(), getManager());
+ this.resourceInjectionPoints = Beans.getResourceInjectionPoints(this, getAnnotatedItem(), manager);
+ }
+
+
+ /**
+ * Validates the type
+ */
+ @Override
+ protected void checkType()
+ {
+ if (getAnnotatedItem().isNonStaticMemberClass())
+ {
+ throw new DefinitionException("Simple bean " + type + " cannot be a non-static inner class");
+ }
+ if (!isDependent() && getAnnotatedItem().isParameterizedType())
+ {
+ throw new DefinitionException("Managed bean " + type + " must be @Dependent");
+ }
+ boolean passivating = manager.getServices().get(MetaAnnotationStore.class).getScopeModel(scopeType).isPassivating();
+ if (passivating && !Reflections.isSerializable(getBeanClass()))
+ {
+ throw new DefinitionException("Simple bean declaring a passivating scope must have a serializable implementation class " + toString());
+ }
+ if (hasDecorators())
+ {
+ if (getAnnotatedItem().isFinal())
+ {
+ throw new DefinitionException("Bean class which has decorators cannot be declared final " + this);
+ }
+ for (Decorator<?> decorator : getDecorators())
+ {
+ if (decorator instanceof DecoratorImpl<?>)
+ {
+ DecoratorImpl<?> decoratorBean = (DecoratorImpl<?>) decorator;
+ for (WBMethod<?, ?> decoratorMethod : decoratorBean.getAnnotatedItem().getWBMethods())
+ {
+ WBMethod<?, ?> method = getAnnotatedItem().getWBMethod(decoratorMethod.getSignature());
+ if (method != null && !method.isStatic() && !method.isPrivate() && method.isFinal())
+ {
+ throw new DefinitionException("Decorated bean method " + method + " (decorated by "+ decoratorMethod + ") cannot be declarted final");
+ }
+ }
+ }
+ else
+ {
+ throw new IllegalStateException("Can only operate on container provided decorators " + decorator);
+ }
+ }
+ }
+ }
+
+ @Override
+ protected void checkBeanImplementation()
+ {
+ super.checkBeanImplementation();
+ if (isNormalScoped())
+ {
+ for (WBField<?, ?> field : getAnnotatedItem().getWBFields())
+ {
+ if (field.isPublic() && !field.isStatic())
+ {
+ throw new DefinitionException("Normal scoped Web Bean implementation class has a public field " + getAnnotatedItem());
+ }
+ }
+ }
+ }
+
+ protected void checkConstructor()
+ {
+ if (!constructor.getAnnotatedWBParameters(Disposes.class).isEmpty())
+ {
+ throw new DefinitionException("Managed bean constructor must not have a parameter annotated @Disposes " + constructor);
+ }
+ if (!constructor.getAnnotatedWBParameters(Observes.class).isEmpty())
+ {
+ throw new DefinitionException("Managed bean constructor must not have a parameter annotated @Observes " + constructor);
+ }
+ }
+
+ @Override
+ protected void preSpecialize(BeanDeployerEnvironment environment)
+ {
+ super.preSpecialize(environment);
+ if (environment.getEjbDescriptors().contains(getAnnotatedItem().getWBSuperclass().getJavaClass()))
+ {
+ throw new DefinitionException("Simple bean must specialize a simple bean");
+ }
+ }
+
+ @Override
+ protected void specialize(BeanDeployerEnvironment environment)
+ {
+ if (environment.getClassBean(getAnnotatedItem().getWBSuperclass()) == null)
+ {
+ throw new DefinitionException(toString() + " does not specialize a bean");
+ }
+ AbstractClassBean<?> specializedBean = environment.getClassBean(getAnnotatedItem().getWBSuperclass());
+ if (!(specializedBean instanceof ManagedBean))
+ {
+ throw new DefinitionException(toString() + " doesn't have a simple bean as a superclass " + specializedBean);
+ } else
+ {
+ this.specializedBean = (ManagedBean<?>) specializedBean;
+ }
+ }
+
+
+ /**
+ * 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 WBConstructor<T> getConstructor()
+ {
+ return constructor;
+ }
+
+ /**
+ * Gets a string representation
+ *
+ * @return The string representation
+ */
+ @Override
+ public String getDescription()
+ {
+ return getDescription("simple bean");
+ }
+
+ protected String getDescription(String beanType)
+ {
+ StringBuilder buffer = new StringBuilder();
+ buffer.append(Names.scopeTypeToString(getScope()));
+ if (getName() == null)
+ {
+ buffer.append("unnamed ").append(beanType);
+ }
+ else
+ {
+ buffer.append(beanType).append(" '" + getName() + "'");
+ }
+ buffer.append(" ").append(getType().getName()).append(", ");
+ buffer.append(" API types = ").append(Names.typesToString(getTypes())).append(", binding types = " + Names.annotationsToString(getQualifiers()));
+ return buffer.toString();
+ }
+
+ @Override
+ public ManagedBean<?> getSpecializedBean()
+ {
+ return specializedBean;
+ }
+
+ protected boolean isInterceptionCandidate()
+ {
+ return !Beans.isInterceptor(getAnnotatedItem()) && !Beans.isDecorator(getAnnotatedItem());
+ }
+
+ private boolean hasBoundInterceptors()
+ {
+ if (manager.getBoundInterceptorsRegistry().getInterceptionModel(getType()) != null)
+ return manager.getBoundInterceptorsRegistry().getInterceptionModel(getType()).getAllInterceptors().size() > 0;
+ else
+ return false;
+ }
+
+ private boolean hasDeclaredInterceptors()
+ {
+ if (manager.getDeclaredInterceptorsRegistry().getInterceptionModel(getType()) != null)
+ return manager.getDeclaredInterceptorsRegistry().getInterceptionModel(getType()).getAllInterceptors().size() > 0;
+ else
+ return false;
+ }
+
+ protected T applyInterceptors(T instance, final CreationalContext<T> creationalContext)
+ {
+ try
+ {
+ List<InterceptorRegistry<Class<?>, ?>> interceptionRegistries = new ArrayList<InterceptorRegistry<Class<?>,?>>();
+ List<InterceptionHandlerFactory<?>> interceptionHandlerFactories = new ArrayList<InterceptionHandlerFactory<?>>();
+ if (hasDeclaredInterceptors())
+ {
+ interceptionRegistries.add(manager.getDeclaredInterceptorsRegistry());
+ interceptionHandlerFactories.add(new ClassInterceptionHandlerFactory(creationalContext, getManager()));
+ }
+ if (hasBoundInterceptors())
+ {
+ interceptionRegistries.add(manager.getBoundInterceptorsRegistry());
+ interceptionHandlerFactories.add(new InterceptorInterceptionHandlerFactory(creationalContext, manager));
+ }
+ if (interceptionRegistries.size() > 0)
+ instance = new InterceptorProxyCreatorImpl(interceptionRegistries, interceptionHandlerFactories).createProxyFromInstance(instance, getType());
+
+ } catch (Exception e)
+ {
+ throw new DeploymentException(e);
+ }
+ return instance;
+ }
+
+ protected void initDeclaredInterceptors()
+ {
+ if (manager.getDeclaredInterceptorsRegistry().getInterceptionModel(getType()) == null && InterceptionUtils.supportsEjb3InterceptorDeclaration())
+ {
+ InterceptionModelBuilder<Class<?>, Class<?>> builder = InterceptionModelBuilder.newBuilderFor(getType(), (Class) Class.class);
+
+ Class<?>[] classDeclaredInterceptors = null;
+ if (getAnnotatedItem().isAnnotationPresent(InterceptionUtils.getInterceptorsAnnotationClass()))
+ {
+ Annotation interceptorsAnnotation = getType().getAnnotation(InterceptionUtils.getInterceptorsAnnotationClass());
+ classDeclaredInterceptors = Reflections.extractValues(interceptorsAnnotation);
+ }
+ if (classDeclaredInterceptors != null)
+ {
+ builder.interceptPostConstruct().with(classDeclaredInterceptors);
+ builder.interceptPreDestroy().with(classDeclaredInterceptors);
+ }
+
+ List<WBMethod<?, ?>> businessMethods = Beans.getInterceptableBusinessMethods(getAnnotatedItem());
+ for (WBMethod<?, ?> method : businessMethods)
+ {
+ boolean excludeClassInterceptors = method.isAnnotationPresent(InterceptionUtils.getExcludeClassInterceptorsAnnotationClass());
+ Class<?>[] methodDeclaredInterceptors = null;
+ if (method.isAnnotationPresent(InterceptionUtils.getInterceptorsAnnotationClass()))
+ {
+ methodDeclaredInterceptors = Reflections.extractValues(method.getAnnotation(InterceptionUtils.getInterceptorsAnnotationClass()));
+ }
+ if (!excludeClassInterceptors && classDeclaredInterceptors != null)
+ {
+ builder.interceptAroundInvoke(((AnnotatedMethod) method).getJavaMember()).with(classDeclaredInterceptors);
+ }
+ if (methodDeclaredInterceptors != null)
+ {
+ builder.interceptAroundInvoke(((AnnotatedMethod) method).getJavaMember()).with(methodDeclaredInterceptors);
+ }
+ }
+ manager.getDeclaredInterceptorsRegistry().registerInterceptionModel(getType(), builder.build());
+ }
+ }
+
+}
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/bean/NewBean.java (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/NewBean.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/weld/bean/NewBean.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/bean/NewBean.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -0,0 +1,28 @@
+/*
+ * 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;
+
+/**
+ * Marker interface for @New beans
+ *
+ * @author Pete Muir
+ *
+ */
+public interface NewBean
+{
+
+}
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/bean/NewManagedBean.java (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/NewManagedBean.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/weld/bean/NewManagedBean.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/bean/NewManagedBean.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -0,0 +1,118 @@
+/*
+ * 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;
+
+import java.lang.annotation.Annotation;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.enterprise.context.Dependent;
+
+import org.jboss.weld.BeanManagerImpl;
+import org.jboss.weld.introspector.WBClass;
+import org.jboss.weld.literal.NewLiteral;
+
+/**
+ * Represents a @New simple bean
+ *
+ * @author Nicklas Karlsson
+ */
+public class NewManagedBean<T> extends ManagedBean<T> implements NewBean
+{
+
+ /**
+ * Creates an instance of a NewSimpleBean from an annotated class
+ *
+ * @param clazz The annotated class
+ * @param manager The Web Beans manager
+ * @return a new NewSimpleBean instance
+ */
+ public static <T> NewManagedBean<T> of(WBClass<T> clazz, BeanManagerImpl manager)
+ {
+ return new NewManagedBean<T>(clazz, new StringBuilder().append(NewManagedBean.class.getSimpleName()).append(BEAN_ID_SEPARATOR).append(clazz.getName()).toString(), manager);
+ }
+
+ private Set<Annotation> bindings;
+
+ /**
+ * Protected constructor
+ *
+ * @param type An annotated class
+ * @param manager The Web Beans manager
+ */
+ protected NewManagedBean(final WBClass<T> type, String idSuffix, BeanManagerImpl manager)
+ {
+ super(type, idSuffix, manager);
+ this.bindings = new HashSet<Annotation>();
+ this.bindings.add(new NewLiteral()
+ {
+
+ @Override
+ public Class<?> value()
+ {
+ return type.getJavaClass();
+ }
+
+ });
+ }
+
+ /**
+ * Gets the scope type
+ *
+ * @return @Dependent
+ */
+ @Override
+ public Class<? extends Annotation> getScope()
+ {
+ return Dependent.class;
+ }
+
+ @Override
+ public boolean isAlternative()
+ {
+ return false;
+ }
+
+ /**
+ * Gets the name of the bean
+ *
+ * @return null
+ */
+ @Override
+ public String getName()
+ {
+ return null;
+ }
+
+ /**
+ * Gets the bindings
+ *
+ * @returns @New
+ */
+ @Override
+ public Set<Annotation> getQualifiers()
+ {
+ return bindings;
+ }
+
+ @Override
+ public boolean isSpecializing()
+ {
+ return false;
+ }
+
+}
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/bean/NewSessionBean.java (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/NewSessionBean.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/weld/bean/NewSessionBean.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/bean/NewSessionBean.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -0,0 +1,127 @@
+/*
+ * 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;
+
+import java.lang.annotation.Annotation;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.enterprise.context.Dependent;
+
+import org.jboss.weld.BeanManagerImpl;
+import org.jboss.weld.ejb.InternalEjbDescriptor;
+import org.jboss.weld.introspector.WBClass;
+import org.jboss.weld.literal.NewLiteral;
+import org.jboss.weld.resources.ClassTransformer;
+
+/**
+ * Represents a @New enterprise bean
+ *
+ * @author Nicklas Karlsson
+ */
+public class NewSessionBean<T> extends SessionBean<T> implements NewBean
+{
+
+ /**
+ * Creates an instance of a NewEnterpriseBean from an annotated class
+ *
+ * @param clazz The annotated class
+ * @param manager The Web Beans manager
+ * @return a new NewEnterpriseBean instance
+ */
+ public static <T> NewSessionBean<T> of(InternalEjbDescriptor<T> ejbDescriptor, BeanManagerImpl manager)
+ {
+ WBClass<T> type = manager.getServices().get(ClassTransformer.class).loadClass(ejbDescriptor.getBeanClass());
+ return new NewSessionBean<T>(type, ejbDescriptor, new StringBuilder().append(NewSessionBean.class.getSimpleName()).append(BEAN_ID_SEPARATOR).append(ejbDescriptor.getEjbName()).toString(), manager);
+ }
+
+ private Set<Annotation> bindings;
+
+ /**
+ * Protected constructor
+ *
+ * @param type An annotated class
+ * @param manager The Web Beans manager
+ */
+ protected NewSessionBean(final WBClass<T> type, InternalEjbDescriptor<T> ejbDescriptor, String idSuffix, BeanManagerImpl manager)
+ {
+ super(type, ejbDescriptor, idSuffix, manager);
+ this.bindings = new HashSet<Annotation>();
+ this.bindings.add(new NewLiteral()
+ {
+
+ @Override
+ public Class<?> value()
+ {
+ return type.getJavaClass();
+ }
+
+ });
+ }
+
+ /**
+ * Gets the scope type
+ *
+ * @return @Dependent
+ */
+ @Override
+ public Class<? extends Annotation> getScope()
+ {
+ return Dependent.class;
+ }
+
+ @Override
+ public boolean isAlternative()
+ {
+ return false;
+ }
+
+ /**
+ * Gets the name of the bean
+ *
+ * @return null
+ */
+ @Override
+ public String getName()
+ {
+ return null;
+ }
+
+ /**
+ * Gets the bindings
+ *
+ * @returns @New
+ */
+ @Override
+ public Set<Annotation> getQualifiers()
+ {
+ return bindings;
+ }
+
+ @Override
+ public boolean isSpecializing()
+ {
+ return false;
+ }
+
+ @Override
+ protected void checkScopeAllowed()
+ {
+ // No-op
+ }
+
+}
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/bean/ProducerField.java (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ProducerField.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/weld/bean/ProducerField.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/bean/ProducerField.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -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.bean;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Field;
+import java.util.Collections;
+import java.util.Set;
+
+import javax.enterprise.context.spi.CreationalContext;
+
+import org.jboss.weld.BeanManagerImpl;
+import org.jboss.weld.bootstrap.BeanDeployerEnvironment;
+import org.jboss.weld.introspector.WBField;
+import org.jboss.weld.util.Names;
+
+/**
+ * Represents a producer field
+ *
+ * @author Pete Muir
+ *
+ * @param <T>
+ */
+public class ProducerField<X, T> extends AbstractProducerBean<X, T, Field>
+{
+ // The underlying field
+ private WBField<T, X> field;
+ private final String id;
+
+ /**
+ * Creates a 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> ProducerField<X, T> of(WBField<T, X> field, AbstractClassBean<X> declaringBean, BeanManagerImpl manager)
+ {
+ return new ProducerField<X, T>(field, declaringBean, manager);
+ }
+
+ /**
+ * Constructor
+ *
+ * @param method The producer field abstraction
+ * @param declaringBean The declaring bean
+ * @param manager The Web Beans manager
+ */
+ protected ProducerField(WBField<T, X> field, AbstractClassBean<X> declaringBean, BeanManagerImpl manager)
+ {
+ super(new StringBuilder().append(ProducerField.class.getSimpleName()).append(BEAN_ID_SEPARATOR).append(declaringBean.getAnnotatedItem().getName()).append(field.getName()).toString(), declaringBean, manager);
+ this.field = field;
+ initType();
+ initTypes();
+ initBindings();
+ this.id = new StringBuilder().append(BEAN_ID_PREFIX).append(getClass().getSimpleName()).append(BEAN_ID_SEPARATOR).append(declaringBean.getAnnotatedItem().getName()).append(getAnnotatedItem().getName()).toString();
+ initStereotypes();
+ initPolicy();
+ }
+
+ @Override
+ public void initialize(BeanDeployerEnvironment environment)
+ {
+ if (!isInitialized())
+ {
+ super.initialize(environment);
+ }
+ }
+
+ public void destroy(T instance, CreationalContext<T> creationalContext)
+ {
+ dispose(instance);
+ }
+
+ public void dispose(T instance)
+ {
+ // No clean up required
+ }
+
+ public T produce(CreationalContext<T> ctx)
+ {
+ return field.get(getReceiver(ctx));
+ }
+
+
+ /**
+ * Gets the annotated item representing the field
+ *
+ * @return The annotated item
+ */
+ @Override
+ public WBField<T, X> getAnnotatedItem()
+ {
+ return field;
+ }
+
+ /**
+ * Returns the default name
+ *
+ * @return The default name
+ */
+ @Override
+ protected String getDefaultName()
+ {
+ return field.getPropertyName();
+ }
+
+ /**
+ * Gets a string representation
+ *
+ * @return The string representation
+ */
+ @Override
+ public String getDescription()
+ {
+ StringBuilder buffer = new StringBuilder();
+ buffer.append("Annotated " + Names.scopeTypeToString(getScope()));
+ if (getName() == null)
+ {
+ buffer.append("unnamed producer field bean");
+ }
+ else
+ {
+ buffer.append("simple producer field bean '" + getName() + "'");
+ }
+ buffer.append(" [" + getBeanClass().getName() + "] for class type [" + getType().getName() + "] API types " + getTypes() + ", binding types " + getQualifiers());
+ return buffer.toString();
+ }
+
+ @Override
+ public AbstractBean<?, ?> getSpecializedBean()
+ {
+ return null;
+ }
+
+ @Override
+ public boolean isSpecializing()
+ {
+ return false;
+ }
+
+ @Override
+ public String getId()
+ {
+ return id;
+ }
+
+ @Override
+ public Set<Class<? extends Annotation>> getStereotypes()
+ {
+ return Collections.emptySet();
+ }
+
+}
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/bean/ProducerMethod.java (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ProducerMethod.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/weld/bean/ProducerMethod.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/bean/ProducerMethod.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -0,0 +1,294 @@
+/*
+ * 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;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
+import java.lang.reflect.Type;
+import java.util.Collections;
+import java.util.Set;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.CreationException;
+import javax.enterprise.inject.Disposes;
+
+import org.jboss.weld.BeanManagerImpl;
+import org.jboss.weld.DefinitionException;
+import org.jboss.weld.bootstrap.BeanDeployerEnvironment;
+import org.jboss.weld.injection.MethodInjectionPoint;
+import org.jboss.weld.injection.ParameterInjectionPoint;
+import org.jboss.weld.introspector.WBMethod;
+import org.jboss.weld.introspector.WBParameter;
+import org.jboss.weld.util.Names;
+
+/**
+ * Represents a producer method bean
+ *
+ * @author Pete Muir
+ *
+ * @param <T>
+ */
+public class ProducerMethod<X, T> extends AbstractProducerBean<X, T, Method>
+{
+ // The underlying method
+ private MethodInjectionPoint<T, X> method;
+
+ private DisposalMethod<X, ?> disposalMethodBean;
+
+ private ProducerMethod<?, ?> specializedBean;
+
+ private final String id;
+
+ /**
+ * Creates a producer method Web Bean
+ *
+ * @param method The underlying method abstraction
+ * @param declaringBean The declaring bean abstraction
+ * @param manager the current manager
+ * @return A producer Web Bean
+ */
+ public static <X, T> ProducerMethod<X, T> of(WBMethod<T, X> method, AbstractClassBean<X> declaringBean, BeanManagerImpl manager)
+ {
+ return new ProducerMethod<X, T>(method, declaringBean, manager);
+ }
+
+ protected ProducerMethod(WBMethod<T, X> method, AbstractClassBean<X> declaringBean, BeanManagerImpl manager)
+ {
+ super(new StringBuilder().append(ProducerMethod.class.getSimpleName()).append(BEAN_ID_SEPARATOR).append(declaringBean.getAnnotatedItem().getName()).append(".").append(method.getSignature().toString()).toString(), declaringBean, manager);
+ this.method = MethodInjectionPoint.of(this, method);
+ initType();
+ initTypes();
+ initBindings();
+ this.id = new StringBuilder().append(BEAN_ID_PREFIX).append(getClass().getSimpleName()).append(BEAN_ID_SEPARATOR).append(declaringBean.getAnnotatedItem().getName()).append(getAnnotatedItem().getSignature().toString()).toString();
+ initStereotypes();
+ initPolicy();
+ }
+
+ public T produce(CreationalContext<T> creationalContext)
+ {
+ Object receiver = getReceiver(creationalContext);
+ if (receiver != null)
+ {
+ return method.invokeOnInstance(receiver, manager, creationalContext, CreationException.class);
+ }
+ else
+ {
+ return method.invoke(receiver, manager, creationalContext, CreationException.class);
+ }
+ }
+
+ /**
+ * Initializes the bean and its metadata
+ */
+ @Override
+ public void initialize(BeanDeployerEnvironment environment)
+ {
+ if (!isInitialized())
+ {
+ initProducerMethodInjectableParameters();
+ super.initialize(environment);
+ checkProducerMethod();
+ initDisposalMethod(environment);
+ }
+ }
+
+ /**
+ * Initializes the injection points
+ */
+ protected void initProducerMethodInjectableParameters()
+ {
+ for (WBParameter<?, ?> parameter : method.getWBParameters())
+ {
+ addInjectionPoint(ParameterInjectionPoint.of(this, parameter));
+ }
+ }
+
+ /**
+ * Validates the producer method
+ */
+ protected void checkProducerMethod()
+ {
+ if (getAnnotatedItem().getAnnotatedWBParameters(Observes.class).size() > 0)
+ {
+ throw new DefinitionException("Producer method cannot have parameter annotated @Observes");
+ }
+ else if (getAnnotatedItem().getAnnotatedWBParameters(Disposes.class).size() > 0)
+ {
+ throw new DefinitionException("Producer method cannot have parameter annotated @Disposes");
+ }
+ else if (getDeclaringBean() instanceof SessionBean<?>)
+ {
+ boolean methodDeclaredOnTypes = false;
+ // TODO use annotated item?
+ for (Type type : getDeclaringBean().getTypes())
+ {
+ if (type instanceof Class)
+ {
+ Class<?> clazz = (Class<?>) type;
+ try
+ {
+ clazz.getDeclaredMethod(getAnnotatedItem().getName(), getAnnotatedItem().getParameterTypesAsArray());
+ methodDeclaredOnTypes = true;
+ }
+ catch (NoSuchMethodException nsme)
+ {
+ // No - op
+ }
+ }
+ }
+ if (!methodDeclaredOnTypes)
+ {
+ throw new DefinitionException("Producer method " + toString() + " must be declared on a business interface of " + getDeclaringBean());
+ }
+ }
+ }
+
+ /**
+ * Initializes the remove method
+ */
+ protected void initDisposalMethod(BeanDeployerEnvironment environment)
+ {
+ Set<DisposalMethod<X, ?>> disposalBeans = environment.<X>resolveDisposalBeans(getTypes(), getQualifiers(), getDeclaringBean());
+
+ if (disposalBeans.size() == 1)
+ {
+ this.disposalMethodBean = disposalBeans.iterator().next();
+ }
+ else if (disposalBeans.size() > 1)
+ {
+ // TODO List out found disposal methods
+ throw new DefinitionException("Cannot declare multiple disposal methods for this producer method. Producer method: " + this + ". Disposal methods: " + disposalBeans);
+ }
+ }
+
+ public void destroy(T instance, CreationalContext<T> creationalContext)
+ {
+ try
+ {
+ dispose(instance);
+ }
+ finally
+ {
+ if (getDeclaringBean().isDependent())
+ {
+ creationalContext.release();
+ }
+ }
+ }
+
+ public void dispose(T instance)
+ {
+ if (disposalMethodBean != null)
+ {
+ disposalMethodBean.invokeDisposeMethod(instance);
+ }
+ }
+
+ /**
+ * Gets the annotated item representing the method
+ *
+ * @return The annotated item
+ */
+ @Override
+ public WBMethod<T, X> getAnnotatedItem()
+ {
+ return method;
+ }
+
+ /**
+ * Returns the default name
+ *
+ * @return The default name
+ */
+ @Override
+ protected String getDefaultName()
+ {
+ return method.getPropertyName();
+ }
+
+ /**
+ * Returns the disposal method
+ *
+ * @return The method representation
+ */
+ public DisposalMethod<X, ?> getDisposalMethod()
+ {
+ return disposalMethodBean;
+ }
+
+ /**
+ * Gets a string representation
+ *
+ * @return The string representation
+ */
+ @Override
+ public String getDescription()
+ {
+ StringBuilder buffer = new StringBuilder();
+ buffer.append(Names.scopeTypeToString(getScope()));
+ if (getName() == null)
+ {
+ buffer.append("unnamed producer method bean");
+ }
+ else
+ {
+ buffer.append("simple producer method bean '" + getName() + "'");
+ }
+ buffer.append(" [" + getBeanClass().getName() + "] for class type [" + getType().getName() + "] API types " + getTypes() + ", binding types " + getQualifiers());
+ return buffer.toString();
+ }
+
+ @Override
+ public AbstractBean<?, ?> getSpecializedBean()
+ {
+ return specializedBean;
+ }
+
+ @Override
+ protected void preSpecialize(BeanDeployerEnvironment environment)
+ {
+ if (getDeclaringBean().getAnnotatedItem().getWBSuperclass().getDeclaredWBMethod(getAnnotatedItem().getAnnotatedMethod()) == null)
+ {
+ throw new DefinitionException("Specialized producer method does not override a method on the direct superclass");
+ }
+ }
+
+ @Override
+ protected void specialize(BeanDeployerEnvironment environment)
+ {
+ WBMethod<?, ?> superClassMethod = getDeclaringBean().getAnnotatedItem().getWBSuperclass().getWBMethod(getAnnotatedItem().getAnnotatedMethod());
+ if (environment.getProducerMethod(superClassMethod) == null)
+ {
+ throw new IllegalStateException(toString() + " does not specialize a bean");
+ }
+ this.specializedBean = environment.getProducerMethod(superClassMethod);
+ }
+
+ @Override
+ public String getId()
+ {
+ return id;
+ }
+
+ @Override
+ public Set<Class<? extends Annotation>> getStereotypes()
+ {
+ return Collections.emptySet();
+ }
+
+}
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/bean/RIBean.java (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/RIBean.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/weld/bean/RIBean.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/bean/RIBean.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -0,0 +1,120 @@
+/*
+ * 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;
+
+import java.util.Set;
+
+import javax.enterprise.context.Dependent;
+import javax.enterprise.inject.spi.Bean;
+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.WBInjectionPoint;
+
+/**
+ * Abstract base class with functions specific to RI built-in beans
+ *
+ * @author Pete Muir
+ */
+public abstract class RIBean<T> implements Bean<T>, PassivationCapable
+{
+
+ public static final String BEAN_ID_PREFIX = RIBean.class.getPackage().getName();
+
+ public static final String BEAN_ID_SEPARATOR = "-";
+
+ private final BeanManagerImpl manager;
+
+ private final String id;
+
+ protected RIBean(String idSuffix, BeanManagerImpl manager)
+ {
+ this.manager = manager;
+ this.id = new StringBuilder().append(BEAN_ID_PREFIX).append(BEAN_ID_SEPARATOR).append(manager.getId()).append(BEAN_ID_SEPARATOR).append(idSuffix).toString();
+ }
+
+ protected BeanManagerImpl getManager()
+ {
+ return manager;
+ }
+
+ public abstract Class<T> getType();
+
+ public Class<?> getBeanClass()
+ {
+ return getType();
+ }
+
+ public abstract void initialize(BeanDeployerEnvironment environment);
+
+ public abstract boolean isSpecializing();
+
+ public boolean isDependent()
+ {
+ return getScope().equals(Dependent.class);
+ }
+
+ public abstract boolean isProxyable();
+
+ public abstract boolean isPrimitive();
+
+ public abstract Set<WBInjectionPoint<?, ?>> getAnnotatedInjectionPoints();
+
+ public Set<InjectionPoint> getInjectionPoints()
+ {
+ return (Set) getAnnotatedInjectionPoints();
+ }
+
+ public abstract RIBean<?> getSpecializedBean();
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (obj instanceof RIBean<?>)
+ {
+ RIBean<?> that = (RIBean<?>) obj;
+ return this.getId().equals(that.getId());
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return getId().hashCode();
+ }
+
+ public String getId()
+ {
+ return id;
+ }
+
+ @Override
+ public String toString()
+ {
+ return id;
+ }
+
+ public abstract String getDescription();
+
+
+}
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/bean/SessionBean.java (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/SessionBean.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/weld/bean/SessionBean.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/bean/SessionBean.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -0,0 +1,408 @@
+/*
+ * 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;
+
+import java.io.Serializable;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
+import java.lang.reflect.Type;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.LinkedHashSet;
+import java.util.Set;
+
+import javassist.util.proxy.ProxyFactory;
+import javassist.util.proxy.ProxyObject;
+
+import javax.decorator.Decorator;
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.CreationException;
+import javax.interceptor.Interceptor;
+
+import org.jboss.weld.BeanManagerImpl;
+import org.jboss.weld.DefinitionException;
+import org.jboss.weld.bean.interceptor.InterceptorBindingsAdapter;
+import org.jboss.weld.bean.proxy.EnterpriseBeanInstance;
+import org.jboss.weld.bean.proxy.EnterpriseBeanProxyMethodHandler;
+import org.jboss.weld.bean.proxy.Marker;
+import org.jboss.weld.bootstrap.BeanDeployerEnvironment;
+import org.jboss.weld.ejb.InternalEjbDescriptor;
+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.injection.InjectionContextImpl;
+import org.jboss.weld.introspector.WBClass;
+import org.jboss.weld.introspector.WBMethod;
+import org.jboss.weld.log.Log;
+import org.jboss.weld.log.Logging;
+import org.jboss.weld.resources.ClassTransformer;
+import org.jboss.weld.util.Beans;
+import org.jboss.weld.util.Proxies;
+import org.jboss.interceptor.model.InterceptionModel;
+
+/**
+ * An enterprise bean representation
+ *
+ * @author Pete Muir
+ *
+ * @param <T> The type (class) of the bean
+ */
+public class SessionBean<T> extends AbstractClassBean<T>
+{
+ private final Log log = Logging.getLog(SessionBean.class);
+
+ // The EJB descriptor
+ private InternalEjbDescriptor<T> ejbDescriptor;
+
+ private Class<T> proxyClass;
+
+ private SessionBean<?> specializedBean;
+
+ /**
+ * Creates a simple, annotation defined Enterprise Web Bean
+ *
+ * @param <T> The type
+ * @param clazz The class
+ * @param manager the current manager
+ * @return An Enterprise Web Bean
+ */
+ public static <T> SessionBean<T> of(InternalEjbDescriptor<T> ejbDescriptor, BeanManagerImpl manager)
+ {
+ WBClass<T> type = manager.getServices().get(ClassTransformer.class).loadClass(ejbDescriptor.getBeanClass());
+ return new SessionBean<T>(type, ejbDescriptor, new StringBuilder().append(SessionBean.class.getSimpleName()).append(BEAN_ID_SEPARATOR).append(ejbDescriptor.getEjbName()).toString(), manager);
+ }
+
+ /**
+ * Constructor
+ *
+ * @param type The type of the bean
+ * @param manager The Web Beans manager
+ */
+ protected SessionBean(WBClass<T> type, InternalEjbDescriptor<T> ejbDescriptor, String idSuffix, BeanManagerImpl manager)
+ {
+ super(type, idSuffix, manager);
+ initType();
+ this.ejbDescriptor = ejbDescriptor;
+ initTypes();
+ initBindings();
+ }
+
+ /**
+ * Initializes the bean and its metadata
+ */
+ @Override
+ public void initialize(BeanDeployerEnvironment environment)
+ {
+ if (!isInitialized())
+ {
+ super.initialize(environment);
+ initProxyClass();
+ checkEJBTypeAllowed();
+ checkConflictingRoles();
+ checkObserverMethods();
+ checkScopeAllowed();
+ registerInterceptors();
+ }
+ }
+
+ @Override
+ protected void initTypes()
+ {
+ Set<Type> types = new LinkedHashSet<Type>();
+ types.add(Object.class);
+ for (BusinessInterfaceDescriptor<?> businessInterfaceDescriptor : ejbDescriptor.getLocalBusinessInterfaces())
+ {
+ types.add(businessInterfaceDescriptor.getInterface());
+ }
+ super.types = types;
+ }
+
+ protected void initProxyClass()
+ {
+ Set<Type> types = new LinkedHashSet<Type>(getTypes());
+ types.add(EnterpriseBeanInstance.class);
+ types.add(Serializable.class);
+ ProxyFactory proxyFactory = Proxies.getProxyFactory(types);
+
+ @SuppressWarnings("unchecked")
+ Class<T> proxyClass = proxyFactory.createClass();
+
+ this.proxyClass = proxyClass;
+ }
+
+ /**
+ * Validates for non-conflicting roles
+ */
+ protected void checkConflictingRoles()
+ {
+ if (getType().isAnnotationPresent(Interceptor.class))
+ {
+ throw new DefinitionException("Enterprise beans cannot be interceptors");
+ }
+ if (getType().isAnnotationPresent(Decorator.class))
+ {
+ throw new DefinitionException("Enterprise beans cannot be decorators");
+ }
+ }
+
+ /**
+ * Check that the scope type is allowed by the stereotypes on the bean and
+ * the bean type
+ */
+ protected void checkScopeAllowed()
+ {
+ if (ejbDescriptor.isStateless() && !isDependent())
+ {
+ throw new DefinitionException("Scope " + getScope() + " is not allowed on stateless enterpise beans for " + getType() + ". Only @Dependent is allowed on stateless enterprise beans");
+ }
+ if (ejbDescriptor.isSingleton() && !(isDependent() || getScope().equals(ApplicationScoped.class)))
+ {
+ throw new DefinitionException("Scope " + getScope() + " is not allowed on singleton enterpise beans for " + getType() + ". Only @Dependent or @ApplicationScoped is allowed on singleton enterprise beans");
+ }
+ }
+
+ /**
+ * Validates specialization
+ */
+ @Override
+ protected void preSpecialize(BeanDeployerEnvironment environment)
+ {
+ super.preSpecialize(environment);
+ // We appear to check this twice?
+ if (!environment.getEjbDescriptors().contains(getAnnotatedItem().getWBSuperclass().getJavaClass()))
+ {
+ throw new DefinitionException("Annotation defined specializing EJB must have EJB superclass");
+ }
+ }
+
+ @Override
+ protected void specialize(BeanDeployerEnvironment environment)
+ {
+ if (environment.getClassBean(getAnnotatedItem().getWBSuperclass()) == null)
+ {
+ throw new IllegalStateException(toString() + " does not specialize a bean");
+ }
+ AbstractClassBean<?> specializedBean = environment.getClassBean(getAnnotatedItem().getWBSuperclass());
+ if (!(specializedBean instanceof SessionBean<?>))
+ {
+ throw new IllegalStateException(toString() + " doesn't have a session bean as a superclass " + specializedBean);
+ }
+ else
+ {
+ this.specializedBean = (SessionBean<?>) specializedBean;
+ }
+ }
+
+ /**
+ * Creates an instance of the bean
+ *
+ * @return The instance
+ */
+ public T create(final CreationalContext<T> creationalContext)
+ {
+ T instance = produce(creationalContext);
+ if (hasDecorators())
+ {
+ instance = applyDecorators(instance, creationalContext, null);
+ }
+ return instance;
+ }
+
+ public void inject(final T instance, final CreationalContext<T> ctx)
+ {
+ new InjectionContextImpl<T>(getManager(), this, instance)
+ {
+
+ public void proceed()
+ {
+ Beans.injectFieldsAndInitializers(instance, ctx, getManager(), getInjectableFields(), getInitializerMethods());
+ }
+
+ }.run();
+
+ }
+
+ public T produce(CreationalContext<T> ctx)
+ {
+ try
+ {
+ T instance = proxyClass.newInstance();
+ ctx.push(instance);
+ ((ProxyObject) instance).setHandler(new EnterpriseBeanProxyMethodHandler<T>(this, ctx));
+ log.trace("Enterprise bean instance created for bean {0}", this);
+ return instance;
+ }
+ catch (InstantiationException e)
+ {
+ throw new RuntimeException("Could not instantiate enterprise proxy for " + toString(), e);
+ }
+ catch (IllegalAccessException e)
+ {
+ throw new RuntimeException("Could not access bean correctly when creating enterprise proxy for " + toString(), e);
+ }
+ catch (Exception e)
+ {
+ throw new CreationException("could not find the EJB in JNDI " + proxyClass, e);
+ }
+ }
+
+ public void destroy(T instance, CreationalContext<T> creationalContext)
+ {
+ if (instance == null)
+ {
+ throw new IllegalArgumentException("instance to destroy cannot be null");
+ }
+ if (!(instance instanceof EnterpriseBeanInstance))
+ {
+ throw new IllegalArgumentException("Cannot destroy session bean instance not created by the container");
+ }
+ EnterpriseBeanInstance enterpiseBeanInstance = (EnterpriseBeanInstance) instance;
+ enterpiseBeanInstance.destroy(Marker.INSTANCE, this, creationalContext);
+ creationalContext.release();
+ }
+
+ /**
+ * Validates the bean type
+ */
+ private void checkEJBTypeAllowed()
+ {
+ if (ejbDescriptor.isMessageDriven())
+ {
+ throw new DefinitionException("Message Driven Beans can't be Web Beans");
+ }
+ }
+
+ /**
+ * Gets a string representation
+ *
+ * @return The string representation
+ */
+ @Override
+ public String getDescription()
+ {
+ StringBuilder buffer = new StringBuilder();
+ // buffer.append("Annotated " + Names.scopeTypeToString(getScopeType()) +
+ // Names.ejbTypeFromMetaData(getEjbMetaData()));
+ if (getName() == null)
+ {
+ buffer.append(" unnamed enterprise bean");
+ }
+ else
+ {
+ buffer.append(" enterprise bean '" + getName() + "'");
+ }
+ buffer.append(" [" + getType().getName() + "] ");
+ buffer.append("API types " + getTypes() + ", binding types " + getQualifiers());
+ return buffer.toString();
+ }
+
+ public void preDestroy(CreationalContext<T> creationalContext)
+ {
+ creationalContext.release();
+ }
+
+ @Override
+ protected void initSerializable()
+ {
+ // No-op
+ }
+
+ @Override
+ public boolean isSerializable()
+ {
+ return true;
+ }
+
+ public InternalEjbDescriptor<T> getEjbDescriptor()
+ {
+ return ejbDescriptor;
+ }
+
+ public boolean isClientCanCallRemoveMethods()
+ {
+ return getEjbDescriptor().isStateful() && isDependent();
+ }
+
+ @Override
+ public AbstractBean<?, ?> getSpecializedBean()
+ {
+ return specializedBean;
+ }
+
+ /**
+ * If there are any observer methods, they must be static or business
+ * methods.
+ */
+ protected void checkObserverMethods()
+ {
+ for (WBMethod<?, ?> method : this.annotatedItem.getDeclaredWBMethodsWithAnnotatedParameters(Observes.class))
+ {
+ if (!method.isStatic())
+ {
+ if (!isMethodExistsOnTypes(method))
+ {
+ throw new DefinitionException("Observer method must be static or business method: " + method + " on " + getAnnotatedItem());
+ }
+ }
+ }
+ }
+
+ // TODO must be a nicer way to do this!
+ public boolean isMethodExistsOnTypes(WBMethod<?, ?> method)
+ {
+ for (Type type : getTypes())
+ {
+ if (type instanceof Class)
+ {
+ for (Method m : ((Class<?>) type).getMethods())
+ {
+ if (method.getName().equals(m.getName()) && Arrays.equals(method.getParameterTypesAsArray(), m.getParameterTypes()))
+ {
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ public SessionObjectReference createReference()
+ {
+ return manager.getServices().get(EjbServices.class).resolveEjb(getEjbDescriptor().delegate());
+ }
+
+ @Override
+ public Set<Class<? extends Annotation>> getStereotypes()
+ {
+ return Collections.emptySet();
+ }
+
+ protected boolean isInterceptionCandidate()
+ {
+ return true;
+ }
+
+ private void registerInterceptors()
+ {
+ InterceptionModel<Class<?>,javax.enterprise.inject.spi.Interceptor<?>> model = manager.getBoundInterceptorsRegistry().getInterceptionModel(ejbDescriptor.getBeanClass());
+ if (model != null)
+ getManager().getServices().get(EjbServices.class).registerInterceptors(getEjbDescriptor(), new InterceptorBindingsAdapter(model));
+ }
+}
+
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/AbstractBuiltInBean.java (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/builtin/AbstractBuiltInBean.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/AbstractBuiltInBean.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/AbstractBuiltInBean.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -0,0 +1,120 @@
+/*
+ * 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;
+
+import java.lang.annotation.Annotation;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+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.WBInjectionPoint;
+import org.jboss.weld.literal.AnyLiteral;
+import org.jboss.weld.literal.DefaultLiteral;
+
+public abstract class AbstractBuiltInBean<T> extends RIBean<T>
+{
+
+ private static final String ID_PREFIX = "Built-in";
+
+ private static final Annotation[] DEFAULT_BINDING_ARRAY = { new DefaultLiteral(), new AnyLiteral() };
+ private static final Set<Annotation> DEFAULT_BINDING = new HashSet<Annotation>(Arrays.asList(DEFAULT_BINDING_ARRAY));
+
+ protected AbstractBuiltInBean(String idSuffix, BeanManagerImpl manager)
+ {
+ super(new StringBuilder().append(ID_PREFIX).append(BEAN_ID_SEPARATOR).append(idSuffix).toString(), manager);
+ }
+
+ @Override
+ public void initialize(BeanDeployerEnvironment environment)
+ {
+ // No-op
+ }
+
+
+ public Set<Annotation> getQualifiers()
+ {
+ return DEFAULT_BINDING;
+ }
+
+ public Class<? extends Annotation> getScope()
+ {
+ return Dependent.class;
+ }
+
+ @Override
+ public RIBean<?> getSpecializedBean()
+ {
+ return null;
+ }
+
+ public String getName()
+ {
+ return null;
+ }
+
+ public Set<Class<? extends Annotation>> getStereotypes()
+ {
+ return Collections.emptySet();
+ }
+
+ @Override
+ public Set<WBInjectionPoint<?, ?>> getAnnotatedInjectionPoints()
+ {
+ return Collections.emptySet();
+ }
+
+ public boolean isNullable()
+ {
+ return true;
+ }
+
+ @Override
+ public boolean isPrimitive()
+ {
+ return false;
+ }
+
+ @Override
+ public boolean isSpecializing()
+ {
+ return false;
+ }
+
+ public boolean isAlternative()
+ {
+ return false;
+ }
+
+ @Override
+ public boolean isProxyable()
+ {
+ return false;
+ }
+
+ @Override
+ public String getDescription()
+ {
+ return "Built-in bean " + getClass().getSimpleName();
+ }
+
+}
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/DefaultValidatorBean.java (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/builtin/DefaultValidatorBean.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/DefaultValidatorBean.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/DefaultValidatorBean.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -0,0 +1,71 @@
+/*
+ * 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;
+
+import java.lang.reflect.Type;
+import java.util.Set;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.validation.Validator;
+
+import org.jboss.weld.BeanManagerImpl;
+import org.jboss.weld.util.collections.Arrays2;
+import org.jboss.weld.validation.spi.ValidationServices;
+
+/**
+ * @author pmuir
+ *
+ */
+public class DefaultValidatorBean extends AbstractBuiltInBean<Validator>
+{
+
+ private static final Set<Type> TYPES = Arrays2.<Type>asSet(Object.class, Validator.class);
+
+ public DefaultValidatorBean(BeanManagerImpl manager)
+ {
+ super(Validator.class.getSimpleName(), manager);
+ }
+
+ @Override
+ public Class<Validator> getType()
+ {
+ return Validator.class;
+ }
+
+ public Set<Type> getTypes()
+ {
+ return TYPES;
+ }
+
+ public Validator create(CreationalContext<Validator> creationalContext)
+ {
+ if (getManager().getServices().contains(ValidationServices.class))
+ {
+ return getManager().getServices().get(ValidationServices.class).getDefaultValidatorFactory().getValidator();
+ }
+ else
+ {
+ throw new IllegalStateException("ValidationServices not available");
+ }
+ }
+
+ public void destroy(Validator instance, CreationalContext<Validator> creationalContext)
+ {
+ // No-op
+ }
+
+}
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/DefaultValidatorFactoryBean.java (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/builtin/DefaultValidatorFactoryBean.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/DefaultValidatorFactoryBean.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/DefaultValidatorFactoryBean.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -0,0 +1,71 @@
+/*
+ * 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;
+
+import java.lang.reflect.Type;
+import java.util.Set;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.validation.ValidatorFactory;
+
+import org.jboss.weld.BeanManagerImpl;
+import org.jboss.weld.util.collections.Arrays2;
+import org.jboss.weld.validation.spi.ValidationServices;
+
+/**
+ * @author pmuir
+ *
+ */
+public class DefaultValidatorFactoryBean extends AbstractBuiltInBean<ValidatorFactory>
+{
+
+ private static final Set<Type> TYPES = Arrays2.<Type>asSet(Object.class, ValidatorFactory.class);
+
+ public DefaultValidatorFactoryBean(BeanManagerImpl manager)
+ {
+ super(ValidatorFactory.class.getSimpleName(), manager);
+ }
+
+ @Override
+ public Class<ValidatorFactory> getType()
+ {
+ return ValidatorFactory.class;
+ }
+
+ public Set<Type> getTypes()
+ {
+ return TYPES;
+ }
+
+ public ValidatorFactory create(CreationalContext<ValidatorFactory> creationalContext)
+ {
+ if (getManager().getServices().contains(ValidationServices.class))
+ {
+ return getManager().getServices().get(ValidationServices.class).getDefaultValidatorFactory();
+ }
+ else
+ {
+ throw new IllegalStateException("ValidationServices not available");
+ }
+ }
+
+ public void destroy(ValidatorFactory instance, CreationalContext<ValidatorFactory> creationalContext)
+ {
+ // No-op
+ }
+
+}
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/ExtensionBean.java (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/builtin/ExtensionBean.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/ExtensionBean.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/ExtensionBean.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -0,0 +1,82 @@
+/*
+ * 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;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.Set;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.Extension;
+
+import org.jboss.weld.BeanManagerImpl;
+import org.jboss.weld.introspector.WBClass;
+
+/**
+ * @author pmuir
+ *
+ */
+public class ExtensionBean extends AbstractBuiltInBean<Extension>
+{
+
+ private static final String ID_PREFIX = "Extension";
+
+ private final WBClass<Extension> clazz;
+ private final Extension instance;
+
+ public ExtensionBean(BeanManagerImpl manager, WBClass<Extension> clazz, Extension instance)
+ {
+ super(new StringBuilder().append(ID_PREFIX).append(BEAN_ID_SEPARATOR).append(clazz.getName()).toString(), manager);
+ this.clazz = clazz;
+ this.instance = instance;
+ }
+
+ @Override
+ public Class<Extension> getType()
+ {
+ return clazz.getJavaClass();
+ }
+
+ public Set<Type> getTypes()
+ {
+ return clazz.getTypeClosure();
+ }
+
+ @Override
+ public boolean isProxyable()
+ {
+ return clazz.isProxyable();
+ }
+
+ public Extension create(CreationalContext<Extension> creationalContext)
+ {
+ return instance;
+ }
+
+ public void destroy(Extension instance, CreationalContext<Extension> creationalContext)
+ {
+ // No-op
+ }
+
+ @Override
+ public Class<? extends Annotation> getScope()
+ {
+ return ApplicationScoped.class;
+ }
+
+}
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/InjectionPointBean.java (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/builtin/InjectionPointBean.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/InjectionPointBean.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/InjectionPointBean.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -0,0 +1,80 @@
+/*
+ * 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;
+
+import java.lang.reflect.Type;
+import java.util.Set;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.InjectionPoint;
+
+import org.jboss.weld.BeanManagerImpl;
+import org.jboss.weld.util.collections.Arrays2;
+
+/**
+ * Bean for InjectionPoint metadata
+ *
+ * @author David Allen
+ *
+ */
+public class InjectionPointBean extends AbstractBuiltInBean<InjectionPoint>
+{
+
+ private static final Set<Type> TYPES = Arrays2.<Type>asSet(InjectionPoint.class, Object.class);
+
+ /**
+ * Creates an InjectionPoint Web Bean for the injection of the containing bean owning
+ * the field, constructor or method for the annotated item
+ *
+ * @param <T> must be InjectionPoint
+ * @param <S>
+ * @param field The annotated member field/parameter for the injection
+ * @param manager The RI manager implementation
+ */
+ public InjectionPointBean(BeanManagerImpl manager)
+ {
+ super(InjectionPoint.class.getSimpleName(), manager);
+ }
+
+ public InjectionPoint create(CreationalContext<InjectionPoint> creationalContext)
+ {
+ return getManager().getCurrentInjectionPoint();
+ }
+
+ public void destroy(InjectionPoint instance, CreationalContext<InjectionPoint> creationalContext)
+ {
+
+ }
+
+ @Override
+ public Class<InjectionPoint> getType()
+ {
+ return InjectionPoint.class;
+ }
+
+ public Set<Type> getTypes()
+ {
+ return TYPES;
+ }
+
+ @Override
+ public String toString()
+ {
+ return "Built-in javax.inject.manager.InjectionPoint bean";
+ }
+
+}
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/ManagerBean.java (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/builtin/ManagerBean.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/ManagerBean.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/ManagerBean.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -0,0 +1,66 @@
+/*
+ * 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;
+
+import java.lang.reflect.Type;
+import java.util.Set;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.BeanManager;
+
+import org.jboss.weld.BeanManagerImpl;
+import org.jboss.weld.util.collections.Arrays2;
+
+public class ManagerBean extends AbstractBuiltInBean<BeanManagerImpl>
+{
+
+ private static final Set<Type> TYPES = Arrays2.<Type>asSet(Object.class, BeanManagerImpl.class, BeanManager.class);
+
+ public ManagerBean(BeanManagerImpl manager)
+ {
+ super(BeanManager.class.getSimpleName(), manager);
+ }
+
+ public BeanManagerImpl create(CreationalContext<BeanManagerImpl> creationalContext)
+ {
+ return getManager().getCurrent();
+ }
+
+ @Override
+ public Class<BeanManagerImpl> getType()
+ {
+ return BeanManagerImpl.class;
+ }
+
+ public Set<Type> getTypes()
+ {
+ return TYPES;
+ }
+
+ public void destroy(BeanManagerImpl instance, CreationalContext<BeanManagerImpl> creationalContext)
+ {
+ // No-op
+ }
+
+ @Override
+ public String toString()
+ {
+ return "Built-in javax.inject.manager.Manager bean";
+ }
+
+
+}
\ No newline at end of file
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/PrincipalBean.java (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/builtin/PrincipalBean.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/PrincipalBean.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/PrincipalBean.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -0,0 +1,71 @@
+/*
+ * 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;
+
+import java.lang.reflect.Type;
+import java.security.Principal;
+import java.util.Set;
+
+import javax.enterprise.context.spi.CreationalContext;
+
+import org.jboss.weld.BeanManagerImpl;
+import org.jboss.weld.security.spi.SecurityServices;
+import org.jboss.weld.util.collections.Arrays2;
+
+/**
+ * @author pmuir
+ *
+ */
+public class PrincipalBean extends AbstractBuiltInBean<Principal>
+{
+
+ private static final Set<Type> TYPES = Arrays2.<Type>asSet(Object.class, Principal.class);
+
+ public PrincipalBean(BeanManagerImpl manager)
+ {
+ super(Principal.class.getSimpleName(), manager);
+ }
+
+ @Override
+ public Class<Principal> getType()
+ {
+ return Principal.class;
+ }
+
+ public Set<Type> getTypes()
+ {
+ return TYPES;
+ }
+
+ public Principal create(CreationalContext<Principal> creationalContext)
+ {
+ if (getManager().getServices().contains(SecurityServices.class))
+ {
+ return getManager().getServices().get(SecurityServices.class).getPrincipal();
+ }
+ else
+ {
+ throw new IllegalStateException("SecurityServices not available");
+ }
+ }
+
+ public void destroy(Principal instance, CreationalContext<Principal> creationalContext)
+ {
+ // No-op
+ }
+
+}
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/UserTransactionBean.java (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/builtin/UserTransactionBean.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/UserTransactionBean.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/UserTransactionBean.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -0,0 +1,71 @@
+/*
+ * 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;
+
+import java.lang.reflect.Type;
+import java.util.Set;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.transaction.UserTransaction;
+
+import org.jboss.weld.BeanManagerImpl;
+import org.jboss.weld.transaction.spi.TransactionServices;
+import org.jboss.weld.util.collections.Arrays2;
+
+/**
+ * @author pmuir
+ *
+ */
+public class UserTransactionBean extends AbstractBuiltInBean<UserTransaction>
+{
+
+ private static final Set<Type> TYPES = Arrays2.<Type>asSet(Object.class, UserTransaction.class);
+
+ public UserTransactionBean(BeanManagerImpl manager)
+ {
+ super(UserTransaction.class.getSimpleName(), manager);
+ }
+
+ @Override
+ public Class<UserTransaction> getType()
+ {
+ return UserTransaction.class;
+ }
+
+ public Set<Type> getTypes()
+ {
+ return TYPES;
+ }
+
+ public UserTransaction create(CreationalContext<UserTransaction> creationalContext)
+ {
+ if (getManager().getServices().contains(TransactionServices.class))
+ {
+ return getManager().getServices().get(TransactionServices.class).getUserTransaction();
+ }
+ else
+ {
+ throw new IllegalStateException("TransactionServices not available");
+ }
+ }
+
+ public void destroy(UserTransaction instance, CreationalContext<UserTransaction> creationalContext)
+ {
+ // No-op
+ }
+
+}
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/facade (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/builtin/facade)
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/facade/AbstractFacade.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/builtin/facade/AbstractFacade.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/facade/AbstractFacade.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.bean.builtin.facade;
+package org.jboss.weld.bean.builtin.facade;
import java.io.Serializable;
import java.lang.annotation.Annotation;
@@ -23,8 +23,8 @@
import java.util.HashSet;
import java.util.Set;
-import org.jboss.webbeans.BeanManagerImpl;
-import org.jboss.webbeans.metadata.cache.MetaAnnotationStore;
+import org.jboss.weld.BeanManagerImpl;
+import org.jboss.weld.metadata.cache.MetaAnnotationStore;
/**
* Common implementation for binding-type-based helpers
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/facade/AbstractFacadeBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/builtin/facade/AbstractFacadeBean.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/facade/AbstractFacadeBean.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.bean.builtin.facade;
+package org.jboss.weld.bean.builtin.facade;
import java.lang.annotation.Annotation;
import java.lang.reflect.ParameterizedType;
@@ -24,10 +24,10 @@
import javax.enterprise.context.spi.CreationalContext;
import javax.enterprise.inject.spi.InjectionPoint;
-import org.jboss.webbeans.BeanManagerImpl;
-import org.jboss.webbeans.bean.builtin.AbstractBuiltInBean;
-import org.jboss.webbeans.log.Log;
-import org.jboss.webbeans.log.Logging;
+import org.jboss.weld.BeanManagerImpl;
+import org.jboss.weld.bean.builtin.AbstractBuiltInBean;
+import org.jboss.weld.log.Log;
+import org.jboss.weld.log.Logging;
public abstract class AbstractFacadeBean<T> extends AbstractBuiltInBean<T>
{
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/facade/EventBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/builtin/facade/EventBean.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/facade/EventBean.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.bean.builtin.facade;
+package org.jboss.weld.bean.builtin.facade;
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
@@ -25,11 +25,11 @@
import javax.enterprise.event.Event;
import javax.enterprise.inject.TypeLiteral;
-import org.jboss.webbeans.BeanManagerImpl;
-import org.jboss.webbeans.event.EventImpl;
-import org.jboss.webbeans.literal.AnyLiteral;
-import org.jboss.webbeans.resolution.ResolvableTransformer;
-import org.jboss.webbeans.util.collections.Arrays2;
+import org.jboss.weld.BeanManagerImpl;
+import org.jboss.weld.event.EventImpl;
+import org.jboss.weld.literal.AnyLiteral;
+import org.jboss.weld.resolution.ResolvableTransformer;
+import org.jboss.weld.util.collections.Arrays2;
public class EventBean extends AbstractFacadeBean<Event<?>>
{
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/facade/FacadeBeanResolvableTransformer.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/builtin/facade/FacadeBeanResolvableTransformer.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/facade/FacadeBeanResolvableTransformer.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.bean.builtin.facade;
+package org.jboss.weld.bean.builtin.facade;
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
@@ -24,10 +24,10 @@
import javax.enterprise.inject.Any;
-import org.jboss.webbeans.literal.AnyLiteral;
-import org.jboss.webbeans.resolution.ForwardingResolvable;
-import org.jboss.webbeans.resolution.Resolvable;
-import org.jboss.webbeans.resolution.ResolvableTransformer;
+import org.jboss.weld.literal.AnyLiteral;
+import org.jboss.weld.resolution.ForwardingResolvable;
+import org.jboss.weld.resolution.Resolvable;
+import org.jboss.weld.resolution.ResolvableTransformer;
/**
* AnnotatedItem transformer which can be used for FacadeBeans
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/facade/InstanceBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/builtin/facade/InstanceBean.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/facade/InstanceBean.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.bean.builtin.facade;
+package org.jboss.weld.bean.builtin.facade;
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
@@ -27,10 +27,10 @@
import javax.enterprise.inject.TypeLiteral;
import javax.inject.Provider;
-import org.jboss.webbeans.BeanManagerImpl;
-import org.jboss.webbeans.literal.AnyLiteral;
-import org.jboss.webbeans.resolution.ResolvableTransformer;
-import org.jboss.webbeans.util.collections.Arrays2;
+import org.jboss.weld.BeanManagerImpl;
+import org.jboss.weld.literal.AnyLiteral;
+import org.jboss.weld.resolution.ResolvableTransformer;
+import org.jboss.weld.util.collections.Arrays2;
public class InstanceBean extends AbstractFacadeBean<Instance<?>>
{
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/facade/InstanceImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/builtin/facade/InstanceImpl.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/facade/InstanceImpl.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.bean.builtin.facade;
+package org.jboss.weld.bean.builtin.facade;
import java.io.Serializable;
import java.lang.annotation.Annotation;
@@ -30,8 +30,8 @@
import javax.enterprise.inject.TypeLiteral;
import javax.enterprise.inject.spi.Bean;
-import org.jboss.webbeans.BeanManagerImpl;
-import org.jboss.webbeans.resolution.ResolvableWBClass;
+import org.jboss.weld.BeanManagerImpl;
+import org.jboss.weld.resolution.ResolvableWBClass;
/**
* Helper implementation for Instance for getting instances
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/bean/ee (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee)
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/bean/ee/EEResourceProducerField.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/EEResourceProducerField.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/bean/ee/EEResourceProducerField.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,16 +14,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.bean.ee;
+package org.jboss.weld.bean.ee;
-import org.jboss.webbeans.BeanManagerImpl;
-import org.jboss.webbeans.bean.AbstractClassBean;
-import org.jboss.webbeans.bean.ProducerField;
-import org.jboss.webbeans.bootstrap.BeanDeployerEnvironment;
-import org.jboss.webbeans.ejb.EJBApiAbstraction;
-import org.jboss.webbeans.introspector.WBField;
-import org.jboss.webbeans.persistence.PersistenceApiAbstraction;
-import org.jboss.webbeans.ws.WSApiAbstraction;
+import org.jboss.weld.BeanManagerImpl;
+import org.jboss.weld.bean.AbstractClassBean;
+import org.jboss.weld.bean.ProducerField;
+import org.jboss.weld.bootstrap.BeanDeployerEnvironment;
+import org.jboss.weld.ejb.EJBApiAbstraction;
+import org.jboss.weld.introspector.WBField;
+import org.jboss.weld.persistence.PersistenceApiAbstraction;
+import org.jboss.weld.ws.WSApiAbstraction;
/**
* @author pmuir
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/bean/ee/PersistenceContextProducerField.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/PersistenceContextProducerField.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/bean/ee/PersistenceContextProducerField.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,13 +14,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.bean.ee;
+package org.jboss.weld.bean.ee;
import javax.persistence.EntityManager;
-import org.jboss.webbeans.BeanManagerImpl;
-import org.jboss.webbeans.bean.AbstractClassBean;
-import org.jboss.webbeans.introspector.WBField;
+import org.jboss.weld.BeanManagerImpl;
+import org.jboss.weld.bean.AbstractClassBean;
+import org.jboss.weld.introspector.WBField;
/**
* @author pmuir
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/bean/interceptor (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/interceptor)
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/bean/interceptor/ClassInterceptionHandlerFactory.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/interceptor/ClassInterceptionHandlerFactory.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/bean/interceptor/ClassInterceptionHandlerFactory.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -15,15 +15,15 @@
* limitations under the License.
*/
-package org.jboss.webbeans.bean.interceptor;
+package org.jboss.weld.bean.interceptor;
import javax.enterprise.context.spi.CreationalContext;
import org.jboss.interceptor.proxy.InterceptionHandlerFactory;
import org.jboss.interceptor.proxy.InterceptionHandler;
import org.jboss.interceptor.proxy.DirectClassInterceptionHandler;
-import org.jboss.webbeans.DeploymentException;
-import org.jboss.webbeans.BeanManagerImpl;
+import org.jboss.weld.BeanManagerImpl;
+import org.jboss.weld.DeploymentException;
/**
* @author Marius Bogoevici
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/bean/interceptor/InterceptorBindingsAdapter.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/interceptor/InterceptorBindingsAdapter.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/bean/interceptor/InterceptorBindingsAdapter.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.jboss.webbeans.bean.interceptor;
+package org.jboss.weld.bean.interceptor;
import java.util.Collection;
import java.util.List;
@@ -28,7 +28,7 @@
import javax.enterprise.inject.spi.Interceptor;
import javax.enterprise.inject.spi.InterceptionType;
-import org.jboss.webbeans.ejb.spi.InterceptorBindings;
+import org.jboss.weld.ejb.spi.InterceptorBindings;
import org.jboss.interceptor.model.InterceptionModel;
/**
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/bean/interceptor/InterceptorInterceptionHandlerFactory.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/interceptor/InterceptorInterceptionHandlerFactory.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/bean/interceptor/InterceptorInterceptionHandlerFactory.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.jboss.webbeans.bean.interceptor;
+package org.jboss.weld.bean.interceptor;
import javax.enterprise.context.spi.CreationalContext;
import javax.enterprise.inject.spi.Interceptor;
@@ -23,7 +23,7 @@
import org.jboss.interceptor.proxy.DirectClassInterceptionHandler;
import org.jboss.interceptor.proxy.InterceptionHandler;
import org.jboss.interceptor.proxy.InterceptionHandlerFactory;
-import org.jboss.webbeans.BeanManagerImpl;
+import org.jboss.weld.BeanManagerImpl;
/**
* @author Marius Bogoevici
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/bean/proxy (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/proxy)
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/bean/proxy/ClientProxyInstance.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/proxy/ClientProxyInstance.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/bean/proxy/ClientProxyInstance.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.bean.proxy;
+package org.jboss.weld.bean.proxy;
/**
* @author pmuir
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/bean/proxy/ClientProxyMethodHandler.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/proxy/ClientProxyMethodHandler.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/bean/proxy/ClientProxyMethodHandler.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.bean.proxy;
+package org.jboss.weld.bean.proxy;
import java.io.Serializable;
import java.lang.reflect.InvocationTargetException;
@@ -26,11 +26,11 @@
import javax.enterprise.context.spi.Context;
import javax.enterprise.inject.spi.Bean;
-import org.jboss.webbeans.BeanManagerImpl;
-import org.jboss.webbeans.context.WBCreationalContext;
-import org.jboss.webbeans.log.LogProvider;
-import org.jboss.webbeans.log.Logging;
-import org.jboss.webbeans.util.Reflections;
+import org.jboss.weld.BeanManagerImpl;
+import org.jboss.weld.context.WBCreationalContext;
+import org.jboss.weld.log.LogProvider;
+import org.jboss.weld.log.Logging;
+import org.jboss.weld.util.Reflections;
/**
* A Javassist MethodHandler that delegates method calls to a proxied bean. If
@@ -39,7 +39,7 @@
*
* @author Nicklas Karlsson
*
- * @see org.jboss.webbeans.bean.proxy.ClientProxyProvider
+ * @see org.jboss.weld.bean.proxy.ClientProxyProvider
*/
public class ClientProxyMethodHandler implements MethodHandler, Serializable
{
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/bean/proxy/ClientProxyProvider.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/proxy/ClientProxyProvider.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/bean/proxy/ClientProxyProvider.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.bean.proxy;
+package org.jboss.weld.bean.proxy;
import java.io.Serializable;
import java.lang.reflect.Type;
@@ -26,10 +26,10 @@
import javax.enterprise.inject.spi.Bean;
-import org.jboss.webbeans.BeanManagerImpl;
-import org.jboss.webbeans.DefinitionException;
-import org.jboss.webbeans.util.Proxies;
-import org.jboss.webbeans.util.collections.ConcurrentCache;
+import org.jboss.weld.BeanManagerImpl;
+import org.jboss.weld.DefinitionException;
+import org.jboss.weld.util.Proxies;
+import org.jboss.weld.util.collections.ConcurrentCache;
/**
* A proxy pool for holding scope adaptors (client proxies)
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/bean/proxy/DecoratorProxyMethodHandler.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/proxy/DecoratorProxyMethodHandler.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/bean/proxy/DecoratorProxyMethodHandler.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,9 +14,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.bean.proxy;
+package org.jboss.weld.bean.proxy;
-import static org.jboss.webbeans.util.Reflections.ensureAccessible;
+import static org.jboss.weld.util.Reflections.ensureAccessible;
import java.io.Serializable;
import java.lang.reflect.Method;
@@ -24,11 +24,11 @@
import javassist.util.proxy.MethodHandler;
-import org.jboss.webbeans.bean.DecoratorImpl;
-import org.jboss.webbeans.context.SerializableContextualInstance;
-import org.jboss.webbeans.introspector.MethodSignature;
-import org.jboss.webbeans.introspector.WBMethod;
-import org.jboss.webbeans.introspector.jlr.MethodSignatureImpl;
+import org.jboss.weld.bean.DecoratorImpl;
+import org.jboss.weld.context.SerializableContextualInstance;
+import org.jboss.weld.introspector.MethodSignature;
+import org.jboss.weld.introspector.WBMethod;
+import org.jboss.weld.introspector.jlr.MethodSignatureImpl;
/**
* Method handler for decorated beans
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/bean/proxy/EnterpriseBeanInstance.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/proxy/EnterpriseBeanInstance.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/bean/proxy/EnterpriseBeanInstance.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,11 +14,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.bean.proxy;
+package org.jboss.weld.bean.proxy;
import javax.enterprise.context.spi.CreationalContext;
-import org.jboss.webbeans.bean.SessionBean;
+import org.jboss.weld.bean.SessionBean;
/**
* Interface implemented by all enterprise bean proxies to query/control the proxy
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/bean/proxy/EnterpriseBeanProxyMethodHandler.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/proxy/EnterpriseBeanProxyMethodHandler.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/bean/proxy/EnterpriseBeanProxyMethodHandler.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.bean.proxy;
+package org.jboss.weld.bean.proxy;
import java.io.Serializable;
import java.lang.reflect.Method;
@@ -25,13 +25,13 @@
import javax.enterprise.context.spi.CreationalContext;
-import org.jboss.webbeans.bean.SessionBean;
-import org.jboss.webbeans.ejb.api.SessionObjectReference;
-import org.jboss.webbeans.introspector.MethodSignature;
-import org.jboss.webbeans.introspector.jlr.MethodSignatureImpl;
-import org.jboss.webbeans.log.Log;
-import org.jboss.webbeans.log.Logging;
-import org.jboss.webbeans.util.Reflections;
+import org.jboss.weld.bean.SessionBean;
+import org.jboss.weld.ejb.api.SessionObjectReference;
+import org.jboss.weld.introspector.MethodSignature;
+import org.jboss.weld.introspector.jlr.MethodSignatureImpl;
+import org.jboss.weld.log.Log;
+import org.jboss.weld.log.Logging;
+import org.jboss.weld.util.Reflections;
/**
* Method handler for enterprise bean client proxies
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/bean/proxy/Marker.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/proxy/Marker.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/bean/proxy/Marker.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -1,4 +1,4 @@
-package org.jboss.webbeans.bean.proxy;
+package org.jboss.weld.bean.proxy;
import java.lang.reflect.Method;
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/bootstrap/AbstractBeanDeployer.java (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/AbstractBeanDeployer.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/weld/bootstrap/AbstractBeanDeployer.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/bootstrap/AbstractBeanDeployer.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -0,0 +1,315 @@
+/*
+ * 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 java.util.Set;
+import java.lang.reflect.Member;
+import java.lang.reflect.Type;
+
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.Disposes;
+import javax.enterprise.inject.Produces;
+import javax.enterprise.inject.spi.ProcessObserverMethod;
+import javax.enterprise.inject.spi.ProcessProducer;
+import javax.enterprise.inject.spi.Interceptor;
+import javax.inject.Inject;
+
+import org.jboss.weld.BeanManagerImpl;
+import org.jboss.weld.DefinitionException;
+import org.jboss.weld.bean.AbstractClassBean;
+import org.jboss.weld.bean.AbstractProducerBean;
+import org.jboss.weld.bean.DecoratorImpl;
+import org.jboss.weld.bean.DisposalMethod;
+import org.jboss.weld.bean.InterceptorImpl;
+import org.jboss.weld.bean.ManagedBean;
+import org.jboss.weld.bean.NewManagedBean;
+import org.jboss.weld.bean.NewSessionBean;
+import org.jboss.weld.bean.ProducerField;
+import org.jboss.weld.bean.ProducerMethod;
+import org.jboss.weld.bean.RIBean;
+import org.jboss.weld.bean.SessionBean;
+import org.jboss.weld.bean.ee.EEResourceProducerField;
+import org.jboss.weld.bean.ee.PersistenceContextProducerField;
+import org.jboss.weld.bootstrap.events.ProcessObserverMethodImpl;
+import org.jboss.weld.bootstrap.events.ProcessProducerImpl;
+import org.jboss.weld.ejb.EJBApiAbstraction;
+import org.jboss.weld.ejb.InternalEjbDescriptor;
+import org.jboss.weld.ejb.spi.EjbServices;
+import org.jboss.weld.event.ObserverFactory;
+import org.jboss.weld.event.ObserverMethodImpl;
+import org.jboss.weld.introspector.WBClass;
+import org.jboss.weld.introspector.WBField;
+import org.jboss.weld.introspector.WBMethod;
+import org.jboss.weld.jsf.JsfApiAbstraction;
+import org.jboss.weld.log.LogProvider;
+import org.jboss.weld.log.Logging;
+import org.jboss.weld.persistence.PersistenceApiAbstraction;
+import org.jboss.weld.servlet.ServletApiAbstraction;
+import org.jboss.weld.util.Reflections;
+import org.jboss.weld.util.reflection.ParameterizedTypeImpl;
+import org.jboss.weld.ws.WSApiAbstraction;
+import org.jboss.interceptor.model.InterceptionModel;
+
+public class AbstractBeanDeployer<E extends BeanDeployerEnvironment>
+{
+
+ private static final LogProvider log = Logging.getLogProvider(AbstractBeanDeployer.class);
+
+ private final BeanManagerImpl manager;
+ private final E environment;
+
+ public AbstractBeanDeployer(BeanManagerImpl manager, E environment)
+ {
+ this.manager = manager;
+ this.environment = environment;
+ }
+
+ protected BeanManagerImpl getManager()
+ {
+ return manager;
+ }
+
+ public AbstractBeanDeployer<E> deploy()
+ {
+ Set<? extends RIBean<?>> beans = getEnvironment().getBeans();
+ // ensure that all decorators are initialized before initializing
+ // the rest of the beans
+ for (DecoratorImpl<?> bean : getEnvironment().getDecorators())
+ {
+ bean.initialize(getEnvironment());
+ manager.addDecorator(bean);
+ log.debug("Bean: " + bean);
+ }
+ for (InterceptorImpl<?> bean: getEnvironment().getInterceptors())
+ {
+ bean.initialize(getEnvironment());
+ manager.addInterceptor(bean);
+ log.debug("Interceptor: " + bean);
+ }
+ for (RIBean<?> bean : beans)
+ {
+ bean.initialize(getEnvironment());
+ if (bean instanceof AbstractProducerBean<?, ?, ?>)
+ {
+ AbstractProducerBean<?, ?, Member> producer = (AbstractProducerBean<?, ?, Member>) bean;
+ createAndFireProcessProducerEvent(producer);
+ }
+ manager.addBean(bean);
+ log.debug("Bean: " + bean);
+ }
+ for (ObserverMethodImpl<?, ?> observer : getEnvironment().getObservers())
+ {
+ log.debug("Observer : " + observer);
+ observer.initialize();
+ createAndFireProcessObserverMethodEvent(observer);
+ manager.addObserver(observer);
+ }
+
+ return this;
+ }
+
+ /**
+ * Creates the sub bean for an class (simple or enterprise) bean
+ *
+ * @param bean
+ * The class bean
+ *
+ */
+ protected <T> void createSubBeans(AbstractClassBean<T> bean)
+ {
+ createProducerMethods(bean, bean.getAnnotatedItem());
+ createProducerFields(bean, bean.getAnnotatedItem());
+ if (manager.isBeanEnabled(bean))
+ {
+ createObserverMethods(bean, bean.getAnnotatedItem());
+ }
+ createDisposalMethods(bean, bean.getAnnotatedItem());
+
+ }
+
+ protected <X> void createProducerMethods(AbstractClassBean<X> declaringBean, WBClass<X> annotatedClass)
+ {
+ for (WBMethod<?, X> method : annotatedClass.getDeclaredAnnotatedWBMethods(Produces.class))
+ {
+ createProducerMethod(declaringBean, method);
+ }
+ }
+
+ protected <X> void createDisposalMethods(AbstractClassBean<X> declaringBean, WBClass<X> annotatedClass)
+ {
+ for (WBMethod<?, X> method : annotatedClass.getDeclaredWBMethodsWithAnnotatedParameters(Disposes.class))
+ {
+ DisposalMethod<X, ?> disposalBean = DisposalMethod.of(manager, method, declaringBean);
+ disposalBean.initialize(getEnvironment());
+ getEnvironment().addBean(disposalBean);
+ }
+ }
+
+ protected <X, T> void createProducerMethod(AbstractClassBean<X> declaringBean, WBMethod<T, X> annotatedMethod)
+ {
+ ProducerMethod<X, T> bean = ProducerMethod.of(annotatedMethod, declaringBean, manager);
+ getEnvironment().addBean(bean);
+ }
+
+ protected <X, T> void createProducerField(AbstractClassBean<X> declaringBean, WBField<T, X> field)
+ {
+ ProducerField<X, T> bean;
+ if (isPersistenceContextProducerField(field))
+ {
+ bean = PersistenceContextProducerField.of(field, declaringBean, manager);
+ }
+ else if (isEEResourceProducerField(field))
+ {
+ bean = EEResourceProducerField.of(field, declaringBean, manager);
+ }
+ else
+ {
+ bean = ProducerField.of(field, declaringBean, manager);
+ }
+ getEnvironment().addBean(bean);
+ }
+
+ private <X, T> void createAndFireProcessProducerEvent(AbstractProducerBean<X, T, Member> producer)
+ {
+ ProcessProducerImpl<X, T> payload = new ProcessProducerImpl<X, T>(producer.getAnnotatedItem(), producer) {};
+ fireEvent(payload, ProcessProducer.class, producer.getAnnotatedItem().getDeclaringType().getBaseType(), producer.getAnnotatedItem().getBaseType());
+ if (!payload.getDefinitionErrors().isEmpty())
+ {
+ // FIXME communicate all the captured definition errors in this exception
+ throw new DefinitionException(payload.getDefinitionErrors().get(0));
+ }
+ }
+
+ private void fireEvent(Object payload, Type rawType, Type... actualTypeArguments)
+ {
+ Type eventType = new ParameterizedTypeImpl(rawType, actualTypeArguments, null);
+ manager.fireEvent(eventType, payload);
+ }
+
+ protected <X> void createProducerFields(AbstractClassBean<X> declaringBean, WBClass<X> annotatedClass)
+ {
+ for (WBField<?, X> field : annotatedClass.getDeclaredAnnotatedWBFields(Produces.class))
+ {
+ createProducerField(declaringBean, field);
+ }
+ }
+
+ protected <X> void createObserverMethods(RIBean<X> declaringBean, WBClass<X> annotatedClass)
+ {
+ for (WBMethod<?, X> method : annotatedClass.getDeclaredWBMethodsWithAnnotatedParameters(Observes.class))
+ {
+ createObserverMethod(declaringBean, method);
+ }
+ }
+
+ protected <X, T> void createObserverMethod(RIBean<X> declaringBean, WBMethod<T, X> method)
+ {
+ ObserverMethodImpl<X, T> observer = ObserverFactory.create(method, declaringBean, manager);
+ getEnvironment().addObserver(observer);
+ }
+
+ private <X, T> void createAndFireProcessObserverMethodEvent(ObserverMethodImpl<X, T> observer)
+ {
+ ProcessObserverMethodImpl<X, T> payload = new ProcessObserverMethodImpl<X, T>(observer.getMethod(), observer) {};
+ fireEvent(payload, ProcessObserverMethod.class, observer.getMethod().getDeclaringType().getBaseType(), observer.getObservedType());
+ if (!payload.getDefinitionErrors().isEmpty())
+ {
+ // FIXME communicate all the captured definition errors in this exception
+ throw new DefinitionException(payload.getDefinitionErrors().get(0));
+ }
+ return;
+ }
+
+ protected <T> void createSimpleBean(WBClass<T> annotatedClass)
+ {
+ ManagedBean<T> bean = ManagedBean.of(annotatedClass, manager);
+ getEnvironment().addBean(bean);
+ createSubBeans(bean);
+ getEnvironment().addBean(NewManagedBean.of(annotatedClass, manager));
+ }
+
+ protected <T> void createDecorator(WBClass<T> annotatedClass)
+ {
+ DecoratorImpl<T> bean = DecoratorImpl.of(annotatedClass, manager);
+ getEnvironment().addBean(bean);
+ }
+
+ protected <T> void createInterceptor(WBClass<T> annotatedClass)
+ {
+ InterceptorImpl<T> bean = InterceptorImpl.of(annotatedClass, manager);
+ getEnvironment().addBean(bean);
+ }
+
+ protected <T> void createEnterpriseBean(InternalEjbDescriptor<T> ejbDescriptor)
+ {
+ // TODO Don't create enterprise bean if it has no local interfaces!
+ SessionBean<T> bean = SessionBean.of(ejbDescriptor, manager);
+ getEnvironment().addBean(bean);
+ createSubBeans(bean);
+ getEnvironment().addBean(NewSessionBean.of(ejbDescriptor, manager));
+ }
+
+ /**
+ * Indicates if the type is a simple Web Bean
+ *
+ * @param type
+ * The type to inspect
+ * @return True if simple Web Bean, false otherwise
+ */
+ protected boolean isTypeManagedBeanOrDecorator(WBClass<?> clazz)
+ {
+ Class<?> javaClass = clazz.getJavaClass();
+ EJBApiAbstraction ejbApiAbstraction = manager.getServices().get(EJBApiAbstraction.class);
+ JsfApiAbstraction jsfApiAbstraction = manager.getServices().get(JsfApiAbstraction.class);
+ ServletApiAbstraction servletApiAbstraction = manager.getServices().get(ServletApiAbstraction.class);
+ return !clazz.isNonStaticMemberClass() &&
+ !Reflections.isParamerterizedTypeWithWildcard(javaClass) &&
+ !servletApiAbstraction.SERVLET_CLASS.isAssignableFrom(javaClass) &&
+ !servletApiAbstraction.FILTER_CLASS.isAssignableFrom(javaClass) &&
+ !servletApiAbstraction.SERVLET_CONTEXT_LISTENER_CLASS.isAssignableFrom(javaClass) &&
+ !servletApiAbstraction.HTTP_SESSION_LISTENER_CLASS.isAssignableFrom(javaClass) &&
+ !servletApiAbstraction.SERVLET_REQUEST_LISTENER_CLASS.isAssignableFrom(javaClass) &&
+ !ejbApiAbstraction.ENTERPRISE_BEAN_CLASS.isAssignableFrom(javaClass) &&
+ !jsfApiAbstraction.UICOMPONENT_CLASS.isAssignableFrom(javaClass) &&
+ hasSimpleWebBeanConstructor(clazz);
+ }
+
+ protected boolean isEEResourceProducerField(WBField<?, ?> field)
+ {
+ 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);
+ }
+
+ protected boolean isPersistenceContextProducerField(WBField<?, ?> field)
+ {
+ PersistenceApiAbstraction persistenceApiAbstraction = manager.getServices().get(PersistenceApiAbstraction.class);
+ return field.isAnnotationPresent(persistenceApiAbstraction.PERSISTENCE_CONTEXT_ANNOTATION_CLASS);
+ }
+
+ private static boolean hasSimpleWebBeanConstructor(WBClass<?> type)
+ {
+ return type.getNoArgsWBConstructor() != null || type.getAnnotatedWBConstructors(Inject.class).size() > 0;
+ }
+
+ public E getEnvironment()
+ {
+ return environment;
+ }
+
+}
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/bootstrap/BeanDeployer.java (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployer.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/weld/bootstrap/BeanDeployer.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/bootstrap/BeanDeployer.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -0,0 +1,126 @@
+/*
+ * 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 java.util.HashSet;
+import java.util.Set;
+
+import javax.decorator.Decorator;
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.interceptor.Interceptor;
+
+import org.jboss.weld.BeanManagerImpl;
+import org.jboss.weld.Container;
+import org.jboss.weld.bootstrap.events.ProcessAnnotatedTypeImpl;
+import org.jboss.weld.ejb.EjbDescriptors;
+import org.jboss.weld.ejb.InternalEjbDescriptor;
+import org.jboss.weld.introspector.WBClass;
+import org.jboss.weld.resources.ClassTransformer;
+
+/**
+ * @author pmuir
+ *
+ */
+public class BeanDeployer extends AbstractBeanDeployer<BeanDeployerEnvironment>
+{
+
+ private final BeanManagerImpl deploymentManager;
+
+ private final Set<WBClass<?>> classes;
+
+ /**
+ * @param manager
+ * @param ejbDescriptors
+ */
+ public BeanDeployer(BeanManagerImpl manager, BeanManagerImpl deploymentManager, EjbDescriptors ejbDescriptors)
+ {
+ super(manager, new BeanDeployerEnvironment(ejbDescriptors, manager));
+ this.classes = new HashSet<WBClass<?>>();
+ this.deploymentManager = deploymentManager;
+ }
+
+ public BeanDeployer addClass(Class<?> clazz)
+ {
+ ClassTransformer classTransformer = Container.instance().deploymentServices().get(ClassTransformer.class);
+ if (!clazz.isAnnotation() && !clazz.isEnum())
+ {
+ ProcessAnnotatedTypeImpl<?> event = createProcessAnnotatedTypeEvent(clazz, classTransformer);
+ deploymentManager.fireEvent(event);
+ if (!event.isVeto())
+ {
+ if (event.getAnnotatedType() instanceof WBClass<?>)
+ {
+ classes.add((WBClass<?>) event.getAnnotatedType());
+ }
+ else
+ {
+ classes.add(classTransformer.loadClass(event.getAnnotatedType()));
+ }
+ }
+ }
+ return this;
+ }
+
+ private static <X> ProcessAnnotatedTypeImpl<X> createProcessAnnotatedTypeEvent(Class<X> clazz, ClassTransformer classTransformer)
+ {
+ WBClass<X> annotatedType = classTransformer.loadClass(clazz);
+ return new ProcessAnnotatedTypeImpl<X>(annotatedType) {};
+ }
+
+ // TODO Do we need to fire PAT for annotated types added via BBD? Probably not PLM.
+ public BeanDeployer addClass(AnnotatedType<?> clazz)
+ {
+ ClassTransformer classTransformer = Container.instance().deploymentServices().get(ClassTransformer.class);
+ classes.add(classTransformer.loadClass(clazz));
+ return this;
+ }
+
+ public BeanDeployer addClasses(Iterable<Class<?>> classes)
+ {
+ for (Class<?> clazz : classes)
+ {
+ addClass(clazz);
+ }
+ return this;
+ }
+
+ public BeanDeployer createBeans()
+ {
+ for (WBClass<?> clazz : classes)
+ {
+ boolean managedBeanOrDecorator = !getEnvironment().getEjbDescriptors().contains(clazz.getJavaClass()) && isTypeManagedBeanOrDecorator(clazz);
+ if (managedBeanOrDecorator && clazz.isAnnotationPresent(Decorator.class))
+ {
+ createDecorator(clazz);
+ }
+ else if (managedBeanOrDecorator && clazz.isAnnotationPresent(Interceptor.class))
+ {
+ createInterceptor(clazz);
+ }
+ else if (managedBeanOrDecorator && !clazz.isAbstract())
+ {
+ createSimpleBean(clazz);
+ }
+ }
+ for (InternalEjbDescriptor<?> ejbDescriptor : getEnvironment().getEjbDescriptors())
+ {
+ createEnterpriseBean(ejbDescriptor);
+ }
+ return this;
+ }
+
+}
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/bootstrap/BeanDeployerEnvironment.java (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployerEnvironment.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/weld/bootstrap/BeanDeployerEnvironment.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/bootstrap/BeanDeployerEnvironment.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -0,0 +1,202 @@
+/*
+ * 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 java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.jboss.weld.BeanManagerImpl;
+import org.jboss.weld.bean.AbstractClassBean;
+import org.jboss.weld.bean.DecoratorImpl;
+import org.jboss.weld.bean.DisposalMethod;
+import org.jboss.weld.bean.InterceptorImpl;
+import org.jboss.weld.bean.NewBean;
+import org.jboss.weld.bean.ProducerField;
+import org.jboss.weld.bean.ProducerMethod;
+import org.jboss.weld.bean.RIBean;
+import org.jboss.weld.bean.builtin.AbstractBuiltInBean;
+import org.jboss.weld.bean.builtin.ExtensionBean;
+import org.jboss.weld.ejb.EjbDescriptors;
+import org.jboss.weld.event.ObserverMethodImpl;
+import org.jboss.weld.introspector.WBClass;
+import org.jboss.weld.introspector.WBMethod;
+import org.jboss.weld.resolution.ResolvableFactory;
+import org.jboss.weld.resolution.TypeSafeDisposerResolver;
+
+public class BeanDeployerEnvironment
+{
+
+ private final Map<WBClass<?>, AbstractClassBean<?>> classBeanMap;
+ private final Map<WBMethod<?, ?>, ProducerMethod<?, ?>> producerMethodBeanMap;
+ private final Set<RIBean<?>> beans;
+ private final Set<ObserverMethodImpl<?, ?>> observers;
+ private final List<DisposalMethod<?, ?>> allDisposalBeans;
+ private final Set<DisposalMethod<?, ?>> resolvedDisposalBeans;
+ private final Set<DecoratorImpl<?>> decorators;
+ private final Set<InterceptorImpl<?>> interceptors;
+ private final EjbDescriptors ejbDescriptors;
+ private final TypeSafeDisposerResolver disposalMethodResolver;
+
+ public BeanDeployerEnvironment(EjbDescriptors ejbDescriptors, BeanManagerImpl manager)
+ {
+ this.classBeanMap = new HashMap<WBClass<?>, AbstractClassBean<?>>();
+ this.producerMethodBeanMap = new HashMap<WBMethod<?, ?>, ProducerMethod<?, ?>>();
+ this.allDisposalBeans = new ArrayList<DisposalMethod<?, ?>>();
+ this.resolvedDisposalBeans = new HashSet<DisposalMethod<?, ?>>();
+ this.beans = new HashSet<RIBean<?>>();
+ this.decorators = new HashSet<DecoratorImpl<?>>();
+ this.interceptors = new HashSet<InterceptorImpl<?>>();
+ this.observers = new HashSet<ObserverMethodImpl<?, ?>>();
+ this.ejbDescriptors = ejbDescriptors;
+ this.disposalMethodResolver = new TypeSafeDisposerResolver(manager, allDisposalBeans);
+ }
+
+ public <X, T> ProducerMethod<X, T> getProducerMethod(WBMethod<X, T> method)
+ {
+ if (!producerMethodBeanMap.containsKey(method))
+ {
+ return null;
+ }
+ else
+ {
+ ProducerMethod<?, ?> bean = producerMethodBeanMap.get(method);
+ bean.initialize(this);
+ return (ProducerMethod<X, T>) bean;
+ }
+ }
+
+ public AbstractClassBean<?> getClassBean(WBClass<?> clazz)
+ {
+ if (!classBeanMap.containsKey(clazz))
+ {
+ return null;
+ }
+ else
+ {
+ AbstractClassBean<?> bean = classBeanMap.get(clazz);
+ bean.initialize(this);
+ return bean;
+ }
+ }
+
+ public void addBean(ProducerMethod<?, ?> bean)
+ {
+ producerMethodBeanMap.put(bean.getAnnotatedItem(), bean);
+ beans.add(bean);
+ }
+
+ public void addBean(ProducerField<?, ?> bean)
+ {
+ beans.add(bean);
+ }
+
+ public void addBean(ExtensionBean bean)
+ {
+ beans.add(bean);
+ }
+
+ public void addBean(AbstractBuiltInBean<?> bean)
+ {
+ beans.add(bean);
+ }
+
+ public void addBean(AbstractClassBean<?> bean)
+ {
+ if (!(bean instanceof NewBean))
+ {
+ classBeanMap.put(bean.getAnnotatedItem(), bean);
+ }
+ beans.add(bean);
+ }
+
+ public void addBean(DecoratorImpl<?> bean)
+ {
+ decorators.add(bean);
+ }
+
+ public void addBean(InterceptorImpl<?> bean)
+ {
+ interceptors.add(bean);
+ }
+
+ public void addBean(DisposalMethod<?, ?> bean)
+ {
+ allDisposalBeans.add(bean);
+ }
+
+ public void addObserver(ObserverMethodImpl<?, ?> observer)
+ {
+ this.observers.add(observer);
+ }
+
+ public Set<? extends RIBean<?>> getBeans()
+ {
+ return Collections.unmodifiableSet(beans);
+ }
+
+ public Set<DecoratorImpl<?>> getDecorators()
+ {
+ return Collections.unmodifiableSet(decorators);
+ }
+
+ public Set<InterceptorImpl<?>> getInterceptors()
+ {
+ return Collections.unmodifiableSet(interceptors);
+ }
+
+ public Set<ObserverMethodImpl<?, ?>> getObservers()
+ {
+ return Collections.unmodifiableSet(observers);
+ }
+
+
+ public Set<DisposalMethod<?, ?>> getUnresolvedDisposalBeans()
+ {
+ Set<DisposalMethod<?, ?>> beans = new HashSet<DisposalMethod<?, ?>>(allDisposalBeans);
+ beans.removeAll(resolvedDisposalBeans);
+ return Collections.unmodifiableSet(beans);
+ }
+
+ public EjbDescriptors getEjbDescriptors()
+ {
+ return ejbDescriptors;
+ }
+
+ /**
+ * Resolve the disposal method for the given producer method. Any resolved
+ * beans will be marked as such for the purpose of validating that all
+ * disposal methods are used. For internal use.
+ *
+ * @param apiType The API type to match
+ * @param bindings The binding types to match
+ * @return The set of matching disposal methods
+ */
+ public <X> Set<DisposalMethod<X, ?>> resolveDisposalBeans(Set<Type> types, Set<Annotation> bindings, AbstractClassBean<X> declaringBean)
+ {
+ Set<DisposalMethod<X, ?>> beans = (Set) disposalMethodResolver.resolve(ResolvableFactory.of(types, bindings, declaringBean));
+ resolvedDisposalBeans.addAll(beans);
+ return Collections.unmodifiableSet(beans);
+ }
+
+}
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/bootstrap/BeanDeployment.java (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployment.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/weld/bootstrap/BeanDeployment.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/bootstrap/BeanDeployment.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -0,0 +1,176 @@
+/*
+ * 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 org.jboss.weld.BeanManagerImpl;
+import org.jboss.weld.bean.builtin.DefaultValidatorBean;
+import org.jboss.weld.bean.builtin.DefaultValidatorFactoryBean;
+import org.jboss.weld.bean.builtin.ExtensionBean;
+import org.jboss.weld.bean.builtin.InjectionPointBean;
+import org.jboss.weld.bean.builtin.ManagerBean;
+import org.jboss.weld.bean.builtin.PrincipalBean;
+import org.jboss.weld.bean.builtin.UserTransactionBean;
+import org.jboss.weld.bean.builtin.facade.EventBean;
+import org.jboss.weld.bean.builtin.facade.InstanceBean;
+import org.jboss.weld.bootstrap.api.Environment;
+import org.jboss.weld.bootstrap.api.Environments;
+import org.jboss.weld.bootstrap.api.ServiceRegistry;
+import org.jboss.weld.bootstrap.api.helpers.SimpleServiceRegistry;
+import org.jboss.weld.bootstrap.spi.BeanDeploymentArchive;
+import org.jboss.weld.bootstrap.spi.Deployment;
+import org.jboss.weld.conversation.ConversationImpl;
+import org.jboss.weld.conversation.JavaSEConversationTerminator;
+import org.jboss.weld.conversation.NumericConversationIdGenerator;
+import org.jboss.weld.conversation.ServletConversationManager;
+import org.jboss.weld.ejb.EjbDescriptors;
+import org.jboss.weld.ejb.spi.EjbServices;
+import org.jboss.weld.event.ObserverMethodImpl;
+import org.jboss.weld.log.Log;
+import org.jboss.weld.log.Logging;
+import org.jboss.weld.resources.spi.ResourceLoader;
+import org.jboss.weld.security.spi.SecurityServices;
+import org.jboss.weld.servlet.HttpSessionManager;
+import org.jboss.weld.transaction.spi.TransactionServices;
+import org.jboss.weld.validation.spi.ValidationServices;
+import org.jboss.weld.xml.BeansXmlParser;
+
+/**
+ * @author pmuir
+ *
+ */
+public class BeanDeployment
+{
+
+ private static final Log log = Logging.getLog(BeanDeployment.class);
+
+ private final BeanDeploymentArchive beanDeploymentArchive;
+ private final BeanManagerImpl beanManager;
+ private final ExtensionBeanDeployerEnvironment extensionBeanDeployerEnvironment;
+ private final BeanDeployer beanDeployer;
+ private final Deployment deployment;
+
+ public BeanDeployment(BeanDeploymentArchive beanDeploymentArchive, BeanManagerImpl deploymentManager, Deployment deployment, ExtensionBeanDeployerEnvironment extensionBeanDeployerEnvironment, ServiceRegistry deploymentServices)
+ {
+ this.extensionBeanDeployerEnvironment = extensionBeanDeployerEnvironment;
+ this.deployment = deployment;
+ this.beanDeploymentArchive = beanDeploymentArchive;
+ EjbDescriptors ejbDescriptors = new EjbDescriptors();
+ beanDeploymentArchive.getServices().add(EjbDescriptors.class, ejbDescriptors);
+ ServiceRegistry services = new SimpleServiceRegistry();
+ services.addAll(deploymentServices.entrySet());
+ services.addAll(beanDeploymentArchive.getServices().entrySet());
+ this.beanManager = BeanManagerImpl.newManager(deploymentManager, beanDeploymentArchive.getId(), services);
+ if (beanManager.getServices().contains(EjbServices.class))
+ {
+ // Must populate EJB cache first, as we need it to detect whether a
+ // bean is an EJB!
+ ejbDescriptors.addAll(beanDeploymentArchive.getEjbs());
+ }
+
+ beanDeployer = new BeanDeployer(beanManager, deploymentManager, ejbDescriptors);
+
+ parseBeansXml();
+ }
+
+ public BeanManagerImpl getBeanManager()
+ {
+ return beanManager;
+ }
+
+ public BeanDeployer getBeanDeployer()
+ {
+ return beanDeployer;
+ }
+
+ public BeanDeploymentArchive getBeanDeploymentArchive()
+ {
+ return beanDeploymentArchive;
+ }
+
+
+ private void parseBeansXml()
+ {
+ BeansXmlParser parser = new BeansXmlParser(beanManager.getServices().get(ResourceLoader.class), getBeanDeploymentArchive().getBeansXml());
+ parser.parse();
+
+ if (parser.getEnabledPolicyClasses() != null)
+ {
+ beanManager.setEnabledPolicyClasses(parser.getEnabledPolicyClasses());
+ }
+ if (parser.getEnabledPolicyStereotypes() != null)
+ {
+ beanManager.setEnabledPolicyStereotypes(parser.getEnabledPolicyStereotypes());
+ }
+ if (parser.getEnabledDecoratorClasses() != null)
+ {
+ beanManager.setEnabledDecoratorClasses(parser.getEnabledDecoratorClasses());
+ }
+ if (parser.getEnabledInterceptorClasses() != null)
+ {
+ beanManager.setEnabledInterceptorClasses(parser.getEnabledInterceptorClasses());
+ }
+ log.debug("Enabled policies for " + this + ": " + beanManager.getEnabledPolicyClasses() + " " + beanManager.getEnabledPolicyStereotypes());
+ log.debug("Enabled decorator types for " + beanManager + ": " + beanManager.getEnabledDecoratorClasses());
+ log.debug("Enabled interceptor types for " + beanManager + ": " + beanManager.getEnabledInterceptorClasses());
+ }
+
+ public void deployBeans(Environment environment)
+ {
+ beanDeployer.addClasses(beanDeploymentArchive.getBeanClasses());
+ beanDeployer.getEnvironment().addBean(new ManagerBean(beanManager));
+ beanDeployer.getEnvironment().addBean(new InjectionPointBean(beanManager));
+ beanDeployer.getEnvironment().addBean(new EventBean(beanManager));
+ beanDeployer.getEnvironment().addBean(new InstanceBean(beanManager));
+ if (!environment.equals(Environments.SE))
+ {
+ beanDeployer.addClass(ConversationImpl.class);
+ beanDeployer.addClass(ServletConversationManager.class);
+ beanDeployer.addClass(JavaSEConversationTerminator.class);
+ beanDeployer.addClass(NumericConversationIdGenerator.class);
+ beanDeployer.addClass(HttpSessionManager.class);
+ }
+ if (beanManager.getServices().contains(TransactionServices.class))
+ {
+ beanDeployer.getEnvironment().addBean(new UserTransactionBean(beanManager));
+ }
+ if (beanManager.getServices().contains(SecurityServices.class))
+ {
+ beanDeployer.getEnvironment().addBean(new PrincipalBean(beanManager));
+ }
+ if (beanManager.getServices().contains(ValidationServices.class))
+ {
+ beanDeployer.getEnvironment().addBean(new DefaultValidatorBean(beanManager));
+ beanDeployer.getEnvironment().addBean(new DefaultValidatorFactoryBean(beanManager));
+ }
+ for (ExtensionBean bean : extensionBeanDeployerEnvironment.getBeans())
+ {
+ if (deployment.loadBeanDeploymentArchive(bean.getBeanClass()).equals(beanDeploymentArchive))
+ {
+ beanDeployer.getManager().addBean(bean);
+ }
+ }
+ for (ObserverMethodImpl<?, ?> observerMethod : extensionBeanDeployerEnvironment.getObservers())
+ {
+ if (deployment.loadBeanDeploymentArchive(observerMethod.getBean().getBeanClass()).equals(beanDeploymentArchive))
+ {
+ beanDeployer.getManager().addObserver(observerMethod);
+ }
+ }
+ beanDeployer.createBeans().deploy();
+ }
+
+}
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/bootstrap/ExtensionBeanDeployer.java (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/ExtensionBeanDeployer.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/weld/bootstrap/ExtensionBeanDeployer.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/bootstrap/ExtensionBeanDeployer.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -0,0 +1,75 @@
+/*
+ * 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 java.util.HashSet;
+import java.util.Set;
+
+import javax.enterprise.inject.spi.Extension;
+
+import org.jboss.weld.BeanManagerImpl;
+import org.jboss.weld.Container;
+import org.jboss.weld.bean.builtin.ExtensionBean;
+import org.jboss.weld.introspector.WBClass;
+import org.jboss.weld.resources.ClassTransformer;
+
+/**
+ * @author pmuir
+ *
+ */
+public class ExtensionBeanDeployer extends AbstractBeanDeployer<ExtensionBeanDeployerEnvironment>
+{
+
+
+ private final Set<Extension> extensions;
+
+ public ExtensionBeanDeployer(BeanManagerImpl manager, ExtensionBeanDeployerEnvironment environment)
+ {
+ super(manager, environment);
+ this.extensions = new HashSet<Extension>();
+ }
+
+ public ExtensionBeanDeployer createBeans()
+ {
+ ClassTransformer classTransformer = Container.instance().deploymentServices().get(ClassTransformer.class);
+ for (Extension extension : extensions)
+ {
+ @SuppressWarnings("unchecked")
+ WBClass<Extension> clazz = (WBClass<Extension>) classTransformer.loadClass(extension.getClass());
+
+ ExtensionBean bean = new ExtensionBean(getManager(), clazz, extension);
+ this.
+ getEnvironment().addBean(bean);
+ createObserverMethods(bean, clazz);
+ }
+ return this;
+ }
+
+ public void addExtensions(Iterable<Extension> extensions)
+ {
+ for (Extension extension : extensions)
+ {
+ addExtension(extension);
+ }
+ }
+
+ public void addExtension(Extension extension)
+ {
+ this.extensions.add(extension);
+ }
+
+}
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/bootstrap/ExtensionBeanDeployerEnvironment.java (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/ExtensionBeanDeployerEnvironment.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/weld/bootstrap/ExtensionBeanDeployerEnvironment.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/bootstrap/ExtensionBeanDeployerEnvironment.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -0,0 +1,34 @@
+package org.jboss.weld.bootstrap;
+
+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;
+
+public class ExtensionBeanDeployerEnvironment extends BeanDeployerEnvironment
+{
+
+ private final Set<ExtensionBean> extensionBeans;
+
+
+ public ExtensionBeanDeployerEnvironment(EjbDescriptors ejbDescriptors, BeanManagerImpl manager)
+ {
+ super(ejbDescriptors, manager);
+ this.extensionBeans = new HashSet<ExtensionBean>();
+ }
+
+ @Override
+ public Set<ExtensionBean> getBeans()
+ {
+ return extensionBeans;
+ }
+
+ @Override
+ public void addBean(ExtensionBean bean)
+ {
+ extensionBeans.add(bean);
+ }
+
+}
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/bootstrap/WebBeansBootstrap.java (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/weld/bootstrap/WebBeansBootstrap.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/bootstrap/WebBeansBootstrap.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -0,0 +1,439 @@
+/*
+ * 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 java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import java.util.Map.Entry;
+
+import javax.enterprise.inject.spi.BeforeBeanDiscovery;
+import javax.enterprise.inject.spi.BeforeShutdown;
+import javax.enterprise.inject.spi.Extension;
+
+import org.jboss.weld.BeanManagerImpl;
+import org.jboss.weld.Container;
+import org.jboss.weld.ContextualStore;
+import org.jboss.weld.DefinitionException;
+import org.jboss.weld.DeploymentException;
+import org.jboss.weld.Validator;
+import org.jboss.weld.bean.builtin.ManagerBean;
+import org.jboss.weld.bootstrap.api.Bootstrap;
+import org.jboss.weld.bootstrap.api.Environment;
+import org.jboss.weld.bootstrap.api.Lifecycle;
+import org.jboss.weld.bootstrap.api.Service;
+import org.jboss.weld.bootstrap.api.ServiceRegistry;
+import org.jboss.weld.bootstrap.api.helpers.ServiceRegistries;
+import org.jboss.weld.bootstrap.api.helpers.SimpleServiceRegistry;
+import org.jboss.weld.bootstrap.events.AfterBeanDiscoveryImpl;
+import org.jboss.weld.bootstrap.events.AfterDeploymentValidationImpl;
+import org.jboss.weld.bootstrap.events.BeforeBeanDiscoveryImpl;
+import org.jboss.weld.bootstrap.events.BeforeShutdownImpl;
+import org.jboss.weld.bootstrap.spi.BeanDeploymentArchive;
+import org.jboss.weld.bootstrap.spi.Deployment;
+import org.jboss.weld.context.AbstractApplicationContext;
+import org.jboss.weld.context.ApplicationContext;
+import org.jboss.weld.context.ContextLifecycle;
+import org.jboss.weld.context.ConversationContext;
+import org.jboss.weld.context.DependentContext;
+import org.jboss.weld.context.RequestContext;
+import org.jboss.weld.context.SessionContext;
+import org.jboss.weld.context.SingletonContext;
+import org.jboss.weld.context.api.BeanStore;
+import org.jboss.weld.ejb.EJBApiAbstraction;
+import org.jboss.weld.ejb.EjbDescriptors;
+import org.jboss.weld.jsf.JsfApiAbstraction;
+import org.jboss.weld.log.Log;
+import org.jboss.weld.log.Logging;
+import org.jboss.weld.metadata.TypeStore;
+import org.jboss.weld.metadata.cache.MetaAnnotationStore;
+import org.jboss.weld.persistence.PersistenceApiAbstraction;
+import org.jboss.weld.resources.ClassTransformer;
+import org.jboss.weld.resources.DefaultResourceLoader;
+import org.jboss.weld.resources.spi.ResourceLoader;
+import org.jboss.weld.servlet.ServletApiAbstraction;
+import org.jboss.weld.transaction.spi.TransactionServices;
+import org.jboss.weld.util.serviceProvider.ServiceLoader;
+import org.jboss.weld.ws.WSApiAbstraction;
+
+/**
+ * Common bootstrapping functionality that is run at application startup and
+ * detects and register beans
+ *
+ * @author Pete Muir
+ */
+public class WebBeansBootstrap implements Bootstrap
+{
+
+ /**
+ *
+ * A Deployment visitor which can find the transitive closure of Bean
+ * Deployment Archives
+ *
+ * @author pmuir
+ *
+ */
+ private static class DeploymentVisitor
+ {
+
+ private final BeanManagerImpl deploymentManager;
+ private final Environment environment;
+ private final Deployment deployment;
+ private final ExtensionBeanDeployerEnvironment extensionBeanDeployerEnvironment;
+
+ public DeploymentVisitor(BeanManagerImpl deploymentManager, Environment environment, Deployment deployment, ExtensionBeanDeployerEnvironment extensionBeanDeployerEnvironment)
+ {
+ this.deploymentManager = deploymentManager;
+ this.environment = environment;
+ this.deployment = deployment;
+ this.extensionBeanDeployerEnvironment = extensionBeanDeployerEnvironment;
+ }
+
+ public Map<BeanDeploymentArchive, BeanDeployment> visit()
+ {
+ Set<BeanDeploymentArchive> seenBeanDeploymentArchives = new HashSet<BeanDeploymentArchive>();
+ Map<BeanDeploymentArchive, BeanDeployment> managerAwareBeanDeploymentArchives = new HashMap<BeanDeploymentArchive, BeanDeployment>();
+ for (BeanDeploymentArchive archvive : deployment.getBeanDeploymentArchives())
+ {
+ visit(archvive, managerAwareBeanDeploymentArchives, seenBeanDeploymentArchives);
+ }
+ return managerAwareBeanDeploymentArchives;
+ }
+
+ private BeanDeployment visit(BeanDeploymentArchive beanDeploymentArchive, Map<BeanDeploymentArchive, BeanDeployment> managerAwareBeanDeploymentArchives, Set<BeanDeploymentArchive> seenBeanDeploymentArchives)
+ {
+ // Check that the required services are specified
+ verifyServices(beanDeploymentArchive.getServices(), environment.getRequiredBeanDeploymentArchiveServices());
+
+ // Check the id is not null
+ if (beanDeploymentArchive.getId() == null)
+ {
+ throw new IllegalArgumentException("BeanDeploymentArchive must not be null " + beanDeploymentArchive);
+ }
+
+ // Create the BeanDeployment and attach
+ BeanDeployment parent = new BeanDeployment(beanDeploymentArchive, deploymentManager, deployment, extensionBeanDeployerEnvironment, deployment.getServices());
+ managerAwareBeanDeploymentArchives.put(beanDeploymentArchive, parent);
+ seenBeanDeploymentArchives.add(beanDeploymentArchive);
+ for (BeanDeploymentArchive archive : beanDeploymentArchive.getBeanDeploymentArchives())
+ {
+ // Cut any circularties
+ if (!seenBeanDeploymentArchives.contains(archive))
+ {
+ BeanDeployment child = visit(archive, managerAwareBeanDeploymentArchives, seenBeanDeploymentArchives);
+ parent.getBeanManager().addAccessibleBeanManager(child.getBeanManager());
+ }
+ }
+ return parent;
+ }
+
+ }
+
+ // The log provider
+ private static Log log = Logging.getLog(WebBeansBootstrap.class);
+
+ static
+ {
+ log.info("Web Beans " + getVersion());
+ }
+
+ // The Web Beans manager
+ private BeanManagerImpl deploymentManager;
+ private Map<BeanDeploymentArchive, BeanDeployment> beanDeployments;
+ private Environment environment;
+ private Deployment deployment;
+ private ExtensionBeanDeployerEnvironment extensionBeanDeployerEnvironment;
+
+ public Bootstrap startContainer(Environment environment, Deployment deployment, BeanStore applicationBeanStore)
+ {
+ synchronized (this)
+ {
+ if (deployment == null)
+ {
+ throw new IllegalArgumentException("Must start the container with a deployment");
+ }
+ if (!deployment.getServices().contains(ResourceLoader.class))
+ {
+ deployment.getServices().add(ResourceLoader.class, new DefaultResourceLoader());
+ }
+
+ verifyServices(deployment.getServices(), environment.getRequiredDeploymentServices());
+
+ if (!deployment.getServices().contains(TransactionServices.class))
+ {
+ log.info("Transactional services not available. Injection of @Current UserTransaction not available. Transactional observers will be invoked synchronously.");
+ }
+ // TODO Reinstate if we can find a good way to detect.
+// if (!deployment.getServices().contains(EjbServices.class))
+// {
+// log.info("EJB services not available. Session beans will be simple beans, CDI-style injection into non-contextual EJBs, injection of remote EJBs and injection of @EJB in simple beans will not be available");
+// }
+// if (!deployment.getServices().contains(JpaInjectionServices.class))
+// {
+// log.info("JPA services not available. Injection of @PersistenceContext will not occur. Entity beans will be discovered as simple beans.");
+// }
+// if (!deployment.getServices().contains(ResourceInjectionServices.class))
+// {
+// log.info("@Resource injection not available.");
+// }
+ if (applicationBeanStore == null)
+ {
+ throw new IllegalStateException("No application context BeanStore set");
+ }
+
+ this.deployment = deployment;
+ ServiceRegistry implementationServices = getImplementationServices(deployment.getServices().get(ResourceLoader.class));
+
+ deployment.getServices().addAll(implementationServices.entrySet());
+
+ ServiceRegistry deploymentServices = new SimpleServiceRegistry();
+ deploymentServices.add(ClassTransformer.class, implementationServices.get(ClassTransformer.class));
+ deploymentServices.add(MetaAnnotationStore.class, implementationServices.get(MetaAnnotationStore.class));
+ deploymentServices.add(TypeStore.class, implementationServices.get(TypeStore.class));
+
+ this.environment = environment;
+ this.deploymentManager = BeanManagerImpl.newRootManager("deployment", deploymentServices);
+
+ Container.initialize(deploymentManager, ServiceRegistries.unmodifiableServiceRegistry(deployment.getServices()));
+
+ createContexts();
+ initializeContexts();
+ // Start the application context
+ Container.instance().deploymentServices().get(ContextLifecycle.class).beginApplication(applicationBeanStore);
+
+ this.extensionBeanDeployerEnvironment = new ExtensionBeanDeployerEnvironment(EjbDescriptors.EMPTY, deploymentManager);
+
+ DeploymentVisitor deploymentVisitor = new DeploymentVisitor(deploymentManager, environment, deployment, extensionBeanDeployerEnvironment);
+ beanDeployments = deploymentVisitor.visit();
+
+ return this;
+ }
+ }
+
+ private ServiceRegistry getImplementationServices(ResourceLoader resourceLoader)
+ {
+ ServiceRegistry services = new SimpleServiceRegistry();
+ services.add(EJBApiAbstraction.class, new EJBApiAbstraction(resourceLoader));
+ services.add(JsfApiAbstraction.class, new JsfApiAbstraction(resourceLoader));
+ services.add(PersistenceApiAbstraction.class, new PersistenceApiAbstraction(resourceLoader));
+ services.add(WSApiAbstraction.class, new WSApiAbstraction(resourceLoader));
+ services.add(ServletApiAbstraction.class, new ServletApiAbstraction(resourceLoader));
+ // Temporary workaround to provide context for building annotated class
+ // TODO expose AnnotatedClass on SPI and allow container to provide impl of this via ResourceLoader
+ services.add(Validator.class, new Validator());
+ services.add(TypeStore.class, new TypeStore());
+ services.add(ClassTransformer.class, new ClassTransformer(services.get(TypeStore.class)));
+ services.add(MetaAnnotationStore.class, new MetaAnnotationStore(services.get(ClassTransformer.class)));
+ services.add(ContextualStore.class, new ContextualStore());
+ return services;
+ }
+
+ public BeanManagerImpl getManager(BeanDeploymentArchive beanDeploymentArchive)
+ {
+ if (beanDeployments.containsKey(beanDeploymentArchive))
+ {
+ return beanDeployments.get(beanDeploymentArchive).getBeanManager();
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public Bootstrap startInitialization()
+ {
+ synchronized (this)
+ {
+ if (deploymentManager == null)
+ {
+ throw new IllegalStateException("Manager has not been initialized");
+ }
+
+ ExtensionBeanDeployer extensionBeanDeployer = new ExtensionBeanDeployer(deploymentManager, extensionBeanDeployerEnvironment);
+ extensionBeanDeployer.addExtensions(ServiceLoader.load(Extension.class));
+ extensionBeanDeployer.createBeans().deploy();
+
+ // Add the Deployment BeanManager Bean to the Deployment BeanManager
+ deploymentManager.addBean(new ManagerBean(deploymentManager));
+
+ fireBeforeBeanDiscoveryEvent();
+ }
+ return this;
+ }
+
+ public Bootstrap deployBeans()
+ {
+ synchronized (this)
+ {
+ for (Entry<BeanDeploymentArchive, BeanDeployment> entry : beanDeployments.entrySet())
+ {
+ entry.getValue().deployBeans(environment);
+ }
+ fireAfterBeanDiscoveryEvent();
+ log.debug("Web Beans initialized. Validating beans.");
+ }
+ return this;
+ }
+
+ public Bootstrap validateBeans()
+ {
+ synchronized (this)
+ {
+ for (Entry<BeanDeploymentArchive, BeanDeployment> entry : beanDeployments.entrySet())
+ {
+ deployment.getServices().get(Validator.class).validateDeployment(entry.getValue().getBeanManager(), entry.getValue().getBeanDeployer().getEnvironment());
+ }
+ fireAfterDeploymentValidationEvent();
+ }
+ return this;
+ }
+
+ public Bootstrap endInitialization()
+ {
+ synchronized (this)
+ {
+ // Register the managers so external requests can handle them
+ Container.instance().putBeanDeployments(beanDeployments);
+ Container.instance().setInitialized(true);
+ }
+ return this;
+ }
+
+ private void fireBeforeBeanDiscoveryEvent()
+ {
+ BeforeBeanDiscovery event = new BeforeBeanDiscoveryImpl(deploymentManager, deployment, beanDeployments, extensionBeanDeployerEnvironment);
+ try
+ {
+ deploymentManager.fireEvent(event);
+ }
+ catch (Exception e)
+ {
+ throw new DefinitionException(e);
+ }
+ }
+
+ private void fireBeforeShutdownEvent()
+ {
+ BeforeShutdown event = new BeforeShutdownImpl();
+ try
+ {
+ deploymentManager.fireEvent(event);
+ }
+ catch (Exception e)
+ {
+ throw new DeploymentException(e);
+ }
+ }
+
+ private void fireAfterBeanDiscoveryEvent()
+ {
+ AfterBeanDiscoveryImpl event = new AfterBeanDiscoveryImpl(deploymentManager, deployment, beanDeployments, extensionBeanDeployerEnvironment);
+ try
+ {
+ deploymentManager.fireEvent(event);
+ }
+ catch (Exception e)
+ {
+ event.addDefinitionError(e);
+ }
+
+ if (event.getDefinitionErrors().size() > 0)
+ {
+ // FIXME communicate all the captured definition errors in this exception
+ throw new DefinitionException(event.getDefinitionErrors().get(0));
+ }
+ }
+
+ private void fireAfterDeploymentValidationEvent()
+ {
+ AfterDeploymentValidationImpl event = new AfterDeploymentValidationImpl();
+
+ try
+ {
+ deploymentManager.fireEvent(event);
+ }
+ catch (Exception e)
+ {
+ event.addDeploymentProblem(e);
+ }
+
+ if (event.getDeploymentProblems().size() > 0)
+ {
+ // FIXME communicate all the captured deployment problems in this exception
+ throw new DeploymentException(event.getDeploymentProblems().get(0));
+ }
+ }
+
+ /**
+ * Gets version information
+ *
+ * @return The implementation version from the Bootstrap class package.
+ */
+ public static String getVersion()
+ {
+ Package pkg = WebBeansBootstrap.class.getPackage();
+ return pkg != null ? pkg.getImplementationVersion() : null;
+ }
+
+ protected void initializeContexts()
+ {
+ Lifecycle lifecycle = deployment.getServices().get(ContextLifecycle.class);
+ deploymentManager.addContext(lifecycle.getDependentContext());
+ deploymentManager.addContext(lifecycle.getRequestContext());
+ deploymentManager.addContext(lifecycle.getConversationContext());
+ deploymentManager.addContext(lifecycle.getSessionContext());
+ deploymentManager.addContext(lifecycle.getApplicationContext());
+ deploymentManager.addContext(lifecycle.getSingletonContext());
+ }
+
+ protected void createContexts()
+ {
+ AbstractApplicationContext applicationContext = new ApplicationContext();
+ AbstractApplicationContext singletonContext = new SingletonContext();
+ SessionContext sessionContext = new SessionContext();
+ ConversationContext conversationContext = new ConversationContext();
+ RequestContext requestContext = new RequestContext();
+ DependentContext dependentContext = new DependentContext();
+
+ deployment.getServices().add(ContextLifecycle.class, new ContextLifecycle(applicationContext, singletonContext, sessionContext, conversationContext, requestContext, dependentContext));
+ }
+
+ public void shutdown()
+ {
+ try
+ {
+ fireBeforeShutdownEvent();
+ }
+ finally
+ {
+ Container.instance().deploymentServices().get(ContextLifecycle.class).endApplication();
+ }
+ }
+
+ protected static void verifyServices(ServiceRegistry services, Set<Class<? extends Service>> requiredServices)
+ {
+ for (Class<? extends Service> serviceType : requiredServices)
+ {
+ if (!services.contains(serviceType))
+ {
+ throw new IllegalStateException("Required service " + serviceType.getName() + " has not been specified");
+ }
+ }
+ }
+
+}
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/events)
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AbstractBeanDiscoveryEvent.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/events/AbstractBeanDiscoveryEvent.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AbstractBeanDiscoveryEvent.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,16 +14,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.bootstrap.events;
+package org.jboss.weld.bootstrap.events;
import java.util.Map;
-import org.jboss.webbeans.BeanManagerImpl;
-import org.jboss.webbeans.bootstrap.BeanDeployment;
-import org.jboss.webbeans.bootstrap.ExtensionBeanDeployerEnvironment;
-import org.jboss.webbeans.bootstrap.spi.BeanDeploymentArchive;
-import org.jboss.webbeans.bootstrap.spi.Deployment;
-import org.jboss.webbeans.metadata.TypeStore;
+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.metadata.TypeStore;
/**
* @author pmuir
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AbstractContainerEvent.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/events/AbstractContainerEvent.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AbstractContainerEvent.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.bootstrap.events;
+package org.jboss.weld.bootstrap.events;
import java.util.ArrayList;
import java.util.List;
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AfterBeanDiscoveryImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/events/AfterBeanDiscoveryImpl.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AfterBeanDiscoveryImpl.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.bootstrap.events;
+package org.jboss.weld.bootstrap.events;
import java.util.Collections;
import java.util.List;
@@ -25,11 +25,11 @@
import javax.enterprise.inject.spi.Bean;
import javax.enterprise.inject.spi.ObserverMethod;
-import org.jboss.webbeans.BeanManagerImpl;
-import org.jboss.webbeans.bootstrap.BeanDeployment;
-import org.jboss.webbeans.bootstrap.ExtensionBeanDeployerEnvironment;
-import org.jboss.webbeans.bootstrap.spi.BeanDeploymentArchive;
-import org.jboss.webbeans.bootstrap.spi.Deployment;
+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;
public class AfterBeanDiscoveryImpl extends AbstractBeanDiscoveryEvent implements AfterBeanDiscovery
{
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AfterDeploymentValidationImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/events/AfterDeploymentValidationImpl.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AfterDeploymentValidationImpl.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.bootstrap.events;
+package org.jboss.weld.bootstrap.events;
import java.util.Collections;
import java.util.List;
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/BeforeBeanDiscoveryImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/events/BeforeBeanDiscoveryImpl.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/BeforeBeanDiscoveryImpl.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.bootstrap.events;
+package org.jboss.weld.bootstrap.events;
import java.lang.annotation.Annotation;
import java.util.Map;
@@ -22,15 +22,15 @@
import javax.enterprise.inject.spi.AnnotatedType;
import javax.enterprise.inject.spi.BeforeBeanDiscovery;
-import org.jboss.webbeans.BeanManagerImpl;
-import org.jboss.webbeans.bootstrap.BeanDeployment;
-import org.jboss.webbeans.bootstrap.ExtensionBeanDeployerEnvironment;
-import org.jboss.webbeans.bootstrap.spi.BeanDeploymentArchive;
-import org.jboss.webbeans.bootstrap.spi.Deployment;
-import org.jboss.webbeans.literal.BindingTypeLiteral;
-import org.jboss.webbeans.literal.InterceptorBindingTypeLiteral;
-import org.jboss.webbeans.literal.NormalScopeLiteral;
-import org.jboss.webbeans.literal.ScopeLiteral;
+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.literal.BindingTypeLiteral;
+import org.jboss.weld.literal.InterceptorBindingTypeLiteral;
+import org.jboss.weld.literal.NormalScopeLiteral;
+import org.jboss.weld.literal.ScopeLiteral;
public class BeforeBeanDiscoveryImpl extends AbstractBeanDiscoveryEvent implements BeforeBeanDiscovery
{
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/BeforeShutdownImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/events/BeforeShutdownImpl.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/BeforeShutdownImpl.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.bootstrap.events;
+package org.jboss.weld.bootstrap.events;
import javax.enterprise.inject.spi.BeforeShutdown;
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessAnnotatedTypeImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/events/ProcessAnnotatedTypeImpl.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessAnnotatedTypeImpl.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.bootstrap.events;
+package org.jboss.weld.bootstrap.events;
import javax.enterprise.inject.spi.AnnotatedType;
import javax.enterprise.inject.spi.ProcessAnnotatedType;
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessObserverMethodImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/events/ProcessObserverMethodImpl.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessObserverMethodImpl.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.jboss.webbeans.bootstrap.events;
+package org.jboss.weld.bootstrap.events;
import java.util.Collections;
import java.util.List;
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessProducerImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/events/ProcessProducerImpl.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessProducerImpl.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -1,4 +1,4 @@
-package org.jboss.webbeans.bootstrap.events;
+package org.jboss.weld.bootstrap.events;
import java.util.List;
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/context/AbstractApplicationContext.java (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/context/AbstractApplicationContext.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/weld/context/AbstractApplicationContext.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/context/AbstractApplicationContext.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -0,0 +1,111 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
+ *
+ * Use is subject to license terms.
+ *
+ * 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.context;
+
+import java.lang.annotation.Annotation;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import org.jboss.weld.context.api.BeanStore;
+
+/**
+ * The Application context
+ *
+ * @author Nicklas Karlsson
+ *
+ * @see org.jboss.weld.context.AbstractApplicationContext
+ */
+public abstract class AbstractApplicationContext extends AbstractMapContext
+{
+
+ // The beans
+ private BeanStore beanStore;
+ // Is the context active?
+ private final AtomicBoolean active;
+
+ /**
+ * Constructor
+ */
+ public AbstractApplicationContext(Class<? extends Annotation> scope)
+ {
+ super(scope);
+ this.active = new AtomicBoolean(false);
+ }
+
+ /**
+ * Gets the bean store
+ *
+ * @return The bean store
+ */
+ @Override
+ public BeanStore getBeanStore()
+ {
+ return this.beanStore;
+ }
+
+ /**
+ * Sets the bean store
+ *
+ * @param applicationBeanStore The bean store
+ */
+ public void setBeanStore(BeanStore applicationBeanStore)
+ {
+ this.beanStore = applicationBeanStore;
+ }
+
+ /**
+ * Indicates if the context is active
+ *
+ * @return True if active, false otherwise
+ */
+ @Override
+ public boolean isActive()
+ {
+ return active.get();
+ }
+
+ /**
+ * Sets the active state of the context
+ *
+ * @param active The new state
+ */
+ @Override
+ public void setActive(boolean active)
+ {
+ this.active.set(active);
+ }
+
+ @Override
+ public String toString()
+ {
+ String active = isActive() ? "Active " : "Inactive ";
+ String beanStoreInfo = getBeanStore() == null ? "" : getBeanStore().toString();
+ return active + "application context " + beanStoreInfo;
+ }
+
+ @Override
+ protected boolean isCreationLockRequired()
+ {
+ return true;
+ }
+
+}
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/context/AbstractContext.java (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/context/AbstractContext.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/weld/context/AbstractContext.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/context/AbstractContext.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -0,0 +1,94 @@
+/*
+ * 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.context;
+
+import java.lang.annotation.Annotation;
+
+import javax.enterprise.context.spi.Context;
+
+/**
+ * Common Context operation
+ *
+ * @author Nicklas Karlsson
+ * @author Pete Muir
+ *
+ */
+public abstract class AbstractContext implements Context
+{
+ // The scope type
+ private Class<? extends Annotation> scopeType;
+ // The active state of the context
+ private ThreadLocal<Boolean> active;
+
+ /**
+ * Constructor
+ *
+ * @param scopeType The scope type
+ */
+ public AbstractContext(Class<? extends Annotation> scopeType)
+ {
+ this.scopeType = scopeType;
+ this.active = new ThreadLocal<Boolean>()
+ {
+ @Override
+ protected Boolean initialValue()
+ {
+ return Boolean.FALSE;
+ }
+ };
+ }
+
+ /**
+ * Get the scope the context is for
+ *
+ * @return The scope type
+ *
+ * @see javax.enterprise.context.spi.Context#getScope()
+ */
+ public Class<? extends Annotation> getScope()
+ {
+ return scopeType;
+ }
+
+ /**
+ * Return true if the context is active
+ *
+ * @return The active state
+ *
+ * @see javax.enterprise.context.spi.Context#isActive()
+ */
+ public boolean isActive()
+ {
+ return active.get().booleanValue();
+ }
+
+ /**
+ * Set the context active, internal API for WBRI
+ *
+ * @param active The new state
+ */
+ public void setActive(boolean active)
+ {
+ this.active.set(Boolean.valueOf(active));
+ }
+
+ public void cleanup()
+ {
+ this.active.remove();
+ }
+
+}
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/context/AbstractMapContext.java (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/context/AbstractMapContext.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/weld/context/AbstractMapContext.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/context/AbstractMapContext.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -0,0 +1,194 @@
+/*
+ * 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.context;
+
+import java.lang.annotation.Annotation;
+import java.util.concurrent.locks.ReentrantLock;
+
+import javax.enterprise.context.ContextNotActiveException;
+import javax.enterprise.context.spi.Contextual;
+import javax.enterprise.context.spi.CreationalContext;
+
+import org.jboss.weld.Container;
+import org.jboss.weld.ContextualStore;
+import org.jboss.weld.context.api.BeanStore;
+import org.jboss.weld.context.api.ContextualInstance;
+import org.jboss.weld.log.LogProvider;
+import org.jboss.weld.log.Logging;
+
+/**
+ * Base for the Context implementations. Delegates calls to the abstract
+ * getBeanStorage and getActive to allow for different implementations (storage
+ * types and ThreadLocal vs. shared)
+ *
+ * @author Nicklas Karlsson
+ * @author Pete Muir
+ *
+ * @see org.jboss.webbeans.contexts.SharedContext
+ * @see org.jboss.webbeans.context.BasicContext
+ */
+public abstract class AbstractMapContext extends AbstractContext
+{
+ private static LogProvider log = Logging.getLogProvider(AbstractMapContext.class);
+
+ private static ReentrantLock creationLock = new ReentrantLock();
+
+ /**
+ * Constructor
+ *
+ * @param scopeType The scope type
+ */
+ public AbstractMapContext(Class<? extends Annotation> scopeType)
+ {
+ super(scopeType);
+ }
+
+ /**
+ * Get the bean if it exists in the contexts.
+ *
+ * @param create If true, a new instance of the bean will be created if none
+ * exists
+ * @return An instance of the bean
+ * @throws ContextNotActiveException if the context is not active
+ *
+ * @see javax.enterprise.context.spi.Context#get(BaseBean, boolean)
+ */
+ public <T> T get(Contextual<T> contextual, CreationalContext<T> creationalContext)
+ {
+ if (!isActive())
+ {
+ throw new ContextNotActiveException();
+ }
+ if (getBeanStore() == null)
+ {
+ throw new IllegalStateException("No bean store available for " + toString());
+ }
+ if (contextual == null)
+ {
+ throw new IllegalArgumentException("Must provide a contextual to get");
+ }
+ String id = getId(contextual);
+ ContextualInstance<T> beanInstance = getBeanStore().get(id);
+ if (beanInstance != null)
+ {
+ return beanInstance.getInstance();
+ }
+ else if (creationalContext != null)
+ {
+ boolean needCreationLock = isCreationLockRequired();
+ try
+ {
+ if (needCreationLock)
+ {
+ creationLock.lock();
+ beanInstance = getBeanStore().get(id);
+ if (beanInstance != null)
+ {
+ return beanInstance.getInstance();
+ }
+ }
+ T instance = contextual.create(creationalContext);
+ if (instance != null)
+ {
+ beanInstance = new SerializableContextualInstance<Contextual<T>, T>(contextual, instance, creationalContext);
+ getBeanStore().put(id, beanInstance);
+ }
+ return instance;
+ }
+ finally
+ {
+ if (needCreationLock)
+ {
+ creationLock.unlock();
+ }
+ }
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public <T> T get(Contextual<T> contextual)
+ {
+ return get(contextual, null);
+ }
+
+ private <T> void destroy(String id)
+ {
+ log.trace("Destroying " + id);
+ if (getBeanStore() == null)
+ {
+ throw new IllegalStateException("No bean store available for " + toString());
+ }
+ ContextualInstance<T> beanInstance = getBeanStore().get(id);
+ beanInstance.getContextual().destroy(beanInstance.getInstance(), beanInstance.getCreationalContext());
+ }
+
+
+ /**
+ * Destroys the context
+ */
+ public void destroy()
+ {
+ log.trace("Destroying context");
+ if (getBeanStore() == null)
+ {
+ throw new IllegalStateException("No bean store available for " + toString());
+ }
+ for (String id : getBeanStore().getContextualIds())
+ {
+ destroy(id);
+ }
+ getBeanStore().clear();
+ }
+
+ /**
+ * A method that returns the actual bean store implementation
+ *
+ * @return The bean store
+ */
+ protected abstract BeanStore getBeanStore();
+
+ /**
+ * If Context need to inhibit concurrent instance creation then true, else false.
+ * @return need lock
+ */
+ protected abstract boolean isCreationLockRequired();
+
+
+ @Override
+ public void cleanup()
+ {
+ super.cleanup();
+ if (getBeanStore() != null)
+ {
+ getBeanStore().clear();
+ }
+ }
+
+ protected static <T> Contextual<T> getContextual(String id)
+ {
+ return Container.instance().deploymentServices().get(ContextualStore.class).<Contextual<T>, T>getContextual(id);
+ }
+
+ protected static String getId(Contextual<?> contextual)
+ {
+ return Container.instance().deploymentServices().get(ContextualStore.class).putIfAbsent(contextual);
+ }
+
+}
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/context/AbstractThreadLocalMapContext.java (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/context/AbstractThreadLocalMapContext.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/weld/context/AbstractThreadLocalMapContext.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/context/AbstractThreadLocalMapContext.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -0,0 +1,72 @@
+/*
+ * 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.context;
+
+import java.lang.annotation.Annotation;
+
+import org.jboss.weld.context.api.BeanStore;
+
+/**
+ * Abstract base class for representing contexts with thread local bean storage
+ *
+ * @author Pete Muir
+ */
+public abstract class AbstractThreadLocalMapContext extends AbstractMapContext
+{
+ private final ThreadLocal<BeanStore> beanStore;
+
+ public AbstractThreadLocalMapContext(Class<? extends Annotation> scopeType)
+ {
+ super(scopeType);
+ this.beanStore = new ThreadLocal<BeanStore>();
+ }
+
+ /**
+ * Gets the bean store
+ *
+ * @returns The bean store
+ */
+ @Override
+ public BeanStore getBeanStore()
+ {
+ return beanStore.get();
+ }
+
+ /**
+ * Sets the bean store
+ *
+ * @param beanStore The bean store
+ */
+ public void setBeanStore(BeanStore beanStore)
+ {
+ this.beanStore.set(beanStore);
+ }
+
+ @Override
+ protected boolean isCreationLockRequired()
+ {
+ return true;
+ }
+
+ @Override
+ public void cleanup()
+ {
+ super.cleanup();
+ beanStore.remove();
+ }
+
+}
\ No newline at end of file
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/context/ApplicationContext.java (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/context/ApplicationContext.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/weld/context/ApplicationContext.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/context/ApplicationContext.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -0,0 +1,13 @@
+package org.jboss.weld.context;
+
+import javax.enterprise.context.ApplicationScoped;
+
+public class ApplicationContext extends AbstractApplicationContext
+{
+
+ public ApplicationContext()
+ {
+ super(ApplicationScoped.class);
+ }
+
+}
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/context/ContextLifecycle.java (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/context/ContextLifecycle.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/weld/context/ContextLifecycle.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/context/ContextLifecycle.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -0,0 +1,178 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
+ *
+ * Use is subject to license terms.
+ *
+ * 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.context;
+
+import org.jboss.weld.Container;
+import org.jboss.weld.bootstrap.api.Lifecycle;
+import org.jboss.weld.bootstrap.api.Service;
+import org.jboss.weld.context.api.BeanStore;
+import org.jboss.weld.context.api.helpers.ConcurrentHashMapBeanStore;
+import org.jboss.weld.log.LogProvider;
+import org.jboss.weld.log.Logging;
+
+/**
+ * An implementation of the Web Beans lifecycle that supports restoring
+ * and destroying all the built in contexts
+ *
+ * @author Pete Muir
+ *
+ */
+public class ContextLifecycle implements Lifecycle, Service
+{
+
+ public static final LogProvider log = Logging.getLogProvider(ContextLifecycle.class);
+
+ private final AbstractApplicationContext applicationContext;
+ private final AbstractApplicationContext singletonContext;
+ private final SessionContext sessionContext;
+ private final ConversationContext conversationContext;
+ private final RequestContext requestContext;
+ private final DependentContext dependentContext;
+
+ public ContextLifecycle(AbstractApplicationContext applicationContext, AbstractApplicationContext singletonContext, SessionContext sessionContext, ConversationContext conversationContext, RequestContext requestContext, DependentContext dependentContext)
+ {
+ this.applicationContext = applicationContext;
+ this.singletonContext = singletonContext;
+ this.sessionContext = sessionContext;
+ this.conversationContext = conversationContext;
+ this.requestContext = requestContext;
+ this.dependentContext = dependentContext;
+ }
+
+ public void restoreSession(String id, BeanStore sessionBeanStore)
+ {
+ log.trace("Restoring session " + id);
+ sessionContext.setBeanStore(sessionBeanStore);
+ sessionContext.setActive(true);
+ }
+
+ public void endSession(String id, BeanStore sessionBeanStore)
+ {
+ log.trace("Ending session " + id);
+ sessionContext.setActive(true);
+ sessionContext.destroy();
+ sessionContext.setBeanStore(null);
+ sessionContext.setActive(false);
+ }
+
+ public void beginRequest(String id, BeanStore requestBeanStore)
+ {
+ log.trace("Starting request " + id);
+ requestContext.setBeanStore(requestBeanStore);
+ requestContext.setActive(true);
+ dependentContext.setActive(true);
+ }
+
+ public void endRequest(String id, BeanStore requestBeanStore)
+ {
+ log.trace("Ending request " + id);
+ requestContext.setBeanStore(requestBeanStore);
+ dependentContext.setActive(false);
+ requestContext.destroy();
+ requestContext.setActive(false);
+ requestContext.setBeanStore(null);
+ }
+
+ public boolean isRequestActive()
+ {
+ return singletonContext.isActive() && applicationContext.isActive() && requestContext.isActive() && dependentContext.isActive();
+ }
+
+ public boolean isApplicationActive()
+ {
+ return singletonContext.isActive() && applicationContext.isActive() && dependentContext.isActive();
+ }
+
+ public boolean isConversationActive()
+ {
+ return singletonContext.isActive() && applicationContext.isActive() && sessionContext.isActive() && conversationContext.isActive() && dependentContext.isActive();
+ }
+
+ public boolean isSessionActive()
+ {
+ return singletonContext.isActive() && applicationContext.isActive() && sessionContext.isActive() && dependentContext.isActive();
+ }
+
+
+ public void beginApplication(BeanStore applicationBeanStore)
+ {
+ log.trace("Starting application");
+ applicationContext.setBeanStore(applicationBeanStore);
+ applicationContext.setActive(true);
+ singletonContext.setBeanStore(new ConcurrentHashMapBeanStore());
+ singletonContext.setActive(true);
+ }
+
+ public void endApplication()
+ {
+ log.trace("Ending application");
+ applicationContext.destroy();
+ applicationContext.setActive(false);
+ applicationContext.setBeanStore(null);
+ singletonContext.destroy();
+ singletonContext.setActive(false);
+ singletonContext.setBeanStore(null);
+ Container.instance().cleanup();
+ }
+
+ public void cleanup()
+ {
+ dependentContext.cleanup();
+ requestContext.cleanup();
+ conversationContext.cleanup();
+ sessionContext.cleanup();
+ singletonContext.cleanup();
+ applicationContext.cleanup();
+ }
+
+ public AbstractApplicationContext getApplicationContext()
+ {
+ return applicationContext;
+ }
+
+ public AbstractApplicationContext getSingletonContext()
+ {
+ return singletonContext;
+ }
+
+ public SessionContext getSessionContext()
+ {
+ return sessionContext;
+ }
+
+ public ConversationContext getConversationContext()
+ {
+ return conversationContext;
+ }
+
+ public RequestContext getRequestContext()
+ {
+ return requestContext;
+ }
+
+ public DependentContext getDependentContext()
+ {
+ return dependentContext;
+ }
+
+}
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/context/ConversationContext.java (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/context/ConversationContext.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/weld/context/ConversationContext.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/context/ConversationContext.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -0,0 +1,56 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
+ *
+ * Use is subject to license terms.
+ *
+ * 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.context;
+
+import javax.enterprise.context.ConversationScoped;
+
+import org.jboss.weld.log.LogProvider;
+import org.jboss.weld.log.Logging;
+
+/**
+ * The conversation context
+ *
+ * @author Nicklas Karlsson
+ */
+public class ConversationContext extends AbstractThreadLocalMapContext
+{
+ private static LogProvider log = Logging.getLogProvider(ConversationContext.class);
+
+ /**
+ * Constructor
+ */
+ public ConversationContext()
+ {
+ super(ConversationScoped.class);
+ log.trace("Created conversation context");
+ }
+
+ @Override
+ public String toString()
+ {
+ String active = isActive() ? "Active " : "Inactive ";
+ String beanStoreInfo = getBeanStore() == null ? "" : getBeanStore().toString();
+ return active + "conversation context " + beanStoreInfo;
+ }
+
+}
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/context/CreationalContextImpl.java (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/context/CreationalContextImpl.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/weld/context/CreationalContextImpl.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/context/CreationalContextImpl.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -0,0 +1,83 @@
+/*
+ * 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.context;
+
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.enterprise.context.spi.Contextual;
+import javax.enterprise.context.spi.CreationalContext;
+
+public class CreationalContextImpl<T> implements CreationalContext<T>, WBCreationalContext<T>, Serializable
+{
+
+ private static final long serialVersionUID = 7375854583908262422L;
+
+ // Only needed for creation, by the time it's serialized we don't need it
+ private final transient Map<Contextual<?>, Object> incompleteInstances;
+ private final transient Contextual<T> contextual;
+
+ private final DependentInstancesStore dependentInstancesStore;
+
+ private final DependentInstancesStore parentDependentInstancesStore;
+
+ public CreationalContextImpl(Contextual<T> contextual)
+ {
+ this(contextual, new HashMap<Contextual<?>, Object>(), new DependentInstancesStore());
+ }
+
+ private CreationalContextImpl(Contextual<T> contextual, Map<Contextual<?>, Object> incompleteInstances, DependentInstancesStore parentDependentInstancesStore)
+ {
+ this.incompleteInstances = incompleteInstances;
+ this.contextual = contextual;
+ this.dependentInstancesStore = new DependentInstancesStore();
+ this.parentDependentInstancesStore = parentDependentInstancesStore;
+ }
+
+ public void push(T incompleteInstance)
+ {
+ incompleteInstances.put(contextual, incompleteInstance);
+ }
+
+ public <S> WBCreationalContext<S> getCreationalContext(Contextual<S> Contextual)
+ {
+ return new CreationalContextImpl<S>(Contextual, new HashMap<Contextual<?>, Object>(incompleteInstances), dependentInstancesStore);
+ }
+
+ public <S> S getIncompleteInstance(Contextual<S> bean)
+ {
+ return (S) incompleteInstances.get(bean);
+ }
+
+ public boolean containsIncompleteInstance(Contextual<?> bean)
+ {
+ return incompleteInstances.containsKey(bean);
+ }
+
+ public DependentInstancesStore getParentDependentInstancesStore()
+ {
+ return parentDependentInstancesStore;
+ }
+
+ public void release()
+ {
+ dependentInstancesStore.destroyDependentInstances();
+ incompleteInstances.clear();
+ }
+
+}
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/context/DependentContext.java (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/context/DependentContext.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/weld/context/DependentContext.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/context/DependentContext.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -0,0 +1,94 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
+ *
+ * Use is subject to license terms.
+ *
+ * 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.context;
+
+import javax.enterprise.context.ContextNotActiveException;
+import javax.enterprise.context.Dependent;
+import javax.enterprise.context.spi.Contextual;
+import javax.enterprise.context.spi.CreationalContext;
+
+import org.jboss.weld.context.api.ContextualInstance;
+
+/**
+ * The dependent context
+ *
+ * @author Nicklas Karlsson
+ */
+public class DependentContext extends AbstractContext
+{
+
+ /**
+ * Constructor
+ */
+ public DependentContext()
+ {
+ super(Dependent.class);
+ }
+
+ /**
+ * Overridden method always creating a new instance
+ *
+ * @param contextual The bean to create
+ * @param create Should a new one be created
+ */
+ public <T> T get(Contextual<T> contextual, CreationalContext<T> creationalContext)
+ {
+ if (!isActive())
+ {
+ throw new ContextNotActiveException();
+ }
+ if (creationalContext != null)
+ {
+ T instance = contextual.create(creationalContext);
+ if (creationalContext instanceof WBCreationalContext<?>)
+ {
+ WBCreationalContext<T> creationalContextImpl = (WBCreationalContext<T>) creationalContext;
+ ContextualInstance<T> beanInstance = new SerializableContextualInstance<Contextual<T>, T>(contextual, instance, creationalContext);
+ creationalContextImpl.getParentDependentInstancesStore().addDependentInstance(beanInstance);
+ }
+ return instance;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public <T> T get(Contextual<T> contextual)
+ {
+ return get(contextual, null);
+ }
+
+ @Override
+ public String toString()
+ {
+ return "dependent context";
+ }
+
+ @Override
+ public boolean isActive()
+ {
+ return true;
+ }
+
+}
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/context/DependentInstancesStore.java (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/context/DependentInstancesStore.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/weld/context/DependentInstancesStore.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/context/DependentInstancesStore.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -0,0 +1,87 @@
+/*
+ * 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.context;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.jboss.weld.context.api.ContextualInstance;
+import org.jboss.weld.log.Log;
+import org.jboss.weld.log.Logging;
+
+/**
+ * A store for dependent instances created under a given key
+ *
+ * @author Nicklas Karlsson
+ */
+public class DependentInstancesStore implements Serializable
+{
+ private static final long serialVersionUID = -2349574791148336833L;
+
+ private static Log log = Logging.getLog(DependentInstancesStore.class);
+
+ // A object -> List of contextual instances mapping
+ private List<ContextualInstance<?>> dependentInstances;
+
+ /**
+ * Creates a new DependentInstancesStore
+ */
+ public DependentInstancesStore()
+ {
+ dependentInstances = Collections.synchronizedList(new ArrayList<ContextualInstance<?>>());
+ }
+
+ /**
+ * Adds a dependent instance under a given key
+ *
+ * @param key The key to store the instance under
+ * @param contextualInstance The instance to store
+ */
+ public <T> void addDependentInstance(ContextualInstance<T> contextualInstance)
+ {
+ log.trace("Registered dependent instance #0", contextualInstance);
+ dependentInstances.add(contextualInstance);
+ }
+
+ /**
+ * Destroys all dependent objects
+ *
+ * @param key The key to remove
+ */
+ public void destroyDependentInstances()
+ {
+ log.trace("Destroying dependent instances");
+ for (ContextualInstance<?> injectedInstance : dependentInstances)
+ {
+ destroy(injectedInstance);
+ }
+ }
+
+ private static <T> void destroy(ContextualInstance<T> beanInstance)
+ {
+ beanInstance.getContextual().destroy(beanInstance.getInstance(), beanInstance.getCreationalContext());
+ }
+
+ @Override
+ public String toString()
+ {
+ return "Dependent Instances: " + dependentInstances;
+ }
+
+}
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/context/ForwardingContextual.java (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/context/ForwardingContextual.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/weld/context/ForwardingContextual.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/context/ForwardingContextual.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -0,0 +1,40 @@
+package org.jboss.weld.context;
+
+import javax.enterprise.context.spi.Contextual;
+import javax.enterprise.context.spi.CreationalContext;
+
+public abstract class ForwardingContextual<T> implements Contextual<T>
+{
+
+ protected abstract Contextual<T> delegate();
+
+ public T create(CreationalContext<T> creationalContext)
+ {
+ return delegate().create(creationalContext);
+ }
+
+ public void destroy(T instance, CreationalContext<T> creationalContext)
+ {
+ delegate().destroy(instance, creationalContext);
+ }
+
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ return this == obj || delegate().equals(obj);
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return delegate().hashCode();
+ }
+
+ @Override
+ public String toString()
+ {
+ return delegate().toString();
+ }
+
+}
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/context/ForwardingWBCreationalContext.java (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/context/ForwardingWBCreationalContext.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/weld/context/ForwardingWBCreationalContext.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/context/ForwardingWBCreationalContext.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -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.context;
+
+import javax.enterprise.context.spi.Contextual;
+
+
+/**
+ * @author pmuir
+ *
+ */
+public abstract class ForwardingWBCreationalContext<T> implements WBCreationalContext<T>
+{
+
+ protected abstract WBCreationalContext<T> delegate();
+
+ public void push(T incompleteInstance)
+ {
+ delegate().push(incompleteInstance);
+ }
+
+ public void release()
+ {
+ delegate().release();
+ }
+
+ public boolean containsIncompleteInstance(Contextual<?> bean)
+ {
+ return delegate().containsIncompleteInstance(bean);
+ }
+
+ public <S> WBCreationalContext<S> getCreationalContext(Contextual<S> Contextual)
+ {
+ return delegate().getCreationalContext(Contextual);
+ }
+
+ public <S> S getIncompleteInstance(Contextual<S> bean)
+ {
+ return delegate().getIncompleteInstance(bean);
+ }
+
+ public DependentInstancesStore getParentDependentInstancesStore()
+ {
+ return delegate().getParentDependentInstancesStore();
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ return delegate().equals(obj);
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return delegate().hashCode();
+ }
+
+ @Override
+ public String toString()
+ {
+ return delegate().toString();
+ }
+
+}
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/context/RequestContext.java (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/context/RequestContext.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/weld/context/RequestContext.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/context/RequestContext.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -0,0 +1,57 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
+ *
+ * Use is subject to license terms.
+ *
+ * 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.context;
+
+import javax.enterprise.context.RequestScoped;
+
+/**
+ * The request context
+ *
+ * @author Nicklas Karlsson
+ */
+public class RequestContext extends AbstractThreadLocalMapContext
+{
+
+ /**
+ * Constructor
+ */
+ public RequestContext()
+ {
+ super(RequestScoped.class);
+ }
+
+ @Override
+ public String toString()
+ {
+ String active = isActive() ? "Active " : "Inactive ";
+ String beanStoreInfo = getBeanStore() == null ? "" : getBeanStore().toString();
+ return active + "request context " + beanStoreInfo;
+ }
+
+ @Override
+ protected boolean isCreationLockRequired()
+ {
+ return false;
+ }
+
+}
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/context/SerializableContextual.java (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/context/SerializableContextual.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/weld/context/SerializableContextual.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/context/SerializableContextual.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -0,0 +1,94 @@
+package org.jboss.weld.context;
+
+import java.io.Serializable;
+
+import javax.enterprise.context.spi.Contextual;
+
+import org.jboss.weld.Container;
+import org.jboss.weld.ContextualStore;
+
+/**
+ * A serializable version of contextual that knows how to restore the
+ * original bean if necessary
+ *
+ * @author pmuir
+ *
+ */
+public class SerializableContextual<C extends Contextual<I>, I> extends ForwardingContextual<I> implements Serializable
+{
+
+ @Override
+ protected Contextual<I> delegate()
+ {
+ return get();
+ }
+
+ private static final long serialVersionUID = 9161034819867283482L;
+
+ // A directly serializable contextual
+ private C serialiazable;
+
+ // A cached, transient version of the contextual
+ private transient C cached;
+
+ // the id of a non-serializable, passivation capable contextual
+ private String id;
+
+ public SerializableContextual(C contextual)
+ {
+ if (contextual instanceof Serializable)
+ {
+ // the contextual is serializable, so we can just use it
+ this.serialiazable = contextual;
+ }
+ else
+ {
+ // otherwise, generate an id (may not be portable between container instances
+ this.id = Container.instance().deploymentServices().get(ContextualStore.class).putIfAbsent(contextual);
+ }
+ // cache the contextual
+ this.cached = contextual;
+ }
+
+ public C get()
+ {
+ if (cached == null)
+ {
+ loadContextual();
+ }
+ return cached;
+ }
+
+ private void loadContextual()
+ {
+ if (serialiazable != null)
+ {
+ this.cached = serialiazable;
+ }
+ else if (id != null)
+ {
+ this.cached = Container.instance().deploymentServices().get(ContextualStore.class).<C, I>getContextual(id);
+ }
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ // if the arriving object is also a SerializableContextual, then unwrap it
+ if (obj instanceof SerializableContextual<?, ?>)
+ {
+ return delegate().equals(((SerializableContextual<?, ?>) obj).get());
+ }
+ else
+ {
+ return delegate().equals(obj);
+ }
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return delegate().hashCode();
+ }
+
+}
\ No newline at end of file
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/context/SerializableContextualInstance.java (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/context/SerializableContextualInstance.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/weld/context/SerializableContextualInstance.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/context/SerializableContextualInstance.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -0,0 +1,63 @@
+/*
+ * 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.context;
+
+import java.io.Serializable;
+
+import javax.enterprise.context.spi.Contextual;
+import javax.enterprise.context.spi.CreationalContext;
+
+import org.jboss.weld.context.api.ContextualInstance;
+
+public class SerializableContextualInstance<C extends Contextual<I>, I> implements ContextualInstance<I>, Serializable
+{
+
+ private static final long serialVersionUID = -6366271037267396256L;
+
+ private final SerializableContextual<C, I> contextual;
+ private final I instance;
+ private final CreationalContext<I> creationalContext;
+
+ public SerializableContextualInstance(C contextual, I instance, CreationalContext<I> creationalContext)
+ {
+ this.contextual = new SerializableContextual<C, I>(contextual);
+ this.instance = instance;
+ this.creationalContext = creationalContext;
+ }
+
+ public SerializableContextual<C, I> getContextual()
+ {
+ return contextual;
+ }
+
+ public I getInstance()
+ {
+ return instance;
+ }
+
+ public CreationalContext<I> getCreationalContext()
+ {
+ return creationalContext;
+ }
+
+ @Override
+ public String toString()
+ {
+ return "Bean: " + contextual + "; Instance: " + instance + "; CreationalContext: " + creationalContext;
+ }
+
+}
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/context/SessionContext.java (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/context/SessionContext.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/weld/context/SessionContext.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/context/SessionContext.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -0,0 +1,69 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
+ *
+ * Use is subject to license terms.
+ *
+ * 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.context;
+
+import javax.enterprise.context.SessionScoped;
+
+import org.jboss.weld.context.api.BeanStore;
+import org.jboss.weld.log.LogProvider;
+import org.jboss.weld.log.Logging;
+
+/**
+ * The session context
+ *
+ * @author Nicklas Karlsson
+ */
+public class SessionContext extends AbstractThreadLocalMapContext
+{
+ private static LogProvider log = Logging.getLogProvider(SessionContext.class);
+
+ /**
+ * Constructor
+ */
+ public SessionContext()
+ {
+ super(SessionScoped.class);
+ log.trace("Created session context");
+ }
+
+ @Override
+ public String toString()
+ {
+ String active = isActive() ? "Active " : "Inactive ";
+ String beanStoreInfo = getBeanStore() == null ? "" : getBeanStore().toString();
+ return active + "session context " + beanStoreInfo;
+ }
+
+ @Override
+ public void setActive(boolean active)
+ {
+ super.setActive(active);
+ }
+
+ @Override
+ public void setBeanStore(BeanStore beanStore)
+ {
+ super.setBeanStore(beanStore);
+ }
+
+}
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/context/SingletonContext.java (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/context/SingletonContext.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/weld/context/SingletonContext.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/context/SingletonContext.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -0,0 +1,13 @@
+package org.jboss.weld.context;
+
+import javax.inject.Singleton;
+
+public class SingletonContext extends AbstractApplicationContext
+{
+
+ public SingletonContext()
+ {
+ super(Singleton.class);
+ }
+
+}
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/context/WBCreationalContext.java (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/context/WBCreationalContext.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/weld/context/WBCreationalContext.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/context/WBCreationalContext.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -0,0 +1,42 @@
+/*
+ * 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.context;
+
+import javax.enterprise.context.spi.Contextual;
+import javax.enterprise.context.spi.CreationalContext;
+
+/**
+ * @author pmuir
+ *
+ * @param <T>
+ */
+public interface WBCreationalContext<T> extends CreationalContext<T>
+{
+
+ public abstract void push(T incompleteInstance);
+
+ public abstract <S> WBCreationalContext<S> getCreationalContext(Contextual<S> Contextual);
+
+ public abstract <S> S getIncompleteInstance(Contextual<S> bean);
+
+ public abstract boolean containsIncompleteInstance(Contextual<?> bean);
+
+ public abstract DependentInstancesStore getParentDependentInstancesStore();
+
+ public abstract void release();
+
+}
\ No newline at end of file
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/context/beanstore (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/context/beanstore)
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/context/beanstore/AbstractAttributeBackedBeanStore.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/context/beanstore/AbstractAttributeBackedBeanStore.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/context/beanstore/AbstractAttributeBackedBeanStore.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,19 +14,19 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.context.beanstore;
+package org.jboss.weld.context.beanstore;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Enumeration;
import java.util.List;
-import org.jboss.webbeans.context.api.BeanStore;
-import org.jboss.webbeans.context.api.ContextualInstance;
-import org.jboss.webbeans.log.LogProvider;
-import org.jboss.webbeans.log.Logging;
-import org.jboss.webbeans.util.Names;
-import org.jboss.webbeans.util.collections.EnumerationList;
+import org.jboss.weld.context.api.BeanStore;
+import org.jboss.weld.context.api.ContextualInstance;
+import org.jboss.weld.log.LogProvider;
+import org.jboss.weld.log.Logging;
+import org.jboss.weld.util.Names;
+import org.jboss.weld.util.collections.EnumerationList;
/**
* Provides common BeanStore operations
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/context/beanstore/HashMapBeanStore.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/context/beanstore/HashMapBeanStore.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/context/beanstore/HashMapBeanStore.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.jboss.webbeans.context.beanstore;
+package org.jboss.weld.context.beanstore;
import java.io.Serializable;
import java.util.HashMap;
@@ -23,8 +23,8 @@
import javax.enterprise.context.spi.Contextual;
-import org.jboss.webbeans.context.api.ContextualInstance;
-import org.jboss.webbeans.context.api.helpers.AbstractMapBackedBeanStore;
+import org.jboss.weld.context.api.ContextualInstance;
+import org.jboss.weld.context.api.helpers.AbstractMapBackedBeanStore;
/**
* A BeanStore that uses a HashMap as backing storage
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/context/beanstore/NamingScheme.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/context/beanstore/NamingScheme.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/context/beanstore/NamingScheme.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.context.beanstore;
+package org.jboss.weld.context.beanstore;
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/conversation (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/conversation)
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/conversation/AbstractConversationManager.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/conversation/AbstractConversationManager.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/conversation/AbstractConversationManager.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -20,7 +20,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.conversation;
+package org.jboss.weld.conversation;
import java.util.Collections;
import java.util.HashSet;
@@ -33,12 +33,12 @@
import javax.enterprise.inject.Any;
import javax.inject.Inject;
-import org.jboss.webbeans.Container;
-import org.jboss.webbeans.context.ContextLifecycle;
-import org.jboss.webbeans.context.ConversationContext;
-import org.jboss.webbeans.context.api.BeanStore;
-import org.jboss.webbeans.log.LogProvider;
-import org.jboss.webbeans.log.Logging;
+import org.jboss.weld.Container;
+import org.jboss.weld.context.ContextLifecycle;
+import org.jboss.weld.context.ConversationContext;
+import org.jboss.weld.context.api.BeanStore;
+import org.jboss.weld.log.LogProvider;
+import org.jboss.weld.log.Logging;
/**
* An abstract conversation manager
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/conversation/ConversationEntry.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/conversation/ConversationEntry.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/conversation/ConversationEntry.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,16 +14,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.conversation;
+package org.jboss.weld.conversation;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.ReentrantLock;
-import org.jboss.webbeans.context.ConversationContext;
-import org.jboss.webbeans.context.api.BeanStore;
-import org.jboss.webbeans.log.LogProvider;
-import org.jboss.webbeans.log.Logging;
+import org.jboss.weld.context.ConversationContext;
+import org.jboss.weld.context.api.BeanStore;
+import org.jboss.weld.log.LogProvider;
+import org.jboss.weld.log.Logging;
/**
* Represents a long-running conversation entry
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/conversation/ConversationImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/conversation/ConversationImpl.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/conversation/ConversationImpl.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.conversation;
+package org.jboss.weld.conversation;
import java.io.Serializable;
@@ -24,8 +24,8 @@
import javax.inject.Inject;
import javax.inject.Named;
-import org.jboss.webbeans.log.LogProvider;
-import org.jboss.webbeans.log.Logging;
+import org.jboss.weld.log.LogProvider;
+import org.jboss.weld.log.Logging;
/**
* The current conversation implementation
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/conversation/JavaSEConversationTerminator.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/conversation/JavaSEConversationTerminator.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/conversation/JavaSEConversationTerminator.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.conversation;
+package org.jboss.weld.conversation;
import java.io.Serializable;
import java.util.concurrent.Executors;
@@ -24,8 +24,8 @@
import javax.enterprise.context.SessionScoped;
-import org.jboss.webbeans.log.LogProvider;
-import org.jboss.webbeans.log.Logging;
+import org.jboss.weld.log.LogProvider;
+import org.jboss.weld.log.Logging;
/**
* A ConversationTerminator implementation using Java SE scheduling
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/conversation/NumericConversationIdGenerator.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/conversation/NumericConversationIdGenerator.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/conversation/NumericConversationIdGenerator.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,15 +14,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.conversation;
+package org.jboss.weld.conversation;
import java.io.Serializable;
import java.util.concurrent.atomic.AtomicInteger;
import javax.enterprise.context.SessionScoped;
-import org.jboss.webbeans.log.LogProvider;
-import org.jboss.webbeans.log.Logging;
+import org.jboss.weld.log.LogProvider;
+import org.jboss.weld.log.Logging;
/**
* A ConversationIdGenerator implementation using running numerical values
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/conversation/ServletConversationManager.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/conversation/ServletConversationManager.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/conversation/ServletConversationManager.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -20,7 +20,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.conversation;
+package org.jboss.weld.conversation;
import java.io.Serializable;
@@ -30,10 +30,10 @@
import javax.inject.Inject;
import javax.servlet.http.HttpSession;
-import org.jboss.webbeans.context.api.BeanStore;
-import org.jboss.webbeans.log.LogProvider;
-import org.jboss.webbeans.log.Logging;
-import org.jboss.webbeans.servlet.ConversationBeanStore;
+import org.jboss.weld.context.api.BeanStore;
+import org.jboss.weld.log.LogProvider;
+import org.jboss.weld.log.Logging;
+import org.jboss.weld.servlet.ConversationBeanStore;
/**
* The HTTP session based conversation manager
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/ejb (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/ejb)
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/ejb/EJBApiAbstraction.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/ejb/EJBApiAbstraction.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/ejb/EJBApiAbstraction.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,13 +14,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.ejb;
+package org.jboss.weld.ejb;
import java.lang.annotation.Annotation;
-import org.jboss.webbeans.bootstrap.api.Service;
-import org.jboss.webbeans.resources.spi.ResourceLoader;
-import org.jboss.webbeans.util.ApiAbstraction;
+import org.jboss.weld.bootstrap.api.Service;
+import org.jboss.weld.resources.spi.ResourceLoader;
+import org.jboss.weld.util.ApiAbstraction;
/**
* Utility class for EJB classes etc. EJB metadata should NOT be inspected here
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/ejb/EjbDescriptors.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/ejb/EjbDescriptors.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/ejb/EjbDescriptors.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.ejb;
+package org.jboss.weld.ejb;
import java.util.Collection;
import java.util.HashMap;
@@ -22,8 +22,8 @@
import java.util.Iterator;
import java.util.Map;
-import org.jboss.webbeans.bootstrap.api.Service;
-import org.jboss.webbeans.ejb.spi.EjbDescriptor;
+import org.jboss.weld.bootstrap.api.Service;
+import org.jboss.weld.ejb.spi.EjbDescriptor;
/**
* EJB descriptors by EJB implementation class or name
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/ejb/InternalEjbDescriptor.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/ejb/InternalEjbDescriptor.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/ejb/InternalEjbDescriptor.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,18 +14,18 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.ejb;
+package org.jboss.weld.ejb;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
-import org.jboss.webbeans.ejb.spi.BusinessInterfaceDescriptor;
-import org.jboss.webbeans.ejb.spi.EjbDescriptor;
-import org.jboss.webbeans.ejb.spi.helpers.ForwardingEjbDescriptor;
-import org.jboss.webbeans.introspector.MethodSignature;
-import org.jboss.webbeans.introspector.jlr.MethodSignatureImpl;
+import org.jboss.weld.ejb.spi.BusinessInterfaceDescriptor;
+import org.jboss.weld.ejb.spi.EjbDescriptor;
+import org.jboss.weld.ejb.spi.helpers.ForwardingEjbDescriptor;
+import org.jboss.weld.introspector.MethodSignature;
+import org.jboss.weld.introspector.jlr.MethodSignatureImpl;
/**
* More powerful version of {@link EjbDescriptor} that exposes Maps for some
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/ejb/SessionBeanInterceptor.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/ejb/SessionBeanInterceptor.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/ejb/SessionBeanInterceptor.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,18 +14,18 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.ejb;
+package org.jboss.weld.ejb;
import java.io.Serializable;
import javax.interceptor.AroundInvoke;
import javax.interceptor.InvocationContext;
-import org.jboss.webbeans.Container;
-import org.jboss.webbeans.bootstrap.api.Lifecycle;
-import org.jboss.webbeans.context.ContextLifecycle;
-import org.jboss.webbeans.context.api.BeanStore;
-import org.jboss.webbeans.context.beanstore.HashMapBeanStore;
+import org.jboss.weld.Container;
+import org.jboss.weld.bootstrap.api.Lifecycle;
+import org.jboss.weld.context.ContextLifecycle;
+import org.jboss.weld.context.api.BeanStore;
+import org.jboss.weld.context.beanstore.HashMapBeanStore;
/**
* Interceptor for ensuring the request context is active during requests to EJBs.
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/el (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/el)
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/el/AbstractWebBeansELResolver.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/el/AbstractWebBeansELResolver.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/el/AbstractWebBeansELResolver.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,9 +14,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.el;
+package org.jboss.weld.el;
-import static org.jboss.webbeans.el.ELCreationalContextStack.getCreationalContextStore;
+import static org.jboss.weld.el.ELCreationalContextStack.getCreationalContextStore;
import java.beans.FeatureDescriptor;
import java.util.Iterator;
@@ -26,7 +26,7 @@
import javax.el.ELResolver;
import javax.enterprise.inject.spi.Bean;
-import org.jboss.webbeans.BeanManagerImpl;
+import org.jboss.weld.BeanManagerImpl;
/**
* An EL-resolver against the named beans
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/el/ELCreationalContext.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/el/ELCreationalContext.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/el/ELCreationalContext.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -1,4 +1,4 @@
-package org.jboss.webbeans.el;
+package org.jboss.weld.el;
import java.util.HashMap;
import java.util.Map;
@@ -7,8 +7,8 @@
import javax.enterprise.context.Dependent;
import javax.enterprise.inject.spi.Bean;
-import org.jboss.webbeans.context.ForwardingWBCreationalContext;
-import org.jboss.webbeans.context.WBCreationalContext;
+import org.jboss.weld.context.ForwardingWBCreationalContext;
+import org.jboss.weld.context.WBCreationalContext;
abstract class ELCreationalContext<T> extends ForwardingWBCreationalContext<T>
{
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/el/ELCreationalContextStack.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/el/ELCreationalContextStack.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/el/ELCreationalContextStack.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -1,4 +1,4 @@
-package org.jboss.webbeans.el;
+package org.jboss.weld.el;
import java.util.Stack;
@@ -6,7 +6,7 @@
import javax.enterprise.context.spi.Contextual;
import javax.enterprise.context.spi.CreationalContext;
-import org.jboss.webbeans.Container;
+import org.jboss.weld.Container;
class ELCreationalContextStack extends Stack<ELCreationalContext<?>>
{
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/el/Namespace.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/el/Namespace.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/el/Namespace.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.el;
+package org.jboss.weld.el;
import java.util.HashMap;
import java.util.Map;
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/el/WebBeansELContextListener.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/el/WebBeansELContextListener.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/el/WebBeansELContextListener.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.el;
+package org.jboss.weld.el;
import javax.el.ELContextEvent;
import javax.el.ELContextListener;
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/el/WebBeansELResolver.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/el/WebBeansELResolver.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/el/WebBeansELResolver.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,11 +14,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.el;
+package org.jboss.weld.el;
import javax.el.ELContext;
-import org.jboss.webbeans.BeanManagerImpl;
+import org.jboss.weld.BeanManagerImpl;
/**
* @author pmuir
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/el/WebBeansExpressionFactory.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/el/WebBeansExpressionFactory.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/el/WebBeansExpressionFactory.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,14 +14,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.el;
+package org.jboss.weld.el;
import javax.el.ELContext;
import javax.el.ExpressionFactory;
import javax.el.MethodExpression;
import javax.el.ValueExpression;
-import org.jboss.webbeans.util.el.ForwardingExpressionFactory;
+import org.jboss.weld.util.el.ForwardingExpressionFactory;
/**
* @author pmuir
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/el/WebBeansMethodExpression.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/el/WebBeansMethodExpression.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/el/WebBeansMethodExpression.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,9 +14,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.el;
+package org.jboss.weld.el;
-import static org.jboss.webbeans.el.ELCreationalContextStack.getCreationalContextStore;
+import static org.jboss.weld.el.ELCreationalContextStack.getCreationalContextStore;
import javax.el.ELContext;
import javax.el.MethodExpression;
@@ -24,8 +24,8 @@
import javax.enterprise.context.spi.Contextual;
import javax.enterprise.context.spi.CreationalContext;
-import org.jboss.webbeans.Container;
-import org.jboss.webbeans.util.el.ForwardingMethodExpression;
+import org.jboss.weld.Container;
+import org.jboss.weld.util.el.ForwardingMethodExpression;
/**
* @author pmuir
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/el/WebBeansValueExpression.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/el/WebBeansValueExpression.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/el/WebBeansValueExpression.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,17 +14,17 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.el;
+package org.jboss.weld.el;
-import static org.jboss.webbeans.el.ELCreationalContextStack.getCreationalContextStore;
+import static org.jboss.weld.el.ELCreationalContextStack.getCreationalContextStore;
import javax.el.ELContext;
import javax.el.ValueExpression;
import javax.enterprise.context.spi.Contextual;
import javax.enterprise.context.spi.CreationalContext;
-import org.jboss.webbeans.Container;
-import org.jboss.webbeans.util.el.ForwardingValueExpression;
+import org.jboss.weld.Container;
+import org.jboss.weld.util.el.ForwardingValueExpression;
/**
* @author pmuir
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/event (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/event)
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/event/AsynchronousTransactionalEventNotification.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/event/AsynchronousTransactionalEventNotification.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/event/AsynchronousTransactionalEventNotification.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,10 +14,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.event;
+package org.jboss.weld.event;
-import org.jboss.webbeans.log.Log;
-import org.jboss.webbeans.log.Logging;
+import org.jboss.weld.log.Log;
+import org.jboss.weld.log.Logging;
/**
* A deferred event notification that will be delivered during the appropriate
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/event/DeferredEventNotification.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/event/DeferredEventNotification.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/event/DeferredEventNotification.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,15 +14,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.event;
+package org.jboss.weld.event;
-import org.jboss.webbeans.Container;
-import org.jboss.webbeans.bootstrap.api.Lifecycle;
-import org.jboss.webbeans.context.ContextLifecycle;
-import org.jboss.webbeans.context.api.BeanStore;
-import org.jboss.webbeans.context.api.helpers.ConcurrentHashMapBeanStore;
-import org.jboss.webbeans.log.Log;
-import org.jboss.webbeans.log.Logging;
+import org.jboss.weld.Container;
+import org.jboss.weld.bootstrap.api.Lifecycle;
+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.log.Log;
+import org.jboss.weld.log.Logging;
/**
* A task that will notify the observer of a specific event at some future time.
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/event/EventImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/event/EventImpl.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/event/EventImpl.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.event;
+package org.jboss.weld.event;
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
@@ -25,10 +25,10 @@
import javax.enterprise.event.Event;
import javax.enterprise.inject.TypeLiteral;
-import org.jboss.webbeans.BeanManagerImpl;
-import org.jboss.webbeans.bean.builtin.facade.AbstractFacade;
-import org.jboss.webbeans.util.Observers;
-import org.jboss.webbeans.util.Strings;
+import org.jboss.weld.BeanManagerImpl;
+import org.jboss.weld.bean.builtin.facade.AbstractFacade;
+import org.jboss.weld.util.Observers;
+import org.jboss.weld.util.Strings;
/**
* Implementation of the Event interface
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/event/ObserverFactory.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/event/ObserverFactory.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/event/ObserverFactory.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,16 +14,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.event;
+package org.jboss.weld.event;
import javax.enterprise.event.Observes;
import javax.enterprise.event.TransactionPhase;
-import org.jboss.webbeans.BeanManagerImpl;
-import org.jboss.webbeans.bean.RIBean;
-import org.jboss.webbeans.introspector.WBMethod;
-import org.jboss.webbeans.introspector.WBParameter;
-import org.jboss.webbeans.transaction.spi.TransactionServices;
+import org.jboss.weld.BeanManagerImpl;
+import org.jboss.weld.bean.RIBean;
+import org.jboss.weld.introspector.WBMethod;
+import org.jboss.weld.introspector.WBParameter;
+import org.jboss.weld.transaction.spi.TransactionServices;
/**
* Basic factory class that produces implicit observers for observer methods.
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/event/ObserverMethodImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/event/ObserverMethodImpl.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/event/ObserverMethodImpl.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.event;
+package org.jboss.weld.event;
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
@@ -36,14 +36,14 @@
import javax.enterprise.inject.spi.ObserverMethod;
import javax.inject.Inject;
-import org.jboss.webbeans.BeanManagerImpl;
-import org.jboss.webbeans.Container;
-import org.jboss.webbeans.DefinitionException;
-import org.jboss.webbeans.bean.RIBean;
-import org.jboss.webbeans.injection.MethodInjectionPoint;
-import org.jboss.webbeans.introspector.WBMethod;
-import org.jboss.webbeans.introspector.WBParameter;
-import org.jboss.webbeans.manager.api.ExecutorServices;
+import org.jboss.weld.BeanManagerImpl;
+import org.jboss.weld.Container;
+import org.jboss.weld.DefinitionException;
+import org.jboss.weld.bean.RIBean;
+import org.jboss.weld.injection.MethodInjectionPoint;
+import org.jboss.weld.introspector.WBMethod;
+import org.jboss.weld.introspector.WBParameter;
+import org.jboss.weld.manager.api.ExecutorServices;
/**
* <p>
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/event/Status.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/event/Status.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/event/Status.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.jboss.webbeans.event;
+package org.jboss.weld.event;
/**
* An enumeration of the possible outcomes for a transaction. This is used
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/event/TransactionSynchronizedRunnable.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/event/TransactionSynchronizedRunnable.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/event/TransactionSynchronizedRunnable.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.event;
+package org.jboss.weld.event;
import static javax.transaction.Status.STATUS_COMMITTED;
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/event/TransactionalObserverMethodImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/event/TransactionalObserverMethodImpl.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/event/TransactionalObserverMethodImpl.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,15 +14,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.event;
+package org.jboss.weld.event;
import javax.enterprise.event.TransactionPhase;
import javax.transaction.Synchronization;
-import org.jboss.webbeans.BeanManagerImpl;
-import org.jboss.webbeans.bean.RIBean;
-import org.jboss.webbeans.introspector.WBMethod;
-import org.jboss.webbeans.transaction.spi.TransactionServices;
+import org.jboss.weld.BeanManagerImpl;
+import org.jboss.weld.bean.RIBean;
+import org.jboss.weld.introspector.WBMethod;
+import org.jboss.weld.transaction.spi.TransactionServices;
/**
* @author David Allen
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/injection (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/injection)
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/injection/ConstructorInjectionPoint.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/ConstructorInjectionPoint.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/injection/ConstructorInjectionPoint.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,9 +14,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.injection;
+package org.jboss.weld.injection;
-import static org.jboss.webbeans.injection.Exceptions.rethrowException;
+import static org.jboss.weld.injection.Exceptions.rethrowException;
import java.lang.annotation.Annotation;
import java.lang.reflect.Constructor;
@@ -34,10 +34,10 @@
import javax.enterprise.inject.spi.Bean;
import javax.enterprise.inject.spi.Decorator;
-import org.jboss.webbeans.BeanManagerImpl;
-import org.jboss.webbeans.introspector.ForwardingWBConstructor;
-import org.jboss.webbeans.introspector.WBConstructor;
-import org.jboss.webbeans.introspector.WBParameter;
+import org.jboss.weld.BeanManagerImpl;
+import org.jboss.weld.introspector.ForwardingWBConstructor;
+import org.jboss.weld.introspector.WBConstructor;
+import org.jboss.weld.introspector.WBParameter;
public class ConstructorInjectionPoint<T> extends ForwardingWBConstructor<T> implements WBInjectionPoint<T, Constructor<T>>
{
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/injection/Exceptions.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/Exceptions.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/injection/Exceptions.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.injection;
+package org.jboss.weld.injection;
import java.lang.reflect.InvocationTargetException;
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/injection/FieldInjectionPoint.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/FieldInjectionPoint.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/injection/FieldInjectionPoint.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,9 +14,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.injection;
+package org.jboss.weld.injection;
-import static org.jboss.webbeans.injection.Exceptions.rethrowException;
+import static org.jboss.weld.injection.Exceptions.rethrowException;
import java.lang.annotation.Annotation;
import java.lang.reflect.Field;
@@ -30,9 +30,9 @@
import javax.enterprise.inject.spi.Bean;
import javax.enterprise.inject.spi.Decorator;
-import org.jboss.webbeans.BeanManagerImpl;
-import org.jboss.webbeans.introspector.ForwardingWBField;
-import org.jboss.webbeans.introspector.WBField;
+import org.jboss.weld.BeanManagerImpl;
+import org.jboss.weld.introspector.ForwardingWBField;
+import org.jboss.weld.introspector.WBField;
public class FieldInjectionPoint<T, X> extends ForwardingWBField<T, X> implements WBInjectionPoint<T, Field>
{
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/injection/InjectionContextImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/InjectionContextImpl.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/injection/InjectionContextImpl.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,13 +14,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.injection;
+package org.jboss.weld.injection;
import javax.enterprise.inject.spi.InjectionTarget;
-import org.jboss.webbeans.BeanManagerImpl;
-import org.jboss.webbeans.injection.spi.InjectionContext;
-import org.jboss.webbeans.injection.spi.InjectionServices;
+import org.jboss.weld.BeanManagerImpl;
+import org.jboss.weld.injection.spi.InjectionContext;
+import org.jboss.weld.injection.spi.InjectionServices;
/**
* @author pmuir
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/injection/MethodInjectionPoint.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/MethodInjectionPoint.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/injection/MethodInjectionPoint.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,9 +14,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.injection;
+package org.jboss.weld.injection;
-import static org.jboss.webbeans.injection.Exceptions.rethrowException;
+import static org.jboss.weld.injection.Exceptions.rethrowException;
import java.lang.annotation.Annotation;
import java.lang.reflect.InvocationTargetException;
@@ -34,10 +34,10 @@
import javax.enterprise.inject.spi.Bean;
import javax.enterprise.inject.spi.Decorator;
-import org.jboss.webbeans.BeanManagerImpl;
-import org.jboss.webbeans.introspector.ForwardingWBMethod;
-import org.jboss.webbeans.introspector.WBMethod;
-import org.jboss.webbeans.introspector.WBParameter;
+import org.jboss.weld.BeanManagerImpl;
+import org.jboss.weld.introspector.ForwardingWBMethod;
+import org.jboss.weld.introspector.WBMethod;
+import org.jboss.weld.introspector.WBParameter;
public class MethodInjectionPoint<T, X> extends ForwardingWBMethod<T, X> implements WBInjectionPoint<T, Method>
{
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/injection/ParameterInjectionPoint.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/ParameterInjectionPoint.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/injection/ParameterInjectionPoint.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.injection;
+package org.jboss.weld.injection;
import java.lang.annotation.Annotation;
import java.lang.reflect.Member;
@@ -27,9 +27,9 @@
import javax.enterprise.inject.spi.Bean;
import javax.enterprise.inject.spi.Decorator;
-import org.jboss.webbeans.BeanManagerImpl;
-import org.jboss.webbeans.introspector.ForwardingWBParameter;
-import org.jboss.webbeans.introspector.WBParameter;
+import org.jboss.weld.BeanManagerImpl;
+import org.jboss.weld.introspector.ForwardingWBParameter;
+import org.jboss.weld.introspector.WBParameter;
public class ParameterInjectionPoint<T, X> extends ForwardingWBParameter<T, X> implements WBInjectionPoint<T, Object>
{
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/injection/WBInjectionPoint.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/WBInjectionPoint.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/injection/WBInjectionPoint.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,11 +14,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.injection;
+package org.jboss.weld.injection;
import javax.enterprise.inject.spi.InjectionPoint;
-import org.jboss.webbeans.introspector.WBAnnotated;
+import org.jboss.weld.introspector.WBAnnotated;
public interface WBInjectionPoint<T, S> extends InjectionPoint, WBAnnotated<T, S>
{
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/introspector/AnnotationStore.java (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/AnnotationStore.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/weld/introspector/AnnotationStore.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/introspector/AnnotationStore.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -0,0 +1,288 @@
+/*
+ * 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.introspector;
+
+import static org.jboss.weld.introspector.WBAnnotated.MAPPED_METAANNOTATIONS;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.AnnotatedElement;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import javax.inject.Qualifier;
+
+import org.jboss.weld.literal.DefaultLiteral;
+import org.jboss.weld.metadata.TypeStore;
+
+import com.google.common.base.Supplier;
+import com.google.common.collect.Multimaps;
+import com.google.common.collect.SetMultimap;
+
+public class AnnotationStore
+{
+
+ // The array of default binding types
+ private static final Annotation[] DEFAULT_BINDING_ARRAY = { new DefaultLiteral() };
+ // The set of default binding types
+ private static final Set<Annotation> DEFAULT_BINDING = new HashSet<Annotation>(Arrays.asList(DEFAULT_BINDING_ARRAY));
+
+ private static final Annotation[] EMPTY_ANNOTATION_ARRAY = new Annotation[0];
+
+ /**
+ * Builds the annotation map (annotation type -> annotation)
+ *
+ * @param annotations The array of annotations to map
+ * @return The annotation map
+ */
+ protected static Map<Class<? extends Annotation>, Annotation> buildAnnotationMap(Annotation[] annotations)
+ {
+ Map<Class<? extends Annotation>, Annotation> annotationMap = new HashMap<Class<? extends Annotation>, Annotation>();
+ for (Annotation annotation : annotations)
+ {
+ annotationMap.put(annotation.annotationType(), annotation);
+ }
+ return annotationMap;
+ }
+
+ /**
+ * Builds the annotation map (annotation type -> annotation)
+ *
+ * @param annotations The array of annotations to map
+ * @return The annotation map
+ */
+ protected static Map<Class<? extends Annotation>, Annotation> buildAnnotationMap(Iterable<Annotation> annotations)
+ {
+ Map<Class<? extends Annotation>, Annotation> annotationMap = new HashMap<Class<? extends Annotation>, Annotation>();
+ for (Annotation annotation : annotations)
+ {
+ annotationMap.put(annotation.annotationType(), annotation);
+ }
+ return annotationMap;
+ }
+
+ /**
+ * Build an AnnotatedItemHelper from a class
+ *
+ * @param annotatedElement
+ * @return
+ */
+ public static AnnotationStore of(AnnotatedElement annotatedElement, TypeStore typeStore)
+ {
+ return new AnnotationStore(buildAnnotationMap(annotatedElement.getAnnotations()), buildAnnotationMap(annotatedElement.getDeclaredAnnotations()), typeStore);
+ }
+
+ public static AnnotationStore of(AnnotatedElement annotatedElement, Set<Annotation> extraAnnotations, Set<Annotation> extraDeclaredAnnotations, TypeStore typeStore)
+ {
+ Map<Class<? extends Annotation>, Annotation> annotationMap = new HashMap<Class<? extends Annotation>, Annotation>();
+ annotationMap.putAll(buildAnnotationMap(annotatedElement.getAnnotations()));
+ annotationMap.putAll(buildAnnotationMap(extraAnnotations));
+
+ Map<Class<? extends Annotation>, Annotation> declaredAnnotationMap = new HashMap<Class<? extends Annotation>, Annotation>();
+ declaredAnnotationMap.putAll(buildAnnotationMap(annotatedElement.getDeclaredAnnotations()));
+ declaredAnnotationMap.putAll(buildAnnotationMap(extraDeclaredAnnotations));
+
+ return new AnnotationStore(annotationMap, declaredAnnotationMap, typeStore);
+ }
+
+ public static AnnotationStore of(Annotation[] annotations, Annotation[] declaredAnnotations, TypeStore typeStore)
+ {
+ return new AnnotationStore(buildAnnotationMap(annotations), buildAnnotationMap(declaredAnnotations), typeStore);
+ }
+
+ public static AnnotationStore of(Set<Annotation> annotations, Set<Annotation> declaredAnnotations, TypeStore typeStore)
+ {
+ return new AnnotationStore(buildAnnotationMap(annotations), buildAnnotationMap(declaredAnnotations), typeStore);
+ }
+
+ public static AnnotationStore wrap(AnnotationStore annotationStore, Set<Annotation> annotations, Set<Annotation> declaredAnnotations, TypeStore typeStore)
+ {
+ Map<Class<? extends Annotation>, Annotation> annotationMap = new HashMap<Class<? extends Annotation>, Annotation>();
+ annotationMap.putAll(buildAnnotationMap(annotations));
+ annotationMap.putAll(annotationStore.getAnnotationMap());
+
+ Map<Class<? extends Annotation>, Annotation> declaredAnnotationMap = new HashMap<Class<? extends Annotation>, Annotation>();
+ declaredAnnotationMap.putAll(buildAnnotationMap(declaredAnnotations));
+ declaredAnnotationMap.putAll(annotationStore.getDeclaredAnnotationMap());
+
+ return new AnnotationStore(annotationMap, declaredAnnotationMap, typeStore);
+ }
+
+ // The annotation map (annotation type -> annotation) of the item
+ private final Map<Class<? extends Annotation>, Annotation> annotationMap;
+ // The meta-annotation map (annotation type -> set of annotations containing
+ // meta-annotation) of the item
+ private final SetMultimap<Class<? extends Annotation>, Annotation> metaAnnotationMap;
+ // The set of all annotations on the item
+ private final Set<Annotation> annotationSet;
+
+ // The annotation map (annotation type -> annotation) of the item
+ private final Map<Class<? extends Annotation>, Annotation> declaredAnnotationMap;
+ // The meta-annotation map (annotation type -> set of annotations containing
+ // meta-annotation) of the item
+ private final SetMultimap<Class<? extends Annotation>, Annotation> declaredMetaAnnotationMap;
+ // The set of all annotations on the item
+ private final Set<Annotation> declaredAnnotationSet;
+
+ /**
+ * Constructor
+ *
+ * Also builds the meta-annotation map. Throws a NullPointerException if
+ * trying to register a null map
+ *
+ * @param annotationMap A map of annotation to register
+ *
+ */
+ protected AnnotationStore(Map<Class<? extends Annotation>, Annotation> annotationMap, Map<Class<? extends Annotation>, Annotation> declaredAnnotationMap, TypeStore typeStore)
+ {
+ if (annotationMap == null)
+ {
+ throw new NullPointerException("annotationMap cannot be null");
+ }
+ this.annotationMap = annotationMap;
+ this.annotationSet = new HashSet<Annotation>();
+ this.metaAnnotationMap = Multimaps.newSetMultimap(new HashMap<Class<? extends Annotation>, Collection<Annotation>>(), new Supplier<Set<Annotation>>()
+ {
+
+ public Set<Annotation> get()
+ {
+ return new HashSet<Annotation>();
+ }
+ });
+ for (Annotation annotation : annotationMap.values())
+ {
+ addMetaAnnotations(metaAnnotationMap, annotation, annotation.annotationType().getAnnotations());
+ addMetaAnnotations(metaAnnotationMap, annotation, typeStore.get(annotation.annotationType()));
+ annotationSet.add(annotation);
+ }
+
+ if (declaredAnnotationMap == null)
+ {
+ throw new NullPointerException("declaredAnnotationMap cannot be null");
+ }
+ this.declaredAnnotationMap = declaredAnnotationMap;
+ this.declaredAnnotationSet = new HashSet<Annotation>();
+ this.declaredMetaAnnotationMap = Multimaps.newSetMultimap(new HashMap<Class<? extends Annotation>, Collection<Annotation>>(), new Supplier<Set<Annotation>>()
+ {
+
+ public Set<Annotation> get()
+ {
+ return new HashSet<Annotation>();
+ }
+ });
+ for (Annotation declaredAnnotation : declaredAnnotationMap.values())
+ {
+ addMetaAnnotations(declaredMetaAnnotationMap, declaredAnnotation, declaredAnnotation.annotationType().getAnnotations());
+ addMetaAnnotations(declaredMetaAnnotationMap, declaredAnnotation, typeStore.get(declaredAnnotation.annotationType()));
+ declaredAnnotationSet.add(declaredAnnotation);
+ }
+ }
+
+ private static void addMetaAnnotations(SetMultimap<Class<? extends Annotation>, Annotation> metaAnnotationMap, Annotation annotation, Annotation[] metaAnnotations)
+ {
+ for (Annotation metaAnnotation : metaAnnotations)
+ {
+ addMetaAnnotation(metaAnnotationMap, annotation, metaAnnotation.annotationType());
+ }
+ }
+
+ private static void addMetaAnnotations(SetMultimap<Class<? extends Annotation>, Annotation> metaAnnotationMap, Annotation annotation, Iterable<Annotation> metaAnnotations)
+ {
+ for (Annotation metaAnnotation : metaAnnotations)
+ {
+ addMetaAnnotation(metaAnnotationMap, annotation, metaAnnotation.annotationType());
+ }
+ }
+
+ private static void addMetaAnnotation(SetMultimap<Class<? extends Annotation>, Annotation> metaAnnotationMap, Annotation annotation, Class<? extends Annotation> metaAnnotationType)
+ {
+ // Only map meta-annotations we are interested in
+ if (MAPPED_METAANNOTATIONS.contains(metaAnnotationType))
+ {
+ metaAnnotationMap.put(metaAnnotationType, annotation);
+ }
+ }
+
+ public Set<Annotation> getAnnotations()
+ {
+ return Collections.unmodifiableSet(annotationSet);
+ }
+
+ public Set<Annotation> getMetaAnnotations(Class<? extends Annotation> metaAnnotationType)
+ {
+ return Collections.unmodifiableSet(metaAnnotationMap.get(metaAnnotationType));
+ }
+
+ public Set<Annotation> getDeclaredMetaAnnotations(Class<? extends Annotation> metaAnnotationType)
+ {
+ return Collections.unmodifiableSet(declaredMetaAnnotationMap.get(metaAnnotationType));
+ }
+
+ public Annotation[] getMetaAnnotationsAsArray(Class<? extends Annotation> metaAnnotationType)
+ {
+ return getMetaAnnotations(metaAnnotationType).toArray(EMPTY_ANNOTATION_ARRAY);
+ }
+
+ @Deprecated
+ public Set<Annotation> getBindings()
+ {
+ if (getMetaAnnotations(Qualifier.class).size() > 0)
+ {
+ return Collections.unmodifiableSet(getMetaAnnotations(Qualifier.class));
+ }
+ else
+ {
+ return Collections.unmodifiableSet(DEFAULT_BINDING);
+ }
+ }
+
+ @Deprecated
+ public Annotation[] getBindingsAsArray()
+ {
+ return getBindings().toArray(EMPTY_ANNOTATION_ARRAY);
+ }
+
+ public <A extends Annotation> A getAnnotation(Class<? extends A> annotationType)
+ {
+ return annotationType.cast(annotationMap.get(annotationType));
+ }
+
+ public boolean isAnnotationPresent(Class<? extends Annotation> annotationType)
+ {
+ return annotationMap.containsKey(annotationType);
+ }
+
+ public boolean isDeclaredAnnotationPresent(Class<? extends Annotation> annotationType)
+ {
+ return declaredAnnotationMap.containsKey(annotationType);
+ }
+
+ Map<Class<? extends Annotation>, Annotation> getAnnotationMap()
+ {
+ return annotationMap;
+ }
+
+ Map<Class<? extends Annotation>, Annotation> getDeclaredAnnotationMap()
+ {
+ return declaredAnnotationMap;
+ }
+
+}
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/introspector/ConstructorSignature.java (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/ConstructorSignature.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/weld/introspector/ConstructorSignature.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/introspector/ConstructorSignature.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -0,0 +1,26 @@
+/*
+ * 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.introspector;
+
+import java.io.Serializable;
+
+public interface ConstructorSignature extends Serializable
+{
+
+ public String[] getParameterTypes();
+
+}
\ No newline at end of file
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/introspector/ForwardingAnnotated.java (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/ForwardingAnnotated.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/weld/introspector/ForwardingAnnotated.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/introspector/ForwardingAnnotated.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -0,0 +1,81 @@
+/*
+ * 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.introspector;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.Set;
+
+import javax.enterprise.inject.spi.Annotated;
+
+/**
+ * Base class to allow implementation of the decorator pattern
+ *
+ * @author Pete Muir
+ *
+ * @param <T> the base type
+ * @param <S> the annotated element type
+ */
+public abstract class ForwardingAnnotated<T, S> implements Annotated
+{
+
+ protected abstract Annotated delegate();
+
+ public <A extends Annotation> A getAnnotation(Class<A> annotationType)
+ {
+ return delegate().getAnnotation(annotationType);
+ }
+
+ public Set<Annotation> getAnnotations()
+ {
+ return delegate().getAnnotations();
+ }
+
+ public boolean isAnnotationPresent(Class<? extends Annotation> annotationType)
+ {
+ return delegate().isAnnotationPresent(annotationType);
+ }
+
+ public Type getBaseType()
+ {
+ return delegate().getBaseType();
+ }
+
+ public Set<Type> getTypeClosure()
+ {
+ return delegate().getTypeClosure();
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ return delegate().equals(obj);
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return delegate().hashCode();
+ }
+
+ @Override
+ public String toString()
+ {
+ return delegate().toString();
+ }
+
+}
\ No newline at end of file
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/introspector/ForwardingWBAnnotated.java (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/ForwardingWBAnnotated.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/weld/introspector/ForwardingWBAnnotated.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/introspector/ForwardingWBAnnotated.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -0,0 +1,139 @@
+/*
+ * 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.introspector;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.Set;
+
+/**
+ * Provides an abstraction for delegating access to an annotated item
+ *
+ * @author Pete Muir
+ *
+ * @param <T>
+ * @param <S>
+ */
+public abstract class ForwardingWBAnnotated<T, S> extends ForwardingAnnotated<T, S> implements WBAnnotated<T, S>
+{
+
+ public Type[] getActualTypeArguments()
+ {
+ return delegate().getActualTypeArguments();
+ }
+
+ public Set<Annotation> getMetaAnnotations(Class<? extends Annotation> metaAnnotationType)
+ {
+ return delegate().getMetaAnnotations(metaAnnotationType);
+ }
+
+ public Annotation[] getMetaAnnotationsAsArray(Class<? extends Annotation> metaAnnotationType)
+ {
+ return delegate().getMetaAnnotationsAsArray(metaAnnotationType);
+ }
+
+ @Deprecated
+ public Set<Annotation> getQualifiers()
+ {
+ return delegate().getQualifiers();
+ }
+
+ @Deprecated
+ public Annotation[] getBindingsAsArray()
+ {
+ return delegate().getBindingsAsArray();
+ }
+
+ public Set<Annotation> getDeclaredMetaAnnotations(Class<? extends Annotation> metaAnnotationType)
+ {
+ return delegate().getDeclaredMetaAnnotations(metaAnnotationType);
+ }
+
+ public String getName()
+ {
+ return delegate().getName();
+ }
+
+ public Class<T> getJavaClass()
+ {
+ return delegate().getJavaClass();
+ }
+
+ public boolean isAssignableFrom(WBAnnotated<?, ?> that)
+ {
+ return delegate().isAssignableFrom(that);
+ }
+
+ public boolean isAssignableFrom(Class<?> type, Type[] actualTypeArguments)
+ {
+ return delegate().isAssignableFrom(type, actualTypeArguments);
+ }
+
+ public boolean isFinal()
+ {
+ return delegate().isFinal();
+ }
+
+ public boolean isStatic()
+ {
+ return delegate().isStatic();
+ }
+
+ public boolean isProxyable()
+ {
+ return delegate().isProxyable();
+ }
+
+ public boolean isPublic()
+ {
+ return delegate().isPublic();
+ }
+
+ public boolean isPrivate()
+ {
+ return delegate().isPrivate();
+ }
+
+ public boolean isPackagePrivate()
+ {
+ return delegate().isPackagePrivate();
+ }
+
+ public Package getPackage()
+ {
+ return delegate().getPackage();
+ }
+
+ @Override
+ protected abstract WBAnnotated<T, S> delegate();
+
+ public boolean isDeclaredAnnotationPresent(Class<? extends Annotation> annotationType)
+ {
+ return delegate().isDeclaredAnnotationPresent(annotationType);
+ }
+
+ public Set<Type> getInterfaceOnlyFlattenedTypeHierarchy()
+ {
+ return delegate().getInterfaceOnlyFlattenedTypeHierarchy();
+ }
+
+ public boolean isParameterizedType()
+ {
+ return delegate().isParameterizedType();
+ }
+
+}
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/introspector/ForwardingWBAnnotation.java (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/ForwardingWBAnnotation.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/weld/introspector/ForwardingWBAnnotation.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/introspector/ForwardingWBAnnotation.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -0,0 +1,38 @@
+/*
+ * 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.introspector;
+
+import java.lang.annotation.Annotation;
+import java.util.Set;
+
+public abstract class ForwardingWBAnnotation<T extends Annotation> extends ForwardingWBClass<T> implements WBAnnotation<T>
+{
+
+ @Override
+ protected abstract WBAnnotation<T> delegate();
+
+ public Set<WBMethod<?, ?>> getAnnotatedMembers(Class<? extends Annotation> annotationType)
+ {
+ return delegate().getAnnotatedMembers(annotationType);
+ }
+
+ public Set<WBMethod<?, ?>> getMembers()
+ {
+ return delegate().getMembers();
+ }
+
+}
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/introspector/ForwardingWBClass.java (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/ForwardingWBClass.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/weld/introspector/ForwardingWBClass.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/introspector/ForwardingWBClass.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -0,0 +1,172 @@
+/*
+ * 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.introspector;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
+import java.util.Set;
+
+public abstract class ForwardingWBClass<T> extends ForwardingWBAnnotated<T, Class<T>> implements WBClass<T>
+{
+
+ @Override
+ protected abstract WBClass<T> delegate();
+
+ public Set<WBConstructor<T>> getAnnotatedWBConstructors(Class<? extends Annotation> annotationType)
+ {
+ return delegate().getAnnotatedWBConstructors(annotationType);
+ }
+
+ public Set<WBField<?, ?>> getAnnotatedWBFields(Class<? extends Annotation> annotationType)
+ {
+ return delegate().getAnnotatedWBFields(annotationType);
+ }
+
+ public Set<WBMethod<?, ?>> getAnnotatedWBMethods(Class<? extends Annotation> annotationType)
+ {
+ return delegate().getAnnotatedWBMethods(annotationType);
+ }
+
+ public WBConstructor<T> getNoArgsWBConstructor()
+ {
+ return delegate().getNoArgsWBConstructor();
+ }
+
+ public Set<WBConstructor<T>> getWBConstructors()
+ {
+ return delegate().getWBConstructors();
+ }
+
+ public Set<WBMethod<?, ?>> getWBMethods()
+ {
+ return delegate().getWBMethods();
+ }
+
+ public Set<WBField<?, T>> getDeclaredAnnotatedWBFields(Class<? extends Annotation> annotationType)
+ {
+ return delegate().getDeclaredAnnotatedWBFields(annotationType);
+ }
+
+ public Set<WBMethod<?, T>> getDeclaredAnnotatedWBMethods(Class<? extends Annotation> annotationType)
+ {
+ return delegate().getDeclaredAnnotatedWBMethods(annotationType);
+ }
+
+ public Set<WBMethod<?, T>> getDeclaredWBMethodsWithAnnotatedParameters(Class<? extends Annotation> annotationType)
+ {
+ return delegate().getDeclaredWBMethodsWithAnnotatedParameters(annotationType);
+ }
+
+ public Set<WBField<?, ?>> getWBFields()
+ {
+ return delegate().getWBFields();
+ }
+
+ public Set<WBField<?, ?>> getMetaAnnotatedWBFields(Class<? extends Annotation> metaAnnotationType)
+ {
+ return delegate().getMetaAnnotatedWBFields(metaAnnotationType);
+ }
+
+ @Deprecated
+ public WBMethod<?, ?> getWBMethod(Method method)
+ {
+ return delegate().getWBMethod(method);
+ }
+
+ public <M> WBMethod<M, ?> getWBMethod(MethodSignature signature)
+ {
+ return delegate().getWBMethod(signature);
+ }
+
+ public Set<WBMethod<?, ?>> getWBMethodsWithAnnotatedParameters(Class<? extends Annotation> annotationType)
+ {
+ return delegate().getWBMethodsWithAnnotatedParameters(annotationType);
+ }
+
+ public Set<WBConstructor<?>> getWBConstructorsWithAnnotatedParameters(Class<? extends Annotation> annotationType)
+ {
+ return delegate().getWBConstructorsWithAnnotatedParameters(annotationType);
+ }
+
+ public WBClass<?> getWBSuperclass()
+ {
+ return delegate().getWBSuperclass();
+ }
+
+ public boolean isNonStaticMemberClass()
+ {
+ return delegate().isNonStaticMemberClass();
+ }
+
+ @Override
+ public boolean isParameterizedType()
+ {
+ return delegate().isParameterizedType();
+ }
+
+ public boolean isAbstract()
+ {
+ return delegate().isAbstract();
+ }
+
+ public boolean isEnum()
+ {
+ return delegate().isEnum();
+ }
+
+ @Deprecated
+ public WBMethod<?, ?> getDeclaredWBMethod(Method method)
+ {
+ return delegate().getDeclaredWBMethod(method);
+ }
+
+ public <F> WBField<F, ?> getDeclaredWBField(String fieldName, WBClass<F> expectedType)
+ {
+ return delegate().getDeclaredWBField(fieldName, expectedType);
+ }
+
+ public <M> WBMethod<M, ?> getDeclaredWBMethod(MethodSignature signature, WBClass<M> expectedReturnType)
+ {
+ return delegate().getDeclaredWBMethod(signature, expectedReturnType);
+ }
+
+ public WBConstructor<T> getDeclaredWBConstructor(ConstructorSignature signature)
+ {
+ return delegate().getDeclaredWBConstructor(signature);
+ }
+
+ public <U> WBClass<? extends U> asWBSubclass(WBClass<U> clazz)
+ {
+ return delegate().asWBSubclass(clazz);
+ }
+
+ public <S> S cast(Object object)
+ {
+ return delegate().<S>cast(object);
+ }
+
+ public boolean isEquivalent(Class<?> clazz)
+ {
+ return delegate().isEquivalent(clazz);
+ }
+
+ public String getSimpleName()
+ {
+ return delegate().getSimpleName();
+ }
+
+}
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/introspector/ForwardingWBConstructor.java (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/ForwardingWBConstructor.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/weld/introspector/ForwardingWBConstructor.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/introspector/ForwardingWBConstructor.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -0,0 +1,62 @@
+/*
+ * 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.introspector;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.util.List;
+
+import javax.enterprise.inject.spi.AnnotatedParameter;
+
+public abstract class ForwardingWBConstructor<T> extends ForwardingWBMember<T, T, Constructor<T>> implements WBConstructor<T>
+{
+
+ @Override
+ protected abstract WBConstructor<T> delegate();
+
+ public List<WBParameter<?, ?>> getAnnotatedWBParameters(Class<? extends Annotation> annotationType)
+ {
+ return delegate().getAnnotatedWBParameters(annotationType);
+ }
+
+ public WBClass<T> getDeclaringType()
+ {
+ return delegate().getDeclaringType();
+ }
+
+ public List<? extends WBParameter<?, ?>> getWBParameters()
+ {
+ return delegate().getWBParameters();
+ }
+
+ public T newInstance(Object... parameters) throws IllegalArgumentException, InstantiationException, IllegalAccessException, InvocationTargetException
+ {
+ return delegate().newInstance(parameters);
+ }
+
+ public ConstructorSignature getSignature()
+ {
+ return delegate().getSignature();
+ }
+
+ public List<AnnotatedParameter<T>> getParameters()
+ {
+ return delegate().getParameters();
+ }
+
+}
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/introspector/ForwardingWBField.java (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/ForwardingWBField.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/weld/introspector/ForwardingWBField.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/introspector/ForwardingWBField.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -0,0 +1,52 @@
+/*
+ * 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.introspector;
+
+import java.lang.reflect.Field;
+
+public abstract class ForwardingWBField<T, X> extends ForwardingWBMember<T, X, Field> implements WBField<T, X>
+{
+
+ @Override
+ protected abstract WBField<T, X> delegate();
+
+ public T get(Object instance)
+ {
+ return delegate().get(instance);
+ }
+
+ public WBClass<X> getDeclaringType()
+ {
+ return delegate().getDeclaringType();
+ }
+
+ public String getPropertyName()
+ {
+ return delegate().getPropertyName();
+ }
+
+ public void set(Object declaringInstance, Object value) throws IllegalArgumentException, IllegalAccessException
+ {
+ delegate().set(declaringInstance, value);
+ }
+
+ public boolean isTransient()
+ {
+ return delegate().isTransient();
+ }
+
+}
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/introspector/ForwardingWBMember.java (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/ForwardingWBMember.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/weld/introspector/ForwardingWBMember.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/introspector/ForwardingWBMember.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -0,0 +1,37 @@
+/*
+ * 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.introspector;
+
+import java.lang.reflect.Member;
+
+public abstract class ForwardingWBMember<T, X, S extends Member> extends ForwardingWBAnnotated<T, S> implements WBMember<T, X, S>
+{
+
+ @Override
+ protected abstract WBMember<T, X, S> delegate();
+
+ public S getJavaMember()
+ {
+ return delegate().getJavaMember();
+ }
+
+ public WBClass<X> getDeclaringType()
+ {
+ return delegate().getDeclaringType();
+ }
+
+}
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/introspector/ForwardingWBMethod.java (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/ForwardingWBMethod.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/weld/introspector/ForwardingWBMethod.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/introspector/ForwardingWBMethod.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -0,0 +1,87 @@
+/*
+ * 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.introspector;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.List;
+
+import javax.enterprise.inject.spi.AnnotatedParameter;
+
+public abstract class ForwardingWBMethod<T, X> extends ForwardingWBMember<T,X, Method> implements WBMethod<T, X>
+{
+
+ @Override
+ protected abstract WBMethod<T, X> delegate();
+
+ public Method getAnnotatedMethod()
+ {
+ return delegate().getAnnotatedMethod();
+ }
+
+ public List<WBParameter<?, ?>> getAnnotatedParameters(Class<? extends Annotation> metaAnnotationType)
+ {
+ return delegate().getAnnotatedWBParameters(metaAnnotationType);
+ }
+
+ public Class<?>[] getParameterTypesAsArray()
+ {
+ return delegate().getParameterTypesAsArray();
+ }
+
+ public List<? extends WBParameter<?, ?>> getWBParameters()
+ {
+ return delegate().getWBParameters();
+ }
+
+ public String getPropertyName()
+ {
+ return delegate().getPropertyName();
+ }
+
+ public T invoke(Object instance, Object... parameters) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException
+ {
+ return delegate().invoke(instance, parameters);
+ }
+
+ public T invokeOnInstance(Object instance, Object... parameters) throws IllegalArgumentException, SecurityException, IllegalAccessException, InvocationTargetException, NoSuchMethodException
+ {
+ return delegate().invokeOnInstance(instance, parameters);
+ }
+
+ public boolean isEquivalent(Method method)
+ {
+ return delegate().isEquivalent(method);
+ }
+
+ public MethodSignature getSignature()
+ {
+ return delegate().getSignature();
+ }
+
+ public List<WBParameter<?, ?>> getAnnotatedWBParameters(Class<? extends Annotation> metaAnnotationType)
+ {
+ return delegate().getAnnotatedWBParameters(metaAnnotationType);
+ }
+
+ public List<AnnotatedParameter<X>> getParameters()
+ {
+ return delegate().getParameters();
+ }
+
+}
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/introspector/ForwardingWBParameter.java (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/ForwardingWBParameter.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/weld/introspector/ForwardingWBParameter.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/introspector/ForwardingWBParameter.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -0,0 +1,38 @@
+/*
+ * 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.introspector;
+
+import javax.enterprise.inject.spi.AnnotatedCallable;
+
+
+public abstract class ForwardingWBParameter<T, X> extends ForwardingWBAnnotated<T, Object> implements WBParameter<T, X>
+{
+
+ @Override
+ protected abstract WBParameter<T, X> delegate();
+
+ public AnnotatedCallable<X> getDeclaringCallable()
+ {
+ return delegate().getDeclaringCallable();
+ }
+
+ public int getPosition()
+ {
+ return delegate().getPosition();
+ }
+
+}
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/introspector/MethodSignature.java (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/MethodSignature.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/weld/introspector/MethodSignature.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/introspector/MethodSignature.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -0,0 +1,28 @@
+/*
+ * 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.introspector;
+
+import java.io.Serializable;
+
+public interface MethodSignature extends Serializable
+{
+
+ public String getMethodName();
+
+ public String[] getParameterTypes();
+
+}
\ No newline at end of file
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/introspector/WBAnnotated.java (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/WBAnnotated.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/weld/introspector/WBAnnotated.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/introspector/WBAnnotated.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -0,0 +1,198 @@
+/*
+ * 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.introspector;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.enterprise.context.NormalScope;
+import javax.enterprise.inject.spi.Annotated;
+import javax.enterprise.inject.stereotype.Stereotype;
+import javax.inject.Qualifier;
+import javax.inject.Scope;
+import javax.interceptor.InterceptorBinding;
+
+/**
+ * AnnotatedItem provides a uniform access to the annotations on an annotated
+ * item defined either in Java or XML
+ *
+ * @author Pete Muir
+ *
+ */
+public interface WBAnnotated<T, S> extends Annotated
+{
+
+ // The set of meta-annotations to map
+ @SuppressWarnings("unchecked")
+ public static final Set<Class<? extends Annotation>> MAPPED_METAANNOTATIONS = new HashSet<Class<? extends Annotation>>(Arrays.asList(Qualifier.class, Stereotype.class, Scope.class, NormalScope.class, InterceptorBinding.class));
+
+ /**
+ * Gets all annotations which are annotated with the given meta annotation
+ * type
+ *
+ * @param The meta annotation to match
+ * @return A set of matching meta-annotations. Returns an empty set if there
+ * are no matches.
+ */
+ public Set<Annotation> getMetaAnnotations(Class<? extends Annotation> metaAnnotationType);
+
+ /**
+ * Gets all annotations which are declared on this annotated item with the
+ * given meta annotation type
+ *
+ * @param The meta annotation to match
+ * @return A set of matching meta-annotations. Returns an empty set if there
+ * are no matches.
+ */
+ public Set<Annotation> getDeclaredMetaAnnotations(Class<? extends Annotation> metaAnnotationType);
+
+ /**
+ * Gets all annotations which are annotated with the given meta annotation
+ * type
+ *
+ * @param The meta annotation to match
+ * @return An array of matching meta-annotations. Returns an empty array if
+ * there are no matches.
+ */
+ public Annotation[] getMetaAnnotationsAsArray(Class<? extends Annotation> metaAnnotationType);
+
+ /**
+ * Gets the binding types for this element
+ *
+ * @returns A set of binding types present on the type. Returns an empty set
+ * if there are no matches.
+ * @deprecated This reflection type should not know about JSR-299 binding
+ * types
+ */
+ @Deprecated
+ public Set<Annotation> getQualifiers();
+
+ /**
+ * Gets the binding types for this element
+ *
+ * @returns An array of binding types present on the type. Returns an empty
+ * array if there are no matches.
+ * @deprecated This reflection type should not know about JSR-299 binding
+ * types
+ */
+ @Deprecated
+ public Annotation[] getBindingsAsArray();
+
+ /**
+ * Get the type hierarchy of any interfaces implemented by this class.
+ *
+ * Interface hierarchies from super classes are not included.
+ *
+ * The returned types should have any type parameters resolved to their
+ * actual types.
+ *
+ * @return the type hierarchy
+ */
+ public Set<Type> getInterfaceOnlyFlattenedTypeHierarchy();
+
+ /**
+ * Indicates if an annotation type specified is present
+ *
+ * @param annotationType The annotation to match
+ * @return True if present, false if not
+ */
+ public boolean isDeclaredAnnotationPresent(Class<? extends Annotation> annotationType);
+
+ /**
+ * Gets the type of the element
+ *
+ * @return The type of the element
+ */
+ public Class<T> getJavaClass();
+
+ /**
+ * Extends Java Class assignability such that actual type parameters are also
+ * considered
+ *
+ * @param that The other item to check assignability against
+ * @return True if assignable, false otherwise.
+ */
+ public boolean isAssignableFrom(WBAnnotated<?, ?> that);
+
+ /**
+ * Extends Java Class assignability such that actual type parameters are also
+ * considered
+ *
+ * @param type The type to compare against
+ * @param actualTypeArguments The type arguments
+ * @return True is assignable, false otherwise
+ */
+ public boolean isAssignableFrom(Class<?> type, Type[] actualTypeArguments);
+
+ /**
+ * Gets the actual type arguments for any parameterized types that this
+ * AnnotatedItem represents.
+ *
+ * @return An array of type arguments
+ */
+ public Type[] getActualTypeArguments();
+
+ /**
+ * Indicates if this AnnotatedItem represents a static element
+ *
+ * @return True if static, false otherwise
+ */
+ public boolean isStatic();
+
+ /**
+ * Indicates if this AnnotatedItem represents a final element
+ *
+ * @return True if final, false otherwise
+ */
+ public boolean isFinal();
+
+ /**
+ * Indicates if this AnnotatedItem can be proxyed
+ *
+ * @return True if proxyable, false otherwise
+ */
+ public boolean isProxyable();
+
+ /**
+ * Indicates if this annotated item is public
+ *
+ * @return if public, returns true
+ */
+ public boolean isPublic();
+
+ public boolean isPrivate();
+
+ public boolean isPackagePrivate();
+
+ public Package getPackage();
+
+ /**
+ * Gets the name of this AnnotatedItem
+ *
+ * If it is not possible to determine the name of the underling element, a
+ * IllegalArgumentException is thrown
+ *
+ * @return The name
+ */
+ public String getName();
+
+ public boolean isParameterizedType();
+
+}
\ No newline at end of file
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/introspector/WBAnnotation.java (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/WBAnnotation.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/weld/introspector/WBAnnotation.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/introspector/WBAnnotation.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -0,0 +1,53 @@
+/*
+ * 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.introspector;
+
+import java.lang.annotation.Annotation;
+import java.util.Set;
+
+/**
+ * Represents a meta annotation
+ *
+ * @author Pete Muir
+ *
+ */
+public interface WBAnnotation<T extends Annotation> extends WBClass<T>
+{
+ /**
+ * Gets all members
+ *
+ * @return A set of abstracted members
+ */
+ public Set<WBMethod<?, ?>> getMembers();
+
+ /**
+ * Gets all the members annotated with annotationType
+ *
+ * @param annotationType The annotation type to match
+ * @return A set of abstracted members with the annotation type
+ */
+ public Set<WBMethod<?, ?>> getAnnotatedMembers(Class<? extends Annotation> annotationType);
+
+ /**
+ * Get an annotation member by name
+ *
+ * @param memberName
+ * @return
+ */
+ public <A> WBMethod<A, ?> getMember(String memberName, WBClass<A> expectedType);
+
+}
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/introspector/WBCallable.java (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/WBCallable.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/weld/introspector/WBCallable.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/introspector/WBCallable.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -0,0 +1,49 @@
+/*
+ * 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.introspector;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Member;
+import java.util.List;
+
+import javax.enterprise.inject.spi.AnnotatedCallable;
+
+/**
+ * @author pmuir
+ *
+ */
+public interface WBCallable<T, X, S extends Member> extends WBMember<T, X, S>, AnnotatedCallable<X>
+{
+
+ /**
+ * Gets the abstracted parameters of the method
+ *
+ * @return A list of parameters. Returns an empty list if no parameters are
+ * present.
+ */
+ public List<? extends WBParameter<?, ?>> getWBParameters();
+
+ /**
+ * Gets the list of annotated parameters for a given annotation
+ *
+ * @param metaAnnotationType The annotation to match
+ * @return A set of matching parameter abstractions. Returns an empty list if
+ * there are no matches.
+ */
+ public List<WBParameter<?, ?>> getAnnotatedWBParameters(Class<? extends Annotation> metaAnnotationType);
+
+}
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/introspector/WBClass.java (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/WBClass.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/weld/introspector/WBClass.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/introspector/WBClass.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -0,0 +1,235 @@
+/*
+ * 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.introspector;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
+import java.util.Set;
+
+import javax.enterprise.inject.spi.AnnotatedType;
+
+/**
+ * Represents a Class
+ *
+ * @author Pete Muir
+ *
+ */
+public interface WBClass<T> extends WBAnnotated<T, Class<T>>, AnnotatedType<T>
+{
+
+ /**
+ * Gets all fields on the type
+ *
+ * @return A set of abstracted fields
+ */
+ public Set<WBField<?, ?>> getWBFields();
+
+ /**
+ * Gets all fields on the type
+ *
+ * @return A set of abstracted fields
+ */
+ public Set<WBMethod<?, ?>> getWBMethods();
+
+ /**
+ * Gets all fields on the type
+ *
+ * @return A set of abstracted fields
+ */
+ public Set<WBMethod<?, ?>> getDeclaredWBMethods();
+
+ /**
+ * Get a field by name
+ *
+ * @param <F> the expected type of the field
+ * @param fieldName the field name
+ * @param expectedType the expected type of the field
+ * @return the field
+ */
+ public <F> WBField<F, ?> getDeclaredWBField(String fieldName, WBClass<F> expectedType);
+
+ /**
+ * Gets all fields which are annotated with the given annotation type on this
+ * class and all super classes
+ *
+ * @param annotationType The annotation to match
+ * @return A set of abstracted fields with the given annotation. Returns an
+ * empty set if there are no matches
+ */
+ public Set<WBField<?, ?>> getAnnotatedWBFields(Class<? extends Annotation> annotationType);
+
+ /**
+ * Gets all fields which are annotated with the given annotation type on this
+ * class only.
+ *
+ * @param annotationType The annotation to match
+ * @return A set of abstracted fields with the given annotation. Returns an
+ * empty set if there are no matches
+ */
+ public Set<WBField<?, T>> getDeclaredAnnotatedWBFields(Class<? extends Annotation> annotationType);
+
+ /**
+ * Gets all fields which are meta-annotated with metaAnnotationType
+ *
+ * @param metaAnnotationType The meta annotation to match
+ * @return A set of abstracted fields with the given meta-annotation. Returns
+ * an empty set if there are no matches
+ */
+ public Set<WBField<?, ?>> getMetaAnnotatedWBFields(Class<? extends Annotation> metaAnnotationType);
+
+ /**
+ * Gets all constructors which are annotated with annotationType
+ *
+ * @param annotationType The annotation type to match
+ * @return A set of abstracted fields with the given annotation. Returns an
+ * empty set if there are no matches
+ */
+ public Set<WBConstructor<T>> getAnnotatedWBConstructors(Class<? extends Annotation> annotationType);
+
+ /**
+ * Gets all constructors
+ *
+ * @return A set of abstracted constructors
+ */
+ public Set<WBConstructor<T>> getWBConstructors();
+
+ /**
+ * Gets the no-args constructor
+ *
+ * @return The no-args constructor, or null if not defined
+ */
+ public WBConstructor<T> getNoArgsWBConstructor();
+
+ /**
+ * Get the constructor which matches the argument list provided
+ *
+ * @param parameterTypes the parameters of the constructor
+ * @return the matching constructor, or null if not defined
+ */
+ public WBConstructor<T> getDeclaredWBConstructor(ConstructorSignature signature);
+
+ /**
+ * Gets all methods annotated with annotationType
+ *
+ * @param annotationType The annotation to match
+ * @return A set of abstracted methods with the given annotation. Returns an
+ * empty set if there are no matches
+ */
+ public Set<WBMethod<?, ?>> getAnnotatedWBMethods(Class<? extends Annotation> annotationType);
+
+ /**
+ * Gets all methods annotated with annotationType
+ *
+ * @param annotationType The annotation to match
+ * @return A set of abstracted methods with the given annotation. Returns an
+ * empty set if there are no matches
+ */
+ public Set<WBMethod<?, T>> getDeclaredAnnotatedWBMethods(Class<? extends Annotation> annotationType);
+
+ /**
+ * Find the annotated method for a given methodDescriptor
+ *
+ * @param methodDescriptor
+ * @return
+ *
+ */
+ public WBMethod<?, ?> getWBMethod(Method method);
+
+ /**
+ * Get a method by name
+ *
+ * @param <M> the expected return type
+ * @param signature the name of the method
+ * @param expectedReturnType the expected return type
+ * @return the method, or null if it doesn't exist
+ */
+ public <M> WBMethod<M, ?> getDeclaredWBMethod(MethodSignature signature, WBClass<M> expectedReturnType);
+
+ /**
+ * Get a method by name
+ *
+ * @param <M> the expected return type
+ * @param signature the name of the method
+ * @return the method, or null if it doesn't exist
+ */
+ public <M> WBMethod<M, ?> getWBMethod(MethodSignature signature);
+
+ // TODO Replace with AnnotatedMethod variant
+ @Deprecated
+ public WBMethod<?, ?> getDeclaredWBMethod(Method method);
+
+ /**
+ * Gets all with parameters annotated with annotationType
+ *
+ * @param annotationType The annotation to match
+ * @return A set of abstracted methods with the given annotation. Returns an
+ * empty set if there are no matches
+ */
+ public Set<WBMethod<?, ?>> getWBMethodsWithAnnotatedParameters(Class<? extends Annotation> annotationType);
+
+ /**
+ * Gets all with constructors annotated with annotationType
+ *
+ * @param annotationType The annotation to match
+ * @return A set of abstracted constructors with the given annotation. Returns an
+ * empty set if there are no matches
+ */
+ public Set<WBConstructor<?>> getWBConstructorsWithAnnotatedParameters(Class<? extends Annotation> annotationType);
+
+ /**
+ * Gets all with parameters annotated with annotationType
+ *
+ * @param annotationType The annotation to match
+ * @return A set of abstracted methods with the given annotation. Returns an
+ * empty set if there are no matches
+ */
+ public Set<WBMethod<?, T>> getDeclaredWBMethodsWithAnnotatedParameters(Class<? extends Annotation> annotationType);
+
+ /**
+ * Gets the superclass.
+ *
+ * @return The abstracted superclass, null if there is no superclass
+ */
+ public WBClass<?> getWBSuperclass();
+
+ /**
+ * Determine if this is a non-static member class
+ *
+ * @return true if this is a non-static member
+ */
+ public boolean isNonStaticMemberClass();
+
+ public boolean isParameterizedType();
+
+ public boolean isAbstract();
+
+ public boolean isEnum();
+
+ public <S> S cast(Object object);
+
+ public <U> WBClass<? extends U> asWBSubclass(WBClass<U> clazz);
+
+ /**
+ * Check if this is equivalent to a java class
+ * @param clazz The Java class
+ * @return true if equivalent
+ */
+ public boolean isEquivalent(Class<?> clazz);
+
+ public String getSimpleName();
+
+}
\ No newline at end of file
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/introspector/WBConstructor.java (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/WBConstructor.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/weld/introspector/WBConstructor.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/introspector/WBConstructor.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -0,0 +1,50 @@
+/*
+ * 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.introspector;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.decorator.Decorates;
+import javax.enterprise.inject.spi.AnnotatedConstructor;
+
+/**
+ * Represents a Class Constructor
+ *
+ * @author Pete Muir
+ *
+ */
+public interface WBConstructor<T> extends WBCallable<T, T, Constructor<T>>, AnnotatedConstructor<T>
+{
+
+ @SuppressWarnings("unchecked")
+ public static final Set<Class<? extends Annotation>> MAPPED_PARAMETER_ANNOTATIONS = new HashSet<Class<? extends Annotation>>(Arrays.asList(Decorates.class));
+
+ /**
+ * Creates a new instance of the class, using this constructor
+ *
+ * @return The created instance
+ */
+ public T newInstance(Object... parameters) throws IllegalArgumentException, InstantiationException, IllegalAccessException, InvocationTargetException;
+
+ public ConstructorSignature getSignature();
+
+}
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/introspector/WBField.java (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/WBField.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/weld/introspector/WBField.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/introspector/WBField.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -0,0 +1,53 @@
+/*
+ * 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.introspector;
+
+import java.lang.reflect.Field;
+
+import javax.enterprise.inject.spi.AnnotatedField;
+
+/**
+ * AnnotatedField provides a uniform access to the annotations on an annotated
+ * field
+ *
+ * @author Pete Muir
+ *
+ */
+public interface WBField<T, X> extends WBMember<T, X, Field>, AnnotatedField<X>
+{
+
+ /**
+ * Injects an instance
+ *
+ *
+ * @param declaringInstance The instance to inject into
+ * @param value The value to inject
+ */
+ public void set(Object declaringInstance, Object value) throws IllegalArgumentException, IllegalAccessException;
+
+ public T get(Object instance);
+
+ /**
+ * Gets the property name of the field
+ *
+ * @return The name
+ */
+ public String getPropertyName();
+
+ public boolean isTransient();
+
+}
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/introspector/WBMember.java (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/WBMember.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/weld/introspector/WBMember.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/introspector/WBMember.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -0,0 +1,40 @@
+/*
+ * 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.introspector;
+
+import java.lang.reflect.Member;
+
+import javax.enterprise.inject.spi.AnnotatedMember;
+/**
+ * AnnotedMember provides enhanced access to an annotated member
+ *
+ * @author Pete Muir
+ *
+ */
+public interface WBMember<T, X, S extends Member> extends WBAnnotated<T, S>, AnnotatedMember<X>
+{
+
+ public S getJavaMember();
+
+ /**
+ * Gets an abstraction of the declaring class
+ *
+ * @return The declaring class
+ */
+ public WBClass<X> getDeclaringType();
+
+}
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/introspector/WBMethod.java (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/WBMethod.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/weld/introspector/WBMethod.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/introspector/WBMethod.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -0,0 +1,85 @@
+/*
+ * 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.introspector;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.Disposes;
+import javax.enterprise.inject.spi.AnnotatedMethod;
+
+/**
+ * AnnotatedType provides a uniform access to the annotations on an annotated
+ * class defined either in Java or XML
+ *
+ * @author Pete Muir
+ *
+ */
+public interface WBMethod<T, X> extends WBCallable<T, X, Method>, AnnotatedMethod<X>
+{
+ @SuppressWarnings("unchecked")
+ public static final Set<Class<? extends Annotation>> MAPPED_PARAMETER_ANNOTATIONS = new HashSet<Class<? extends Annotation>>(Arrays.asList(Disposes.class, Observes.class, Disposes.class));
+
+ /**
+ * Get the parameter types as an array
+ */
+ public Class<?>[] getParameterTypesAsArray();
+
+ /**
+ * Invokes the method
+ *
+ * @param instance The instance to invoke
+ * @param parameters The method parameters
+ * @return A reference to the instance
+ */
+ public T invoke(Object instance, Object... parameters) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException;
+
+ /**
+ * Invokes the method on the class of the passed instance, not the declaring
+ * class. Useful with proxies
+ *
+ * @param instance The instance to invoke
+ * @param manager The Web Beans manager
+ * @return A reference to the instance
+ */
+ public T invokeOnInstance(Object instance, Object... parameters) throws IllegalArgumentException, SecurityException, IllegalAccessException, InvocationTargetException, NoSuchMethodException;
+
+ /**
+ * Gets the property name
+ *
+ * @return The name
+ */
+ public String getPropertyName();
+
+ /**
+ * Checks if a this is equivalent to a JLR method
+ *
+ * @param method The JLR method
+ * @return true if equivalent
+ */
+ public boolean isEquivalent(Method method);
+
+ public Method getAnnotatedMethod();
+
+ public MethodSignature getSignature();
+
+}
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/introspector/WBParameter.java (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/WBParameter.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/weld/introspector/WBParameter.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/introspector/WBParameter.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -0,0 +1,31 @@
+/*
+ * 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.introspector;
+
+import javax.enterprise.inject.spi.AnnotatedParameter;
+
+/**
+ * AnnotatedParameter provides a uniform access to a method parameter defined
+ * either in Java or XML
+ *
+ * @author Pete Muir
+ * @param <T>
+ */
+public interface WBParameter<T, X> extends WBAnnotated<T, Object>, AnnotatedParameter<X>
+{
+
+}
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/introspector/jlr (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr)
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/introspector/jlr/AbstractWBAnnotated.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractWBAnnotated.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/introspector/jlr/AbstractWBAnnotated.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.introspector.jlr;
+package org.jboss.weld.introspector.jlr;
import java.lang.annotation.Annotation;
import java.lang.reflect.ParameterizedType;
@@ -24,10 +24,10 @@
import java.util.HashSet;
import java.util.Set;
-import org.jboss.webbeans.introspector.AnnotationStore;
-import org.jboss.webbeans.introspector.WBAnnotated;
-import org.jboss.webbeans.util.Proxies;
-import org.jboss.webbeans.util.Reflections;
+import org.jboss.weld.introspector.AnnotationStore;
+import org.jboss.weld.introspector.WBAnnotated;
+import org.jboss.weld.util.Proxies;
+import org.jboss.weld.util.Reflections;
/**
* Represents functionality common for all annotated items, mainly different
@@ -41,7 +41,7 @@
* @param <T>
* @param <S>
*
- * @see org.jboss.webbeans.introspector.WBAnnotated
+ * @see org.jboss.weld.introspector.WBAnnotated
*/
public abstract class AbstractWBAnnotated<T, S> implements WBAnnotated<T, S>
{
@@ -144,7 +144,7 @@
* @param annotatedType The annotation type to check for
* @return True if present, false otherwise.
*
- * @see org.jboss.webbeans.introspector.WBAnnotated#isAnnotationPresent(Class)
+ * @see org.jboss.weld.introspector.WBAnnotated#isAnnotationPresent(Class)
*/
public boolean isAnnotationPresent(Class<? extends Annotation> annotatedType)
{
@@ -175,7 +175,7 @@
* @param that The other annotated item to check against
* @return True if assignable, false otherwise
*
- * @see org.jboss.webbeans.introspector.WBAnnotated#isAssignableFrom(WBAnnotated)
+ * @see org.jboss.weld.introspector.WBAnnotated#isAssignableFrom(WBAnnotated)
*/
public boolean isAssignableFrom(WBAnnotated<?, ?> that)
{
@@ -233,7 +233,7 @@
*
* @return An array of (binding type) annotations
*
- * @see org.jboss.webbeans.introspector.WBAnnotated#getBindingsAsArray()
+ * @see org.jboss.weld.introspector.WBAnnotated#getBindingsAsArray()
*/
@Deprecated
public Annotation[] getBindingsAsArray()
@@ -246,7 +246,7 @@
*
* @return True if proxyable, false otherwise.
*
- * @see org.jboss.webbeans.introspector.WBAnnotated#isProxyable()
+ * @see org.jboss.weld.introspector.WBAnnotated#isProxyable()
*/
public boolean isProxyable()
{
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/introspector/jlr/AbstractWBCallable.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractWBCallable.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/introspector/jlr/AbstractWBCallable.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,14 +14,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.introspector.jlr;
+package org.jboss.weld.introspector.jlr;
import java.lang.reflect.Member;
import java.lang.reflect.Type;
-import org.jboss.webbeans.introspector.AnnotationStore;
-import org.jboss.webbeans.introspector.WBCallable;
-import org.jboss.webbeans.introspector.WBClass;
+import org.jboss.weld.introspector.AnnotationStore;
+import org.jboss.weld.introspector.WBCallable;
+import org.jboss.weld.introspector.WBClass;
/**
* @author pmuir
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/introspector/jlr/AbstractWBMember.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractWBMember.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/introspector/jlr/AbstractWBMember.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,17 +14,17 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.introspector.jlr;
+package org.jboss.weld.introspector.jlr;
import java.lang.reflect.Member;
import java.lang.reflect.Modifier;
import java.lang.reflect.Type;
-import org.jboss.webbeans.introspector.AnnotationStore;
-import org.jboss.webbeans.introspector.ForwardingWBMember;
-import org.jboss.webbeans.introspector.WBClass;
-import org.jboss.webbeans.introspector.WBMember;
-import org.jboss.webbeans.util.Reflections;
+import org.jboss.weld.introspector.AnnotationStore;
+import org.jboss.weld.introspector.ForwardingWBMember;
+import org.jboss.weld.introspector.WBClass;
+import org.jboss.weld.introspector.WBMember;
+import org.jboss.weld.util.Reflections;
/**
* Represents an abstract annotated memeber (field, method or constructor)
@@ -76,7 +76,7 @@
*
* @return True if static, false otherwise
*
- * @see org.jboss.webbeans.introspector.WBAnnotated#isStatic()
+ * @see org.jboss.weld.introspector.WBAnnotated#isStatic()
*/
public boolean isStatic()
{
@@ -88,7 +88,7 @@
*
* @return True if final, false otherwise
*
- * @see org.jboss.webbeans.introspector.WBAnnotated#isFinal()
+ * @see org.jboss.weld.introspector.WBAnnotated#isFinal()
*/
public boolean isFinal()
{
@@ -136,7 +136,7 @@
*
* @returns The name
*
- * @see org.jboss.webbeans.introspector.WBAnnotated#getName()
+ * @see org.jboss.weld.introspector.WBAnnotated#getName()
*/
public String getName()
{
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/introspector/jlr/ConstructorSignatureImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/ConstructorSignatureImpl.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/introspector/jlr/ConstructorSignatureImpl.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,12 +14,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.introspector.jlr;
+package org.jboss.weld.introspector.jlr;
import java.util.Arrays;
-import org.jboss.webbeans.introspector.ConstructorSignature;
-import org.jboss.webbeans.introspector.WBConstructor;
+import org.jboss.weld.introspector.ConstructorSignature;
+import org.jboss.weld.introspector.WBConstructor;
public class ConstructorSignatureImpl implements ConstructorSignature
{
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/introspector/jlr/MethodSignatureImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/MethodSignatureImpl.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/introspector/jlr/MethodSignatureImpl.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,13 +14,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.introspector.jlr;
+package org.jboss.weld.introspector.jlr;
import java.lang.reflect.Method;
import java.util.Arrays;
-import org.jboss.webbeans.introspector.MethodSignature;
-import org.jboss.webbeans.introspector.WBMethod;
+import org.jboss.weld.introspector.MethodSignature;
+import org.jboss.weld.introspector.WBMethod;
public class MethodSignatureImpl implements MethodSignature
{
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/introspector/jlr/WBAnnotationImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/WBAnnotationImpl.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/introspector/jlr/WBAnnotationImpl.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.introspector.jlr;
+package org.jboss.weld.introspector.jlr;
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
@@ -25,12 +25,12 @@
import java.util.Map;
import java.util.Set;
-import org.jboss.webbeans.introspector.AnnotationStore;
-import org.jboss.webbeans.introspector.WBAnnotation;
-import org.jboss.webbeans.introspector.WBClass;
-import org.jboss.webbeans.introspector.WBMethod;
-import org.jboss.webbeans.resources.ClassTransformer;
-import org.jboss.webbeans.util.Names;
+import org.jboss.weld.introspector.AnnotationStore;
+import org.jboss.weld.introspector.WBAnnotation;
+import org.jboss.weld.introspector.WBClass;
+import org.jboss.weld.introspector.WBMethod;
+import org.jboss.weld.resources.ClassTransformer;
+import org.jboss.weld.util.Names;
import com.google.common.base.Supplier;
import com.google.common.collect.Multimaps;
@@ -107,7 +107,7 @@
*
* @return The set of abstracted members
*
- * @see org.jboss.webbeans.introspector.WBAnnotation#getMembers()
+ * @see org.jboss.weld.introspector.WBAnnotation#getMembers()
*/
public Set<WBMethod<?, ?>> getMembers()
{
@@ -123,7 +123,7 @@
* @return The set of abstracted members with the given annotation type
* present. An empty set is returned if no matches are found
*
- * @see org.jboss.webbeans.introspector.WBAnnotation#getAnnotatedMembers(Class)
+ * @see org.jboss.weld.introspector.WBAnnotation#getAnnotatedMembers(Class)
*/
public Set<WBMethod<?, ?>> getAnnotatedMembers(Class<? extends Annotation> annotationType)
{
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/introspector/jlr/WBClassImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/WBClassImpl.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/introspector/jlr/WBClassImpl.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.introspector.jlr;
+package org.jboss.weld.introspector.jlr;
import java.lang.annotation.Annotation;
import java.lang.reflect.Constructor;
@@ -37,16 +37,16 @@
import javax.enterprise.inject.spi.AnnotatedMethod;
import javax.enterprise.inject.spi.AnnotatedType;
-import org.jboss.webbeans.introspector.AnnotationStore;
-import org.jboss.webbeans.introspector.ConstructorSignature;
-import org.jboss.webbeans.introspector.MethodSignature;
-import org.jboss.webbeans.introspector.WBClass;
-import org.jboss.webbeans.introspector.WBConstructor;
-import org.jboss.webbeans.introspector.WBField;
-import org.jboss.webbeans.introspector.WBMethod;
-import org.jboss.webbeans.resources.ClassTransformer;
-import org.jboss.webbeans.util.Names;
-import org.jboss.webbeans.util.Reflections;
+import org.jboss.weld.introspector.AnnotationStore;
+import org.jboss.weld.introspector.ConstructorSignature;
+import org.jboss.weld.introspector.MethodSignature;
+import org.jboss.weld.introspector.WBClass;
+import org.jboss.weld.introspector.WBConstructor;
+import org.jboss.weld.introspector.WBField;
+import org.jboss.weld.introspector.WBMethod;
+import org.jboss.weld.resources.ClassTransformer;
+import org.jboss.weld.util.Names;
+import org.jboss.weld.util.Reflections;
import com.google.common.base.Supplier;
import com.google.common.collect.Multimaps;
@@ -556,7 +556,7 @@
* @return A set of matching method abstractions. Returns an empty set if no
* matches are found.
*
- * @see org.jboss.webbeans.introspector.WBClass#getAnnotatedWBMethods(Class)
+ * @see org.jboss.weld.introspector.WBClass#getAnnotatedWBMethods(Class)
*/
public Set<WBMethod<?, ?>> getAnnotatedWBMethods(Class<? extends Annotation> annotationType)
{
@@ -576,7 +576,7 @@
* the constructors set is empty, initialize it first. Returns an
* empty set if there are no matches.
*
- * @see org.jboss.webbeans.introspector.WBClass#getAnnotatedWBConstructors(Class)
+ * @see org.jboss.weld.introspector.WBClass#getAnnotatedWBConstructors(Class)
*/
public Set<WBConstructor<T>> getAnnotatedWBConstructors(Class<? extends Annotation> annotationType)
{
@@ -672,7 +672,7 @@
*
* @return True if static, false otherwise
*
- * @see org.jboss.webbeans.introspector.WBAnnotated#isStatic()
+ * @see org.jboss.weld.introspector.WBAnnotated#isStatic()
*/
public boolean isStatic()
{
@@ -684,7 +684,7 @@
*
* @return True if final, false otherwise
*
- * @see org.jboss.webbeans.introspector.WBAnnotated#isFinal()
+ * @see org.jboss.weld.introspector.WBAnnotated#isFinal()
*/
public boolean isFinal()
{
@@ -701,7 +701,7 @@
*
* @returns The name
*
- * @see org.jboss.webbeans.introspector.WBAnnotated#getName()
+ * @see org.jboss.weld.introspector.WBAnnotated#getName()
*/
public String getName()
{
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/introspector/jlr/WBConstructorImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/WBConstructorImpl.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/introspector/jlr/WBConstructorImpl.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,9 +14,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.introspector.jlr;
+package org.jboss.weld.introspector.jlr;
-import static org.jboss.webbeans.util.Reflections.ensureAccessible;
+import static org.jboss.weld.util.Reflections.ensureAccessible;
import java.lang.annotation.Annotation;
import java.lang.reflect.Constructor;
@@ -32,13 +32,13 @@
import javax.enterprise.inject.spi.AnnotatedConstructor;
import javax.enterprise.inject.spi.AnnotatedParameter;
-import org.jboss.webbeans.BeanManagerImpl;
-import org.jboss.webbeans.introspector.AnnotationStore;
-import org.jboss.webbeans.introspector.ConstructorSignature;
-import org.jboss.webbeans.introspector.WBClass;
-import org.jboss.webbeans.introspector.WBConstructor;
-import org.jboss.webbeans.introspector.WBParameter;
-import org.jboss.webbeans.resources.ClassTransformer;
+import org.jboss.weld.BeanManagerImpl;
+import org.jboss.weld.introspector.AnnotationStore;
+import org.jboss.weld.introspector.ConstructorSignature;
+import org.jboss.weld.introspector.WBClass;
+import org.jboss.weld.introspector.WBConstructor;
+import org.jboss.weld.introspector.WBParameter;
+import org.jboss.weld.resources.ClassTransformer;
import com.google.common.base.Supplier;
import com.google.common.collect.ListMultimap;
@@ -192,7 +192,7 @@
*
* @return A list of annotated parameter abstractions
*
- * @see org.jboss.webbeans.introspector.WBConstructor#getWBParameters()
+ * @see org.jboss.weld.introspector.WBConstructor#getWBParameters()
*/
public List<WBParameter<?, ?>> getWBParameters()
{
@@ -208,7 +208,7 @@
* @return A list of matching parameter abstractions. An empty list is
* returned if there are no matches.
*
- * @see org.jboss.webbeans.introspector.WBConstructor#getAnnotatedWBParameters(Class)
+ * @see org.jboss.weld.introspector.WBConstructor#getAnnotatedWBParameters(Class)
*/
public List<WBParameter<?, ?>> getAnnotatedWBParameters(Class<? extends Annotation> annotationType)
{
@@ -225,7 +225,7 @@
* @throws InstantiationException
* @throws IllegalArgumentException
*
- * @see org.jboss.webbeans.introspector.WBConstructor#newInstance(BeanManagerImpl)
+ * @see org.jboss.weld.introspector.WBConstructor#newInstance(BeanManagerImpl)
*/
public T newInstance(Object... parameters) throws IllegalArgumentException, InstantiationException, IllegalAccessException, InvocationTargetException
{
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/introspector/jlr/WBFieldImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/WBFieldImpl.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/introspector/jlr/WBFieldImpl.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,19 +14,19 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.introspector.jlr;
+package org.jboss.weld.introspector.jlr;
-import static org.jboss.webbeans.util.Reflections.ensureAccessible;
+import static org.jboss.weld.util.Reflections.ensureAccessible;
import java.lang.reflect.Field;
import javax.enterprise.inject.spi.AnnotatedField;
-import org.jboss.webbeans.introspector.AnnotationStore;
-import org.jboss.webbeans.introspector.WBClass;
-import org.jboss.webbeans.introspector.WBField;
-import org.jboss.webbeans.resources.ClassTransformer;
-import org.jboss.webbeans.util.Reflections;
+import org.jboss.weld.introspector.AnnotationStore;
+import org.jboss.weld.introspector.WBClass;
+import org.jboss.weld.introspector.WBField;
+import org.jboss.weld.resources.ClassTransformer;
+import org.jboss.weld.util.Reflections;
/**
* Represents an annotated field
@@ -111,7 +111,7 @@
*
* @return The property name
*
- * @see org.jboss.webbeans.introspector.WBField#getName()
+ * @see org.jboss.weld.introspector.WBField#getName()
*/
public String getPropertyName()
{
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/introspector/jlr/WBMethodImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/WBMethodImpl.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/introspector/jlr/WBMethodImpl.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,9 +14,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.introspector.jlr;
+package org.jboss.weld.introspector.jlr;
-import static org.jboss.webbeans.util.Reflections.ensureAccessible;
+import static org.jboss.weld.util.Reflections.ensureAccessible;
import java.lang.annotation.Annotation;
import java.lang.reflect.InvocationTargetException;
@@ -33,13 +33,13 @@
import javax.enterprise.inject.spi.AnnotatedMethod;
import javax.enterprise.inject.spi.AnnotatedParameter;
-import org.jboss.webbeans.introspector.AnnotationStore;
-import org.jboss.webbeans.introspector.MethodSignature;
-import org.jboss.webbeans.introspector.WBClass;
-import org.jboss.webbeans.introspector.WBMethod;
-import org.jboss.webbeans.introspector.WBParameter;
-import org.jboss.webbeans.resources.ClassTransformer;
-import org.jboss.webbeans.util.Reflections;
+import org.jboss.weld.introspector.AnnotationStore;
+import org.jboss.weld.introspector.MethodSignature;
+import org.jboss.weld.introspector.WBClass;
+import org.jboss.weld.introspector.WBMethod;
+import org.jboss.weld.introspector.WBParameter;
+import org.jboss.weld.resources.ClassTransformer;
+import org.jboss.weld.util.Reflections;
import com.google.common.base.Supplier;
import com.google.common.collect.ListMultimap;
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/introspector/jlr/WBParameterImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/WBParameterImpl.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/introspector/jlr/WBParameterImpl.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.introspector.jlr;
+package org.jboss.weld.introspector.jlr;
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
@@ -22,10 +22,10 @@
import javax.enterprise.inject.spi.AnnotatedCallable;
-import org.jboss.webbeans.introspector.AnnotationStore;
-import org.jboss.webbeans.introspector.WBCallable;
-import org.jboss.webbeans.introspector.WBParameter;
-import org.jboss.webbeans.resources.ClassTransformer;
+import org.jboss.weld.introspector.AnnotationStore;
+import org.jboss.weld.introspector.WBCallable;
+import org.jboss.weld.introspector.WBParameter;
+import org.jboss.weld.resources.ClassTransformer;
/**
* Represents a parameter
@@ -84,7 +84,7 @@
*
* @return True if final, false otherwise
*
- * @see org.jboss.webbeans.introspector.WBAnnotated#isFinal()
+ * @see org.jboss.weld.introspector.WBAnnotated#isFinal()
*/
public boolean isFinal()
{
@@ -96,7 +96,7 @@
*
* @return True if static, false otherwise
*
- * @see org.jboss.webbeans.introspector.WBAnnotated#isStatic()
+ * @see org.jboss.weld.introspector.WBAnnotated#isStatic()
*/
public boolean isStatic()
{
@@ -128,7 +128,7 @@
*
* @throws IllegalArgumentException (not supported)
*
- * @see org.jboss.webbeans.introspector.WBAnnotated#getName()
+ * @see org.jboss.weld.introspector.WBAnnotated#getName()
*/
public String getName()
{
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/jsf (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/jsf)
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/jsf/ConversationAwareViewHandler.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/jsf/ConversationAwareViewHandler.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/jsf/ConversationAwareViewHandler.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,15 +14,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.jsf;
+package org.jboss.weld.jsf;
-import static org.jboss.webbeans.jsf.JsfHelper.getModuleBeanManager;
+import static org.jboss.weld.jsf.JsfHelper.getModuleBeanManager;
import javax.faces.application.ViewHandler;
import javax.faces.application.ViewHandlerWrapper;
import javax.faces.context.FacesContext;
-import org.jboss.webbeans.conversation.ConversationImpl;
+import org.jboss.weld.conversation.ConversationImpl;
/**
* <p>
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/jsf/FacesUrlTransformer.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/jsf/FacesUrlTransformer.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/jsf/FacesUrlTransformer.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,14 +14,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.jsf;
+package org.jboss.weld.jsf;
-import static org.jboss.webbeans.jsf.JsfHelper.getModuleBeanManager;
+import static org.jboss.weld.jsf.JsfHelper.getModuleBeanManager;
import javax.enterprise.inject.AnnotationLiteral;
import javax.faces.context.FacesContext;
-import org.jboss.webbeans.conversation.ConversationIdName;
+import org.jboss.weld.conversation.ConversationIdName;
/**
* Helper class for preparing JSF URLs which include the conversation id.
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/jsf/JsfApiAbstraction.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/jsf/JsfApiAbstraction.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/jsf/JsfApiAbstraction.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,11 +14,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.jsf;
+package org.jboss.weld.jsf;
-import org.jboss.webbeans.bootstrap.api.Service;
-import org.jboss.webbeans.resources.spi.ResourceLoader;
-import org.jboss.webbeans.util.ApiAbstraction;
+import org.jboss.weld.bootstrap.api.Service;
+import org.jboss.weld.resources.spi.ResourceLoader;
+import org.jboss.weld.util.ApiAbstraction;
/**
* Utility class for JSF related components, concepts etc. It can also
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/jsf/JsfHelper.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/jsf/JsfHelper.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/jsf/JsfHelper.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,20 +14,20 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.jsf;
+package org.jboss.weld.jsf;
import javax.enterprise.inject.AnnotationLiteral;
import javax.faces.context.FacesContext;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpSession;
-import org.jboss.webbeans.BeanManagerImpl;
-import org.jboss.webbeans.Container;
-import org.jboss.webbeans.conversation.ConversationIdName;
-import org.jboss.webbeans.log.LogProvider;
-import org.jboss.webbeans.log.Logging;
-import org.jboss.webbeans.servlet.ServletHelper;
-import org.jboss.webbeans.util.Reflections;
+import org.jboss.weld.BeanManagerImpl;
+import org.jboss.weld.Container;
+import org.jboss.weld.conversation.ConversationIdName;
+import org.jboss.weld.log.LogProvider;
+import org.jboss.weld.log.Logging;
+import org.jboss.weld.servlet.ServletHelper;
+import org.jboss.weld.util.Reflections;
/**
* Helper class for JSF related operations
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/jsf/WebBeansPhaseListener.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/jsf/WebBeansPhaseListener.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/jsf/WebBeansPhaseListener.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -20,11 +20,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.jsf;
+package org.jboss.weld.jsf;
-import static org.jboss.webbeans.jsf.JsfHelper.getConversationId;
-import static org.jboss.webbeans.jsf.JsfHelper.getHttpSession;
-import static org.jboss.webbeans.jsf.JsfHelper.getModuleBeanManager;
+import static org.jboss.weld.jsf.JsfHelper.getConversationId;
+import static org.jboss.weld.jsf.JsfHelper.getHttpSession;
+import static org.jboss.weld.jsf.JsfHelper.getModuleBeanManager;
import javax.faces.context.FacesContext;
import javax.faces.event.PhaseEvent;
@@ -32,17 +32,17 @@
import javax.faces.event.PhaseListener;
import javax.servlet.http.HttpSession;
-import org.jboss.webbeans.BeanManagerImpl;
-import org.jboss.webbeans.Container;
-import org.jboss.webbeans.context.ContextLifecycle;
-import org.jboss.webbeans.context.ConversationContext;
-import org.jboss.webbeans.context.SessionContext;
-import org.jboss.webbeans.conversation.ConversationImpl;
-import org.jboss.webbeans.conversation.ConversationManager;
-import org.jboss.webbeans.log.LogProvider;
-import org.jboss.webbeans.log.Logging;
-import org.jboss.webbeans.servlet.ConversationBeanStore;
-import org.jboss.webbeans.servlet.HttpSessionManager;
+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.log.LogProvider;
+import org.jboss.weld.log.Logging;
+import org.jboss.weld.servlet.ConversationBeanStore;
+import org.jboss.weld.servlet.HttpSessionManager;
/**
* <p>
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/jsp (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/jsp)
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/literal (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/literal)
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/literal/AnyLiteral.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/literal/AnyLiteral.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/literal/AnyLiteral.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.literal;
+package org.jboss.weld.literal;
import javax.enterprise.inject.AnnotationLiteral;
import javax.enterprise.inject.Any;
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/literal/BindingTypeLiteral.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/literal/BindingTypeLiteral.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/literal/BindingTypeLiteral.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.literal;
+package org.jboss.weld.literal;
import javax.enterprise.inject.AnnotationLiteral;
import javax.inject.Qualifier;
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/literal/DefaultLiteral.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/literal/DefaultLiteral.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/literal/DefaultLiteral.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.literal;
+package org.jboss.weld.literal;
import javax.enterprise.inject.AnnotationLiteral;
import javax.enterprise.inject.Default;
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/literal/InjectLiteral.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/literal/InjectLiteral.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/literal/InjectLiteral.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.literal;
+package org.jboss.weld.literal;
import javax.enterprise.inject.AnnotationLiteral;
import javax.inject.Inject;
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/literal/InterceptorBindingTypeLiteral.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/literal/InterceptorBindingTypeLiteral.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/literal/InterceptorBindingTypeLiteral.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.literal;
+package org.jboss.weld.literal;
import javax.enterprise.inject.AnnotationLiteral;
import javax.interceptor.InterceptorBinding;
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/literal/NewLiteral.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/literal/NewLiteral.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/literal/NewLiteral.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.literal;
+package org.jboss.weld.literal;
import javax.enterprise.inject.AnnotationLiteral;
import javax.enterprise.inject.New;
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/literal/NormalScopeLiteral.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/literal/NormalScopeLiteral.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/literal/NormalScopeLiteral.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.literal;
+package org.jboss.weld.literal;
import javax.enterprise.context.NormalScope;
import javax.enterprise.inject.AnnotationLiteral;
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/literal/ScopeLiteral.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/literal/ScopeLiteral.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/literal/ScopeLiteral.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.literal;
+package org.jboss.weld.literal;
import javax.enterprise.inject.AnnotationLiteral;
import javax.inject.Scope;
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/literal/StereotypeLiteral.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/literal/StereotypeLiteral.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/literal/StereotypeLiteral.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.literal;
+package org.jboss.weld.literal;
import javax.enterprise.inject.AnnotationLiteral;
import javax.enterprise.inject.stereotype.Stereotype;
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/metadata/TypeStore.java (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/TypeStore.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/weld/metadata/TypeStore.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/metadata/TypeStore.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -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.metadata;
+
+import java.lang.annotation.Annotation;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.jboss.weld.bootstrap.api.Service;
+
+import com.google.common.base.Supplier;
+import com.google.common.collect.Multimaps;
+import com.google.common.collect.SetMultimap;
+
+/**
+ * @author pmuir
+ *
+ */
+public class TypeStore implements Service
+{
+
+ private final SetMultimap<Class<? extends Annotation>, Annotation> extraAnnotations;
+
+ public TypeStore()
+ {
+ this.extraAnnotations = Multimaps.synchronizedSetMultimap(Multimaps.newSetMultimap(new HashMap<Class<? extends Annotation>, Collection<Annotation>>(), new Supplier<Set<Annotation>>()
+ {
+
+ public Set<Annotation> get()
+ {
+ return new HashSet<Annotation>();
+ }
+
+ }));
+ }
+
+ public Set<Annotation> get(Class<? extends Annotation> annotationType)
+ {
+ return extraAnnotations.get(annotationType);
+ }
+
+ public void add(Class<? extends Annotation> annotationType, Annotation annotation)
+ {
+ this.extraAnnotations.put(annotationType, annotation);
+ }
+
+ public void addAll(Class<? extends Annotation> annotationType, Set<Annotation> annotations)
+ {
+ this.extraAnnotations.get(annotationType).addAll(annotations);
+ }
+
+ public void cleanup() {}
+
+}
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/metadata/cache (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/cache)
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/metadata/cache/AnnotationModel.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/cache/AnnotationModel.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/metadata/cache/AnnotationModel.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,18 +14,18 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.metadata.cache;
+package org.jboss.weld.metadata.cache;
import java.lang.annotation.Annotation;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.Set;
-import org.jboss.webbeans.DefinitionException;
-import org.jboss.webbeans.introspector.WBAnnotation;
-import org.jboss.webbeans.log.Log;
-import org.jboss.webbeans.log.Logging;
-import org.jboss.webbeans.resources.ClassTransformer;
+import org.jboss.weld.DefinitionException;
+import org.jboss.weld.introspector.WBAnnotation;
+import org.jboss.weld.log.Log;
+import org.jboss.weld.log.Logging;
+import org.jboss.weld.resources.ClassTransformer;
/**
* Abstract representation of an annotation model
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/metadata/cache/BindingTypeModel.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/cache/BindingTypeModel.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/metadata/cache/BindingTypeModel.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.metadata.cache;
+package org.jboss.weld.metadata.cache;
import java.lang.annotation.Annotation;
import java.lang.reflect.InvocationTargetException;
@@ -23,13 +23,13 @@
import javax.enterprise.inject.Nonbinding;
import javax.inject.Qualifier;
-import org.jboss.webbeans.DefinitionException;
-import org.jboss.webbeans.introspector.WBMethod;
-import org.jboss.webbeans.log.Log;
-import org.jboss.webbeans.log.Logging;
-import org.jboss.webbeans.resources.ClassTransformer;
-import org.jboss.webbeans.util.Reflections;
-import org.jboss.webbeans.util.collections.Arrays2;
+import org.jboss.weld.DefinitionException;
+import org.jboss.weld.introspector.WBMethod;
+import org.jboss.weld.log.Log;
+import org.jboss.weld.log.Logging;
+import org.jboss.weld.resources.ClassTransformer;
+import org.jboss.weld.util.Reflections;
+import org.jboss.weld.util.collections.Arrays2;
/**
*
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/metadata/cache/InterceptorBindingModel.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/cache/InterceptorBindingModel.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/metadata/cache/InterceptorBindingModel.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -15,13 +15,13 @@
* limitations under the License.
*/
-package org.jboss.webbeans.metadata.cache;
+package org.jboss.weld.metadata.cache;
-import org.jboss.webbeans.resources.ClassTransformer;
-import org.jboss.webbeans.util.collections.Arrays2;
-import org.jboss.webbeans.log.Log;
-import org.jboss.webbeans.log.Logging;
-import org.jboss.webbeans.introspector.WBMethod;
+import org.jboss.weld.introspector.WBMethod;
+import org.jboss.weld.log.Log;
+import org.jboss.weld.log.Logging;
+import org.jboss.weld.resources.ClassTransformer;
+import org.jboss.weld.util.collections.Arrays2;
import javax.interceptor.InterceptorBinding;
import javax.enterprise.inject.Nonbinding;
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/metadata/cache/MergedStereotypes.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/cache/MergedStereotypes.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/metadata/cache/MergedStereotypes.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,13 +14,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.metadata.cache;
+package org.jboss.weld.metadata.cache;
import java.lang.annotation.Annotation;
import java.util.HashSet;
import java.util.Set;
-import org.jboss.webbeans.BeanManagerImpl;
+import org.jboss.weld.BeanManagerImpl;
/**
* Meta model for the merged stereotype for a bean
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/metadata/cache/MetaAnnotationStore.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/cache/MetaAnnotationStore.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/metadata/cache/MetaAnnotationStore.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,14 +14,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.metadata.cache;
+package org.jboss.weld.metadata.cache;
import java.lang.annotation.Annotation;
import java.util.concurrent.Callable;
-import org.jboss.webbeans.bootstrap.api.Service;
-import org.jboss.webbeans.resources.ClassTransformer;
-import org.jboss.webbeans.util.collections.ConcurrentCache;
+import org.jboss.weld.bootstrap.api.Service;
+import org.jboss.weld.resources.ClassTransformer;
+import org.jboss.weld.util.collections.ConcurrentCache;
/**
* Metadata singleton for holding EJB metadata, scope models etc.
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/metadata/cache/ScopeModel.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/cache/ScopeModel.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/metadata/cache/ScopeModel.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.metadata.cache;
+package org.jboss.weld.metadata.cache;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.METHOD;
@@ -27,10 +27,10 @@
import javax.enterprise.context.NormalScope;
import javax.inject.Scope;
-import org.jboss.webbeans.log.Log;
-import org.jboss.webbeans.log.Logging;
-import org.jboss.webbeans.resources.ClassTransformer;
-import org.jboss.webbeans.util.collections.Arrays2;
+import org.jboss.weld.log.Log;
+import org.jboss.weld.log.Logging;
+import org.jboss.weld.resources.ClassTransformer;
+import org.jboss.weld.util.collections.Arrays2;
/**
*
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/metadata/cache/StereotypeModel.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/cache/StereotypeModel.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/metadata/cache/StereotypeModel.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.metadata.cache;
+package org.jboss.weld.metadata.cache;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.METHOD;
@@ -33,11 +33,11 @@
import javax.inject.Scope;
import javax.interceptor.InterceptorBinding;
-import org.jboss.webbeans.DefinitionException;
-import org.jboss.webbeans.log.Log;
-import org.jboss.webbeans.log.Logging;
-import org.jboss.webbeans.resources.ClassTransformer;
-import org.jboss.webbeans.util.collections.Arrays2;
+import org.jboss.weld.DefinitionException;
+import org.jboss.weld.log.Log;
+import org.jboss.weld.log.Logging;
+import org.jboss.weld.resources.ClassTransformer;
+import org.jboss.weld.util.collections.Arrays2;
/**
* A meta model for a stereotype, allows us to cache a stereotype and to
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/persistence (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/persistence)
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/persistence/PersistenceApiAbstraction.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/persistence/PersistenceApiAbstraction.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/persistence/PersistenceApiAbstraction.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,13 +14,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.persistence;
+package org.jboss.weld.persistence;
import java.lang.annotation.Annotation;
-import org.jboss.webbeans.bootstrap.api.Service;
-import org.jboss.webbeans.resources.spi.ResourceLoader;
-import org.jboss.webbeans.util.ApiAbstraction;
+import org.jboss.weld.bootstrap.api.Service;
+import org.jboss.weld.resources.spi.ResourceLoader;
+import org.jboss.weld.util.ApiAbstraction;
public class PersistenceApiAbstraction extends ApiAbstraction implements Service
{
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/resolution (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/resolution)
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/resolution/ForwardingResolvable.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/resolution/ForwardingResolvable.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/resolution/ForwardingResolvable.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,13 +14,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.resolution;
+package org.jboss.weld.resolution;
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
import java.util.Set;
-import org.jboss.webbeans.bean.AbstractClassBean;
+import org.jboss.weld.bean.AbstractClassBean;
public abstract class ForwardingResolvable implements Resolvable
{
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/resolution/InterceptorResolvable.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/resolution/InterceptorResolvable.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/resolution/InterceptorResolvable.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.jboss.webbeans.resolution;
+package org.jboss.weld.resolution;
import javax.enterprise.inject.spi.InterceptionType;
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/resolution/NameBasedResolver.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/resolution/NameBasedResolver.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/resolution/NameBasedResolver.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.resolution;
+package org.jboss.weld.resolution;
import java.util.HashSet;
import java.util.Set;
@@ -22,9 +22,9 @@
import javax.enterprise.inject.spi.Bean;
-import org.jboss.webbeans.BeanManagerImpl;
-import org.jboss.webbeans.util.Beans;
-import org.jboss.webbeans.util.collections.ConcurrentCache;
+import org.jboss.weld.BeanManagerImpl;
+import org.jboss.weld.util.Beans;
+import org.jboss.weld.util.collections.ConcurrentCache;
/**
* Implementation of name based bean resolution
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/resolution/NewResolvableTransformer.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/resolution/NewResolvableTransformer.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/resolution/NewResolvableTransformer.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.resolution;
+package org.jboss.weld.resolution;
import java.lang.annotation.Annotation;
import java.util.HashSet;
@@ -22,7 +22,7 @@
import javax.enterprise.inject.New;
-import org.jboss.webbeans.literal.NewLiteral;
+import org.jboss.weld.literal.NewLiteral;
/**
* @author pmuir
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/resolution/Resolvable.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/resolution/Resolvable.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/resolution/Resolvable.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,13 +14,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.resolution;
+package org.jboss.weld.resolution;
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
import java.util.Set;
-import org.jboss.webbeans.bean.AbstractClassBean;
+import org.jboss.weld.bean.AbstractClassBean;
/**
* Something that is resovable by the resolver. A resolvable is defined by it's
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/resolution/ResolvableFactory.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/resolution/ResolvableFactory.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/resolution/ResolvableFactory.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.resolution;
+package org.jboss.weld.resolution;
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
@@ -25,10 +25,10 @@
import java.util.Set;
import java.util.Collections;
-import org.jboss.webbeans.bean.AbstractClassBean;
-import org.jboss.webbeans.introspector.WBAnnotated;
-import org.jboss.webbeans.literal.DefaultLiteral;
-import org.jboss.webbeans.util.Reflections;
+import org.jboss.weld.bean.AbstractClassBean;
+import org.jboss.weld.introspector.WBAnnotated;
+import org.jboss.weld.literal.DefaultLiteral;
+import org.jboss.weld.util.Reflections;
import javax.enterprise.inject.spi.InterceptionType;
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/resolution/ResolvableTransformer.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/resolution/ResolvableTransformer.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/resolution/ResolvableTransformer.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.resolution;
+package org.jboss.weld.resolution;
public interface ResolvableTransformer
{
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/resolution/ResolvableWBClass.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/resolution/ResolvableWBClass.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/resolution/ResolvableWBClass.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.resolution;
+package org.jboss.weld.resolution;
import java.lang.annotation.Annotation;
import java.lang.reflect.Field;
@@ -30,15 +30,15 @@
import javax.enterprise.inject.TypeLiteral;
import javax.enterprise.inject.spi.InjectionPoint;
-import org.jboss.webbeans.BeanManagerImpl;
-import org.jboss.webbeans.bean.AbstractClassBean;
-import org.jboss.webbeans.injection.WBInjectionPoint;
-import org.jboss.webbeans.introspector.AnnotationStore;
-import org.jboss.webbeans.introspector.WBAnnotated;
-import org.jboss.webbeans.introspector.jlr.AbstractWBAnnotated;
-import org.jboss.webbeans.metadata.TypeStore;
-import org.jboss.webbeans.util.Names;
-import org.jboss.webbeans.util.Reflections;
+import org.jboss.weld.BeanManagerImpl;
+import org.jboss.weld.bean.AbstractClassBean;
+import org.jboss.weld.injection.WBInjectionPoint;
+import org.jboss.weld.introspector.AnnotationStore;
+import org.jboss.weld.introspector.WBAnnotated;
+import org.jboss.weld.introspector.jlr.AbstractWBAnnotated;
+import org.jboss.weld.metadata.TypeStore;
+import org.jboss.weld.util.Names;
+import org.jboss.weld.util.Reflections;
public class ResolvableWBClass<T> extends AbstractWBAnnotated<T, Class<T>> implements Resolvable
{
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/resolution/TypeSafeBeanResolver.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/resolution/TypeSafeBeanResolver.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/resolution/TypeSafeBeanResolver.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.resolution;
+package org.jboss.weld.resolution;
import java.util.Collection;
import java.util.HashSet;
@@ -23,12 +23,12 @@
import javax.enterprise.inject.spi.Bean;
-import org.jboss.webbeans.BeanManagerImpl;
-import org.jboss.webbeans.bean.builtin.facade.EventBean;
-import org.jboss.webbeans.bean.builtin.facade.InstanceBean;
-import org.jboss.webbeans.util.Beans;
-import org.jboss.webbeans.util.Reflections;
-import org.jboss.webbeans.util.collections.ConcurrentCache;
+import org.jboss.weld.BeanManagerImpl;
+import org.jboss.weld.bean.builtin.facade.EventBean;
+import org.jboss.weld.bean.builtin.facade.InstanceBean;
+import org.jboss.weld.util.Beans;
+import org.jboss.weld.util.Reflections;
+import org.jboss.weld.util.collections.ConcurrentCache;
/**
* @author pmuir
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/resolution/TypeSafeDecoratorResolver.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/resolution/TypeSafeDecoratorResolver.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/resolution/TypeSafeDecoratorResolver.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,17 +14,17 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.resolution;
+package org.jboss.weld.resolution;
import java.util.Comparator;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;
-import org.jboss.webbeans.BeanManagerImpl;
-import org.jboss.webbeans.bean.DecoratorImpl;
-import org.jboss.webbeans.util.Beans;
-import org.jboss.webbeans.util.Reflections;
+import org.jboss.weld.BeanManagerImpl;
+import org.jboss.weld.bean.DecoratorImpl;
+import org.jboss.weld.util.Beans;
+import org.jboss.weld.util.Reflections;
/**
* @author pmuir
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/resolution/TypeSafeDisposerResolver.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/resolution/TypeSafeDisposerResolver.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/resolution/TypeSafeDisposerResolver.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,15 +14,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.resolution;
+package org.jboss.weld.resolution;
import java.util.Collections;
import java.util.Set;
-import org.jboss.webbeans.BeanManagerImpl;
-import org.jboss.webbeans.bean.DisposalMethod;
-import org.jboss.webbeans.util.Beans;
-import org.jboss.webbeans.util.Reflections;
+import org.jboss.weld.BeanManagerImpl;
+import org.jboss.weld.bean.DisposalMethod;
+import org.jboss.weld.util.Beans;
+import org.jboss.weld.util.Reflections;
/**
* @author pmuir
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/resolution/TypeSafeInterceptorResolver.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/resolution/TypeSafeInterceptorResolver.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/resolution/TypeSafeInterceptorResolver.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.jboss.webbeans.resolution;
+package org.jboss.weld.resolution;
import java.util.Collections;
import java.util.Comparator;
@@ -23,9 +23,9 @@
import java.util.Set;
import java.util.TreeSet;
-import org.jboss.webbeans.BeanManagerImpl;
-import org.jboss.webbeans.bean.InterceptorImpl;
-import org.jboss.webbeans.util.Beans;
+import org.jboss.weld.BeanManagerImpl;
+import org.jboss.weld.bean.InterceptorImpl;
+import org.jboss.weld.util.Beans;
/**
* @author <a href="mailto:mariusb@redhat.com">Marius Bogoevici</a>
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/resolution/TypeSafeObserverResolver.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/resolution/TypeSafeObserverResolver.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/resolution/TypeSafeObserverResolver.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,16 +14,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.resolution;
+package org.jboss.weld.resolution;
import java.util.Collections;
import java.util.Set;
import javax.enterprise.inject.spi.ObserverMethod;
-import org.jboss.webbeans.BeanManagerImpl;
-import org.jboss.webbeans.util.Beans;
-import org.jboss.webbeans.util.Reflections;
+import org.jboss.weld.BeanManagerImpl;
+import org.jboss.weld.util.Beans;
+import org.jboss.weld.util.Reflections;
/**
* @author pmuir
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/resolution/TypeSafeResolver.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/resolution/TypeSafeResolver.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/resolution/TypeSafeResolver.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,14 +14,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.resolution;
+package org.jboss.weld.resolution;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import java.util.concurrent.Callable;
-import org.jboss.webbeans.util.collections.ConcurrentCache;
+import org.jboss.weld.util.collections.ConcurrentCache;
/**
* Implementation of type safe bean resolution
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/resources (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/resources)
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/resources/ClassTransformer.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/resources/ClassTransformer.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/resources/ClassTransformer.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,20 +14,20 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.resources;
+package org.jboss.weld.resources;
import java.lang.annotation.Annotation;
import java.util.concurrent.Callable;
import javax.enterprise.inject.spi.AnnotatedType;
-import org.jboss.webbeans.bootstrap.api.Service;
-import org.jboss.webbeans.introspector.WBAnnotation;
-import org.jboss.webbeans.introspector.WBClass;
-import org.jboss.webbeans.introspector.jlr.WBAnnotationImpl;
-import org.jboss.webbeans.introspector.jlr.WBClassImpl;
-import org.jboss.webbeans.metadata.TypeStore;
-import org.jboss.webbeans.util.collections.ConcurrentCache;
+import org.jboss.weld.bootstrap.api.Service;
+import org.jboss.weld.introspector.WBAnnotation;
+import org.jboss.weld.introspector.WBClass;
+import org.jboss.weld.introspector.jlr.WBAnnotationImpl;
+import org.jboss.weld.introspector.jlr.WBClassImpl;
+import org.jboss.weld.metadata.TypeStore;
+import org.jboss.weld.util.collections.ConcurrentCache;
public class ClassTransformer implements Service
{
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/resources/DefaultResourceLoader.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/resources/DefaultResourceLoader.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/resources/DefaultResourceLoader.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,15 +14,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.resources;
+package org.jboss.weld.resources;
import java.io.IOException;
import java.net.URL;
import java.util.Collection;
-import org.jboss.webbeans.resources.spi.ResourceLoader;
-import org.jboss.webbeans.resources.spi.ResourceLoadingException;
-import org.jboss.webbeans.util.collections.EnumerationList;
+import org.jboss.weld.resources.spi.ResourceLoader;
+import org.jboss.weld.resources.spi.ResourceLoadingException;
+import org.jboss.weld.util.collections.EnumerationList;
/**
* A simple resource loader.
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/resources/ManagerObjectFactory.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/resources/ManagerObjectFactory.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/resources/ManagerObjectFactory.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.resources;
+package org.jboss.weld.resources;
import java.util.Hashtable;
@@ -22,7 +22,7 @@
import javax.naming.Name;
import javax.naming.spi.ObjectFactory;
-import org.jboss.webbeans.Container;
+import org.jboss.weld.Container;
public class ManagerObjectFactory implements ObjectFactory
{
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/servlet (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/servlet)
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/servlet/ApplicationBeanStore.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/servlet/ApplicationBeanStore.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/servlet/ApplicationBeanStore.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,23 +14,23 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.servlet;
+package org.jboss.weld.servlet;
import java.util.Collection;
import java.util.Enumeration;
import javax.servlet.ServletContext;
-import org.jboss.webbeans.context.AbstractApplicationContext;
-import org.jboss.webbeans.context.beanstore.AbstractAttributeBackedBeanStore;
-import org.jboss.webbeans.context.beanstore.NamingScheme;
+import org.jboss.weld.context.AbstractApplicationContext;
+import org.jboss.weld.context.beanstore.AbstractAttributeBackedBeanStore;
+import org.jboss.weld.context.beanstore.NamingScheme;
/**
* A BeanStore that uses a servlet context as backing storage
*
* @author Nicklas Karlsson
*
- * @see org.jboss.webbeans.context.AbstractApplicationContext
+ * @see org.jboss.weld.context.AbstractApplicationContext
*/
public class ApplicationBeanStore extends AbstractAttributeBackedBeanStore
{
@@ -52,7 +52,7 @@
}
/**
- * @see org.jboss.webbeans.context.beanstore.AbstractAttributeBackedBeanStore#getAttribute()
+ * @see org.jboss.weld.context.beanstore.AbstractAttributeBackedBeanStore#getAttribute()
*/
@Override
protected Object getAttribute(String key)
@@ -61,7 +61,7 @@
}
/**
- * @see org.jboss.webbeans.context.beanstore.AbstractAttributeBackedBeanStore#getAttributeNames()
+ * @see org.jboss.weld.context.beanstore.AbstractAttributeBackedBeanStore#getAttributeNames()
*/
@SuppressWarnings("unchecked")
@Override
@@ -71,7 +71,7 @@
}
/**
- * @see org.jboss.webbeans.context.beanstore.AbstractAttributeBackedBeanStore#removeAttributes()
+ * @see org.jboss.weld.context.beanstore.AbstractAttributeBackedBeanStore#removeAttributes()
*/
@Override
protected void removeAttribute(String key)
@@ -80,7 +80,7 @@
}
/**
- * @see org.jboss.webbeans.context.beanstore.AbstractAttributeBackedBeanStore#setAttribute()
+ * @see org.jboss.weld.context.beanstore.AbstractAttributeBackedBeanStore#setAttribute()
*/
@Override
protected void setAttribute(String key, Object instance)
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/servlet/ConversationBeanStore.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/servlet/ConversationBeanStore.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/servlet/ConversationBeanStore.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,12 +14,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.servlet;
+package org.jboss.weld.servlet;
import javax.servlet.http.HttpSession;
-import org.jboss.webbeans.context.ConversationContext;
-import org.jboss.webbeans.context.beanstore.NamingScheme;
+import org.jboss.weld.context.ConversationContext;
+import org.jboss.weld.context.beanstore.NamingScheme;
/**
* A HTTP session backed bean store for the conversational scope
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/servlet/ConversationPropagationFilter.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/servlet/ConversationPropagationFilter.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/servlet/ConversationPropagationFilter.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,9 +14,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.servlet;
+package org.jboss.weld.servlet;
-import static org.jboss.webbeans.servlet.ServletHelper.getModuleBeanManager;
+import static org.jboss.weld.servlet.ServletHelper.getModuleBeanManager;
import java.io.IOException;
@@ -33,10 +33,10 @@
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpServletResponseWrapper;
-import org.jboss.webbeans.conversation.ConversationIdName;
-import org.jboss.webbeans.conversation.ConversationImpl;
-import org.jboss.webbeans.conversation.ConversationManager;
-import org.jboss.webbeans.jsf.FacesUrlTransformer;
+import org.jboss.weld.conversation.ConversationIdName;
+import org.jboss.weld.conversation.ConversationImpl;
+import org.jboss.weld.conversation.ConversationManager;
+import org.jboss.weld.jsf.FacesUrlTransformer;
/**
* <p>A Filter for handling conversation propagation over redirects.</p>
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/servlet/HttpRequestSessionBeanStore.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/servlet/HttpRequestSessionBeanStore.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/servlet/HttpRequestSessionBeanStore.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -4,7 +4,7 @@
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
-package org.jboss.webbeans.servlet;
+package org.jboss.weld.servlet;
import java.util.Collections;
import java.util.Enumeration;
@@ -12,9 +12,9 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
-import org.jboss.webbeans.context.SessionContext;
-import org.jboss.webbeans.context.beanstore.AbstractAttributeBackedBeanStore;
-import org.jboss.webbeans.context.beanstore.NamingScheme;
+import org.jboss.weld.context.SessionContext;
+import org.jboss.weld.context.beanstore.AbstractAttributeBackedBeanStore;
+import org.jboss.weld.context.beanstore.NamingScheme;
/**
* Abstracts the servlet API specific session context
@@ -40,7 +40,7 @@
}
/**
- * @see org.jboss.webbeans.context.beanstore.AbstractAttributeBackedBeanStore#getAttribute()
+ * @see org.jboss.weld.context.beanstore.AbstractAttributeBackedBeanStore#getAttribute()
*/
@Override
protected Object getAttribute(String key)
@@ -50,7 +50,7 @@
}
/**
- * @see org.jboss.webbeans.context.beanstore.AbstractAttributeBackedBeanStore#getAttributeNames()
+ * @see org.jboss.weld.context.beanstore.AbstractAttributeBackedBeanStore#getAttributeNames()
*/
@SuppressWarnings("unchecked")
@Override
@@ -68,7 +68,7 @@
}
/**
- * @see org.jboss.webbeans.context.beanstore.AbstractAttributeBackedBeanStore#removeAttributes()
+ * @see org.jboss.weld.context.beanstore.AbstractAttributeBackedBeanStore#removeAttributes()
*/
@Override
protected void removeAttribute(String key)
@@ -81,7 +81,7 @@
}
/**
- * @see org.jboss.webbeans.context.beanstore.AbstractAttributeBackedBeanStore#setAttribute()
+ * @see org.jboss.weld.context.beanstore.AbstractAttributeBackedBeanStore#setAttribute()
*/
@Override
protected void setAttribute(String key, Object instance)
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/servlet/HttpSessionBeanStore.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/servlet/HttpSessionBeanStore.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/servlet/HttpSessionBeanStore.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,22 +14,22 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.servlet;
+package org.jboss.weld.servlet;
import java.util.Enumeration;
import javax.servlet.http.HttpSession;
-import org.jboss.webbeans.context.SessionContext;
-import org.jboss.webbeans.context.beanstore.AbstractAttributeBackedBeanStore;
-import org.jboss.webbeans.context.beanstore.NamingScheme;
+import org.jboss.weld.context.SessionContext;
+import org.jboss.weld.context.beanstore.AbstractAttributeBackedBeanStore;
+import org.jboss.weld.context.beanstore.NamingScheme;
/**
* A BeanStore that uses a HTTP session as backing storage
*
* @author Nicklas Karlsson
*
- * @see org.jboss.webbeans.context.AbstractApplicationContext
+ * @see org.jboss.weld.context.AbstractApplicationContext
*/
public class HttpSessionBeanStore extends AbstractAttributeBackedBeanStore
{
@@ -51,7 +51,7 @@
}
/**
- * @see org.jboss.webbeans.context.beanstore.AbstractAttributeBackedBeanStore#getAttribute()
+ * @see org.jboss.weld.context.beanstore.AbstractAttributeBackedBeanStore#getAttribute()
*/
@Override
protected Object getAttribute(String key)
@@ -60,7 +60,7 @@
}
/**
- * @see org.jboss.webbeans.context.beanstore.AbstractAttributeBackedBeanStore#getAttributeNames()
+ * @see org.jboss.weld.context.beanstore.AbstractAttributeBackedBeanStore#getAttributeNames()
*/
@SuppressWarnings("unchecked")
@Override
@@ -70,7 +70,7 @@
}
/**
- * @see org.jboss.webbeans.context.beanstore.AbstractAttributeBackedBeanStore#removeAttributes()
+ * @see org.jboss.weld.context.beanstore.AbstractAttributeBackedBeanStore#removeAttributes()
*/
@Override
protected void removeAttribute(String key)
@@ -79,7 +79,7 @@
}
/**
- * @see org.jboss.webbeans.context.beanstore.AbstractAttributeBackedBeanStore#setAttribute()
+ * @see org.jboss.weld.context.beanstore.AbstractAttributeBackedBeanStore#setAttribute()
*/
@Override
protected void setAttribute(String key, Object instance)
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/servlet/HttpSessionManager.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/servlet/HttpSessionManager.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/servlet/HttpSessionManager.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.servlet;
+package org.jboss.weld.servlet;
import javax.enterprise.context.RequestScoped;
import javax.enterprise.inject.Produces;
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/servlet/ServletApiAbstraction.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/servlet/ServletApiAbstraction.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/servlet/ServletApiAbstraction.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,11 +14,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.servlet;
+package org.jboss.weld.servlet;
-import org.jboss.webbeans.bootstrap.api.Service;
-import org.jboss.webbeans.resources.spi.ResourceLoader;
-import org.jboss.webbeans.util.ApiAbstraction;
+import org.jboss.weld.bootstrap.api.Service;
+import org.jboss.weld.resources.spi.ResourceLoader;
+import org.jboss.weld.util.ApiAbstraction;
/**
* Abstraction for classes in the Servlet API
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/servlet/ServletHelper.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/servlet/ServletHelper.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/servlet/ServletHelper.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,14 +14,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.servlet;
+package org.jboss.weld.servlet;
import javax.servlet.ServletContext;
-import org.jboss.webbeans.BeanManagerImpl;
-import org.jboss.webbeans.Container;
-import org.jboss.webbeans.bootstrap.spi.BeanDeploymentArchive;
-import org.jboss.webbeans.servlet.api.ServletServices;
+import org.jboss.weld.BeanManagerImpl;
+import org.jboss.weld.Container;
+import org.jboss.weld.bootstrap.spi.BeanDeploymentArchive;
+import org.jboss.weld.servlet.api.ServletServices;
/**
* @author pmuir
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/servlet/ServletLifecycle.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/servlet/ServletLifecycle.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/servlet/ServletLifecycle.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -20,19 +20,19 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.servlet;
+package org.jboss.weld.servlet;
-import static org.jboss.webbeans.servlet.ServletHelper.getModuleBeanManager;
+import static org.jboss.weld.servlet.ServletHelper.getModuleBeanManager;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
-import org.jboss.webbeans.context.ContextLifecycle;
-import org.jboss.webbeans.context.api.BeanStore;
-import org.jboss.webbeans.context.api.helpers.ConcurrentHashMapBeanStore;
-import org.jboss.webbeans.conversation.ConversationManager;
-import org.jboss.webbeans.log.LogProvider;
-import org.jboss.webbeans.log.Logging;
+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.log.LogProvider;
+import org.jboss.weld.log.Logging;
/**
* Implementation of the Web Beans lifecycle that can react to servlet events
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/servlet/WebBeansListener.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/servlet/WebBeansListener.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/servlet/WebBeansListener.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -20,15 +20,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.servlet;
+package org.jboss.weld.servlet;
import javax.servlet.ServletRequestEvent;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSessionEvent;
-import org.jboss.webbeans.Container;
-import org.jboss.webbeans.context.ContextLifecycle;
-import org.jboss.webbeans.servlet.api.helpers.AbstractServletListener;
+import org.jboss.weld.Container;
+import org.jboss.weld.context.ContextLifecycle;
+import org.jboss.weld.servlet.api.helpers.AbstractServletListener;
/**
* The Web Beans listener
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/util/ApiAbstraction.java (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/util/ApiAbstraction.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/weld/util/ApiAbstraction.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/util/ApiAbstraction.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -0,0 +1,131 @@
+/*
+ * 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.util;
+
+import java.lang.annotation.Annotation;
+
+import org.jboss.weld.resources.spi.ResourceLoader;
+import org.jboss.weld.resources.spi.ResourceLoadingException;
+
+/**
+ * A base class for utility classes that represent annotations, classes etc
+ *
+ * @author Pete Muir
+ */
+public class ApiAbstraction
+{
+
+ private static final Class<DummyAnnotation> DUMMY_ANNOTATION = DummyAnnotation.class;
+
+ private static final Class<Dummy> DUMMY_CLASS = Dummy.class;
+ private static final Class<Object> OBJECT_CLASS = Object.class;
+
+ private ResourceLoader resourceLoader;
+
+ /**
+ * "Not found" annotation
+ */
+ public @interface DummyAnnotation
+ {
+ }
+
+ /**
+ * "Not found" class
+ */
+ public interface Dummy
+ {
+ }
+
+ /**
+ * "Not found" enumeration value.
+ */
+ public enum DummyEnum
+ {
+ DUMMY_VALUE
+ }
+
+ /**
+ * Constructor
+ *
+ * @param resourceLoader The root resource loaderS
+ */
+ public ApiAbstraction(ResourceLoader resourceLoader)
+ {
+ this.resourceLoader = resourceLoader;
+ }
+
+ /**
+ * Initializes an annotation class
+ *
+ * @param name The name of the annotation class
+ * @return The instance of the annotation. Returns a dummy if the class was
+ * not found
+ */
+ @SuppressWarnings("unchecked")
+ protected Class<? extends Annotation> annotationTypeForName(String name)
+ {
+ try
+ {
+ return (Class<? extends Annotation>) resourceLoader.classForName(name);
+ }
+ catch (ResourceLoadingException cnfe)
+ {
+ return DUMMY_ANNOTATION;
+ }
+ }
+
+ /**
+ * Initializes a type
+ *
+ * @param name The name of the class
+ * @return The instance of the class. Returns a dummy if the class was not
+ * found.
+ */
+ @SuppressWarnings("unchecked")
+ protected Class<?> classForName(String name)
+ {
+ try
+ {
+ return resourceLoader.classForName(name);
+ }
+ catch (ResourceLoadingException cnfe)
+ {
+ return DUMMY_CLASS;
+ }
+ }
+
+ protected Object enumValue(Class<?> clazz, String memberName)
+ {
+ if (!clazz.isEnum())
+ {
+ throw new IllegalArgumentException(clazz + " is not an enum!");
+ }
+ try
+ {
+ return clazz.getField(memberName);
+ }
+ catch (SecurityException e)
+ {
+ return null;
+ }
+ catch (NoSuchFieldException e)
+ {
+ return null;
+ }
+ }
+
+}
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/util/Beans.java (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/util/Beans.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/weld/util/Beans.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/util/Beans.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -0,0 +1,724 @@
+/*
+ * 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.util;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.lang.reflect.Member;
+import java.lang.reflect.Modifier;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.decorator.Decorates;
+import javax.decorator.Decorator;
+import javax.enterprise.context.spi.Contextual;
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.CreationException;
+import javax.enterprise.inject.Disposes;
+import javax.enterprise.inject.Produces;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.Interceptor;
+import javax.enterprise.inject.spi.AnnotatedMethod;
+import javax.inject.Inject;
+import javax.interceptor.AroundInvoke;
+
+import org.jboss.weld.BeanManagerImpl;
+import org.jboss.weld.DefinitionException;
+import org.jboss.weld.bean.AbstractProducerBean;
+import org.jboss.weld.bean.RIBean;
+import org.jboss.weld.bean.SessionBean;
+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.injection.ParameterInjectionPoint;
+import org.jboss.weld.injection.WBInjectionPoint;
+import org.jboss.weld.injection.spi.EjbInjectionServices;
+import org.jboss.weld.injection.spi.JpaInjectionServices;
+import org.jboss.weld.injection.spi.ResourceInjectionServices;
+import org.jboss.weld.introspector.*;
+import org.jboss.weld.log.Log;
+import org.jboss.weld.log.Logging;
+import org.jboss.weld.metadata.cache.BindingTypeModel;
+import org.jboss.weld.metadata.cache.InterceptorBindingModel;
+import org.jboss.weld.metadata.cache.MetaAnnotationStore;
+import org.jboss.weld.persistence.PersistenceApiAbstraction;
+import org.jboss.interceptor.model.InterceptionType;
+import org.jboss.interceptor.model.InterceptionTypeRegistry;
+
+import com.google.common.base.Supplier;
+import com.google.common.collect.Multimap;
+import com.google.common.collect.Multimaps;
+
+/**
+ * Helper class for bean inspection
+ *
+ * @author Pete Muir
+ * @author David Allen
+ *
+ */
+public class Beans
+{
+
+ private static final Log log = Logging.getLog(Beans.class);
+
+ /**
+ * Indicates if a bean's scope type is passivating
+ *
+ * @param bean The bean to inspect
+ * @return True if the scope is passivating, false otherwise
+ */
+ public static boolean isPassivatingScope(Bean<?> bean, BeanManagerImpl manager)
+ {
+ if (bean instanceof SessionBean<?>)
+ {
+ return ((SessionBean<?>) bean).getEjbDescriptor().isStateful();
+ }
+ else
+ {
+ return manager.getServices().get(MetaAnnotationStore.class).getScopeModel(bean.getScope()).isPassivating();
+ }
+ }
+
+ /**
+ * Tests if a bean is capable of having its state temporarily stored to
+ * secondary storage
+ *
+ * @param bean The bean to inspect
+ * @return True if the bean is passivation capable
+ */
+ public static boolean isPassivationCapableBean(Bean<?> bean)
+ {
+ if (bean instanceof SessionBean<?>)
+ {
+ return ((SessionBean<?>) bean).getEjbDescriptor().isStateful();
+ }
+ else if (bean instanceof AbstractProducerBean<?, ?, ?>)
+ {
+ return Reflections.isSerializable(((AbstractProducerBean<?, ?, ?>) bean).getType());
+ }
+ else
+ {
+ return Reflections.isSerializable(bean.getBeanClass());
+ }
+ }
+
+ /**
+ * Indicates if a bean is proxyable
+ *
+ * @param bean The bean to test
+ * @return True if proxyable, false otherwise
+ */
+ public static boolean isBeanProxyable(Bean<?> bean)
+ {
+ if (bean instanceof RIBean<?>)
+ {
+ return ((RIBean<?>) bean).isProxyable();
+ }
+ else
+ {
+ return Proxies.isTypesProxyable(bean.getTypes());
+ }
+ }
+
+ public static List<Set<FieldInjectionPoint<?, ?>>> getFieldInjectionPoints(Bean<?> declaringBean, WBClass<?> type)
+ {
+ List<Set<FieldInjectionPoint<?, ?>>> injectableFieldsList = new ArrayList<Set<FieldInjectionPoint<?, ?>>>();
+ WBClass<?> t = type;
+ while (!t.getJavaClass().equals(Object.class))
+ {
+ Set<FieldInjectionPoint<?, ?>> fields = new HashSet<FieldInjectionPoint<?,?>>();
+ injectableFieldsList.add(0, fields);
+ for (WBField<?, ?> annotatedField : t.getDeclaredAnnotatedWBFields(Inject.class))
+ {
+ if (!annotatedField.isStatic())
+ {
+ addFieldInjectionPoint(annotatedField, fields, declaringBean);
+ }
+ }
+ for (WBField<?, ?> annotatedField : t.getAnnotatedWBFields(Decorates.class))
+ {
+ if (!annotatedField.isStatic())
+ {
+ addFieldInjectionPoint(annotatedField, fields, declaringBean);
+ }
+ }
+ t = t.getWBSuperclass();
+ }
+ return injectableFieldsList;
+ }
+
+ public static Set<FieldInjectionPoint<?, ?>> getFieldInjectionPoints(Bean<?> declaringBean, List<? extends Set<? extends FieldInjectionPoint<?, ?>>> fieldInjectionPoints)
+ {
+ Set<FieldInjectionPoint<?, ?>> injectionPoints = new HashSet<FieldInjectionPoint<?,?>>();
+ for (Set<? extends FieldInjectionPoint<?, ?>> i : fieldInjectionPoints)
+ {
+ injectionPoints.addAll(i);
+ }
+ return injectionPoints;
+ }
+
+ public static WBMethod<?, ?> getPostConstruct(WBClass<?> type)
+ {
+ Set<WBMethod<?, ?>> postConstructMethods = type.getAnnotatedWBMethods(PostConstruct.class);
+ log.trace("Found " + postConstructMethods + " constructors annotated with @Initializer for " + type);
+ if (postConstructMethods.size() > 1)
+ {
+ throw new DefinitionException("Cannot have more than one post construct method annotated with @PostConstruct for " + type);
+ }
+ else if (postConstructMethods.size() == 1)
+ {
+ WBMethod<?, ?> postConstruct = postConstructMethods.iterator().next();
+ log.trace("Exactly one post construct method (" + postConstruct + ") for " + type);
+ return postConstruct;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public static WBMethod<?, ?> getPreDestroy(WBClass<?> type)
+ {
+ Set<WBMethod<?, ?>> preDestroyMethods = type.getAnnotatedWBMethods(PreDestroy.class);
+ log.trace("Found " + preDestroyMethods + " constructors annotated with @Initializer for " + type);
+ if (preDestroyMethods.size() > 1)
+ {
+ // TODO actually this is wrong, in EJB you can have @PreDestroy methods
+ // on the superclass, though the Web Beans spec is silent on the issue
+ throw new DefinitionException("Cannot have more than one pre destroy method annotated with @PreDestroy for " + type);
+ }
+ else if (preDestroyMethods.size() == 1)
+ {
+ WBMethod<?, ?> preDestroy = preDestroyMethods.iterator().next();
+ log.trace("Exactly one post construct method (" + preDestroy + ") for " + type);
+ return preDestroy;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public static List<WBMethod<?,?>> getInterceptableBusinessMethods(WBClass<?> type)
+ {
+ List<WBMethod<?, ?>> annotatedMethods = new ArrayList<WBMethod<?, ?>>();
+ for (WBMethod<?, ?> annotatedMethod : type.getWBMethods())
+ {
+ int modifiers = ((WBMember) annotatedMethod).getJavaMember().getModifiers();
+ boolean businessMethod = !annotatedMethod.isStatic()
+ && (Modifier.isPublic(modifiers)
+ || Modifier.isProtected(modifiers))
+ && !annotatedMethod.isAnnotationPresent(Inject.class)
+ && !annotatedMethod.isAnnotationPresent(Produces.class)
+ && annotatedMethod.getAnnotatedWBParameters(Disposes.class).isEmpty()
+ && annotatedMethod.getAnnotatedWBParameters(Observes.class).isEmpty();
+
+ if (businessMethod)
+ {
+ for (InterceptionType interceptionType : InterceptionTypeRegistry.getSupportedInterceptionTypes())
+ {
+ businessMethod = !annotatedMethod.isAnnotationPresent(InterceptionTypeRegistry.getAnnotationClass(interceptionType));
+ if (!businessMethod)
+ break;
+ }
+ if (businessMethod)
+ annotatedMethods.add(annotatedMethod);
+ }
+ }
+ return annotatedMethods;
+ }
+
+
+ public static Set<WBInjectionPoint<?, ?>> getEjbInjectionPoints(Bean<?> declaringBean, WBClass<?> type, BeanManagerImpl manager)
+ {
+ if (manager.getServices().contains(EjbInjectionServices.class))
+ {
+ Class<? extends Annotation> ejbAnnotationType = manager.getServices().get(EJBApiAbstraction.class).EJB_ANNOTATION_CLASS;
+ Set<WBInjectionPoint<?, ?>> ejbInjectionPoints = new HashSet<WBInjectionPoint<?, ?>>();
+ for (WBField<?, ?> field : type.getAnnotatedWBFields(ejbAnnotationType))
+ {
+ ejbInjectionPoints.add(FieldInjectionPoint.of(declaringBean, field));
+ }
+ return ejbInjectionPoints;
+ }
+ else
+ {
+ return Collections.emptySet();
+ }
+ }
+
+ public static Set<WBInjectionPoint<?, ?>> getPersistenceContextInjectionPoints(Bean<?> declaringBean, WBClass<?> type, BeanManagerImpl manager)
+ {
+ if (manager.getServices().contains(JpaInjectionServices.class))
+ {
+ Set<WBInjectionPoint<?, ?>> jpaInjectionPoints = new HashSet<WBInjectionPoint<?, ?>>();
+ Class<? extends Annotation> persistenceContextAnnotationType = manager.getServices().get(PersistenceApiAbstraction.class).PERSISTENCE_CONTEXT_ANNOTATION_CLASS;
+ for (WBField<?, ?> field : type.getAnnotatedWBFields(persistenceContextAnnotationType))
+ {
+ jpaInjectionPoints.add(FieldInjectionPoint.of(declaringBean, field));
+ }
+ return jpaInjectionPoints;
+ }
+ else
+ {
+ return Collections.emptySet();
+ }
+ }
+
+ public static Set<WBInjectionPoint<?, ?>> getPersistenceUnitInjectionPoints(Bean<?> declaringBean, WBClass<?> type, BeanManagerImpl manager)
+ {
+ if (manager.getServices().contains(JpaInjectionServices.class))
+ {
+ Set<WBInjectionPoint<?, ?>> jpaInjectionPoints = new HashSet<WBInjectionPoint<?, ?>>();
+ Class<? extends Annotation> persistenceUnitAnnotationType = manager.getServices().get(PersistenceApiAbstraction.class).PERSISTENCE_UNIT_ANNOTATION_CLASS;
+ for (WBField<?, ?> field : type.getAnnotatedWBFields(persistenceUnitAnnotationType))
+ {
+ jpaInjectionPoints.add(FieldInjectionPoint.of(declaringBean, field));
+ }
+ return jpaInjectionPoints;
+ }
+ else
+ {
+ return Collections.emptySet();
+ }
+ }
+
+ public static Set<WBInjectionPoint<?, ?>> getResourceInjectionPoints(Bean<?> declaringBean, WBClass<?> type, BeanManagerImpl manager)
+ {
+ if (manager.getServices().contains(ResourceInjectionServices.class))
+ {
+ Class<? extends Annotation> resourceAnnotationType = manager.getServices().get(EJBApiAbstraction.class).RESOURCE_ANNOTATION_CLASS;
+ Set<WBInjectionPoint<?, ?>> resourceInjectionPoints = new HashSet<WBInjectionPoint<?, ?>>();
+ for (WBField<?, ?> field : type.getAnnotatedWBFields(resourceAnnotationType))
+ {
+ resourceInjectionPoints.add(FieldInjectionPoint.of(declaringBean, field));
+ }
+ return resourceInjectionPoints;
+ }
+ else
+ {
+ return Collections.emptySet();
+ }
+ }
+
+ public static List<Set<MethodInjectionPoint<?, ?>>> getInitializerMethods(Bean<?> declaringBean, WBClass<?> type)
+ {
+ List<Set<MethodInjectionPoint<?, ?>>> initializerMethodsList = new ArrayList<Set<MethodInjectionPoint<?, ?>>>();
+ // Keep track of all seen methods so we can ignore overridden methods
+ Multimap<MethodSignature, Package> seenMethods = Multimaps.newSetMultimap(new HashMap<MethodSignature, Collection<Package>>(), new Supplier<Set<Package>>()
+ {
+
+ public Set<Package> get()
+ {
+ return new HashSet<Package>();
+ }
+
+ });
+ WBClass<?> t = type;
+ while (!t.getJavaClass().equals(Object.class))
+ {
+ Set<MethodInjectionPoint<?, ?>> initializerMethods = new HashSet<MethodInjectionPoint<?,?>>();
+ initializerMethodsList.add(0, initializerMethods);
+ for (WBMethod<?, ?> method : t.getDeclaredWBMethods())
+ {
+ if (method.isAnnotationPresent(Inject.class) && !method.isStatic())
+ {
+ if (method.getAnnotation(Produces.class) != null)
+ {
+ throw new DefinitionException("Initializer method " + method.toString() + " cannot be annotated @Produces on " + type);
+ }
+ else if (method.getAnnotatedWBParameters(Disposes.class).size() > 0)
+ {
+ throw new DefinitionException("Initializer method " + method.toString() + " cannot have parameters annotated @Disposes on " + type);
+ }
+ else if (method.getAnnotatedWBParameters(Observes.class).size() > 0)
+ {
+ throw new DefinitionException("Initializer method " + method.toString() + " cannot be annotated @Observes on " + type);
+ }
+ else
+ {
+ if (!isOverridden(method, seenMethods))
+ {
+ MethodInjectionPoint<?, ?> initializerMethod = MethodInjectionPoint.of(declaringBean, method);
+ initializerMethods.add(initializerMethod);
+ }
+ }
+ }
+ seenMethods.put(method.getSignature(), method.getPackage());
+ }
+ t = t.getWBSuperclass();
+ }
+ return initializerMethodsList;
+ }
+
+ private static boolean isOverridden(WBMethod<?, ?> method, Multimap<MethodSignature, Package> seenMethods)
+ {
+ if (method.isPrivate())
+ {
+ return false;
+ }
+ else if (method.isPackagePrivate() && seenMethods.containsKey(method.getSignature()))
+ {
+ return seenMethods.get(method.getSignature()).contains(method.getPackage());
+ }
+ else
+ {
+ return seenMethods.containsKey(method.getSignature());
+ }
+ }
+
+ public static Set<ParameterInjectionPoint<?, ?>> getParameterInjectionPoints(Bean<?> declaringBean, WBConstructor<?> constructor)
+ {
+ Set<ParameterInjectionPoint<?,?>> injectionPoints = new HashSet<ParameterInjectionPoint<?,?>>();
+ for (WBParameter<?, ?> parameter : constructor.getWBParameters())
+ {
+ injectionPoints.add(ParameterInjectionPoint.of(declaringBean, parameter));
+ }
+ return injectionPoints;
+ }
+
+ public static Set<ParameterInjectionPoint<?, ?>> getParameterInjectionPoints(Bean<?> declaringBean, List<Set<MethodInjectionPoint<?, ?>>> methodInjectionPoints)
+ {
+ Set<ParameterInjectionPoint<?, ?>> injectionPoints = new HashSet<ParameterInjectionPoint<?,?>>();
+ for (Set<MethodInjectionPoint<?, ?>> i : methodInjectionPoints)
+ {
+ for (MethodInjectionPoint<?, ?> method : i)
+ {
+ for (WBParameter<?, ?> parameter : method.getWBParameters())
+ {
+ injectionPoints.add(ParameterInjectionPoint.of(declaringBean, parameter));
+ }
+ }
+ }
+ return injectionPoints;
+ }
+
+ private static void addFieldInjectionPoint(WBField<?, ?> annotatedField, Set<FieldInjectionPoint<?, ?>> injectableFields, Bean<?> declaringBean)
+ {
+ if (!annotatedField.isAnnotationPresent(Produces.class))
+ {
+ if (annotatedField.isFinal())
+ {
+ throw new DefinitionException("Don't place binding annotations on final fields " + annotatedField);
+ }
+ FieldInjectionPoint<?, ?> fieldInjectionPoint = FieldInjectionPoint.of(declaringBean, annotatedField);
+ injectableFields.add(fieldInjectionPoint);
+ }
+ }
+
+ /**
+ * Checks if binding criteria fulfill all binding types
+ *
+ * @param element The binding criteria to check
+ * @param bindings2 The binding types to check
+ * @return True if all matches, false otherwise
+ */
+ public static boolean containsAllBindings(Set<Annotation> bindings1, Set<Annotation> bindings2, BeanManagerImpl manager)
+ {
+ for (Annotation binding : bindings1)
+ {
+ BindingTypeModel<?> bindingType = manager.getServices().get(MetaAnnotationStore.class).getBindingTypeModel(binding.annotationType());
+ boolean matchFound = false;
+ // TODO Something wrong with annotation proxy hashcode in JDK/AnnotationLiteral hashcode, so always do a full check, don't use contains
+ for (Annotation otherBinding : bindings2)
+ {
+ if (bindingType.isEqual(binding, otherBinding))
+ {
+ matchFound = true;
+ }
+ }
+ if (!matchFound)
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public static boolean containsAllInterceptionBindings(Set<Annotation> expectedBindings, Set<Annotation> existingBindings, BeanManagerImpl manager)
+ {
+ for (Annotation binding : expectedBindings)
+ {
+ InterceptorBindingModel<?> bindingType = manager.getServices().get(MetaAnnotationStore.class).getInterceptorBindingModel(binding.annotationType());
+ boolean matchFound = false;
+ // TODO Something wrong with annotation proxy hashcode in JDK/AnnotationLiteral hashcode, so always do a full check, don't use contains
+ for (Annotation otherBinding : existingBindings)
+ {
+ if (bindingType.isEqual(binding, otherBinding))
+ {
+ matchFound = true;
+ }
+ }
+ if (!matchFound)
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+
+
+ /**
+ * Retains only beans which have deployment type X.
+ *
+ * The deployment type X is
+ *
+ * @param <T>
+ * @param beans The beans to filter
+ * @param enabledDeploymentTypes The enabled deployment types
+ * @return The filtered beans
+ */
+ public static <T extends Bean<?>> Set<T> retainEnabledPolicies(Set<T> beans, Collection<Class<?>> enabledPolicyClasses, Collection<Class<? extends Annotation>> enabledPolicySterotypes)
+ {
+ if (beans.size() == 0)
+ {
+ return beans;
+ }
+ else
+ {
+ Set<T> enabledBeans = new HashSet<T>();
+ for (T bean : beans)
+ {
+ if (isBeanEnabled(bean, enabledPolicyClasses, enabledPolicySterotypes))
+ {
+ enabledBeans.add(bean);
+ }
+ }
+ return enabledBeans;
+ }
+ }
+
+ public static boolean isBeanEnabled(Bean<?> bean, Collection<Class<?>> enabledPolicyClasses, Collection<Class<? extends Annotation>> enabledPolicySterotypes)
+ {
+ if (bean.isAlternative())
+ {
+ if (enabledPolicyClasses.contains(bean.getBeanClass()))
+ {
+ return true;
+ }
+ else
+ {
+ for (Class<? extends Annotation> stereotype : bean.getStereotypes())
+ {
+ if (enabledPolicySterotypes.contains(stereotype))
+ {
+ return true;
+ }
+ }
+ }
+ }
+ else
+ {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Check if any of the beans is a policy
+ *
+ * @param beans
+ * @return
+ */
+ public static <X> boolean isPolicyPresent(Set<Bean<? extends X>> beans)
+ {
+ for (Bean<?> bean : beans)
+ {
+ if (bean.isAlternative())
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Check if bean is specialized by any of beans
+ *
+ * @param bean
+ * @param beans
+ * @param specializedBeans
+ * @return
+ */
+ public static <X> boolean isSpecialized(Bean<? extends X> bean, Set<Bean<? extends X>> beans, Map<Contextual<?>, Contextual<?>> specializedBeans)
+ {
+ if (specializedBeans.containsKey(bean))
+ {
+ if (beans.contains(specializedBeans.get(bean)))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public static <T> ConstructorInjectionPoint<T> getBeanConstructor(Bean<?> declaringBean, WBClass<T> type)
+ {
+ ConstructorInjectionPoint<T> constructor = null;
+ Set<WBConstructor<T>> initializerAnnotatedConstructors = type.getAnnotatedWBConstructors(Inject.class);
+ log.trace("Found " + initializerAnnotatedConstructors + " constructors annotated with @Initializer for " + type);
+ if (initializerAnnotatedConstructors.size() > 1)
+ {
+ if (initializerAnnotatedConstructors.size() > 1)
+ {
+ throw new DefinitionException("Cannot have more than one constructor annotated with @Initializer for " + type);
+ }
+ }
+ else if (initializerAnnotatedConstructors.size() == 1)
+ {
+ constructor = ConstructorInjectionPoint.of(declaringBean, initializerAnnotatedConstructors.iterator().next());
+ log.trace("Exactly one constructor (" + constructor + ") annotated with @Initializer defined, using it as the bean constructor for " + type);
+ }
+ else if (type.getNoArgsWBConstructor() != null)
+ {
+
+ constructor = ConstructorInjectionPoint.of(declaringBean, type.getNoArgsWBConstructor());
+ log.trace("Exactly one constructor (" + constructor + ") defined, using it as the bean constructor for " + type);
+ }
+
+ if (constructor == null)
+ {
+ throw new DefinitionException("Cannot determine constructor to use for " + type);
+ }
+ else
+ {
+ return constructor;
+ }
+ }
+
+ /**
+ * Injects EJBs and common fields
+ */
+ public static <T> void injectEEFields(T beanInstance, BeanManagerImpl manager, Iterable<WBInjectionPoint<?, ?>> ejbInjectionPoints, Iterable<WBInjectionPoint<?, ?>> persistenceContextInjectionPoints, Iterable<WBInjectionPoint<?, ?>> persistenceUnitInjectionPoints, Iterable<WBInjectionPoint<?, ?>> resourceInjectionPoints)
+ {
+ EjbInjectionServices ejbServices = manager.getServices().get(EjbInjectionServices.class);
+ JpaInjectionServices jpaServices = manager.getServices().get(JpaInjectionServices.class);
+ ResourceInjectionServices resourceServices = manager.getServices().get(ResourceInjectionServices.class);
+
+ if (ejbServices != null)
+ {
+ for (WBInjectionPoint<?, ?> injectionPoint : ejbInjectionPoints)
+ {
+ Object ejbInstance = ejbServices.resolveEjb(injectionPoint);
+ injectionPoint.inject(beanInstance, ejbInstance);
+ }
+ }
+
+ if (jpaServices != null)
+ {
+ for (WBInjectionPoint<?, ?> injectionPoint : persistenceContextInjectionPoints)
+ {
+ Object pcInstance = jpaServices.resolvePersistenceContext(injectionPoint);
+ injectionPoint.inject(beanInstance, pcInstance);
+ }
+ for (WBInjectionPoint<?, ?> injectionPoint : persistenceUnitInjectionPoints)
+ {
+ Object puInstance = jpaServices.resolvePersistenceUnit(injectionPoint);
+ injectionPoint.inject(beanInstance, puInstance);
+ }
+ }
+
+ if (resourceServices != null)
+ {
+ for (WBInjectionPoint<?, ?> injectionPoint : resourceInjectionPoints)
+ {
+ Object resourceInstance = resourceServices.resolveResource(injectionPoint);
+ injectionPoint.inject(beanInstance, resourceInstance);
+ }
+ }
+ }
+
+
+ /**
+ * Gets the declared bean type
+ *
+ * @return The bean type
+ */
+ public static Type getDeclaredBeanType(Class<? extends Bean> clazz)
+ {
+ Type[] actualTypeArguments = Reflections.getActualTypeArguments(clazz);
+ if (actualTypeArguments.length == 1)
+ {
+ return actualTypeArguments[0];
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+
+ /**
+ * Injects bound fields
+ *
+ * @param instance The instance to inject into
+ */
+ public static <T> void injectBoundFields(T instance, CreationalContext<T> creationalContext, BeanManagerImpl manager, Iterable<? extends FieldInjectionPoint<?, ?>> injectableFields)
+ {
+ for (FieldInjectionPoint<?, ?> injectableField : injectableFields)
+ {
+ injectableField.inject(instance, manager, creationalContext);
+ }
+ }
+
+ public static<T> void injectFieldsAndInitializers(T instance, CreationalContext<T> ctx, BeanManagerImpl beanManager, List<? extends Iterable<? extends FieldInjectionPoint<?, ?>>> injectableFields, List<? extends Iterable<? extends MethodInjectionPoint<?, ?>>>initializerMethods)
+ {
+ if (injectableFields.size() != initializerMethods.size())
+ {
+ throw new IllegalArgumentException("injectableFields and initializerMethods must have the same size. InjectableFields: " + injectableFields + "; InitializerMethods: " + initializerMethods);
+ }
+ for (int i = 0; i < injectableFields.size(); i++)
+ {
+ injectBoundFields(instance, ctx, beanManager, injectableFields.get(i));
+ callInitializers(instance, ctx, beanManager, initializerMethods.get(i));
+ }
+ }
+
+ /**
+ * Calls all initializers of the bean
+ *
+ * @param instance The bean instance
+ */
+ public static <T> void callInitializers(T instance, CreationalContext<T> creationalContext, BeanManagerImpl manager, Iterable<? extends MethodInjectionPoint<?, ?>> initializerMethods)
+ {
+ for (MethodInjectionPoint<?, ?> initializer : initializerMethods)
+ {
+ initializer.invoke(instance, manager, creationalContext, CreationException.class);
+ }
+ }
+
+ public static <T> boolean isInterceptor(WBClass<T> annotatedItem)
+ {
+ return annotatedItem.isAnnotationPresent(javax.interceptor.Interceptor.class);
+ }
+
+ public static <T> boolean isDecorator(WBClass<T> annotatedItem)
+ {
+ return annotatedItem.isAnnotationPresent(Decorator.class);
+ }
+
+}
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/util/Names.java (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/util/Names.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/weld/util/Names.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/util/Names.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -0,0 +1,336 @@
+/*
+ * 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.util;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * Utility class to produce friendly names e.g. for debugging
+ *
+ * @author Pete Muir
+ *
+ */
+public class Names
+{
+ // Pattern for recognizing strings with leading capital letter
+ private static Pattern CAPITAL_LETTERS = Pattern.compile("\\p{Upper}{1}\\p{Lower}*");
+
+ /**
+ * Gets a string representation of the scope type annotation
+ *
+ * @param scopeType The scope type
+ * @return A string representation
+ */
+ public static String scopeTypeToString(Class<? extends Annotation> scopeType)
+ {
+ StringBuilder result = new StringBuilder();
+ if (scopeType != null)
+ {
+ String scopeName = scopeType.getSimpleName();
+ Matcher matcher = CAPITAL_LETTERS.matcher(scopeName);
+ int i = 0;
+ while (matcher.find())
+ {
+ String name = matcher.group();
+ if (i > 0)
+ {
+ name = name.toLowerCase();
+ }
+ result.append(name).append(" ");
+ i++;
+ }
+ }
+ return result.toString();
+ }
+
+ /**
+ * Counts item in an iteratble
+ *
+ * @param iterable The iteraboe
+ * @return The count
+ */
+ public static int count(final Iterable<?> iterable)
+ {
+ int count = 0;
+ for (Iterator<?> i = iterable.iterator(); i.hasNext();)
+ {
+ count++;
+ }
+ return count;
+ }
+
+ /**
+ * Converts a list of strings to a String with given delimeter
+ *
+ * @param list The list
+ * @param delimiter The delimeter
+ * @return The string representation
+ */
+ private static String listToString(List<String> list, String delimiter)
+ {
+ StringBuilder buffer = new StringBuilder();
+ for (String item : list)
+ {
+ buffer.append(item);
+ buffer.append(delimiter);
+ }
+ return buffer.toString();
+ }
+
+ /**
+ * Parses a reflection modifier to a list of string
+ *
+ * @param modifier The modifier to parse
+ * @return The resulting string list
+ */
+ private static List<String> parseModifiers(int modifier)
+ {
+ List<String> modifiers = new ArrayList<String>();
+ if (Modifier.isPrivate(modifier))
+ {
+ modifiers.add("private");
+ }
+ if (Modifier.isProtected(modifier))
+ {
+ modifiers.add("protected");
+ }
+ if (Modifier.isPublic(modifier))
+ {
+ modifiers.add("public");
+ }
+ if (Modifier.isAbstract(modifier))
+ {
+ modifiers.add("abstract");
+ }
+ if (Modifier.isFinal(modifier))
+ {
+ modifiers.add("final");
+ }
+ if (Modifier.isNative(modifier))
+ {
+ modifiers.add("native");
+ }
+ if (Modifier.isStatic(modifier))
+ {
+ modifiers.add("static");
+ }
+ if (Modifier.isStrict(modifier))
+ {
+ modifiers.add("strict");
+ }
+ if (Modifier.isSynchronized(modifier))
+ {
+ modifiers.add("synchronized");
+ }
+ if (Modifier.isTransient(modifier))
+ {
+ modifiers.add("transient");
+ }
+ if (Modifier.isVolatile(modifier))
+ {
+ modifiers.add("volatile");
+ }
+ if (Modifier.isInterface(modifier))
+ {
+ modifiers.add("interface");
+ }
+ return modifiers;
+ }
+
+ /**
+ * Gets a string representation from an array of annotations
+ *
+ * @param annotations The annotations
+ * @return The string representation
+ */
+ private static String annotationsToString(Annotation[] annotations)
+ {
+ StringBuilder buffer = new StringBuilder();
+ for (Annotation annotation : annotations)
+ {
+ buffer.append("@" + annotation.annotationType().getSimpleName());
+ buffer.append(" ");
+ }
+ return buffer.toString();
+ }
+
+ /**
+ * Gets a string representation from a field
+ *
+ * @param field The field
+ * @return The string representation
+ */
+ public static String fieldToString(Field field)
+ {
+ if (!field.isAccessible())
+ {
+ field.setAccessible(true);
+ }
+ return " Field " + annotationsToString(field.getAnnotations()) + listToString(parseModifiers(field.getModifiers()), " ") + field.getName();
+ }
+
+ /**
+ * Gets the string representation from a method
+ *
+ * @param method The method
+ * @return The string representation
+ */
+ public static String methodToString(Method method)
+ {
+ if (!method.isAccessible())
+ {
+ method.setAccessible(true);
+ }
+ return " Method " + method.getReturnType().getSimpleName() + " " + annotationsToString(method.getAnnotations()) + listToString(parseModifiers(method.getModifiers()), " ") + method.getName() + "(" + parametersToString(method.getParameterTypes(), method.getParameterAnnotations(), false) + ");\n";
+ }
+
+ /**
+ * Gets a string representation from an annotation
+ *
+ * @param annotation The annotation
+ * @return The string representation
+ */
+ public static String annotationToString(Annotation annotation)
+ {
+ return "Annotation " + annotationsToString(annotation.annotationType().getAnnotations()) + annotation.annotationType().getSimpleName();
+ }
+
+ /**
+ * Gets a string representation from a method
+ *
+ * @param constructor The method
+ * @return The string representation
+ */
+ public static String constructorToString(Constructor<?> constructor)
+ {
+ return " Constructor " + annotationsToString(constructor.getAnnotations()) + listToString(parseModifiers(constructor.getModifiers()), " ") + constructor.getDeclaringClass().getSimpleName() + "(" + parametersToString(constructor.getParameterTypes(), constructor.getParameterAnnotations(), true) + ");\n";
+ }
+
+ /**
+ * Gets a string representation from a list of parameters and their
+ * annotations
+ *
+ * @param parameterTypes The parameters
+ * @param annotations The annotation map
+ * @return The string representation
+ */
+ private static String parametersToString(Class<?>[] parameterTypes, Annotation[][] annotations, boolean constructor)
+ {
+ StringBuilder buffer = new StringBuilder();
+ int start = constructor ? 1 : 0;
+ for (int i = start; i < parameterTypes.length; i++)
+ {
+ if (i > start)
+ {
+ buffer.append(", ");
+ }
+ buffer.append(annotationsToString(annotations[i]) + typeToString(parameterTypes[i]));
+ }
+ return buffer.toString();
+ }
+
+ /**
+ * Gets a string representation from a type
+ *
+ * @param clazz The type
+ * @return The string representation
+ */
+ private static String typeToString(Class<?> clazz)
+ {
+ return annotationsToString(clazz.getAnnotations()) + clazz.getSimpleName();
+ }
+
+ /**
+ * Gets a string representation from a class
+ *
+ * @param clazz The class
+ * @return The string representation
+ */
+ public static String classToString(Class<?> clazz)
+ {
+ StringBuilder buffer = new StringBuilder();
+ buffer.append("Class " + typeToString(clazz) + "\n");
+ for (Field field : clazz.getFields())
+ {
+ buffer.append(fieldToString(field));
+ }
+ for (Constructor<?> constructor : clazz.getConstructors())
+ {
+ buffer.append(constructorToString(constructor));
+ }
+ for (Method method : clazz.getMethods())
+ {
+ buffer.append(methodToString(method));
+ }
+ return buffer.toString();
+ }
+
+ public static String typesToString(Set<? extends Type> types)
+ {
+ StringBuilder buffer = new StringBuilder();
+ int i = 0;
+ buffer.append("[");
+ for (Type type : types)
+ {
+ if (i > 0)
+ {
+ buffer.append(", ");
+ }
+ if (type instanceof Class<?>)
+ {
+ buffer.append(((Class<?>) type).getSimpleName());
+ }
+ else
+ {
+ buffer.append(type.toString());
+ }
+ i++;
+ }
+ buffer.append("]");
+ return buffer.toString();
+ }
+
+ public static String annotationsToString(Set<Annotation> annotations)
+ {
+ StringBuilder buffer = new StringBuilder();
+ int i = 0;
+ buffer.append("[");
+ for (Annotation annotation : annotations)
+ {
+ if (i > 0)
+ {
+ buffer.append(", ");
+ }
+ buffer.append("@").append(annotation.annotationType().getSimpleName());
+ i++;
+ }
+ buffer.append("]");
+ return buffer.toString();
+ }
+
+}
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/util/Observers.java (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/util/Observers.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/weld/util/Observers.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/util/Observers.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -0,0 +1,60 @@
+/*
+ * 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.util;
+
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.lang.reflect.TypeVariable;
+
+/**
+ * @author pmuir
+ *
+ */
+public class Observers
+{
+
+ public static void checkEventObjectType(Type eventType)
+ {
+ Type[] types;
+ Type resolvedType = new Reflections.HierarchyDiscovery(eventType).getResolvedType();
+ if (resolvedType instanceof Class<?>)
+ {
+ types = new Type[0];
+ }
+ else if (resolvedType instanceof ParameterizedType)
+ {
+ types = ((ParameterizedType) resolvedType).getActualTypeArguments();
+ }
+ else
+ {
+ throw new IllegalArgumentException("Event type " + resolvedType + " is not allowed");
+ }
+ for (Type type : types)
+ {
+ if (type instanceof TypeVariable<?>)
+ {
+ throw new IllegalArgumentException("Cannot provide an event type parameterized with a type parameter " + resolvedType);
+ }
+ }
+ }
+
+ public static void checkEventObjectType(Object event)
+ {
+ checkEventObjectType(event.getClass());
+
+ }
+}
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/util/Proxies.java (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/util/Proxies.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/weld/util/Proxies.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/util/Proxies.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -0,0 +1,242 @@
+/*
+ * 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.util;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Modifier;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.util.Iterator;
+import java.util.LinkedHashSet;
+import java.util.Set;
+
+import javassist.util.proxy.ProxyFactory;
+
+/**
+ * Utilties for working with Javassist proxies
+ *
+ * @author Nicklas Karlsson
+ * @author Pete Muir
+ *
+ */
+public class Proxies
+{
+
+ public static class TypeInfo
+ {
+
+ private static final Class<?>[] EMPTY_INTERFACES_ARRAY = new Class<?>[0];
+
+ private final Set<Class<?>> interfaces;
+ private final Set<Class<?>> classes;
+
+ private TypeInfo()
+ {
+ super();
+ this.interfaces = new LinkedHashSet<Class<?>>();
+ this.classes = new LinkedHashSet<Class<?>>();
+ }
+
+ public Class<?> getSuperClass()
+ {
+ if (classes.isEmpty())
+ {
+ return null;
+ }
+ Iterator<Class<?>> it = classes.iterator();
+ Class<?> superclass = it.next();
+ while (it.hasNext())
+ {
+ Class<?> clazz = it.next();
+ if (superclass.isAssignableFrom(clazz))
+ {
+ superclass = clazz;
+ }
+ }
+ return superclass;
+ }
+
+ private Class<?>[] getInterfaces()
+ {
+ return interfaces.toArray(EMPTY_INTERFACES_ARRAY);
+ }
+
+ public ProxyFactory createProxyFactory()
+ {
+ ProxyFactory proxyFactory = new ProxyFactory();
+ Class<?> superClass = getSuperClass();
+ if(superClass != null && superClass != Object.class)
+ {
+ proxyFactory.setSuperclass(superClass);
+ }
+ proxyFactory.setInterfaces(getInterfaces());
+ return proxyFactory;
+ }
+
+ private void add(Type type)
+ {
+ if (type instanceof Class)
+ {
+ Class<?> clazz = (Class<?>) type;
+ if (clazz.isInterface())
+ {
+ interfaces.add(clazz);
+ }
+ else
+ {
+ classes.add(clazz);
+ }
+ }
+ else if (type instanceof ParameterizedType)
+ {
+ add(((ParameterizedType)type).getRawType());
+ }
+ else
+ {
+ throw new IllegalArgumentException("Cannot proxy non-Class Type " + type);
+ }
+ }
+
+ public static TypeInfo ofTypes(Set<? extends Type> types)
+ {
+ TypeInfo typeInfo = new TypeInfo();
+ for (Type type : types)
+ {
+ typeInfo.add(type);
+ }
+ return typeInfo;
+ }
+
+ public static TypeInfo ofClasses(Set<Class<?>> classes)
+ {
+ TypeInfo typeInfo = new TypeInfo();
+ for (Class<?> type : classes)
+ {
+ typeInfo.add(type);
+ }
+ return typeInfo;
+ }
+
+ }
+
+ /**
+ * Get the proxy factory for the given set of types
+ *
+ * @param types The types to create the proxy factory for
+ * @param classes Additional interfaces the proxy should implement
+ * @return the proxy factory
+ */
+ public static ProxyFactory getProxyFactory(Set<Type> types)
+ {
+ return TypeInfo.ofTypes(types).createProxyFactory();
+ }
+
+ /**
+ * Indicates if a class is proxyable
+ *
+ * @param type The class to test
+ * @return True if proxyable, false otherwise
+ */
+ public static boolean isTypeProxyable(Type type)
+ {
+ if (type instanceof Class)
+ {
+ return isClassProxyable((Class<?>) type);
+ }
+ else if (type instanceof ParameterizedType)
+ {
+ Type rawType = ((ParameterizedType) type).getRawType();
+ if (rawType instanceof Class)
+ {
+ return isClassProxyable((Class<?>) rawType);
+ }
+ }
+ return false;
+ }
+
+
+ /**
+ * Indicates if a set of types are all proxyable
+ *
+ * @param types The types to test
+ * @return True if proxyable, false otherwise
+ */
+ public static boolean isTypesProxyable(Iterable<? extends Type> types)
+ {
+ for (Type apiType : types)
+ {
+ if (Object.class.equals(apiType))
+ {
+ continue;
+ }
+ if (!isTypeProxyable(apiType))
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ private static boolean isClassProxyable(Class<?> clazz)
+ {
+ if (clazz.isInterface())
+ {
+ return true;
+ }
+ else
+ {
+ Constructor<?> constructor = Reflections.getDeclaredConstructor(clazz);
+ if (constructor == null)
+ {
+ return false;
+ }
+ else if (Modifier.isPrivate(constructor.getModifiers()))
+ {
+ return false;
+ }
+ else if (Reflections.isTypeOrAnyMethodFinal(clazz))
+ {
+ return false;
+ }
+ else if (Reflections.isPrimitive(clazz))
+ {
+ return false;
+ }
+ else if (Reflections.isArrayType(clazz))
+ {
+ return false;
+ }
+ else
+ {
+ return true;
+ }
+ }
+ }
+
+ /**
+ * Indicates if an instance is a Javassist proxy
+ *
+ * @param instance The instance to examine
+ * @return True if proxy, false otherwise
+ */
+ public static boolean isProxy(Object instance)
+ {
+ return instance.getClass().getName().indexOf("_$$_javassist_") > 0;
+ }
+
+
+}
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/util/Reflections.java (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/util/Reflections.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/weld/util/Reflections.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/util/Reflections.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -0,0 +1,917 @@
+/*
+ * 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.util;
+
+import java.beans.Introspector;
+import java.io.Serializable;
+import java.lang.annotation.Annotation;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Member;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.lang.reflect.TypeVariable;
+import java.lang.reflect.WildcardType;
+import java.security.AccessControlException;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.inject.Qualifier;
+
+import org.jboss.weld.DeploymentException;
+import org.jboss.weld.log.Log;
+import org.jboss.weld.log.Logging;
+import org.jboss.weld.util.reflection.ParameterizedTypeImpl;
+
+/**
+ * Utility class for static reflection-type operations
+ *
+ * @author Pete Muir
+ *
+ */
+public class Reflections
+{
+
+ private static final Log log = Logging.getLog(Reflections.class);
+
+ public static final Type[] EMPTY_TYPES = {};
+
+ public static final Annotation[] EMPTY_ANNOTATIONS = {};
+
+ public static class HierarchyDiscovery
+ {
+
+ private final Type type;
+
+ private Set<Type> types;
+
+ public HierarchyDiscovery(Type type)
+ {
+ this.type = type;
+ }
+
+ protected void add(Type type)
+ {
+ types.add(type);
+ }
+
+ public Set<Type> getFlattenedTypes()
+ {
+ if (types == null)
+ {
+ this.types = new HashSet<Type>();
+ discoverTypes(type);
+ }
+ return types;
+ }
+
+ public Type getResolvedType()
+ {
+ if (type instanceof Class)
+ {
+ Class<?> clazz = (Class<?>) type;
+ return resolveType(clazz);
+ }
+ return type;
+ }
+
+ private void discoverTypes(Type type)
+ {
+ if (type != null)
+ {
+ if (type instanceof Class)
+ {
+ Class<?> clazz = (Class<?>) type;
+ add(resolveType(clazz));
+ discoverFromClass(clazz);
+ }
+ else
+ {
+ if (type instanceof ParameterizedType)
+ {
+ Type rawType = ((ParameterizedType) type).getRawType();
+ if (rawType instanceof Class)
+ {
+ discoverFromClass((Class<?>) rawType);
+ }
+ }
+ add(type);
+ }
+ }
+ }
+
+ private Type resolveType(Class<?> clazz)
+ {
+ if (clazz.getTypeParameters().length > 0)
+ {
+ TypeVariable<?>[] actualTypeParameters = clazz.getTypeParameters();
+ ParameterizedType parameterizedType = new ParameterizedTypeImpl(clazz, actualTypeParameters, clazz.getDeclaringClass());
+ return parameterizedType;
+ }
+ else
+ {
+ return clazz;
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ private void discoverFromClass(Class<?> clazz)
+ {
+ try
+ {
+ discoverTypes(resolveType(type, clazz.getGenericSuperclass()));
+ for (Type c : clazz.getGenericInterfaces())
+ {
+ discoverTypes(resolveType(type, c));
+ }
+ }
+ catch (AccessControlException e)
+ {
+ // TODO Hmm, is this a hack?
+ log.trace("Security exception scanning " + clazz.getName(), e);
+ }
+ }
+
+ /**
+ * Gets the actual types by resolving TypeParameters.
+ *
+ * @param beanType
+ * @param type
+ * @return actual type
+ */
+ private Type resolveType(Type beanType, Type type)
+ {
+ if (type instanceof ParameterizedType)
+ {
+ if (beanType instanceof ParameterizedType)
+ {
+ return resolveParameterizedType((ParameterizedType) beanType, (ParameterizedType) type);
+ }
+ if (beanType instanceof Class)
+ {
+ return resolveType(((Class<?>) beanType).getGenericSuperclass(), type);
+ }
+ }
+
+ if (type instanceof TypeVariable)
+ {
+ if (beanType instanceof ParameterizedType)
+ {
+ return resolveTypeParameter((ParameterizedType) beanType, (TypeVariable<?>) type);
+ }
+ if (beanType instanceof Class)
+ {
+ return resolveType(((Class<?>) beanType).getGenericSuperclass(), type);
+ }
+ }
+ return type;
+ }
+
+ private Type resolveParameterizedType(ParameterizedType beanType, ParameterizedType parameterizedType)
+ {
+ Type rawType = parameterizedType.getRawType();
+ Type[] actualTypes = parameterizedType.getActualTypeArguments();
+
+ Type resolvedRawType = resolveType(beanType, rawType);
+ Type[] resolvedActualTypes = new Type[actualTypes.length];
+
+ for (int i = 0; i < actualTypes.length; i++)
+ {
+ resolvedActualTypes[i] = resolveType(beanType, actualTypes[i]);
+ }
+ // reconstruct ParameterizedType by types resolved TypeVariable.
+ return new ParameterizedTypeImpl(resolvedRawType, resolvedActualTypes, parameterizedType.getOwnerType());
+ }
+
+ private Type resolveTypeParameter(ParameterizedType beanType, TypeVariable<?> typeVariable)
+ {
+ // step1. raw type
+ Class<?> actualType = (Class<?>) beanType.getRawType();
+ TypeVariable<?>[] typeVariables = actualType.getTypeParameters();
+ Type[] actualTypes = beanType.getActualTypeArguments();
+ for (int i = 0; i < typeVariables.length; i++)
+ {
+ if (typeVariables[i].equals(typeVariable))
+ {
+ return resolveType(type, actualTypes[i]);
+ }
+ }
+
+ // step2. generic super class
+ Type genericSuperType = actualType.getGenericSuperclass();
+ Type type = resolveType(genericSuperType, typeVariable);
+ if (!(type instanceof TypeVariable<?>))
+ {
+ return type;
+ }
+
+ // step3. generic interfaces
+ for (Type interfaceType : actualType.getGenericInterfaces())
+ {
+ Type resolvedType = resolveType(interfaceType, typeVariable);
+ if (!(resolvedType instanceof TypeVariable<?>))
+ {
+ return resolvedType;
+ }
+ }
+
+ // don't resolve type variable
+ return typeVariable;
+ }
+
+ }
+
+ /**
+ * Gets the property name from a getter method
+ *
+ * @param method The getter method
+ * @return The name of the property. Returns null if method wasn't JavaBean
+ * getter-styled
+ */
+ public static String getPropertyName(Method method)
+ {
+ String methodName = method.getName();
+ if (methodName.matches("^(get).*") && method.getParameterTypes().length == 0)
+ {
+ return Introspector.decapitalize(methodName.substring(3));
+ }
+ else if (methodName.matches("^(is).*") && method.getParameterTypes().length == 0)
+ {
+ return Introspector.decapitalize(methodName.substring(2));
+ }
+ else
+ {
+ return null;
+ }
+
+ }
+
+ /**
+ * Checks if class is final
+ *
+ * @param clazz The class to check
+ * @return True if final, false otherwise
+ */
+ public static boolean isFinal(Class<?> clazz)
+ {
+ return Modifier.isFinal(clazz.getModifiers());
+ }
+
+ /**
+ * Checks if member is final
+ *
+ * @param member The member to check
+ * @return True if final, false otherwise
+ */
+ public static boolean isFinal(Member member)
+ {
+ return Modifier.isFinal(member.getModifiers());
+ }
+
+ /**
+ * Checks if type or member is final
+ *
+ * @param type Type or member
+ * @return True if final, false otherwise
+ */
+ public static boolean isTypeOrAnyMethodFinal(Class<?> type)
+ {
+ if (isFinal(type))
+ {
+ return true;
+ }
+ for (Method method : type.getDeclaredMethods())
+ {
+ if (isFinal(method))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Checks if type is primitive
+ *
+ * @param type Type to check
+ * @return True if primitive, false otherwise
+ */
+ public static boolean isPrimitive(Class<?> type)
+ {
+ return type.isPrimitive();
+ }
+
+ public static boolean isPackagePrivate(int mod)
+ {
+ return !(Modifier.isPrivate(mod) || Modifier.isProtected(mod) || Modifier.isPublic(mod));
+ }
+
+ /**
+ * Checks if type is static
+ *
+ * @param type Type to check
+ * @return True if static, false otherwise
+ */
+ public static boolean isStatic(Class<?> type)
+ {
+ return Modifier.isStatic(type.getModifiers());
+ }
+
+ /**
+ * Checks if member is static
+ *
+ * @param member Member to check
+ * @return True if static, false otherwise
+ */
+ public static boolean isStatic(Member member)
+ {
+ return Modifier.isStatic(member.getModifiers());
+ }
+
+ public static boolean isTransient(Member member)
+ {
+ return Modifier.isTransient(member.getModifiers());
+ }
+
+ /**
+ * Checks if clazz is abstract
+ *
+ * @param clazz Class to check
+ * @return True if abstract, false otherwise
+ */
+ public static boolean isAbstract(Class<?> clazz)
+ {
+ return Modifier.isAbstract(clazz.getModifiers());
+ }
+
+ /**
+ * Checks if class is a non-static inner one
+ *
+ * @param clazz Class to Check
+ * @return True if static, false otherwise
+ */
+ public static boolean isNonStaticInnerClass(Class<?> clazz)
+ {
+ return (clazz.isMemberClass() || clazz.isAnonymousClass()) && !isStatic(clazz);
+ }
+
+ /**
+ * Gets a constructor with matching parameter types
+ *
+ * @param <T> The type
+ * @param clazz The class
+ * @param parameterTypes The parameter types
+ * @return The matching constructor. Null is returned if none is found
+ */
+ public static <T> Constructor<T> getDeclaredConstructor(Class<T> clazz, Class<?>... parameterTypes)
+ {
+ try
+ {
+ return clazz.getDeclaredConstructor(parameterTypes);
+ }
+ catch (NoSuchMethodException e)
+ {
+ return null;
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException("Error accessing constructor (with parameters " + Arrays.toString(parameterTypes) + ") of " + clazz, e);
+ }
+ }
+
+ /**
+ * Gets the actual type arguments of a class
+ *
+ * @param clazz The class to examine
+ * @return The type arguments
+ */
+ public static Type[] getActualTypeArguments(Class<?> clazz)
+ {
+ Type type = new HierarchyDiscovery(clazz).getResolvedType();
+ if (type instanceof ParameterizedType)
+ {
+ return ((ParameterizedType) type).getActualTypeArguments();
+ }
+ else
+ {
+ return EMPTY_TYPES;
+ }
+ }
+
+ /**
+ * Checks if raw type is array type
+ *
+ * @param rawType The raw type to check
+ * @return True if array, false otherwise
+ */
+ public static boolean isArrayType(Class<?> rawType)
+ {
+ return rawType.isArray();
+ }
+
+ /**
+ * Checks if type is parameterized type
+ *
+ * @param type The type to check
+ * @return True if parameterized, false otherwise
+ */
+ public static boolean isParameterizedType(Class<?> type)
+ {
+ return type.getTypeParameters().length > 0;
+ }
+
+ public static boolean isParamerterizedTypeWithWildcard(Class<?> type)
+ {
+ if (isParameterizedType(type))
+ {
+ return containsWildcards(type.getTypeParameters());
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ public static boolean containsWildcards(Type[] types)
+ {
+ for (Type type : types)
+ {
+ if (type instanceof WildcardType)
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public static Set<Type> createTypeClosure(Class<?> rawType, Type[] actualTypeArguments)
+ {
+ Type type = new ParameterizedTypeImpl(rawType, actualTypeArguments, rawType.getDeclaringClass());
+ return new HierarchyDiscovery(type).getFlattenedTypes();
+ }
+
+ /**
+ * Invokes a method and wraps exceptions
+ *
+ * @param method The method to invoke
+ * @param instance The instance to invoke on
+ * @param parameters The parameters
+ * @return The return value
+ */
+ public static Object invokeAndWrap(Method method, Object instance, Object... parameters)
+ {
+ try
+ {
+ method.setAccessible(true);
+ return method.invoke(instance, parameters);
+ }
+ catch (IllegalArgumentException e)
+ {
+ throw new RuntimeException("Error invoking method " + method.getName() + " on " + method.getDeclaringClass(), e);
+ }
+ catch (IllegalAccessException e)
+ {
+ throw new RuntimeException("Error invoking method " + method.getName() + " on " + method.getDeclaringClass(), e);
+ }
+ catch (InvocationTargetException e)
+ {
+ throw new RuntimeException("Error invoking method " + method.getName() + " on " + method.getDeclaringClass(), e);
+ }
+ }
+
+ public static Object invokeAndWrap(String methodName, Object instance, Object... parameters)
+ {
+ Class<?>[] parameterTypes = new Class<?>[parameters.length];
+ for (int i = 0; i < parameters.length; i++)
+ {
+ parameterTypes[i] = parameters[i].getClass();
+ }
+ try
+ {
+ return invokeAndWrap(instance.getClass().getMethod(methodName, parameterTypes), instance, parameters);
+ }
+ catch (SecurityException e)
+ {
+ throw new RuntimeException("Error invoking method " + methodName + " on " + instance.getClass(), e);
+ }
+ catch (NoSuchMethodException e)
+ {
+ throw new RuntimeException("Error invoking method " + methodName + " on " + instance.getClass(), e);
+ }
+ }
+
+ /**
+ * Gets value of a field and wraps exceptions
+ *
+ * @param field The field to set on
+ * @param target The instance to set on
+ * @return The value to set
+ */
+ public static Object getAndWrap(Field field, Object target)
+ {
+ try
+ {
+ return field.get(target);
+ }
+ catch (IllegalArgumentException e)
+ {
+ throw new RuntimeException("Error getting field " + field.getName() + " on " + field.getDeclaringClass(), e);
+ }
+ catch (IllegalAccessException e)
+ {
+ throw new RuntimeException("Error getting field " + field.getName() + " on " + field.getDeclaringClass(), e);
+ }
+ }
+
+ public static Object getAndWrap(String fieldName, Object target)
+ {
+ try
+ {
+ return getAndWrap(target.getClass().getField(fieldName), target);
+ }
+ catch (SecurityException e)
+ {
+ throw new RuntimeException("Error getting field " + fieldName + " on " + target.getClass(), e);
+ }
+ catch (NoSuchFieldException e)
+ {
+ throw new RuntimeException("Error getting field " + fieldName + " on " + target.getClass(), e);
+ }
+ }
+
+ /**
+ * Looks up a method in the type hierarchy of an instance
+ *
+ * @param method The method to look for
+ * @param instance The instance to start from
+ * @return The method found
+ * @throws IllegalArgumentException if the method is not found
+ */
+ public static Method lookupMethod(Method method, Object instance)
+ {
+ try
+ {
+ return lookupMethod(method.getName(), method.getParameterTypes(), instance);
+ }
+ catch (NoSuchMethodException e)
+ {
+ throw new IllegalArgumentException(e);
+ }
+ }
+
+ /**
+ * Looks up a method in the type hierarchy of an instance
+ *
+ * @param method The method to look for
+ * @param instance The instance to start from
+ * @return the method
+ * @throws NoSuchMethodException if the method is not found
+ */
+ public static Method lookupMethod(String methodName, Class<?>[] parameterTypes, Object instance) throws NoSuchMethodException
+ {
+ return lookupMethod(methodName, parameterTypes, instance.getClass());
+ }
+
+ private static Method lookupMethod(String methodName, Class<?>[] parameterTypes, Class<?> c) throws NoSuchMethodException
+ {
+ for (Class<? extends Object> clazz = c; clazz != null; clazz = clazz.getSuperclass())
+ {
+ for (Class<?> intf : clazz.getInterfaces())
+ {
+ try
+ {
+ return lookupMethod(methodName, parameterTypes, intf);
+ }
+ catch (NoSuchMethodException e)
+ {
+ // Expected
+ }
+ }
+ try
+ {
+ Method targetMethod = clazz.getDeclaredMethod(methodName, parameterTypes);
+ if (!targetMethod.isAccessible())
+ {
+ targetMethod.setAccessible(true);
+ }
+ return targetMethod;
+ }
+ catch (NoSuchMethodException nsme)
+ {
+ // Expected, nothing to see here.
+ }
+ }
+ throw new NoSuchMethodException("Method " + methodName + Arrays.asList(parameterTypes).toString().replace("[", "(").replace("]", ")") + " not implemented by instance " + c.getName());
+ }
+
+ /**
+ * Checks the bindingType to make sure the annotation was declared properly
+ * as a binding type (annotated with @BindingType) and that it has
+ * a runtime retention policy.
+ *
+ * @param binding The binding type to check
+ * @return true only if the annotation is really a binding type
+ */
+ @Deprecated
+ // TODO Replace usage of this with metadatacache
+ public static boolean isBindings(Annotation binding)
+ {
+ boolean isBindingAnnotation = false;
+ if (binding.annotationType().isAnnotationPresent(Qualifier.class) &&
+ binding.annotationType().isAnnotationPresent(Retention.class) &&
+ binding.annotationType().getAnnotation(Retention.class).value().equals(RetentionPolicy.RUNTIME))
+ {
+ isBindingAnnotation = true;
+ }
+ return isBindingAnnotation;
+ }
+
+ /**
+ * Check the assignability of one type to another, taking into account the
+ * actual type arguements
+ *
+ * @param rawType1 the raw type of the class to check
+ * @param actualTypeArguments1 the actual type arguements to check, or an empty array if not a parameterized type
+ * @param rawType2 the raw type of the class to check
+ * @param actualTypeArguments2 the actual type arguements to check, or an empty array if not a parameterized type
+ * @return
+ */
+ public static boolean isAssignableFrom(Class<?> rawType1, Type[] actualTypeArguments1, Class<?> rawType2, Type[] actualTypeArguments2)
+ {
+ return Types.boxedClass(rawType1).isAssignableFrom(Types.boxedClass(rawType2)) && isAssignableFrom(actualTypeArguments1, actualTypeArguments2);
+ }
+
+ public static boolean isAssignableFrom(Type[] actualTypeArguments1, Type[] actualTypeArguments2)
+ {
+ for (int i = 0; i < actualTypeArguments1.length; i++)
+ {
+ Type type1 = actualTypeArguments1[i];
+ Type type2 = Object.class;
+ if (actualTypeArguments2.length > i)
+ {
+ type2 = actualTypeArguments2[i];
+ }
+ if (!isAssignableFrom(type1, type2))
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public static boolean isAssignableFrom(Type type1, Set<? extends Type> types2)
+ {
+ for (Type type2 : types2)
+ {
+ if (isAssignableFrom(type1, type2))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public static boolean isAssignableFrom(Type type1, Type[] types2)
+ {
+ for (Type type2 : types2)
+ {
+ if (isAssignableFrom(type1, type2))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public static boolean isAssignableFrom(Type type1, Type type2)
+ {
+ if (type1 instanceof Class)
+ {
+ Class<?> clazz = (Class<?>) type1;
+ if (isAssignableFrom(clazz, EMPTY_TYPES, type2))
+ {
+ return true;
+ }
+ }
+ if (type1 instanceof ParameterizedType)
+ {
+ ParameterizedType parameterizedType1 = (ParameterizedType) type1;
+ if (parameterizedType1.getRawType() instanceof Class)
+ {
+ if (isAssignableFrom((Class<?>) parameterizedType1.getRawType(), parameterizedType1.getActualTypeArguments(), type2))
+ {
+ return true;
+ }
+ }
+ }
+ if (type1 instanceof WildcardType)
+ {
+ WildcardType wildcardType = (WildcardType) type1;
+ if (isTypeBounded(type2, wildcardType.getLowerBounds(), wildcardType.getUpperBounds()))
+ {
+ return true;
+ }
+ }
+ if (type2 instanceof WildcardType)
+ {
+ WildcardType wildcardType = (WildcardType) type2;
+ if (isTypeBounded(type1, wildcardType.getUpperBounds(), wildcardType.getLowerBounds()))
+ {
+ return true;
+ }
+ }
+ if (type1 instanceof TypeVariable<?>)
+ {
+ TypeVariable<?> typeVariable = (TypeVariable<?>) type1;
+ if (isTypeBounded(type2, EMPTY_TYPES, typeVariable.getBounds()))
+ {
+ return true;
+ }
+ }
+ if (type2 instanceof TypeVariable<?>)
+ {
+ TypeVariable<?> typeVariable = (TypeVariable<?>) type2;
+ if (isTypeBounded(type1, typeVariable.getBounds(), EMPTY_TYPES))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public static boolean isTypeBounded(Type type, Type[] lowerBounds, Type[] upperBounds)
+ {
+ if (lowerBounds.length > 0)
+ {
+ if (!isAssignableFrom(type, lowerBounds))
+ {
+ return false;
+ }
+ }
+ if (upperBounds.length > 0)
+ {
+ if (!isAssignableFrom(upperBounds, type))
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public static boolean isAssignableFrom(Class<?> rawType1, Type[] actualTypeArguments1, Type type2)
+ {
+ if (type2 instanceof ParameterizedType)
+ {
+ ParameterizedType parameterizedType = (ParameterizedType) type2;
+ if (parameterizedType.getRawType() instanceof Class)
+ {
+ if (isAssignableFrom(rawType1, actualTypeArguments1, (Class<?>) parameterizedType.getRawType(), parameterizedType.getActualTypeArguments()))
+ {
+ return true;
+ }
+ }
+ }
+ else if (type2 instanceof Class)
+ {
+ Class<?> clazz = (Class<?>) type2;
+ if (isAssignableFrom(rawType1, actualTypeArguments1, clazz, EMPTY_TYPES))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Check the assiginability of a set of <b>flattened</b> types. This algorithm
+ * will check whether any of the types1 matches a type in types2
+ *
+ * @param types1
+ * @param types2
+ * @return
+ */
+ public static boolean isAssignableFrom(Set<Type> types1, Set<Type> types2)
+ {
+ for (Type type : types1)
+ {
+ if (isAssignableFrom(type, types2))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Check the assiginability of a set of <b>flattened</b> types. This algorithm
+ * will check whether any of the types1 matches a type in types2
+ *
+ * @param types1
+ * @param types2
+ * @return
+ */
+ public static boolean isAssignableFrom(Set<Type> types1, Type type2)
+ {
+ for (Type type : types1)
+ {
+ if (isAssignableFrom(type, type2))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public static boolean isAssignableFrom(Type[] types1, Type type2)
+ {
+ for (Type type : types1)
+ {
+ if (isAssignableFrom(type, type2))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public static boolean isSerializable(Class<?> clazz)
+ {
+ return clazz.isPrimitive() || Serializable.class.isAssignableFrom(clazz);
+ }
+
+ public static Field ensureAccessible(Field field)
+ {
+ if (!field.isAccessible() && !isIgnorePackage(field.getDeclaringClass().getPackage()))
+ {
+ field.setAccessible(true);
+ }
+ return field;
+ }
+
+ public static Method ensureAccessible(Method method)
+ {
+ if (!method.isAccessible() && !isIgnorePackage(method.getDeclaringClass().getPackage()))
+ {
+ method.setAccessible(true);
+ }
+ return method;
+ }
+
+ public static <T> Constructor<T> ensureAccessible(Constructor<T> constructor)
+ {
+ Class<?> c = constructor.getDeclaringClass();
+ Package p = c.getPackage();
+ if (!constructor.isAccessible() && !isIgnorePackage(p))
+ {
+ constructor.setAccessible(true);
+ }
+ return constructor;
+ }
+
+ private static boolean isIgnorePackage(Package pkg)
+ {
+ if (pkg != null)
+ {
+ return pkg.getName().startsWith("java.lang");
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ public static Class<?>[] extractValues(Annotation annotation)
+ {
+ try
+ {
+ Class<?>[] valueClasses = (Class<?>[]) annotation.annotationType().getMethod("value").invoke(annotation);
+ return valueClasses;
+ }
+ catch (Exception e)
+ {
+ throw new DeploymentException("Cannot access values() on annotation", e);
+ }
+ }
+
+
+}
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/util/Strings.java (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/util/Strings.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/weld/util/Strings.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/util/Strings.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -0,0 +1,133 @@
+/*
+ * 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.util;
+
+import java.beans.Introspector;
+import java.util.Collection;
+import java.util.Map;
+import java.util.StringTokenizer;
+import java.util.Map.Entry;
+
+
+/**
+ * String utilities
+ *
+ * @author Pete Muir
+ *
+ */
+public class Strings
+{
+
+ /**
+ * Decapitalizes a String
+ *
+ * @param camelCase The String
+ * @return The decapitalized result
+ */
+ public static String decapitalize(String camelCase)
+ {
+ return Introspector.decapitalize(camelCase);
+ }
+
+ /**
+ * Split a string into parts
+ *
+ * @param strings The sources
+ * @param delims The delimeter
+ * @return The parts
+ */
+ public static String[] split(String strings, String delims)
+ {
+ if (strings == null)
+ {
+ return new String[0];
+ }
+ else
+ {
+ StringTokenizer tokens = new StringTokenizer(strings, delims);
+ String[] result = new String[tokens.countTokens()];
+ int i = 0;
+ while (tokens.hasMoreTokens())
+ {
+ result[i++] = tokens.nextToken();
+ }
+ return result;
+ }
+ }
+
+ /**
+ * Returns a textual representation of a map for debug purposes
+ *
+ * @param header The description of the map
+ * @param map The map
+ * @return A textual representation
+ */
+ public static String mapToString(String header, Map<?, ?> map)
+ {
+ StringBuilder buffer = new StringBuilder();
+ if (map == null)
+ {
+ buffer.append(header).append("null\n");
+ return buffer.toString();
+ }
+ buffer.append(header).append("[").append(map.size()).append(" entries]\n");
+ int i = 0;
+ for (Entry<?, ?> entry: map.entrySet())
+ {
+ Object value = entry.getValue();
+ buffer.append(" #").append(++i).append(": ").append(entry.getKey()).append(" -> ");
+ if (value instanceof Iterable<?>)
+ {
+ buffer.append("\n");
+ for (Object subValue : (Iterable<?>) value)
+ {
+ buffer.append(" ").append(subValue.toString()).append("\n");
+ }
+ }
+ else
+ {
+ buffer.append(value.toString()).append("\n");
+ }
+ }
+ return buffer.toString();
+ }
+
+ /**
+ * Returns a textual representation of a collection for debug purposes
+ *
+ * @param header The description of the collection
+ * @param collection The collection
+ * @return A textual representation
+ */
+ public static String collectionToString(String header, Collection<?> collection)
+ {
+ StringBuilder buffer = new StringBuilder();
+ if (collection == null)
+ {
+ buffer.append(header + "null\n");
+ return buffer.toString();
+ }
+ buffer.append(header + "[" + collection.size() + " entries]\n");
+ int i = 0;
+ for (Object item : collection)
+ {
+ buffer.append(" #" + ++i + ": " + item.toString() + "\n");
+ }
+ return buffer.toString();
+ }
+
+}
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/util/Types.java (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/util/Types.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/weld/util/Types.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/util/Types.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -0,0 +1,90 @@
+/*
+ * 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.util;
+
+import java.lang.reflect.Type;
+
+/**
+ * Utility class for Types
+ *
+ * @author Pete Muir
+ */
+public class Types
+{
+
+ /**
+ * Gets the boxed type of a class
+ *
+ * @param type The type
+ * @return The boxed type
+ */
+ public static Type boxedType(Type type)
+ {
+ if (type instanceof Class)
+ {
+ return boxedClass((Class<?>) type);
+ }
+ else
+ {
+ return type;
+ }
+ }
+
+ public static Class<?> boxedClass(Class<?> type)
+ {
+ if (type.equals(Boolean.TYPE))
+ {
+ return Boolean.class;
+ }
+ else if (type.equals(Character.TYPE))
+ {
+ return Character.class;
+ }
+ else if (type.equals(Byte.TYPE))
+ {
+ return Byte.class;
+ }
+ else if (type.equals(Short.TYPE))
+ {
+ return Short.class;
+ }
+ else if (type.equals(Integer.TYPE))
+ {
+ return Integer.class;
+ }
+ else if (type.equals(Long.TYPE))
+ {
+ return Long.class;
+ }
+ else if (type.equals(Float.TYPE))
+ {
+ return Float.class;
+ }
+ else if (type.equals(Double.TYPE))
+ {
+ return Double.class;
+ }
+ else if (type.equals(Void.TYPE))
+ {
+ return Void.class;
+ }
+ return type;
+ }
+
+
+
+}
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/util/collections (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections)
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/util/collections/Arrays2.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/Arrays2.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/util/collections/Arrays2.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.util.collections;
+package org.jboss.weld.util.collections;
import java.util.Arrays;
import java.util.HashSet;
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/util/collections/ConcurrentCache.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/ConcurrentCache.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/util/collections/ConcurrentCache.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.util.collections;
+package org.jboss.weld.util.collections;
import java.util.Map;
import java.util.concurrent.Callable;
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/util/collections/EnumerationList.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/EnumerationList.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/util/collections/EnumerationList.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.util.collections;
+package org.jboss.weld.util.collections;
import java.util.ArrayList;
import java.util.Enumeration;
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/util/collections/ListComparator.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/util/collections/ListComparator.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/util/collections/ListComparator.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.util.collections;
+package org.jboss.weld.util.collections;
import java.util.Comparator;
import java.util.List;
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/util/dom (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/util/dom)
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/util/dom/NodeListIterable.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/util/dom/NodeListIterable.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/util/dom/NodeListIterable.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.util.dom;
+package org.jboss.weld.util.dom;
import java.util.Iterator;
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/util/dom/NodeListIterator.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/util/dom/NodeListIterator.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/util/dom/NodeListIterator.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.util.dom;
+package org.jboss.weld.util.dom;
import java.util.Iterator;
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/util/el (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/util/el)
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/util/el/ForwardingELContext.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/util/el/ForwardingELContext.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/util/el/ForwardingELContext.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.util.el;
+package org.jboss.weld.util.el;
import java.util.Locale;
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/util/el/ForwardingELResolver.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/util/el/ForwardingELResolver.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/util/el/ForwardingELResolver.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.util.el;
+package org.jboss.weld.util.el;
import java.beans.FeatureDescriptor;
import java.util.Iterator;
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/util/el/ForwardingExpressionFactory.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/util/el/ForwardingExpressionFactory.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/util/el/ForwardingExpressionFactory.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.util.el;
+package org.jboss.weld.util.el;
import javax.el.ELContext;
import javax.el.ExpressionFactory;
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/util/el/ForwardingMethodExpression.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/util/el/ForwardingMethodExpression.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/util/el/ForwardingMethodExpression.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.util.el;
+package org.jboss.weld.util.el;
import javax.el.ELContext;
import javax.el.MethodExpression;
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/util/el/ForwardingValueExpression.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/util/el/ForwardingValueExpression.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/util/el/ForwardingValueExpression.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.util.el;
+package org.jboss.weld.util.el;
import javax.el.ELContext;
import javax.el.ValueExpression;
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/util/reflection (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/util/reflection)
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/util/reflection/ParameterizedTypeImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/util/reflection/ParameterizedTypeImpl.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/util/reflection/ParameterizedTypeImpl.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.util.reflection;
+package org.jboss.weld.util.reflection;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/util/serviceProvider (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/util/serviceProvider)
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/util/serviceProvider/ServiceLoader.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/util/serviceProvider/ServiceLoader.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/util/serviceProvider/ServiceLoader.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.util.serviceProvider;
+package org.jboss.weld.util.serviceProvider;
import java.io.BufferedReader;
import java.io.IOException;
@@ -27,9 +27,9 @@
import java.util.Iterator;
import java.util.Set;
-import org.jboss.webbeans.log.Log;
-import org.jboss.webbeans.log.Logging;
-import org.jboss.webbeans.util.Reflections;
+import org.jboss.weld.log.Log;
+import org.jboss.weld.log.Logging;
+import org.jboss.weld.util.Reflections;
/**
* This class handles looking up service providers on the class path. It
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/ws (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/ws)
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/ws/WSApiAbstraction.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/ws/WSApiAbstraction.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/ws/WSApiAbstraction.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,13 +14,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.ws;
+package org.jboss.weld.ws;
import java.lang.annotation.Annotation;
-import org.jboss.webbeans.bootstrap.api.Service;
-import org.jboss.webbeans.resources.spi.ResourceLoader;
-import org.jboss.webbeans.util.ApiAbstraction;
+import org.jboss.weld.bootstrap.api.Service;
+import org.jboss.weld.resources.spi.ResourceLoader;
+import org.jboss.weld.util.ApiAbstraction;
public class WSApiAbstraction extends ApiAbstraction implements Service
{
Copied: ri/trunk/impl/src/main/java/org/jboss/weld/xml (from rev 3872, ri/trunk/impl/src/main/java/org/jboss/webbeans/xml)
Modified: ri/trunk/impl/src/main/java/org/jboss/weld/xml/BeansXmlParser.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/BeansXmlParser.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/impl/src/main/java/org/jboss/weld/xml/BeansXmlParser.java 2009-10-08 03:34:46 UTC (rev 3879)
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.xml;
+package org.jboss.weld.xml;
import java.io.IOException;
import java.io.InputStream;
@@ -29,10 +29,10 @@
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
-import org.jboss.webbeans.DeploymentException;
-import org.jboss.webbeans.resources.spi.ResourceLoader;
-import org.jboss.webbeans.resources.spi.ResourceLoadingException;
-import org.jboss.webbeans.util.dom.NodeListIterable;
+import org.jboss.weld.DeploymentException;
+import org.jboss.weld.resources.spi.ResourceLoader;
+import org.jboss.weld.resources.spi.ResourceLoadingException;
+import org.jboss.weld.util.dom.NodeListIterable;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
15 years, 1 month
Weld SVN: r3877 - in ri/trunk/logging: src/main/java/org/jboss and 4 other directories.
by weld-commits@lists.jboss.org
Author: shane.bryzak(a)jboss.com
Date: 2009-10-07 23:19:35 -0400 (Wed, 07 Oct 2009)
New Revision: 3877
Added:
ri/trunk/logging/src/main/java/org/jboss/weld/
ri/trunk/logging/src/main/java/org/jboss/weld/log/
Removed:
ri/trunk/logging/src/main/java/org/jboss/webbeans/log/
Modified:
ri/trunk/logging/pom.xml
ri/trunk/logging/src/main/java/org/jboss/weld/log/JDKProvider.java
ri/trunk/logging/src/main/java/org/jboss/weld/log/Log.java
ri/trunk/logging/src/main/java/org/jboss/weld/log/Log4JProvider.java
ri/trunk/logging/src/main/java/org/jboss/weld/log/LogImpl.java
ri/trunk/logging/src/main/java/org/jboss/weld/log/LogProvider.java
ri/trunk/logging/src/main/java/org/jboss/weld/log/Logging.java
ri/trunk/logging/src/test/java/org/jboss/webbeans/test/log/LoggingTest.java
Log:
refactor weld-logging packages
Modified: ri/trunk/logging/pom.xml
===================================================================
--- ri/trunk/logging/pom.xml 2009-10-08 03:14:09 UTC (rev 3876)
+++ ri/trunk/logging/pom.xml 2009-10-08 03:19:35 UTC (rev 3877)
@@ -1,14 +1,14 @@
<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">
<parent>
- <artifactId>webbeans-parent</artifactId>
- <groupId>org.jboss.webbeans</groupId>
+ <artifactId>weld-parent</artifactId>
+ <groupId>org.jboss.weld</groupId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
- <groupId>org.jboss.webbeans</groupId>
- <artifactId>webbeans-logging</artifactId>
+ <groupId>org.jboss.weld</groupId>
+ <artifactId>weld-logging</artifactId>
<version>1.0.0-SNAPSHOT</version>
- <name>Web Beans Logging</name>
+ <name>Weld Logging</name>
<dependencies>
<dependency>
Copied: ri/trunk/logging/src/main/java/org/jboss/weld/log (from rev 3872, ri/trunk/logging/src/main/java/org/jboss/webbeans/log)
Modified: ri/trunk/logging/src/main/java/org/jboss/weld/log/JDKProvider.java
===================================================================
--- ri/trunk/logging/src/main/java/org/jboss/webbeans/log/JDKProvider.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/logging/src/main/java/org/jboss/weld/log/JDKProvider.java 2009-10-08 03:19:35 UTC (rev 3877)
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.log;
+package org.jboss.weld.log;
import java.util.logging.Level;
import java.util.logging.Logger;
Modified: ri/trunk/logging/src/main/java/org/jboss/weld/log/Log.java
===================================================================
--- ri/trunk/logging/src/main/java/org/jboss/webbeans/log/Log.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/logging/src/main/java/org/jboss/weld/log/Log.java 2009-10-08 03:19:35 UTC (rev 3877)
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.log;
+package org.jboss.weld.log;
/**
* <p>A <code>Log</code> object is used by RI classes to log messages.
Modified: ri/trunk/logging/src/main/java/org/jboss/weld/log/Log4JProvider.java
===================================================================
--- ri/trunk/logging/src/main/java/org/jboss/webbeans/log/Log4JProvider.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/logging/src/main/java/org/jboss/weld/log/Log4JProvider.java 2009-10-08 03:19:35 UTC (rev 3877)
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.log;
+package org.jboss.weld.log;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
Modified: ri/trunk/logging/src/main/java/org/jboss/weld/log/LogImpl.java
===================================================================
--- ri/trunk/logging/src/main/java/org/jboss/webbeans/log/LogImpl.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/logging/src/main/java/org/jboss/weld/log/LogImpl.java 2009-10-08 03:19:35 UTC (rev 3877)
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.log;
+package org.jboss.weld.log;
import java.io.Externalizable;
import java.io.IOException;
Modified: ri/trunk/logging/src/main/java/org/jboss/weld/log/LogProvider.java
===================================================================
--- ri/trunk/logging/src/main/java/org/jboss/webbeans/log/LogProvider.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/logging/src/main/java/org/jboss/weld/log/LogProvider.java 2009-10-08 03:19:35 UTC (rev 3877)
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.log;
+package org.jboss.weld.log;
/**
*
Modified: ri/trunk/logging/src/main/java/org/jboss/weld/log/Logging.java
===================================================================
--- ri/trunk/logging/src/main/java/org/jboss/webbeans/log/Logging.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/logging/src/main/java/org/jboss/weld/log/Logging.java 2009-10-08 03:19:35 UTC (rev 3877)
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.log;
+package org.jboss.weld.log;
/**
*
Modified: ri/trunk/logging/src/test/java/org/jboss/webbeans/test/log/LoggingTest.java
===================================================================
--- ri/trunk/logging/src/test/java/org/jboss/webbeans/test/log/LoggingTest.java 2009-10-08 03:14:09 UTC (rev 3876)
+++ ri/trunk/logging/src/test/java/org/jboss/webbeans/test/log/LoggingTest.java 2009-10-08 03:19:35 UTC (rev 3877)
@@ -1,8 +1,8 @@
package org.jboss.webbeans.test.log;
-import org.jboss.webbeans.log.Log;
-import org.jboss.webbeans.log.LogProvider;
-import org.jboss.webbeans.log.Logging;
+import org.jboss.weld.log.Log;
+import org.jboss.weld.log.LogProvider;
+import org.jboss.weld.log.Logging;
import org.testng.annotations.Test;
/**
15 years, 1 month
Weld SVN: r3875 - in ri/trunk/spi/src/main/java/org/jboss: webbeans and 44 other directories.
by weld-commits@lists.jboss.org
Author: shane.bryzak(a)jboss.com
Date: 2009-10-07 23:07:40 -0400 (Wed, 07 Oct 2009)
New Revision: 3875
Added:
ri/trunk/spi/src/main/java/org/jboss/weld/
ri/trunk/spi/src/main/java/org/jboss/weld/bootstrap/
ri/trunk/spi/src/main/java/org/jboss/weld/bootstrap/api/
ri/trunk/spi/src/main/java/org/jboss/weld/bootstrap/api/Bootstrap.java
ri/trunk/spi/src/main/java/org/jboss/weld/bootstrap/api/Environment.java
ri/trunk/spi/src/main/java/org/jboss/weld/bootstrap/api/Environments.java
ri/trunk/spi/src/main/java/org/jboss/weld/bootstrap/api/Lifecycle.java
ri/trunk/spi/src/main/java/org/jboss/weld/bootstrap/api/Service.java
ri/trunk/spi/src/main/java/org/jboss/weld/bootstrap/api/ServiceRegistry.java
ri/trunk/spi/src/main/java/org/jboss/weld/bootstrap/api/Singleton.java
ri/trunk/spi/src/main/java/org/jboss/weld/bootstrap/api/SingletonProvider.java
ri/trunk/spi/src/main/java/org/jboss/weld/bootstrap/api/helpers/
ri/trunk/spi/src/main/java/org/jboss/weld/bootstrap/spi/
ri/trunk/spi/src/main/java/org/jboss/weld/bootstrap/spi/BeanDeploymentArchive.java
ri/trunk/spi/src/main/java/org/jboss/weld/bootstrap/spi/Deployment.java
ri/trunk/spi/src/main/java/org/jboss/weld/bootstrap/spi/helpers/
ri/trunk/spi/src/main/java/org/jboss/weld/context/
ri/trunk/spi/src/main/java/org/jboss/weld/context/api/
ri/trunk/spi/src/main/java/org/jboss/weld/context/api/BeanStore.java
ri/trunk/spi/src/main/java/org/jboss/weld/context/api/ContextualInstance.java
ri/trunk/spi/src/main/java/org/jboss/weld/context/api/helpers/
ri/trunk/spi/src/main/java/org/jboss/weld/ejb/
ri/trunk/spi/src/main/java/org/jboss/weld/ejb/api/
ri/trunk/spi/src/main/java/org/jboss/weld/ejb/spi/
ri/trunk/spi/src/main/java/org/jboss/weld/ejb/spi/BusinessInterfaceDescriptor.java
ri/trunk/spi/src/main/java/org/jboss/weld/ejb/spi/EjbDescriptor.java
ri/trunk/spi/src/main/java/org/jboss/weld/ejb/spi/EjbServices.java
ri/trunk/spi/src/main/java/org/jboss/weld/ejb/spi/InterceptorBindings.java
ri/trunk/spi/src/main/java/org/jboss/weld/ejb/spi/helpers/
ri/trunk/spi/src/main/java/org/jboss/weld/injection/
ri/trunk/spi/src/main/java/org/jboss/weld/injection/spi/
ri/trunk/spi/src/main/java/org/jboss/weld/injection/spi/EjbInjectionServices.java
ri/trunk/spi/src/main/java/org/jboss/weld/injection/spi/InjectionContext.java
ri/trunk/spi/src/main/java/org/jboss/weld/injection/spi/InjectionServices.java
ri/trunk/spi/src/main/java/org/jboss/weld/injection/spi/JpaInjectionServices.java
ri/trunk/spi/src/main/java/org/jboss/weld/injection/spi/ResourceInjectionServices.java
ri/trunk/spi/src/main/java/org/jboss/weld/injection/spi/helpers/
ri/trunk/spi/src/main/java/org/jboss/weld/manager/
ri/trunk/spi/src/main/java/org/jboss/weld/manager/api/
ri/trunk/spi/src/main/java/org/jboss/weld/messaging/
ri/trunk/spi/src/main/java/org/jboss/weld/persistence/
ri/trunk/spi/src/main/java/org/jboss/weld/persistence/spi/
ri/trunk/spi/src/main/java/org/jboss/weld/resources/
ri/trunk/spi/src/main/java/org/jboss/weld/resources/spi/
ri/trunk/spi/src/main/java/org/jboss/weld/resources/spi/ResourceLoader.java
ri/trunk/spi/src/main/java/org/jboss/weld/resources/spi/ResourceLoadingException.java
ri/trunk/spi/src/main/java/org/jboss/weld/resources/spi/helpers/
ri/trunk/spi/src/main/java/org/jboss/weld/security/
ri/trunk/spi/src/main/java/org/jboss/weld/security/spi/
ri/trunk/spi/src/main/java/org/jboss/weld/servlet/
ri/trunk/spi/src/main/java/org/jboss/weld/servlet/api/
ri/trunk/spi/src/main/java/org/jboss/weld/servlet/api/ServletListener.java
ri/trunk/spi/src/main/java/org/jboss/weld/servlet/api/ServletServices.java
ri/trunk/spi/src/main/java/org/jboss/weld/servlet/api/helpers/
ri/trunk/spi/src/main/java/org/jboss/weld/transaction/
ri/trunk/spi/src/main/java/org/jboss/weld/transaction/spi/
ri/trunk/spi/src/main/java/org/jboss/weld/validation/
ri/trunk/spi/src/main/java/org/jboss/weld/validation/spi/
ri/trunk/spi/src/main/java/org/jboss/weld/ws/
Removed:
ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/Bootstrap.java
ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/Environment.java
ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/Environments.java
ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/Lifecycle.java
ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/Service.java
ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/ServiceRegistry.java
ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/Singleton.java
ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/SingletonProvider.java
ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/helpers/
ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/spi/BeanDeploymentArchive.java
ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/spi/Deployment.java
ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/spi/helpers/
ri/trunk/spi/src/main/java/org/jboss/webbeans/context/api/BeanStore.java
ri/trunk/spi/src/main/java/org/jboss/webbeans/context/api/ContextualInstance.java
ri/trunk/spi/src/main/java/org/jboss/webbeans/context/api/helpers/
ri/trunk/spi/src/main/java/org/jboss/webbeans/ejb/api/
ri/trunk/spi/src/main/java/org/jboss/webbeans/ejb/spi/BusinessInterfaceDescriptor.java
ri/trunk/spi/src/main/java/org/jboss/webbeans/ejb/spi/EjbDescriptor.java
ri/trunk/spi/src/main/java/org/jboss/webbeans/ejb/spi/EjbServices.java
ri/trunk/spi/src/main/java/org/jboss/webbeans/ejb/spi/InterceptorBindings.java
ri/trunk/spi/src/main/java/org/jboss/webbeans/ejb/spi/helpers/
ri/trunk/spi/src/main/java/org/jboss/webbeans/injection/spi/EjbInjectionServices.java
ri/trunk/spi/src/main/java/org/jboss/webbeans/injection/spi/InjectionContext.java
ri/trunk/spi/src/main/java/org/jboss/webbeans/injection/spi/InjectionServices.java
ri/trunk/spi/src/main/java/org/jboss/webbeans/injection/spi/JpaInjectionServices.java
ri/trunk/spi/src/main/java/org/jboss/webbeans/injection/spi/ResourceInjectionServices.java
ri/trunk/spi/src/main/java/org/jboss/webbeans/injection/spi/helpers/
ri/trunk/spi/src/main/java/org/jboss/webbeans/manager/api/
ri/trunk/spi/src/main/java/org/jboss/webbeans/messaging/
ri/trunk/spi/src/main/java/org/jboss/webbeans/persistence/spi/
ri/trunk/spi/src/main/java/org/jboss/webbeans/resources/spi/ResourceLoader.java
ri/trunk/spi/src/main/java/org/jboss/webbeans/resources/spi/ResourceLoadingException.java
ri/trunk/spi/src/main/java/org/jboss/webbeans/resources/spi/helpers/
ri/trunk/spi/src/main/java/org/jboss/webbeans/security/spi/
ri/trunk/spi/src/main/java/org/jboss/webbeans/servlet/api/ServletListener.java
ri/trunk/spi/src/main/java/org/jboss/webbeans/servlet/api/ServletServices.java
ri/trunk/spi/src/main/java/org/jboss/webbeans/servlet/api/helpers/
ri/trunk/spi/src/main/java/org/jboss/webbeans/transaction/spi/
ri/trunk/spi/src/main/java/org/jboss/webbeans/validation/spi/
ri/trunk/spi/src/main/java/org/jboss/webbeans/ws/
Modified:
ri/trunk/spi/src/main/java/org/jboss/weld/bootstrap/api/helpers/ForwardingBootstrap.java
ri/trunk/spi/src/main/java/org/jboss/weld/bootstrap/api/helpers/ForwardingLifecycle.java
ri/trunk/spi/src/main/java/org/jboss/weld/bootstrap/api/helpers/ForwardingServiceRegistry.java
ri/trunk/spi/src/main/java/org/jboss/weld/bootstrap/api/helpers/IsolatedStaticSingletonProvider.java
ri/trunk/spi/src/main/java/org/jboss/weld/bootstrap/api/helpers/ServiceRegistries.java
ri/trunk/spi/src/main/java/org/jboss/weld/bootstrap/api/helpers/SimpleServiceRegistry.java
ri/trunk/spi/src/main/java/org/jboss/weld/bootstrap/api/helpers/TCCLSingletonProvider.java
ri/trunk/spi/src/main/java/org/jboss/weld/bootstrap/spi/helpers/ForwardingBeanDeploymentArchive.java
ri/trunk/spi/src/main/java/org/jboss/weld/context/api/helpers/AbstractMapBackedBeanStore.java
ri/trunk/spi/src/main/java/org/jboss/weld/context/api/helpers/ConcurrentHashMapBeanStore.java
ri/trunk/spi/src/main/java/org/jboss/weld/context/api/helpers/ForwardingBeanStore.java
ri/trunk/spi/src/main/java/org/jboss/weld/ejb/api/SessionObjectReference.java
ri/trunk/spi/src/main/java/org/jboss/weld/ejb/spi/helpers/ForwadingBusinessInterfaceDescriptor.java
ri/trunk/spi/src/main/java/org/jboss/weld/ejb/spi/helpers/ForwardingEjbDescriptor.java
ri/trunk/spi/src/main/java/org/jboss/weld/ejb/spi/helpers/ForwardingEjbServices.java
ri/trunk/spi/src/main/java/org/jboss/weld/injection/spi/helpers/AbstractResourceServices.java
ri/trunk/spi/src/main/java/org/jboss/weld/injection/spi/helpers/ForwardingJpaInjectionServices.java
ri/trunk/spi/src/main/java/org/jboss/weld/injection/spi/helpers/ForwardingResourceInjectionServices.java
ri/trunk/spi/src/main/java/org/jboss/weld/manager/api/ExecutorServices.java
ri/trunk/spi/src/main/java/org/jboss/weld/manager/api/WebBeansManager.java
ri/trunk/spi/src/main/java/org/jboss/weld/resources/spi/helpers/ForwardingResourceLoader.java
ri/trunk/spi/src/main/java/org/jboss/weld/security/spi/SecurityServices.java
ri/trunk/spi/src/main/java/org/jboss/weld/servlet/api/helpers/AbstractServletListener.java
ri/trunk/spi/src/main/java/org/jboss/weld/servlet/api/helpers/ForwardingServletListener.java
ri/trunk/spi/src/main/java/org/jboss/weld/transaction/spi/TransactionServices.java
ri/trunk/spi/src/main/java/org/jboss/weld/validation/spi/ValidationServices.java
Log:
renamed spi packages
Deleted: ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/Bootstrap.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/Bootstrap.java 2009-10-08 02:48:09 UTC (rev 3874)
+++ ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/Bootstrap.java 2009-10-08 03:07:40 UTC (rev 3875)
@@ -1,137 +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.webbeans.bootstrap.api;
-
-import javax.enterprise.inject.spi.AfterBeanDiscovery;
-import javax.enterprise.inject.spi.AfterDeploymentValidation;
-import javax.enterprise.inject.spi.BeforeBeanDiscovery;
-import javax.enterprise.inject.spi.BeforeShutdown;
-import javax.enterprise.inject.spi.Extension;
-
-import org.jboss.webbeans.bootstrap.spi.BeanDeploymentArchive;
-import org.jboss.webbeans.bootstrap.spi.Deployment;
-import org.jboss.webbeans.context.api.BeanStore;
-import org.jboss.webbeans.manager.api.WebBeansManager;
-
-/**
- * Application container initialization API for Web Beans.
- *
- * To initialize the container you must call, in this order:
- *
- * <ol>
- * <li>{@link #startContainer()}</li>
- * <li>{@link #startInitialization()}</li>
- * <li>{@link #deployBeans()}</li>
- * <li>{@link #validateBeans()}</li>
- * <li>{@link #endInitialization()}</li>
- * </ol>
- *
- * To stop the container and clean up, you must call {@link #shutdown()}
- *
- * @author Pete Muir
- *
- */
-public interface Bootstrap
-{
-
- /**
- * Creates the application container:
- * <ul>
- * <li>Checks that the services required by the environment have been
- * provided</li>
- * <li>Adds container provided services</li>
- * <li>Creates and initializes the built in contexts</li>
- * <li>Creates the manager</li>
- * </ul>
- *
- * @param beanStore the bean store to use as backing for the application
- * context
- * @param environment the environment in use, by default
- * {@link Environments.EE}
- * @param deployment the Deployment to be booted
- * @throws IllegalStateException if not all the services required for the
- * given environment are available
- *
- */
- public Bootstrap startContainer(Environment environment, Deployment deployment, BeanStore beanStore);
-
- /**
- * Starts the application container initialization process:
- *
- * <ul>
- * <li>Reads metadata from beans.xml and the {@link Deployment} service</li>
- * <li>Starts the application context</li>
- * <li>Starts the request context which lasts until
- * {@link #endInitialization()} is called</li>
- * <li>Discovers and creates {@link Extension} service providers</li>
- * </ul>
- *
- * Finally, the {@link BeforeBeanDiscovery} event is fired.
- *
- */
- public Bootstrap startInitialization();
-
- /**
- * Creates and deploys the application's beans:
- *
- * <ul>
- * <li>Creates and deploys the discovered beans</li>
- * <li>Creates and deploys the built-in beans defined by the CDI
- * specification</li>
- * </ul>
- *
- * Finally the {@link AfterBeanDiscovery} is event is fired
- */
- public Bootstrap deployBeans();
-
- /**
- * Validates the deployment.
- *
- * After validation, the {@link AfterDeploymentValidation} event is fired
- */
- public Bootstrap validateBeans();
-
- /**
- * Cleans up after the initialization
- *
- */
- public Bootstrap endInitialization();
-
- /**
- * Causes the container to clean up and shutdown
- *
- * Before the contain is shutdown the {@link BeforeShutdown} event is fired
- */
- public void shutdown();
-
- /**
- * Get the manager used for this beanDeploymentArchive.
- *
- * If {@link #startContainer()} has not been called, this method will return
- * null.
- *
- * If the beanDeploymentArchive is not known to Web Beans (for example, it
- * was not passed to the Web Beans as part of the {@link Deployment}, or has
- * not yet been requested by
- * {@link Deployment#loadBeanDeploymentArchive(Class)}), null will be
- * returned.
- *
- * @return the manager or null if not yet available or not found.
- */
- public WebBeansManager getManager(BeanDeploymentArchive beanDeploymentArchive);
-
-}
Deleted: ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/Environment.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/Environment.java 2009-10-08 02:48:09 UTC (rev 3874)
+++ ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/Environment.java 2009-10-08 03:07:40 UTC (rev 3875)
@@ -1,39 +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.webbeans.bootstrap.api;
-
-import java.util.Set;
-
-/**
- * Represents an environment. Specifies the services Web Beans requires
- *
- * @author Pete Muir
- *
- */
-public interface Environment
-{
-
- /**
- * The deployment scoped services required for this environment
- *
- * @return the services to require
- */
- public Set<Class<? extends Service>> getRequiredDeploymentServices();
-
- public Set<Class<? extends Service>> getRequiredBeanDeploymentArchiveServices();
-
-}
Deleted: ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/Environments.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/Environments.java 2009-10-08 02:48:09 UTC (rev 3874)
+++ ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/Environments.java 2009-10-08 03:07:40 UTC (rev 3875)
@@ -1,153 +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.webbeans.bootstrap.api;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import org.jboss.webbeans.ejb.spi.EjbServices;
-import org.jboss.webbeans.injection.spi.EjbInjectionServices;
-import org.jboss.webbeans.injection.spi.InjectionServices;
-import org.jboss.webbeans.injection.spi.JpaInjectionServices;
-import org.jboss.webbeans.injection.spi.ResourceInjectionServices;
-import org.jboss.webbeans.resources.spi.ResourceLoader;
-import org.jboss.webbeans.security.spi.SecurityServices;
-import org.jboss.webbeans.servlet.api.ServletServices;
-import org.jboss.webbeans.transaction.spi.TransactionServices;
-import org.jboss.webbeans.validation.spi.ValidationServices;
-
-/**
- * Requirements for various well known environments.
- *
- * @author Pete Muir
- *
- */
-public enum Environments implements Environment
-{
-
- /**
- * Java EE5 or Java EE6
- *
- * In this environment, Web Beans requires that {@link JpaInjectionServices},
- * {@link ResourceInjectionServices} and {@link EjbInjectionServices} are
- * present, and so will perform EE-style field injection on managed beans
- * itself
- */
- EE_INJECT(new EnvironmentBuilder()
- .addRequiredDeploymentService(TransactionServices.class)
- .addRequiredDeploymentService(ResourceLoader.class)
- .addRequiredDeploymentService(SecurityServices.class)
- .addRequiredDeploymentService(ValidationServices.class)
- .addRequiredDeploymentService(ServletServices.class)
- .addRequiredDeploymentService(EjbServices.class)
- .addRequiredBeanDeploymentArchiveService(JpaInjectionServices.class)
- .addRequiredBeanDeploymentArchiveService(ResourceInjectionServices.class)
- .addRequiredBeanDeploymentArchiveService(EjbInjectionServices.class)
- ),
-
- /**
- * Java EE5 or Java EE6
- *
- * In this environment, Web Beans requires that {@link InjectionServices} are
- * present, and expects the container to use this callback to perform EE-style
- * injection
- *
- */
- EE(new EnvironmentBuilder()
- .addRequiredDeploymentService(TransactionServices.class)
- .addRequiredDeploymentService(ResourceLoader.class)
- .addRequiredDeploymentService(SecurityServices.class)
- .addRequiredDeploymentService(ValidationServices.class)
- .addRequiredDeploymentService(ServletServices.class)
- .addRequiredDeploymentService(EjbServices.class)
- .addRequiredBeanDeploymentArchiveService(InjectionServices.class)
- ),
-
-
-
- /**
- * Servlet container such as Tomcat
- */
- SERVLET(new EnvironmentBuilder()
- .addRequiredDeploymentService(ResourceLoader.class)
- .addRequiredDeploymentService(ServletServices.class)
- ),
-
- /**
- * Java SE
- */
- SE(new EnvironmentBuilder()
- );
-
- private final Set<Class<? extends Service>> requiredDeploymentServices;
-
- private final Set<Class<? extends Service>> requiredBeanDeploymentArchiveServices;
-
- private Environments(EnvironmentBuilder builder)
- {
- this.requiredDeploymentServices = builder.getRequiredDeploymentServices();
- this.requiredBeanDeploymentArchiveServices = builder.getRequiredBeanDeploymentArchiveServices();
- }
-
- public Set<Class<? extends Service>> getRequiredDeploymentServices()
- {
- return requiredDeploymentServices;
- }
-
- public Set<Class<? extends Service>> getRequiredBeanDeploymentArchiveServices()
- {
- return requiredBeanDeploymentArchiveServices;
- }
-
- private static class EnvironmentBuilder
- {
-
- private final Set<Class<? extends Service>> requiredDeploymentServices;
-
- private final Set<Class<? extends Service>> requiredBeanDeploymentArchiveServices;
-
- private EnvironmentBuilder()
- {
- this.requiredBeanDeploymentArchiveServices = new HashSet<Class<? extends Service>>();
- this.requiredDeploymentServices = new HashSet<Class<? extends Service>>();
- }
-
- private Set<Class<? extends Service>> getRequiredBeanDeploymentArchiveServices()
- {
- return requiredBeanDeploymentArchiveServices;
- }
-
- private Set<Class<? extends Service>> getRequiredDeploymentServices()
- {
- return requiredDeploymentServices;
- }
-
- private EnvironmentBuilder addRequiredDeploymentService(Class<? extends Service> service)
- {
- this.requiredDeploymentServices.add(service);
- return this;
- }
-
- private EnvironmentBuilder addRequiredBeanDeploymentArchiveService(Class<? extends Service> service)
- {
- this.requiredBeanDeploymentArchiveServices.add(service);
- return this;
- }
-
- }
-
-}
\ No newline at end of file
Deleted: ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/Lifecycle.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/Lifecycle.java 2009-10-08 02:48:09 UTC (rev 3874)
+++ ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/Lifecycle.java 2009-10-08 03:07:40 UTC (rev 3875)
@@ -1,50 +0,0 @@
-package org.jboss.webbeans.bootstrap.api;
-
-import javax.enterprise.context.spi.Context;
-
-import org.jboss.webbeans.context.api.BeanStore;
-
-/**
- * Note Lifecycle is not complete, and the API may change.
- *
- * {@link Lifecycle} is a per-deployment service.
- *
- * @author pmuir
- *
- */
-public interface Lifecycle
-{
-
- public void restoreSession(String id, BeanStore sessionBeanStore);
-
- public void endSession(String id, BeanStore sessionBeanStore);
-
- public void beginRequest(String id, BeanStore requestBeanStore);
-
- public void endRequest(String id, BeanStore requestBeanStore);
-
- public boolean isRequestActive();
-
- public boolean isSessionActive();
-
- public boolean isApplicationActive();
-
- public boolean isConversationActive();
-
- public void beginApplication(BeanStore applicationBeanStore);
-
- public void endApplication();
-
- public Context getApplicationContext();
-
- public Context getSingletonContext();
-
- public Context getSessionContext();
-
- public Context getConversationContext();
-
- public Context getRequestContext();
-
- public Context getDependentContext();
-
-}
Deleted: ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/Service.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/Service.java 2009-10-08 02:48:09 UTC (rev 3874)
+++ ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/Service.java 2009-10-08 03:07:40 UTC (rev 3875)
@@ -1,33 +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.webbeans.bootstrap.api;
-
-/**
- * Marks a Service which is used by Web Beans to interact with it's environment
- * @author Pete Muir
- *
- */
-public interface Service
-{
-
- /**
- * Called by Web beans when it is shutting down, allowing the service to
- * perform any cleanup needed.
- */
- public void cleanup();
-
-}
Deleted: ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/ServiceRegistry.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/ServiceRegistry.java 2009-10-08 02:48:09 UTC (rev 3874)
+++ ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/ServiceRegistry.java 2009-10-08 03:07:40 UTC (rev 3875)
@@ -1,62 +0,0 @@
-package org.jboss.webbeans.bootstrap.api;
-
-import java.util.Collection;
-import java.util.Set;
-import java.util.Map.Entry;
-
-/**
- * A service registry
- *
- * @author Pete Muir
- *
- */
-public interface ServiceRegistry extends Iterable<Service>
-{
-
- /**
- * Add a service
- *
- * @see Service
- *
- * @param <S> the service type to add
- * @param serviceType the service type to add
- * @param service the service implementation
- */
- public <S extends Service> void add(Class<S> type, S service);
-
- /**
- * Add services
- *
- * @param services
- */
- public void addAll(Collection<Entry<Class<? extends Service>, Service>> services);
-
- public Set<Entry<Class<? extends Service>, Service>> entrySet();
-
- /**
- * Retrieve a service implementation
- *
- * @param <S> the service type
- * @param serviceType the service type
- * @return the service implementation, or null if none is registered
- */
- public <S extends Service> S get(Class<S> type);
-
- /**
- * Check if a service is registered
- *
- * @param <S> the service type
- * @param serviceType the service type
- * @return true if a service is registered, otherwise false
- */
- public <S extends Service> boolean contains(Class<S> type);
-
- /**
- * Clear up the services registered, by calling {@link Service#cleanup()} on
- * each registered service
- */
- public void cleanup();
-
-
-
-}
\ No newline at end of file
Deleted: ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/Singleton.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/Singleton.java 2009-10-08 02:48:09 UTC (rev 3874)
+++ ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/Singleton.java 2009-10-08 03:07:40 UTC (rev 3875)
@@ -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.
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
- *
- * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
- *
- * Use is subject to license terms.
- *
- * 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.webbeans.bootstrap.api;
-
-/**
- * Holds a reference to an application singleton. This singleton is used
- * internally by Web Beans to store various application scoped objects.
- *
- * This allows Web Beans to operate as a shared library. In a shared mode, the
- * same instance of WebBeans implementation is used by all the applications in
- * a server environment. In the exclusive mode, each application loads a
- * separate copy of WebBeans implementation at the application level.
- *
- * Alternative implementations of Singleton can be used as required
- *
- * @see SingletonProvider
- * @author Sanjeeb.Sahoo(a)Sun.COM
- * @author Pete Muir
- */
-public interface Singleton<T>
-{
- /**
- * Access the singleton
- *
- * @return a singleton object
- * @throws IllegalStateException if the singleton is not set
- */
- public T get();
-
- /**
- * Check if the singleton is set
- *
- * @return true if the singleton is set
- */
- public boolean isSet();
-
- /**
- * Store a singleton
- *
- * @param object the object to store
- */
- public void set(T object);
-
- /**
- * Clear the singleton
- */
- public void clear();
-}
Deleted: ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/SingletonProvider.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/SingletonProvider.java 2009-10-08 02:48:09 UTC (rev 3874)
+++ ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/SingletonProvider.java 2009-10-08 03:07:40 UTC (rev 3875)
@@ -1,123 +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.
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
- *
- * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
- *
- * Use is subject to license terms.
- *
- * 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.webbeans.bootstrap.api;
-
-import org.jboss.webbeans.bootstrap.api.helpers.IsolatedStaticSingletonProvider;
-import org.jboss.webbeans.bootstrap.api.helpers.TCCLSingletonProvider;
-
-/**
- * A provider of {@link Singleton}s
- *
- * @see IsolatedStaticSingletonProvider
- * @see TCCLSingletonProvider
- *
- * @author Sanjeeb.Sahoo(a)Sun.COM
- * @author Pete Muir
- */
-public abstract class SingletonProvider
-{
- /*
- * Singleton pattern. Upon first access (see instance()), it initializes
- * itself by a default implementation. Containers are free to explicitly
- * initialize it by calling initialize() method.
- */
- private static volatile SingletonProvider INSTANCE;
-
- private static final String DEFAULT_SCOPE_FACTORY = IsolatedStaticSingletonProvider.class.getName();
-
- public static SingletonProvider instance()
- {
- if (INSTANCE == null)
- {
- synchronized (SingletonProvider.class)
- {
- if (INSTANCE == null)
- {
- /*
- * TODO: We should discover ScopeFactory implementation using
- * Service Provider Mechanism. In the absence of any explicitly
- * configured service, should we default to the default
- * implementation.
- */
- initializeWithDefaultScope();
- }
- }
- }
- return INSTANCE;
- }
-
- protected SingletonProvider()
- {
- }
-
- /**
- * Create a new singleton
- *
- * @param expectedType represents the type of Java object stored in the singleton
- * @return a singelton
- */
- public abstract <T> Singleton<T> create(Class<? extends T> expectedType);
-
- /**
- * Initialize with the default instance
- */
- private static void initializeWithDefaultScope()
- {
- try
- {
- Class<?> aClass = Class.forName(DEFAULT_SCOPE_FACTORY);
- INSTANCE = (SingletonProvider) aClass.newInstance();
- }
- catch (Exception e)
- {
- throw new RuntimeException(e);
- }
- }
-
- /**
- * Initialize with an explicit instance
- *
- * @param instance
- */
- public static void initialize(SingletonProvider instance)
- {
- synchronized (SingletonProvider.class)
- {
- if (INSTANCE == null)
- {
- INSTANCE = instance;
- }
- else
- {
- throw new RuntimeException("SingletonProvider is already initialized with " + INSTANCE);
- }
- }
- }
-
- public static void reset()
- {
- INSTANCE = null;
- }
-
-}
Deleted: ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/spi/BeanDeploymentArchive.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/spi/BeanDeploymentArchive.java 2009-10-08 02:48:09 UTC (rev 3874)
+++ ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/spi/BeanDeploymentArchive.java 2009-10-08 03:07:40 UTC (rev 3875)
@@ -1,108 +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.webbeans.bootstrap.spi;
-
-import java.net.URL;
-import java.util.Collection;
-
-import org.jboss.webbeans.bootstrap.api.ServiceRegistry;
-import org.jboss.webbeans.ejb.spi.EjbDescriptor;
-
-/**
- * Represents a CDI bean deployment archive.
- *
- * A deployment archive is any library jar, library directory, EJB jar, rar
- * archive or any war WEB-INF/classes directory contained in the Java EE
- * deployment (as defined in the Java Platform, Enterprise Edition (Java EE)
- * Specification, v6, Section 8.1.2).
- *
- * TODO Java SE definition of a deployment archive
- *
- * A bean deployment archive is any deployment archive with a META-INF/beans.xml
- * file, or for a war, with a WEB-INF/beans.xml.
- *
- * The container is allowed to specify a deployment archive as
- * {@link BeanDeploymentArchive} even if no beans.xml is present (for example, a
- * container could define a deployment archive with container specific metadata
- * to be a bean deployment archive).
- *
- * @see Deployment
- *
- * @author Pete Muir
- *
- */
-public interface BeanDeploymentArchive
-{
-
- /**
- * Get the bean deployment archives which are accessible to this bean
- * deployment archive and adjacent to it in the deployment archive graph.
- *
- * Cycles in the accessible BeanDeploymentArchive graph are allowed. If a
- * cycle is detected by Web Beans, it will be automatically removed by Web
- * Beans. This means any implementor of this interface don't need to worry
- * about circularities.
- *
- * @return the accessible bean deployment archives
- */
- public Collection<BeanDeploymentArchive> getBeanDeploymentArchives();
-
- /**
- * Gets all classes in the bean deployment archive
- *
- * @return the classes, empty if no classes are present
- */
- public Collection<Class<?>> getBeanClasses();
-
- /**
- * Get any deployment descriptors in the bean deployment archive.
- *
- * The container will normally return a single deployment descriptor per bean
- * deployment archive (the physical META-INF/beans.xml or WEB-INF/beans.xml),
- * however it is permitted to return other deployment descriptors defined
- * using other methods.
- *
- * @return the URLs pointing to the deployment descriptor,
- * or an empty set if none are present
- */
- public Collection<URL> getBeansXml();
-
- /**
- * Get all the EJBs in the deployment archive
- *
- * @return the EJBs, or empty if no EJBs are present or if
- * this is not an EJB archive
- */
- public Collection<EjbDescriptor<?>> getEjbs();
-
- /**
- * Get the Bean Deployment Archive scoped services
- *
- * @return
- */
- public ServiceRegistry getServices();
-
- /**
- * Get a string which uniquely identifies the {@link BeanDeploymentArchive} within
- * the {@link Deployment}. The identifier must be consistent between multiple
- * occurrences of this deployment.
- *
- * @return
- */
- public String getId();
-
-}
Deleted: ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/spi/Deployment.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/spi/Deployment.java 2009-10-08 02:48:09 UTC (rev 3874)
+++ ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/spi/Deployment.java 2009-10-08 03:07:40 UTC (rev 3875)
@@ -1,154 +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.webbeans.bootstrap.spi;
-
-import java.util.Collection;
-
-import org.jboss.webbeans.bootstrap.api.ServiceRegistry;
-
-/**
- * Represents a deployment of a CDI application.
- *
- * <h3>Background</h3>
- *
- * <p>
- * Java EE defines a series of accessibility rules for classloading, which CDI
- * extends to cover bean resolution. For example a bean in the war can inject a
- * bean in an ejb-jar, but not vice-versa.
- * </p>
- *
- * <p>
- * These rules are defined via the MANIFEST.MF <a
- * href="http://java.sun.com/javase/6/docs/technotes/guides/extensions/"
- * >Extension Mechanism Architecture</a> and <a
- * href="http://java.sun.com/javase/6/docs/technotes/guides/jar/jar.html">JAR
- * File Specification</a>.
- * </p>
- *
- * <h3>Deployment structure representation</h3>
- *
- * <p>
- * Web Beans will request the bean archive deployment structure during the bean
- * discovery initialization step. After this step, CDI allows users to define
- * bean's programmatically, possibly with bean classes from a deployment archive
- * which is currently not a bean deployment archive. Web Beans will request the
- * {@link BeanDeploymentArchive} for each programmatically using
- * {@link #loadBeanDeploymentArchive(Class)}. If any unknown
- * {@link BeanDeploymentArchive}s are loaded, before Web Beans proceeds to
- * validating the deployment, the bean archive deployment structure will
- * re-requested.
- * </p>
- *
- * <p>
- * The BeanDeploymentArchive tree represents the "logical structure" of the
- * deployment; Given two archives A and B, which have a transitive closure of
- * accessible archives A' and B', it allowable for the the archives A & B to be
- * represented as a single BeanDeploymentArchive, assuming that A' and B' are
- * bi-directionally accessible.
- * </p>
- *
- * <p>
- * For an application deployed as an ear to a Java EE container, all library
- * jars, EJB jars, rars and war WEB-INF/classes directories should be searched,
- * and the bean deployment archive structure built.
- * </p>
- *
- * <p>
- * For an application deployed as a war to a Java EE or Servlet container, all
- * library jars and the WEB-INF/classes directory should be searched, and the
- * bean deployment archive structure built.
- * </p>
- *
- * <p>
- * For an application deployed in the SE environment, all library jars and
- * classpath directories should be searched, and the bean deployment archive
- * structure built. A single, logical deployment archive will be built for all
- * beans and beans.xml files found on the classpath.
- * </p>
- *
- * <h3>A Java EE example</h3>
- *
- * <p>
- * Given an ejb-module A (not as part of an ear), an ear B (containing an
- * ejb-jar C which uses the standard mechanism to reference module A, libraries
- * F bundled in /lib, and a war D which references module C), and a war E (which
- * references module A and bundles libraries G in /WEB-INF/lib) all deployed.
- * </p>
- *
- * <p>
- * War E would have be able to resolve beans from ejb module A, libraries G, as
- * well as other app server libraries. Furthermore, any libraries in G will be
- * able to resolve beans in other libraries G as well as in ejb module A and war
- * E. Ejb module A will not be able to resolve beans in war E or libraries G. It
- * would be legal to represent any libraries G as a single logical
- * BeanDeploymentArchive, also incorportating classes in war E.
- * </p>
- *
- * <p>
- * War D would be able to resolve beans from from ejb module C, module A
- * (transitively via C), libraries F, as well as other app server libraries. Ejb
- * module C can resolve beans in libraries F as well as module A, but not beans
- * in War D. Ejb module A cannot resolve beans in libraries F, module A or war
- * D. It would be legal to represent libraries F as a single logical
- * BeanDeploymentArchive.
- * </p>
- *
- * @see BeanDeploymentArchive
- *
- * @author Pete Muir
- *
- */
-public interface Deployment
-{
-
- /**
- * Get the bean deployment archives which are part of this deployment
- * and adjacent to it in the deployment archive graph. This should include
- * all Java EE modules such as WARs, EJB jars and RARs.
- *
- * Cycles in the accessible BeanDeploymentArchive graph are allowed. If a
- * cycle is detected by Web Beans, it will be automatically removed by Web
- * Beans. This means any implementor of this interface don't need to worry
- * about circularities.
- *
- * @return the accessible bean deployment archives
- *
- */
- public Collection<BeanDeploymentArchive> getBeanDeploymentArchives();
-
- /**
- * Load the {@link BeanDeploymentArchive} containing the given class.
- *
- * If the deployment archive containing the given class is not currently a
- * bean deployment archive, it should be added to the bean deployment archive
- * graph and returned. If the deployment archive is currently a bean
- * deployment archive it should be returned.
- *
- * @param beanClass the bean class to load
- * @return the {@link BeanDeploymentArchive} containing the bean class
- */
- public BeanDeploymentArchive loadBeanDeploymentArchive(Class<?> beanClass);
-
-
- /**
- * Get the services available to this deployment
- *
- * @return the services available
- */
- public ServiceRegistry getServices();
-
-}
Deleted: ri/trunk/spi/src/main/java/org/jboss/webbeans/context/api/BeanStore.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/context/api/BeanStore.java 2009-10-08 02:48:09 UTC (rev 3874)
+++ ri/trunk/spi/src/main/java/org/jboss/webbeans/context/api/BeanStore.java 2009-10-08 03:07:40 UTC (rev 3875)
@@ -1,58 +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.webbeans.context.api;
-
-import java.util.Collection;
-
-
-/**
- * Interface for different implementations of Contextual instance storage.
- *
- * @author Nicklas Karlsson
- *
- */
-public interface BeanStore
-{
- /**
- * Gets an instance of a contextual from the store
- *
- * @param contextual The id of the contextual to return
- * @return The instance. Null if not found
- */
- public abstract <T> ContextualInstance<T> get(String id);
-
- /**
- * Clears the store of contextual instances
- */
- public abstract void clear();
-
- /**
- * Returns the current contextual instances in the store
- *
- * @return the instances
- */
- public abstract Collection<String> getContextualIds();
-
- /**
- * Adds a bean instance to the storage
- *
- * @param contextualInstance the contextual instance
- * @return the id for the instance
- */
- public abstract <T> void put(String id, ContextualInstance<T> contextualInstance);
-}
\ No newline at end of file
Deleted: ri/trunk/spi/src/main/java/org/jboss/webbeans/context/api/ContextualInstance.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/context/api/ContextualInstance.java 2009-10-08 02:48:09 UTC (rev 3874)
+++ ri/trunk/spi/src/main/java/org/jboss/webbeans/context/api/ContextualInstance.java 2009-10-08 03:07:40 UTC (rev 3875)
@@ -1,14 +0,0 @@
-package org.jboss.webbeans.context.api;
-
-import javax.enterprise.context.spi.Contextual;
-import javax.enterprise.context.spi.CreationalContext;
-
-public interface ContextualInstance<T>
-{
-
- public T getInstance();
-
- public CreationalContext<T> getCreationalContext();
-
- public Contextual<T> getContextual();
-}
Deleted: ri/trunk/spi/src/main/java/org/jboss/webbeans/ejb/spi/BusinessInterfaceDescriptor.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/ejb/spi/BusinessInterfaceDescriptor.java 2009-10-08 02:48:09 UTC (rev 3874)
+++ ri/trunk/spi/src/main/java/org/jboss/webbeans/ejb/spi/BusinessInterfaceDescriptor.java 2009-10-08 03:07:40 UTC (rev 3875)
@@ -1,35 +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.webbeans.ejb.spi;
-
-/**
- * Represents the business interface of an EJB
- *
- * @author Pete Muir
- *
- * @param <T>
- */
-public interface BusinessInterfaceDescriptor<T>
-{
-
- /**
- * Gets the business interface class
- */
- public Class<T> getInterface();
-
-}
\ No newline at end of file
Deleted: ri/trunk/spi/src/main/java/org/jboss/webbeans/ejb/spi/EjbDescriptor.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/ejb/spi/EjbDescriptor.java 2009-10-08 02:48:09 UTC (rev 3874)
+++ ri/trunk/spi/src/main/java/org/jboss/webbeans/ejb/spi/EjbDescriptor.java 2009-10-08 03:07:40 UTC (rev 3875)
@@ -1,90 +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.webbeans.ejb.spi;
-
-import java.lang.reflect.Method;
-import java.util.Collection;
-
-
-/**
- * EJB metadata from the EJB descriptor
- *
- * @author Pete Muir
- *
- * @param <T> the bean type
- */
-public interface EjbDescriptor<T>
-{
-
- /**
- * Gets the EJB type
- *
- * @return The EJB Bean class
- */
- public Class<T> getBeanClass();
-
- /**
- * Gets the local business interfaces of the EJB
- *
- * @return An iterator over the local business interfaces
- */
- public Collection<BusinessInterfaceDescriptor<?>> getLocalBusinessInterfaces();
-
- /**
- * Get the EJB name
- *
- * @return
- */
- public String getEjbName();
-
- /**
- * Get the remove methods of the EJB
- *
- * @return An iterator over the remove methods
- */
- public Collection<Method> getRemoveMethods();
-
- /**
- * Indicates if the bean is a stateless session bean
- *
- * @return True if stateless, false otherwise
- */
- public boolean isStateless();
-
- /**
- * Indicates if the bean is a EJB 3.1 Singleton session bean
- *
- * @return True if the bean is a singleton, false otherwise
- */
- public boolean isSingleton();
-
- /**
- * Indicates if the EJB is a stateful session bean
- *
- * @return True if the bean is stateful, false otherwise
- */
- public boolean isStateful();
-
- /**
- * Indicates if the EJB is an MDB
- *
- * @return True if the bean is an MDB, false otherwise
- */
- public boolean isMessageDriven();
-
-}
Deleted: ri/trunk/spi/src/main/java/org/jboss/webbeans/ejb/spi/EjbServices.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/ejb/spi/EjbServices.java 2009-10-08 02:48:09 UTC (rev 3874)
+++ ri/trunk/spi/src/main/java/org/jboss/webbeans/ejb/spi/EjbServices.java 2009-10-08 03:07:40 UTC (rev 3875)
@@ -1,55 +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.webbeans.ejb.spi;
-
-import org.jboss.webbeans.bootstrap.api.Service;
-import org.jboss.webbeans.ejb.api.SessionObjectReference;
-
-/**
- * A container should implement this interface to allow Web Beans to
- * resolve EJB and discover EJBs
- *
- * {@link EjbServices} is a per-deployment service.
- *
- * @author Pete Muir
- * @author Marius Bogoevici
- *
- */
-public interface EjbServices extends Service
-{
-
- /**
- * Request a reference to an EJB session object from the container. If the
- * EJB being resolved is a stateful session bean, the container should ensure
- * the session bean is created before this method returns.
- *
- * @param ejbDescriptor the ejb to resolve
- * @return a reference to the session object
- */
- public SessionObjectReference resolveEjb(EjbDescriptor<?> ejbDescriptor);
-
- /**
- * Provides interceptor binding metadata to the container. This method should be
- * called before any EJB object is created.
- *
- * @param ejbDescriptor the ejb to bound interceptors to
- * @param interceptorBindings the interceptor bindings descriptor
- */
- public void registerInterceptors(EjbDescriptor<?> ejbDescriptor, InterceptorBindings interceptorBindings);
-
-}
Deleted: ri/trunk/spi/src/main/java/org/jboss/webbeans/ejb/spi/InterceptorBindings.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/ejb/spi/InterceptorBindings.java 2009-10-08 02:48:09 UTC (rev 3874)
+++ ri/trunk/spi/src/main/java/org/jboss/webbeans/ejb/spi/InterceptorBindings.java 2009-10-08 03:07:40 UTC (rev 3875)
@@ -1,81 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2009, 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.webbeans.ejb.spi;
-
-import java.util.List;
-import java.util.Collection;
-import java.lang.reflect.Method;
-
-import javax.enterprise.inject.spi.Interceptor;
-import javax.enterprise.inject.spi.InterceptionType;
-import javax.interceptor.InterceptorBinding;
-
-/**
- * @author Marius Bogoevici
- */
-public interface InterceptorBindings
-{
- /**
- * Returns all interceptors that are bound to an EJB object through
- * the {@link InterceptorBinding} mechanism and are
- * enabled through the beans.xml file.
- *
- * This includes class and method-bound interceptors.The purpose of this
- * method is to indicate what interceptors does the container need to
- * interact with, for a given EJB.
- *
- * Note: in the case of an EJB, the expectation is that the interpretation
- * of {link @javax.interceptor.Interceptors} is left to the container, and
- * the interceptors provided by the binding are complementary
- */
- Collection<Interceptor<?>> getAllInterceptors();
-
-
- /**
- * Returns the interceptors that are applicable to a given {@link InterceptionType}
- * and method (bound by {@link InterceptorBinding}).
- * This includes class and method-bound interceptors, but no interceptors
- * bound by EJB-specific mechanisms.
- *
- * @param interceptionType - the interception type (non-lifecycle)
- * @param method - the method that is to be intercepted
- * @return - an immutable list of interceptors applicable to the method (empty if no such
- * interceptors exist)
- * @throw IllegalArgumentException if interceptionType is not {@link InterceptionType.AROUND_INVOKE}
- * or {@link InterceptionType.AROUND_TIMEOUT}
- */
- List<Interceptor<?>> getMethodInterceptors(InterceptionType interceptionType, Method method);
-
-
- /**
- * Returns the lifecycle interceptors that are applicable to a given {@link InterceptionType}
- * (bound by {@link InterceptorBinding}).
- *
- * This includes class and method-bound interceptors, but no interceptors
- * bound by EJB-specific mechanisms.
- *
- * @param interceptionType - the interception type (lifecycle)
- * @param method - the method that is to be intercepted
- * @return - an immutable list of interceptors applicable to the method (empty if no such
- * interceptors exist)
- * @throw IllegalArgumentException if interceptionType not {@link InterceptionType.AROUND_INVOKE}
- * or {@link InterceptionType.AROUND_TIMEOUT}
- */
- List<Interceptor<?>> getLifecycleInterceptors(InterceptionType interceptionType);
-
-}
Deleted: ri/trunk/spi/src/main/java/org/jboss/webbeans/injection/spi/EjbInjectionServices.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/injection/spi/EjbInjectionServices.java 2009-10-08 02:48:09 UTC (rev 3874)
+++ ri/trunk/spi/src/main/java/org/jboss/webbeans/injection/spi/EjbInjectionServices.java 2009-10-08 03:07:40 UTC (rev 3875)
@@ -1,50 +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.webbeans.injection.spi;
-
-import javax.enterprise.inject.spi.InjectionPoint;
-
-import org.jboss.webbeans.bootstrap.api.Service;
-
-/**
- * A container should implement this interface to allow Web Beans to
- * resolve EJB.
- *
- * {@link EjbInjectionServices} is a per-module service.
- *
- * @author Pete Muir
- *
- */
-public interface EjbInjectionServices extends Service
-{
-
- /**
- * Resolve the value for the given @EJB injection point
- *
- * @param injectionPoint
- * the injection point metadata
- * @return an instance of the EJB
- * @throws IllegalArgumentException
- * if the injection point is not annotated with @EJB, or, if the
- * injection point is a method that doesn't follow JavaBean
- * conventions
-
- */
- public Object resolveEjb(InjectionPoint injectionPoint);
-
-}
Deleted: ri/trunk/spi/src/main/java/org/jboss/webbeans/injection/spi/InjectionContext.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/injection/spi/InjectionContext.java 2009-10-08 02:48:09 UTC (rev 3874)
+++ ri/trunk/spi/src/main/java/org/jboss/webbeans/injection/spi/InjectionContext.java 2009-10-08 03:07:40 UTC (rev 3875)
@@ -1,34 +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.webbeans.injection.spi;
-
-import javax.enterprise.inject.spi.InjectionTarget;
-
-/**
- * @author pmuir
- *
- */
-public interface InjectionContext<T>
-{
-
- public void proceed();
-
- public T getTarget();
-
- public InjectionTarget<T> getInjectionTarget();
-
-}
Deleted: ri/trunk/spi/src/main/java/org/jboss/webbeans/injection/spi/InjectionServices.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/injection/spi/InjectionServices.java 2009-10-08 02:48:09 UTC (rev 3874)
+++ ri/trunk/spi/src/main/java/org/jboss/webbeans/injection/spi/InjectionServices.java 2009-10-08 03:07:40 UTC (rev 3875)
@@ -1,45 +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.webbeans.injection.spi;
-
-import org.jboss.webbeans.bootstrap.api.Service;
-
-/**
- * Provides callbacks to the container when Web Beans performs injection on an
- * InjectionTarget, managed bean or session bean
- *
- * This service may be used to provide EE-style injection.
- *
- * {@link InjectionServices} is a per-BeanDeploymentArchive service.
- *
- * @author pmuir
- *
- */
-public interface InjectionServices extends Service
-{
-
- /**
- * Callback for injection.
- *
- * Call {@link InjectionContext#proceed()} to cause CDI-style injection to
- * occur.
- *
- * @param injectionContext
- */
- public <T> void aroundInject(InjectionContext<T> injectionContext);
-
-}
Deleted: ri/trunk/spi/src/main/java/org/jboss/webbeans/injection/spi/JpaInjectionServices.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/injection/spi/JpaInjectionServices.java 2009-10-08 02:48:09 UTC (rev 3874)
+++ ri/trunk/spi/src/main/java/org/jboss/webbeans/injection/spi/JpaInjectionServices.java 2009-10-08 03:07:40 UTC (rev 3875)
@@ -1,67 +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.webbeans.injection.spi;
-
-import javax.enterprise.inject.spi.InjectionPoint;
-import javax.persistence.EntityManager;
-import javax.persistence.EntityManagerFactory;
-
-import org.jboss.webbeans.bootstrap.api.Service;
-
-/**
- * A container should implement this interface to allow the Web Beans RI to
- * resolve JPA persistence units and discover entities
- *
- * {@link JpaInjectionServices} is a per-module service.
- *
- * @author Pete Muir
- *
- */
-public interface JpaInjectionServices extends Service
-{
-
- /**
- * Resolve the value for the given @PersistenceContext injection point
- *
- * @param injectionPoint
- * the injection point metadata
- * @return an instance of the entity manager
- * @throws IllegalArgumentException
- * if the injection point is not annotated with
- * @PersistenceContext, or, if the injection point is a method
- * that doesn't follow JavaBean conventions
- * @throws IllegalStateException
- * if no suitable persistence units can be resolved for injection
- */
- public EntityManager resolvePersistenceContext(InjectionPoint injectionPoint);
-
- /**
- * Resolve the value for the given @PersistenceUnit injection point
- *
- * @param injectionPoint
- * the injection point metadata
- * @return an instance of the entity manager
- * @throws IllegalArgumentException
- * if the injection point is not annotated with
- * @PersistenceUnit, or, if the injection point is a method
- * that doesn't follow JavaBean conventions
- * @throws IllegalStateException
- * if no suitable persistence units can be resolved for injection
- */
- public EntityManagerFactory resolvePersistenceUnit(InjectionPoint injectionPoint);
-
-}
Deleted: ri/trunk/spi/src/main/java/org/jboss/webbeans/injection/spi/ResourceInjectionServices.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/injection/spi/ResourceInjectionServices.java 2009-10-08 02:48:09 UTC (rev 3874)
+++ ri/trunk/spi/src/main/java/org/jboss/webbeans/injection/spi/ResourceInjectionServices.java 2009-10-08 03:07:40 UTC (rev 3875)
@@ -1,63 +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.webbeans.injection.spi;
-
-import javax.enterprise.inject.spi.InjectionPoint;
-
-import org.jboss.webbeans.bootstrap.api.Service;
-
-/**
- * A container should implement this interface to allow the Web Beans RI to
- * resolve Resources
- *
- * {@link ResourceInjectionServices} is per-module service.
- *
- * @author Pete Muir
- *
- */
-public interface ResourceInjectionServices extends Service
-{
-
- /**
- * Resolve the value for the given @Resource injection point
- *
- * @param injectionPoint
- * the injection point metadata
- * @return an instance of the resource
- * @throws IllegalArgumentException
- * if the injection point is not annotated with @Resource, or, if
- * the injection point is a method that doesn't follow JavaBean
- * conventions
- * @throws IllegalStateException
- * if no resource can be resolved for injection
- */
- public Object resolveResource(InjectionPoint injectionPoint);
-
- /**
- * Resolve the value for the given JNDI name and mapped name
- *
- * @param injectionPoint
- * the injection point metadata
- * @return an instance of the resource
- * @throws IllegalStateException
- * if no resource can be resolved for injection
- * @throws IllegalArgumentException
- * if both jndiName and mappedName are null
- */
- public Object resolveResource(String jndiName, String mappedName);
-
-}
\ No newline at end of file
Deleted: ri/trunk/spi/src/main/java/org/jboss/webbeans/resources/spi/ResourceLoader.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/resources/spi/ResourceLoader.java 2009-10-08 02:48:09 UTC (rev 3874)
+++ ri/trunk/spi/src/main/java/org/jboss/webbeans/resources/spi/ResourceLoader.java 2009-10-08 03:07:40 UTC (rev 3875)
@@ -1,64 +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.webbeans.resources.spi;
-
-import java.net.URL;
-import java.util.Collection;
-
-import org.jboss.webbeans.bootstrap.api.Service;
-
-/**
- * Resource loading/class creation services for Web Beans. By default an
- * implementation which uses the Thread Context ClassLoader if available,
- * otherwise the classloading of the implementation is used.
- *
- * The {@link ResourceLoader} is a per-deployment service.
- *
- * @author Pete Muir
- *
- */
-public interface ResourceLoader extends Service
-{
- // Name of the resource loader
- public static final String PROPERTY_NAME = ResourceLoader.class.getName();
-
- /**
- * Creates a class from a given FQCN
- *
- * @param name The name of the clsas
- * @return The class
- */
- public Class<?> classForName(String name);
-
- /**
- * Gets a resource as a URL by name
- *
- * @param name The name of the resource
- * @return An URL to the resource
- */
- public URL getResource(String name);
-
- /**
- * Gets resources as URLs by name
- *
- * @param name The name of the resource
- * @return references to the URLS
- */
- public Collection<URL> getResources(String name);
-
-}
Deleted: ri/trunk/spi/src/main/java/org/jboss/webbeans/resources/spi/ResourceLoadingException.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/resources/spi/ResourceLoadingException.java 2009-10-08 02:48:09 UTC (rev 3874)
+++ ri/trunk/spi/src/main/java/org/jboss/webbeans/resources/spi/ResourceLoadingException.java 2009-10-08 03:07:40 UTC (rev 3875)
@@ -1,57 +0,0 @@
-/**
- *
- */
-package org.jboss.webbeans.resources.spi;
-
-
-
-/**
- * Exception thrown when errors occur while loading resource
- *
- * @author Pete Muir
- *
- */
-public class ResourceLoadingException extends RuntimeException
-{
- private static final long serialVersionUID = 1L;
-
- /**
- * Constructor
- */
- public ResourceLoadingException()
- {
- super();
- }
-
- /**
- * Constructor
- *
- * @param message The message
- * @param throwable The exception
- */
- public ResourceLoadingException(String message, Throwable throwable)
- {
- super(message, throwable);
- }
-
- /**
- * Constructor
- *
- * @param message The message
- */
- public ResourceLoadingException(String message)
- {
- super(message);
- }
-
- /**
- * Constructor
- *
- * @param throwable The exception
- */
- public ResourceLoadingException(Throwable throwable)
- {
- super(throwable);
- }
-
-}
\ No newline at end of file
Deleted: ri/trunk/spi/src/main/java/org/jboss/webbeans/servlet/api/ServletListener.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/servlet/api/ServletListener.java 2009-10-08 02:48:09 UTC (rev 3874)
+++ ri/trunk/spi/src/main/java/org/jboss/webbeans/servlet/api/ServletListener.java 2009-10-08 03:07:40 UTC (rev 3875)
@@ -1,12 +0,0 @@
-package org.jboss.webbeans.servlet.api;
-
-import javax.servlet.ServletContextListener;
-import javax.servlet.ServletRequestListener;
-import javax.servlet.http.HttpSessionListener;
-
-public interface ServletListener extends ServletContextListener, ServletRequestListener, HttpSessionListener
-{
-
-
-
-}
Deleted: ri/trunk/spi/src/main/java/org/jboss/webbeans/servlet/api/ServletServices.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/servlet/api/ServletServices.java 2009-10-08 02:48:09 UTC (rev 3874)
+++ ri/trunk/spi/src/main/java/org/jboss/webbeans/servlet/api/ServletServices.java 2009-10-08 03:07:40 UTC (rev 3875)
@@ -1,46 +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.webbeans.servlet.api;
-
-import javax.servlet.ServletContext;
-
-import org.jboss.webbeans.bootstrap.api.Service;
-import org.jboss.webbeans.bootstrap.spi.BeanDeploymentArchive;
-
-/**
- * Allows the container to identify BDA in use for a request. This method will
- * be called, in the same thread as the request, every time Web Beans needs to
- * identify a request.
- *
- * {@link ServletServices} is a per-deployment service.
- *
- * @author pmuir
- *
- */
-public interface ServletServices extends Service
-{
-
- /**
- * Get the BDA for the current request. The ServletContext is provided for
- * context.
- *
- * @param ctx
- * @return
- */
- public BeanDeploymentArchive getBeanDeploymentArchive(ServletContext ctx);
-
-}
Copied: ri/trunk/spi/src/main/java/org/jboss/weld/bootstrap/api/Bootstrap.java (from rev 3874, ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/Bootstrap.java)
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/weld/bootstrap/api/Bootstrap.java (rev 0)
+++ ri/trunk/spi/src/main/java/org/jboss/weld/bootstrap/api/Bootstrap.java 2009-10-08 03:07:40 UTC (rev 3875)
@@ -0,0 +1,137 @@
+/*
+ * 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.api;
+
+import javax.enterprise.inject.spi.AfterBeanDiscovery;
+import javax.enterprise.inject.spi.AfterDeploymentValidation;
+import javax.enterprise.inject.spi.BeforeBeanDiscovery;
+import javax.enterprise.inject.spi.BeforeShutdown;
+import javax.enterprise.inject.spi.Extension;
+
+import org.jboss.weld.bootstrap.spi.BeanDeploymentArchive;
+import org.jboss.weld.bootstrap.spi.Deployment;
+import org.jboss.weld.context.api.BeanStore;
+import org.jboss.weld.manager.api.WebBeansManager;
+
+/**
+ * Application container initialization API for Web Beans.
+ *
+ * To initialize the container you must call, in this order:
+ *
+ * <ol>
+ * <li>{@link #startContainer()}</li>
+ * <li>{@link #startInitialization()}</li>
+ * <li>{@link #deployBeans()}</li>
+ * <li>{@link #validateBeans()}</li>
+ * <li>{@link #endInitialization()}</li>
+ * </ol>
+ *
+ * To stop the container and clean up, you must call {@link #shutdown()}
+ *
+ * @author Pete Muir
+ *
+ */
+public interface Bootstrap
+{
+
+ /**
+ * Creates the application container:
+ * <ul>
+ * <li>Checks that the services required by the environment have been
+ * provided</li>
+ * <li>Adds container provided services</li>
+ * <li>Creates and initializes the built in contexts</li>
+ * <li>Creates the manager</li>
+ * </ul>
+ *
+ * @param beanStore the bean store to use as backing for the application
+ * context
+ * @param environment the environment in use, by default
+ * {@link Environments.EE}
+ * @param deployment the Deployment to be booted
+ * @throws IllegalStateException if not all the services required for the
+ * given environment are available
+ *
+ */
+ public Bootstrap startContainer(Environment environment, Deployment deployment, BeanStore beanStore);
+
+ /**
+ * Starts the application container initialization process:
+ *
+ * <ul>
+ * <li>Reads metadata from beans.xml and the {@link Deployment} service</li>
+ * <li>Starts the application context</li>
+ * <li>Starts the request context which lasts until
+ * {@link #endInitialization()} is called</li>
+ * <li>Discovers and creates {@link Extension} service providers</li>
+ * </ul>
+ *
+ * Finally, the {@link BeforeBeanDiscovery} event is fired.
+ *
+ */
+ public Bootstrap startInitialization();
+
+ /**
+ * Creates and deploys the application's beans:
+ *
+ * <ul>
+ * <li>Creates and deploys the discovered beans</li>
+ * <li>Creates and deploys the built-in beans defined by the CDI
+ * specification</li>
+ * </ul>
+ *
+ * Finally the {@link AfterBeanDiscovery} is event is fired
+ */
+ public Bootstrap deployBeans();
+
+ /**
+ * Validates the deployment.
+ *
+ * After validation, the {@link AfterDeploymentValidation} event is fired
+ */
+ public Bootstrap validateBeans();
+
+ /**
+ * Cleans up after the initialization
+ *
+ */
+ public Bootstrap endInitialization();
+
+ /**
+ * Causes the container to clean up and shutdown
+ *
+ * Before the contain is shutdown the {@link BeforeShutdown} event is fired
+ */
+ public void shutdown();
+
+ /**
+ * Get the manager used for this beanDeploymentArchive.
+ *
+ * If {@link #startContainer()} has not been called, this method will return
+ * null.
+ *
+ * If the beanDeploymentArchive is not known to Web Beans (for example, it
+ * was not passed to the Web Beans as part of the {@link Deployment}, or has
+ * not yet been requested by
+ * {@link Deployment#loadBeanDeploymentArchive(Class)}), null will be
+ * returned.
+ *
+ * @return the manager or null if not yet available or not found.
+ */
+ public WebBeansManager getManager(BeanDeploymentArchive beanDeploymentArchive);
+
+}
Copied: ri/trunk/spi/src/main/java/org/jboss/weld/bootstrap/api/Environment.java (from rev 3874, ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/Environment.java)
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/weld/bootstrap/api/Environment.java (rev 0)
+++ ri/trunk/spi/src/main/java/org/jboss/weld/bootstrap/api/Environment.java 2009-10-08 03:07:40 UTC (rev 3875)
@@ -0,0 +1,39 @@
+/*
+ * 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.api;
+
+import java.util.Set;
+
+/**
+ * Represents an environment. Specifies the services Web Beans requires
+ *
+ * @author Pete Muir
+ *
+ */
+public interface Environment
+{
+
+ /**
+ * The deployment scoped services required for this environment
+ *
+ * @return the services to require
+ */
+ public Set<Class<? extends Service>> getRequiredDeploymentServices();
+
+ public Set<Class<? extends Service>> getRequiredBeanDeploymentArchiveServices();
+
+}
Copied: ri/trunk/spi/src/main/java/org/jboss/weld/bootstrap/api/Environments.java (from rev 3874, ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/Environments.java)
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/weld/bootstrap/api/Environments.java (rev 0)
+++ ri/trunk/spi/src/main/java/org/jboss/weld/bootstrap/api/Environments.java 2009-10-08 03:07:40 UTC (rev 3875)
@@ -0,0 +1,153 @@
+/*
+ * 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.api;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.jboss.weld.ejb.spi.EjbServices;
+import org.jboss.weld.injection.spi.EjbInjectionServices;
+import org.jboss.weld.injection.spi.InjectionServices;
+import org.jboss.weld.injection.spi.JpaInjectionServices;
+import org.jboss.weld.injection.spi.ResourceInjectionServices;
+import org.jboss.weld.resources.spi.ResourceLoader;
+import org.jboss.weld.security.spi.SecurityServices;
+import org.jboss.weld.servlet.api.ServletServices;
+import org.jboss.weld.transaction.spi.TransactionServices;
+import org.jboss.weld.validation.spi.ValidationServices;
+
+/**
+ * Requirements for various well known environments.
+ *
+ * @author Pete Muir
+ *
+ */
+public enum Environments implements Environment
+{
+
+ /**
+ * Java EE5 or Java EE6
+ *
+ * In this environment, Web Beans requires that {@link JpaInjectionServices},
+ * {@link ResourceInjectionServices} and {@link EjbInjectionServices} are
+ * present, and so will perform EE-style field injection on managed beans
+ * itself
+ */
+ EE_INJECT(new EnvironmentBuilder()
+ .addRequiredDeploymentService(TransactionServices.class)
+ .addRequiredDeploymentService(ResourceLoader.class)
+ .addRequiredDeploymentService(SecurityServices.class)
+ .addRequiredDeploymentService(ValidationServices.class)
+ .addRequiredDeploymentService(ServletServices.class)
+ .addRequiredDeploymentService(EjbServices.class)
+ .addRequiredBeanDeploymentArchiveService(JpaInjectionServices.class)
+ .addRequiredBeanDeploymentArchiveService(ResourceInjectionServices.class)
+ .addRequiredBeanDeploymentArchiveService(EjbInjectionServices.class)
+ ),
+
+ /**
+ * Java EE5 or Java EE6
+ *
+ * In this environment, Web Beans requires that {@link InjectionServices} are
+ * present, and expects the container to use this callback to perform EE-style
+ * injection
+ *
+ */
+ EE(new EnvironmentBuilder()
+ .addRequiredDeploymentService(TransactionServices.class)
+ .addRequiredDeploymentService(ResourceLoader.class)
+ .addRequiredDeploymentService(SecurityServices.class)
+ .addRequiredDeploymentService(ValidationServices.class)
+ .addRequiredDeploymentService(ServletServices.class)
+ .addRequiredDeploymentService(EjbServices.class)
+ .addRequiredBeanDeploymentArchiveService(InjectionServices.class)
+ ),
+
+
+
+ /**
+ * Servlet container such as Tomcat
+ */
+ SERVLET(new EnvironmentBuilder()
+ .addRequiredDeploymentService(ResourceLoader.class)
+ .addRequiredDeploymentService(ServletServices.class)
+ ),
+
+ /**
+ * Java SE
+ */
+ SE(new EnvironmentBuilder()
+ );
+
+ private final Set<Class<? extends Service>> requiredDeploymentServices;
+
+ private final Set<Class<? extends Service>> requiredBeanDeploymentArchiveServices;
+
+ private Environments(EnvironmentBuilder builder)
+ {
+ this.requiredDeploymentServices = builder.getRequiredDeploymentServices();
+ this.requiredBeanDeploymentArchiveServices = builder.getRequiredBeanDeploymentArchiveServices();
+ }
+
+ public Set<Class<? extends Service>> getRequiredDeploymentServices()
+ {
+ return requiredDeploymentServices;
+ }
+
+ public Set<Class<? extends Service>> getRequiredBeanDeploymentArchiveServices()
+ {
+ return requiredBeanDeploymentArchiveServices;
+ }
+
+ private static class EnvironmentBuilder
+ {
+
+ private final Set<Class<? extends Service>> requiredDeploymentServices;
+
+ private final Set<Class<? extends Service>> requiredBeanDeploymentArchiveServices;
+
+ private EnvironmentBuilder()
+ {
+ this.requiredBeanDeploymentArchiveServices = new HashSet<Class<? extends Service>>();
+ this.requiredDeploymentServices = new HashSet<Class<? extends Service>>();
+ }
+
+ private Set<Class<? extends Service>> getRequiredBeanDeploymentArchiveServices()
+ {
+ return requiredBeanDeploymentArchiveServices;
+ }
+
+ private Set<Class<? extends Service>> getRequiredDeploymentServices()
+ {
+ return requiredDeploymentServices;
+ }
+
+ private EnvironmentBuilder addRequiredDeploymentService(Class<? extends Service> service)
+ {
+ this.requiredDeploymentServices.add(service);
+ return this;
+ }
+
+ private EnvironmentBuilder addRequiredBeanDeploymentArchiveService(Class<? extends Service> service)
+ {
+ this.requiredBeanDeploymentArchiveServices.add(service);
+ return this;
+ }
+
+ }
+
+}
\ No newline at end of file
Copied: ri/trunk/spi/src/main/java/org/jboss/weld/bootstrap/api/Lifecycle.java (from rev 3874, ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/Lifecycle.java)
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/weld/bootstrap/api/Lifecycle.java (rev 0)
+++ ri/trunk/spi/src/main/java/org/jboss/weld/bootstrap/api/Lifecycle.java 2009-10-08 03:07:40 UTC (rev 3875)
@@ -0,0 +1,50 @@
+package org.jboss.weld.bootstrap.api;
+
+import javax.enterprise.context.spi.Context;
+
+import org.jboss.weld.context.api.BeanStore;
+
+/**
+ * Note Lifecycle is not complete, and the API may change.
+ *
+ * {@link Lifecycle} is a per-deployment service.
+ *
+ * @author pmuir
+ *
+ */
+public interface Lifecycle
+{
+
+ public void restoreSession(String id, BeanStore sessionBeanStore);
+
+ public void endSession(String id, BeanStore sessionBeanStore);
+
+ public void beginRequest(String id, BeanStore requestBeanStore);
+
+ public void endRequest(String id, BeanStore requestBeanStore);
+
+ public boolean isRequestActive();
+
+ public boolean isSessionActive();
+
+ public boolean isApplicationActive();
+
+ public boolean isConversationActive();
+
+ public void beginApplication(BeanStore applicationBeanStore);
+
+ public void endApplication();
+
+ public Context getApplicationContext();
+
+ public Context getSingletonContext();
+
+ public Context getSessionContext();
+
+ public Context getConversationContext();
+
+ public Context getRequestContext();
+
+ public Context getDependentContext();
+
+}
Copied: ri/trunk/spi/src/main/java/org/jboss/weld/bootstrap/api/Service.java (from rev 3874, ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/Service.java)
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/weld/bootstrap/api/Service.java (rev 0)
+++ ri/trunk/spi/src/main/java/org/jboss/weld/bootstrap/api/Service.java 2009-10-08 03:07:40 UTC (rev 3875)
@@ -0,0 +1,33 @@
+/*
+ * 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.api;
+
+/**
+ * Marks a Service which is used by Web Beans to interact with it's environment
+ * @author Pete Muir
+ *
+ */
+public interface Service
+{
+
+ /**
+ * Called by Web beans when it is shutting down, allowing the service to
+ * perform any cleanup needed.
+ */
+ public void cleanup();
+
+}
Copied: ri/trunk/spi/src/main/java/org/jboss/weld/bootstrap/api/ServiceRegistry.java (from rev 3874, ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/ServiceRegistry.java)
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/weld/bootstrap/api/ServiceRegistry.java (rev 0)
+++ ri/trunk/spi/src/main/java/org/jboss/weld/bootstrap/api/ServiceRegistry.java 2009-10-08 03:07:40 UTC (rev 3875)
@@ -0,0 +1,62 @@
+package org.jboss.weld.bootstrap.api;
+
+import java.util.Collection;
+import java.util.Set;
+import java.util.Map.Entry;
+
+/**
+ * A service registry
+ *
+ * @author Pete Muir
+ *
+ */
+public interface ServiceRegistry extends Iterable<Service>
+{
+
+ /**
+ * Add a service
+ *
+ * @see Service
+ *
+ * @param <S> the service type to add
+ * @param serviceType the service type to add
+ * @param service the service implementation
+ */
+ public <S extends Service> void add(Class<S> type, S service);
+
+ /**
+ * Add services
+ *
+ * @param services
+ */
+ public void addAll(Collection<Entry<Class<? extends Service>, Service>> services);
+
+ public Set<Entry<Class<? extends Service>, Service>> entrySet();
+
+ /**
+ * Retrieve a service implementation
+ *
+ * @param <S> the service type
+ * @param serviceType the service type
+ * @return the service implementation, or null if none is registered
+ */
+ public <S extends Service> S get(Class<S> type);
+
+ /**
+ * Check if a service is registered
+ *
+ * @param <S> the service type
+ * @param serviceType the service type
+ * @return true if a service is registered, otherwise false
+ */
+ public <S extends Service> boolean contains(Class<S> type);
+
+ /**
+ * Clear up the services registered, by calling {@link Service#cleanup()} on
+ * each registered service
+ */
+ public void cleanup();
+
+
+
+}
\ No newline at end of file
Copied: ri/trunk/spi/src/main/java/org/jboss/weld/bootstrap/api/Singleton.java (from rev 3874, ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/Singleton.java)
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/weld/bootstrap/api/Singleton.java (rev 0)
+++ ri/trunk/spi/src/main/java/org/jboss/weld/bootstrap/api/Singleton.java 2009-10-08 03:07:40 UTC (rev 3875)
@@ -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.
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
+ *
+ * Use is subject to license terms.
+ *
+ * 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.api;
+
+/**
+ * Holds a reference to an application singleton. This singleton is used
+ * internally by Web Beans to store various application scoped objects.
+ *
+ * This allows Web Beans to operate as a shared library. In a shared mode, the
+ * same instance of WebBeans implementation is used by all the applications in
+ * a server environment. In the exclusive mode, each application loads a
+ * separate copy of WebBeans implementation at the application level.
+ *
+ * Alternative implementations of Singleton can be used as required
+ *
+ * @see SingletonProvider
+ * @author Sanjeeb.Sahoo(a)Sun.COM
+ * @author Pete Muir
+ */
+public interface Singleton<T>
+{
+ /**
+ * Access the singleton
+ *
+ * @return a singleton object
+ * @throws IllegalStateException if the singleton is not set
+ */
+ public T get();
+
+ /**
+ * Check if the singleton is set
+ *
+ * @return true if the singleton is set
+ */
+ public boolean isSet();
+
+ /**
+ * Store a singleton
+ *
+ * @param object the object to store
+ */
+ public void set(T object);
+
+ /**
+ * Clear the singleton
+ */
+ public void clear();
+}
Copied: ri/trunk/spi/src/main/java/org/jboss/weld/bootstrap/api/SingletonProvider.java (from rev 3874, ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/SingletonProvider.java)
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/weld/bootstrap/api/SingletonProvider.java (rev 0)
+++ ri/trunk/spi/src/main/java/org/jboss/weld/bootstrap/api/SingletonProvider.java 2009-10-08 03:07:40 UTC (rev 3875)
@@ -0,0 +1,123 @@
+/*
+ * 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.
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
+ *
+ * Use is subject to license terms.
+ *
+ * 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.api;
+
+import org.jboss.weld.bootstrap.api.helpers.IsolatedStaticSingletonProvider;
+import org.jboss.weld.bootstrap.api.helpers.TCCLSingletonProvider;
+
+/**
+ * A provider of {@link Singleton}s
+ *
+ * @see IsolatedStaticSingletonProvider
+ * @see TCCLSingletonProvider
+ *
+ * @author Sanjeeb.Sahoo(a)Sun.COM
+ * @author Pete Muir
+ */
+public abstract class SingletonProvider
+{
+ /*
+ * Singleton pattern. Upon first access (see instance()), it initializes
+ * itself by a default implementation. Containers are free to explicitly
+ * initialize it by calling initialize() method.
+ */
+ private static volatile SingletonProvider INSTANCE;
+
+ private static final String DEFAULT_SCOPE_FACTORY = IsolatedStaticSingletonProvider.class.getName();
+
+ public static SingletonProvider instance()
+ {
+ if (INSTANCE == null)
+ {
+ synchronized (SingletonProvider.class)
+ {
+ if (INSTANCE == null)
+ {
+ /*
+ * TODO: We should discover ScopeFactory implementation using
+ * Service Provider Mechanism. In the absence of any explicitly
+ * configured service, should we default to the default
+ * implementation.
+ */
+ initializeWithDefaultScope();
+ }
+ }
+ }
+ return INSTANCE;
+ }
+
+ protected SingletonProvider()
+ {
+ }
+
+ /**
+ * Create a new singleton
+ *
+ * @param expectedType represents the type of Java object stored in the singleton
+ * @return a singelton
+ */
+ public abstract <T> Singleton<T> create(Class<? extends T> expectedType);
+
+ /**
+ * Initialize with the default instance
+ */
+ private static void initializeWithDefaultScope()
+ {
+ try
+ {
+ Class<?> aClass = Class.forName(DEFAULT_SCOPE_FACTORY);
+ INSTANCE = (SingletonProvider) aClass.newInstance();
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ /**
+ * Initialize with an explicit instance
+ *
+ * @param instance
+ */
+ public static void initialize(SingletonProvider instance)
+ {
+ synchronized (SingletonProvider.class)
+ {
+ if (INSTANCE == null)
+ {
+ INSTANCE = instance;
+ }
+ else
+ {
+ throw new RuntimeException("SingletonProvider is already initialized with " + INSTANCE);
+ }
+ }
+ }
+
+ public static void reset()
+ {
+ INSTANCE = null;
+ }
+
+}
Copied: ri/trunk/spi/src/main/java/org/jboss/weld/bootstrap/api/helpers (from rev 3874, ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/helpers)
Modified: ri/trunk/spi/src/main/java/org/jboss/weld/bootstrap/api/helpers/ForwardingBootstrap.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/helpers/ForwardingBootstrap.java 2009-10-08 02:48:09 UTC (rev 3874)
+++ ri/trunk/spi/src/main/java/org/jboss/weld/bootstrap/api/helpers/ForwardingBootstrap.java 2009-10-08 03:07:40 UTC (rev 3875)
@@ -14,14 +14,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.bootstrap.api.helpers;
+package org.jboss.weld.bootstrap.api.helpers;
-import org.jboss.webbeans.bootstrap.api.Bootstrap;
-import org.jboss.webbeans.bootstrap.api.Environment;
-import org.jboss.webbeans.bootstrap.spi.BeanDeploymentArchive;
-import org.jboss.webbeans.bootstrap.spi.Deployment;
-import org.jboss.webbeans.context.api.BeanStore;
-import org.jboss.webbeans.manager.api.WebBeansManager;
+import org.jboss.weld.bootstrap.api.Bootstrap;
+import org.jboss.weld.bootstrap.api.Environment;
+import org.jboss.weld.bootstrap.spi.BeanDeploymentArchive;
+import org.jboss.weld.bootstrap.spi.Deployment;
+import org.jboss.weld.context.api.BeanStore;
+import org.jboss.weld.manager.api.WebBeansManager;
/**
* Implementation of {@link Bootstrap} which supports the decorator pattern
Modified: ri/trunk/spi/src/main/java/org/jboss/weld/bootstrap/api/helpers/ForwardingLifecycle.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/helpers/ForwardingLifecycle.java 2009-10-08 02:48:09 UTC (rev 3874)
+++ ri/trunk/spi/src/main/java/org/jboss/weld/bootstrap/api/helpers/ForwardingLifecycle.java 2009-10-08 03:07:40 UTC (rev 3875)
@@ -14,12 +14,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.bootstrap.api.helpers;
+package org.jboss.weld.bootstrap.api.helpers;
import javax.enterprise.context.spi.Context;
-import org.jboss.webbeans.bootstrap.api.Lifecycle;
-import org.jboss.webbeans.context.api.BeanStore;
+import org.jboss.weld.bootstrap.api.Lifecycle;
+import org.jboss.weld.context.api.BeanStore;
/**
* @author pmuir
Modified: ri/trunk/spi/src/main/java/org/jboss/weld/bootstrap/api/helpers/ForwardingServiceRegistry.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/helpers/ForwardingServiceRegistry.java 2009-10-08 02:48:09 UTC (rev 3874)
+++ ri/trunk/spi/src/main/java/org/jboss/weld/bootstrap/api/helpers/ForwardingServiceRegistry.java 2009-10-08 03:07:40 UTC (rev 3875)
@@ -1,12 +1,12 @@
-package org.jboss.webbeans.bootstrap.api.helpers;
+package org.jboss.weld.bootstrap.api.helpers;
import java.util.Collection;
import java.util.Iterator;
import java.util.Set;
import java.util.Map.Entry;
-import org.jboss.webbeans.bootstrap.api.Service;
-import org.jboss.webbeans.bootstrap.api.ServiceRegistry;
+import org.jboss.weld.bootstrap.api.Service;
+import org.jboss.weld.bootstrap.api.ServiceRegistry;
public abstract class ForwardingServiceRegistry implements ServiceRegistry
{
Modified: ri/trunk/spi/src/main/java/org/jboss/weld/bootstrap/api/helpers/IsolatedStaticSingletonProvider.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/helpers/IsolatedStaticSingletonProvider.java 2009-10-08 02:48:09 UTC (rev 3874)
+++ ri/trunk/spi/src/main/java/org/jboss/weld/bootstrap/api/helpers/IsolatedStaticSingletonProvider.java 2009-10-08 03:07:40 UTC (rev 3875)
@@ -21,10 +21,10 @@
* limitations under the License.
*/
-package org.jboss.webbeans.bootstrap.api.helpers;
+package org.jboss.weld.bootstrap.api.helpers;
-import org.jboss.webbeans.bootstrap.api.Singleton;
-import org.jboss.webbeans.bootstrap.api.SingletonProvider;
+import org.jboss.weld.bootstrap.api.Singleton;
+import org.jboss.weld.bootstrap.api.SingletonProvider;
/**
*
Modified: ri/trunk/spi/src/main/java/org/jboss/weld/bootstrap/api/helpers/ServiceRegistries.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/helpers/ServiceRegistries.java 2009-10-08 02:48:09 UTC (rev 3874)
+++ ri/trunk/spi/src/main/java/org/jboss/weld/bootstrap/api/helpers/ServiceRegistries.java 2009-10-08 03:07:40 UTC (rev 3875)
@@ -1,7 +1,7 @@
-package org.jboss.webbeans.bootstrap.api.helpers;
+package org.jboss.weld.bootstrap.api.helpers;
-import org.jboss.webbeans.bootstrap.api.Service;
-import org.jboss.webbeans.bootstrap.api.ServiceRegistry;
+import org.jboss.weld.bootstrap.api.Service;
+import org.jboss.weld.bootstrap.api.ServiceRegistry;
public class ServiceRegistries
{
Modified: ri/trunk/spi/src/main/java/org/jboss/weld/bootstrap/api/helpers/SimpleServiceRegistry.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/helpers/SimpleServiceRegistry.java 2009-10-08 02:48:09 UTC (rev 3874)
+++ ri/trunk/spi/src/main/java/org/jboss/weld/bootstrap/api/helpers/SimpleServiceRegistry.java 2009-10-08 03:07:40 UTC (rev 3875)
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.bootstrap.api.helpers;
+package org.jboss.weld.bootstrap.api.helpers;
import java.util.Collection;
import java.util.HashMap;
@@ -23,8 +23,8 @@
import java.util.Set;
import java.util.Map.Entry;
-import org.jboss.webbeans.bootstrap.api.Service;
-import org.jboss.webbeans.bootstrap.api.ServiceRegistry;
+import org.jboss.weld.bootstrap.api.Service;
+import org.jboss.weld.bootstrap.api.ServiceRegistry;
/**
* A registry for services
Modified: ri/trunk/spi/src/main/java/org/jboss/weld/bootstrap/api/helpers/TCCLSingletonProvider.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/helpers/TCCLSingletonProvider.java 2009-10-08 02:48:09 UTC (rev 3874)
+++ ri/trunk/spi/src/main/java/org/jboss/weld/bootstrap/api/helpers/TCCLSingletonProvider.java 2009-10-08 03:07:40 UTC (rev 3875)
@@ -21,15 +21,15 @@
* limitations under the License.
*/
-package org.jboss.webbeans.bootstrap.api.helpers;
+package org.jboss.weld.bootstrap.api.helpers;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.Hashtable;
import java.util.Map;
-import org.jboss.webbeans.bootstrap.api.Singleton;
-import org.jboss.webbeans.bootstrap.api.SingletonProvider;
+import org.jboss.weld.bootstrap.api.Singleton;
+import org.jboss.weld.bootstrap.api.SingletonProvider;
/**
* Singleton provider that uses the Thread Context ClassLoader to differentiate
Copied: ri/trunk/spi/src/main/java/org/jboss/weld/bootstrap/spi/BeanDeploymentArchive.java (from rev 3874, ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/spi/BeanDeploymentArchive.java)
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/weld/bootstrap/spi/BeanDeploymentArchive.java (rev 0)
+++ ri/trunk/spi/src/main/java/org/jboss/weld/bootstrap/spi/BeanDeploymentArchive.java 2009-10-08 03:07:40 UTC (rev 3875)
@@ -0,0 +1,108 @@
+/*
+ * 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.spi;
+
+import java.net.URL;
+import java.util.Collection;
+
+import org.jboss.weld.bootstrap.api.ServiceRegistry;
+import org.jboss.weld.ejb.spi.EjbDescriptor;
+
+/**
+ * Represents a CDI bean deployment archive.
+ *
+ * A deployment archive is any library jar, library directory, EJB jar, rar
+ * archive or any war WEB-INF/classes directory contained in the Java EE
+ * deployment (as defined in the Java Platform, Enterprise Edition (Java EE)
+ * Specification, v6, Section 8.1.2).
+ *
+ * TODO Java SE definition of a deployment archive
+ *
+ * A bean deployment archive is any deployment archive with a META-INF/beans.xml
+ * file, or for a war, with a WEB-INF/beans.xml.
+ *
+ * The container is allowed to specify a deployment archive as
+ * {@link BeanDeploymentArchive} even if no beans.xml is present (for example, a
+ * container could define a deployment archive with container specific metadata
+ * to be a bean deployment archive).
+ *
+ * @see Deployment
+ *
+ * @author Pete Muir
+ *
+ */
+public interface BeanDeploymentArchive
+{
+
+ /**
+ * Get the bean deployment archives which are accessible to this bean
+ * deployment archive and adjacent to it in the deployment archive graph.
+ *
+ * Cycles in the accessible BeanDeploymentArchive graph are allowed. If a
+ * cycle is detected by Web Beans, it will be automatically removed by Web
+ * Beans. This means any implementor of this interface don't need to worry
+ * about circularities.
+ *
+ * @return the accessible bean deployment archives
+ */
+ public Collection<BeanDeploymentArchive> getBeanDeploymentArchives();
+
+ /**
+ * Gets all classes in the bean deployment archive
+ *
+ * @return the classes, empty if no classes are present
+ */
+ public Collection<Class<?>> getBeanClasses();
+
+ /**
+ * Get any deployment descriptors in the bean deployment archive.
+ *
+ * The container will normally return a single deployment descriptor per bean
+ * deployment archive (the physical META-INF/beans.xml or WEB-INF/beans.xml),
+ * however it is permitted to return other deployment descriptors defined
+ * using other methods.
+ *
+ * @return the URLs pointing to the deployment descriptor,
+ * or an empty set if none are present
+ */
+ public Collection<URL> getBeansXml();
+
+ /**
+ * Get all the EJBs in the deployment archive
+ *
+ * @return the EJBs, or empty if no EJBs are present or if
+ * this is not an EJB archive
+ */
+ public Collection<EjbDescriptor<?>> getEjbs();
+
+ /**
+ * Get the Bean Deployment Archive scoped services
+ *
+ * @return
+ */
+ public ServiceRegistry getServices();
+
+ /**
+ * Get a string which uniquely identifies the {@link BeanDeploymentArchive} within
+ * the {@link Deployment}. The identifier must be consistent between multiple
+ * occurrences of this deployment.
+ *
+ * @return
+ */
+ public String getId();
+
+}
Copied: ri/trunk/spi/src/main/java/org/jboss/weld/bootstrap/spi/Deployment.java (from rev 3874, ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/spi/Deployment.java)
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/weld/bootstrap/spi/Deployment.java (rev 0)
+++ ri/trunk/spi/src/main/java/org/jboss/weld/bootstrap/spi/Deployment.java 2009-10-08 03:07:40 UTC (rev 3875)
@@ -0,0 +1,154 @@
+/*
+ * 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.spi;
+
+import java.util.Collection;
+
+import org.jboss.weld.bootstrap.api.ServiceRegistry;
+
+/**
+ * Represents a deployment of a CDI application.
+ *
+ * <h3>Background</h3>
+ *
+ * <p>
+ * Java EE defines a series of accessibility rules for classloading, which CDI
+ * extends to cover bean resolution. For example a bean in the war can inject a
+ * bean in an ejb-jar, but not vice-versa.
+ * </p>
+ *
+ * <p>
+ * These rules are defined via the MANIFEST.MF <a
+ * href="http://java.sun.com/javase/6/docs/technotes/guides/extensions/"
+ * >Extension Mechanism Architecture</a> and <a
+ * href="http://java.sun.com/javase/6/docs/technotes/guides/jar/jar.html">JAR
+ * File Specification</a>.
+ * </p>
+ *
+ * <h3>Deployment structure representation</h3>
+ *
+ * <p>
+ * Web Beans will request the bean archive deployment structure during the bean
+ * discovery initialization step. After this step, CDI allows users to define
+ * bean's programmatically, possibly with bean classes from a deployment archive
+ * which is currently not a bean deployment archive. Web Beans will request the
+ * {@link BeanDeploymentArchive} for each programmatically using
+ * {@link #loadBeanDeploymentArchive(Class)}. If any unknown
+ * {@link BeanDeploymentArchive}s are loaded, before Web Beans proceeds to
+ * validating the deployment, the bean archive deployment structure will
+ * re-requested.
+ * </p>
+ *
+ * <p>
+ * The BeanDeploymentArchive tree represents the "logical structure" of the
+ * deployment; Given two archives A and B, which have a transitive closure of
+ * accessible archives A' and B', it allowable for the the archives A & B to be
+ * represented as a single BeanDeploymentArchive, assuming that A' and B' are
+ * bi-directionally accessible.
+ * </p>
+ *
+ * <p>
+ * For an application deployed as an ear to a Java EE container, all library
+ * jars, EJB jars, rars and war WEB-INF/classes directories should be searched,
+ * and the bean deployment archive structure built.
+ * </p>
+ *
+ * <p>
+ * For an application deployed as a war to a Java EE or Servlet container, all
+ * library jars and the WEB-INF/classes directory should be searched, and the
+ * bean deployment archive structure built.
+ * </p>
+ *
+ * <p>
+ * For an application deployed in the SE environment, all library jars and
+ * classpath directories should be searched, and the bean deployment archive
+ * structure built. A single, logical deployment archive will be built for all
+ * beans and beans.xml files found on the classpath.
+ * </p>
+ *
+ * <h3>A Java EE example</h3>
+ *
+ * <p>
+ * Given an ejb-module A (not as part of an ear), an ear B (containing an
+ * ejb-jar C which uses the standard mechanism to reference module A, libraries
+ * F bundled in /lib, and a war D which references module C), and a war E (which
+ * references module A and bundles libraries G in /WEB-INF/lib) all deployed.
+ * </p>
+ *
+ * <p>
+ * War E would have be able to resolve beans from ejb module A, libraries G, as
+ * well as other app server libraries. Furthermore, any libraries in G will be
+ * able to resolve beans in other libraries G as well as in ejb module A and war
+ * E. Ejb module A will not be able to resolve beans in war E or libraries G. It
+ * would be legal to represent any libraries G as a single logical
+ * BeanDeploymentArchive, also incorportating classes in war E.
+ * </p>
+ *
+ * <p>
+ * War D would be able to resolve beans from from ejb module C, module A
+ * (transitively via C), libraries F, as well as other app server libraries. Ejb
+ * module C can resolve beans in libraries F as well as module A, but not beans
+ * in War D. Ejb module A cannot resolve beans in libraries F, module A or war
+ * D. It would be legal to represent libraries F as a single logical
+ * BeanDeploymentArchive.
+ * </p>
+ *
+ * @see BeanDeploymentArchive
+ *
+ * @author Pete Muir
+ *
+ */
+public interface Deployment
+{
+
+ /**
+ * Get the bean deployment archives which are part of this deployment
+ * and adjacent to it in the deployment archive graph. This should include
+ * all Java EE modules such as WARs, EJB jars and RARs.
+ *
+ * Cycles in the accessible BeanDeploymentArchive graph are allowed. If a
+ * cycle is detected by Web Beans, it will be automatically removed by Web
+ * Beans. This means any implementor of this interface don't need to worry
+ * about circularities.
+ *
+ * @return the accessible bean deployment archives
+ *
+ */
+ public Collection<BeanDeploymentArchive> getBeanDeploymentArchives();
+
+ /**
+ * Load the {@link BeanDeploymentArchive} containing the given class.
+ *
+ * If the deployment archive containing the given class is not currently a
+ * bean deployment archive, it should be added to the bean deployment archive
+ * graph and returned. If the deployment archive is currently a bean
+ * deployment archive it should be returned.
+ *
+ * @param beanClass the bean class to load
+ * @return the {@link BeanDeploymentArchive} containing the bean class
+ */
+ public BeanDeploymentArchive loadBeanDeploymentArchive(Class<?> beanClass);
+
+
+ /**
+ * Get the services available to this deployment
+ *
+ * @return the services available
+ */
+ public ServiceRegistry getServices();
+
+}
Copied: ri/trunk/spi/src/main/java/org/jboss/weld/bootstrap/spi/helpers (from rev 3874, ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/spi/helpers)
Modified: ri/trunk/spi/src/main/java/org/jboss/weld/bootstrap/spi/helpers/ForwardingBeanDeploymentArchive.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/spi/helpers/ForwardingBeanDeploymentArchive.java 2009-10-08 02:48:09 UTC (rev 3874)
+++ ri/trunk/spi/src/main/java/org/jboss/weld/bootstrap/spi/helpers/ForwardingBeanDeploymentArchive.java 2009-10-08 03:07:40 UTC (rev 3875)
@@ -14,13 +14,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.bootstrap.spi.helpers;
+package org.jboss.weld.bootstrap.spi.helpers;
import java.net.URL;
import java.util.Collection;
-import org.jboss.webbeans.bootstrap.spi.BeanDeploymentArchive;
-import org.jboss.webbeans.ejb.spi.EjbDescriptor;
+import org.jboss.weld.bootstrap.spi.BeanDeploymentArchive;
+import org.jboss.weld.ejb.spi.EjbDescriptor;
/**
* @author pmuir
Copied: ri/trunk/spi/src/main/java/org/jboss/weld/context/api/BeanStore.java (from rev 3874, ri/trunk/spi/src/main/java/org/jboss/webbeans/context/api/BeanStore.java)
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/weld/context/api/BeanStore.java (rev 0)
+++ ri/trunk/spi/src/main/java/org/jboss/weld/context/api/BeanStore.java 2009-10-08 03:07:40 UTC (rev 3875)
@@ -0,0 +1,58 @@
+/*
+ * 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.context.api;
+
+import java.util.Collection;
+
+
+/**
+ * Interface for different implementations of Contextual instance storage.
+ *
+ * @author Nicklas Karlsson
+ *
+ */
+public interface BeanStore
+{
+ /**
+ * Gets an instance of a contextual from the store
+ *
+ * @param contextual The id of the contextual to return
+ * @return The instance. Null if not found
+ */
+ public abstract <T> ContextualInstance<T> get(String id);
+
+ /**
+ * Clears the store of contextual instances
+ */
+ public abstract void clear();
+
+ /**
+ * Returns the current contextual instances in the store
+ *
+ * @return the instances
+ */
+ public abstract Collection<String> getContextualIds();
+
+ /**
+ * Adds a bean instance to the storage
+ *
+ * @param contextualInstance the contextual instance
+ * @return the id for the instance
+ */
+ public abstract <T> void put(String id, ContextualInstance<T> contextualInstance);
+}
\ No newline at end of file
Copied: ri/trunk/spi/src/main/java/org/jboss/weld/context/api/ContextualInstance.java (from rev 3874, ri/trunk/spi/src/main/java/org/jboss/webbeans/context/api/ContextualInstance.java)
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/weld/context/api/ContextualInstance.java (rev 0)
+++ ri/trunk/spi/src/main/java/org/jboss/weld/context/api/ContextualInstance.java 2009-10-08 03:07:40 UTC (rev 3875)
@@ -0,0 +1,14 @@
+package org.jboss.weld.context.api;
+
+import javax.enterprise.context.spi.Contextual;
+import javax.enterprise.context.spi.CreationalContext;
+
+public interface ContextualInstance<T>
+{
+
+ public T getInstance();
+
+ public CreationalContext<T> getCreationalContext();
+
+ public Contextual<T> getContextual();
+}
Copied: ri/trunk/spi/src/main/java/org/jboss/weld/context/api/helpers (from rev 3874, ri/trunk/spi/src/main/java/org/jboss/webbeans/context/api/helpers)
Modified: ri/trunk/spi/src/main/java/org/jboss/weld/context/api/helpers/AbstractMapBackedBeanStore.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/context/api/helpers/AbstractMapBackedBeanStore.java 2009-10-08 02:48:09 UTC (rev 3874)
+++ ri/trunk/spi/src/main/java/org/jboss/weld/context/api/helpers/AbstractMapBackedBeanStore.java 2009-10-08 03:07:40 UTC (rev 3875)
@@ -1,12 +1,12 @@
-package org.jboss.webbeans.context.api.helpers;
+package org.jboss.weld.context.api.helpers;
import java.util.Map;
import java.util.Set;
import javax.enterprise.context.spi.Contextual;
-import org.jboss.webbeans.context.api.BeanStore;
-import org.jboss.webbeans.context.api.ContextualInstance;
+import org.jboss.weld.context.api.BeanStore;
+import org.jboss.weld.context.api.ContextualInstance;
public abstract class AbstractMapBackedBeanStore implements BeanStore
{
@@ -24,7 +24,7 @@
* @param The bean to look for
* @return An instance, if found
*
- * @see org.jboss.webbeans.context.api.BeanStore#get(BaseBean)
+ * @see org.jboss.weld.context.api.BeanStore#get(BaseBean)
*/
public <T extends Object> ContextualInstance<T> get(String id)
{
@@ -36,7 +36,7 @@
/**
* Clears the store
*
- * @see org.jboss.webbeans.context.api.BeanStore#clear()
+ * @see org.jboss.weld.context.api.BeanStore#clear()
*/
public void clear()
{
@@ -48,7 +48,7 @@
*
* @return The beans present
*
- * @see org.jboss.webbeans.context.api.BeanStore#getContextuals()
+ * @see org.jboss.weld.context.api.BeanStore#getContextuals()
*/
public Set<String> getContextualIds()
{
@@ -61,7 +61,7 @@
* @param bean The bean
* @param instance the instance
*
- * @see org.jboss.webbeans.context.api.BeanStore#put(Contextual, Object)
+ * @see org.jboss.weld.context.api.BeanStore#put(Contextual, Object)
*/
public <T> void put(String id, ContextualInstance<T> beanInstance)
{
Modified: ri/trunk/spi/src/main/java/org/jboss/weld/context/api/helpers/ConcurrentHashMapBeanStore.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/context/api/helpers/ConcurrentHashMapBeanStore.java 2009-10-08 02:48:09 UTC (rev 3874)
+++ ri/trunk/spi/src/main/java/org/jboss/weld/context/api/helpers/ConcurrentHashMapBeanStore.java 2009-10-08 03:07:40 UTC (rev 3875)
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.jboss.webbeans.context.api.helpers;
+package org.jboss.weld.context.api.helpers;
import java.io.Serializable;
import java.util.Map;
@@ -23,7 +23,7 @@
import javax.enterprise.context.spi.Contextual;
-import org.jboss.webbeans.context.api.ContextualInstance;
+import org.jboss.weld.context.api.ContextualInstance;
/**
* A BeanStore that uses a HashMap as backing storage
Modified: ri/trunk/spi/src/main/java/org/jboss/weld/context/api/helpers/ForwardingBeanStore.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/context/api/helpers/ForwardingBeanStore.java 2009-10-08 02:48:09 UTC (rev 3874)
+++ ri/trunk/spi/src/main/java/org/jboss/weld/context/api/helpers/ForwardingBeanStore.java 2009-10-08 03:07:40 UTC (rev 3875)
@@ -1,9 +1,9 @@
-package org.jboss.webbeans.context.api.helpers;
+package org.jboss.weld.context.api.helpers;
import java.util.Collection;
-import org.jboss.webbeans.context.api.BeanStore;
-import org.jboss.webbeans.context.api.ContextualInstance;
+import org.jboss.weld.context.api.BeanStore;
+import org.jboss.weld.context.api.ContextualInstance;
public abstract class ForwardingBeanStore implements BeanStore
{
Copied: ri/trunk/spi/src/main/java/org/jboss/weld/ejb/api (from rev 3874, ri/trunk/spi/src/main/java/org/jboss/webbeans/ejb/api)
Modified: ri/trunk/spi/src/main/java/org/jboss/weld/ejb/api/SessionObjectReference.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/ejb/api/SessionObjectReference.java 2009-10-08 02:48:09 UTC (rev 3874)
+++ ri/trunk/spi/src/main/java/org/jboss/weld/ejb/api/SessionObjectReference.java 2009-10-08 03:07:40 UTC (rev 3875)
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.ejb.api;
+package org.jboss.weld.ejb.api;
import java.io.Serializable;
Copied: ri/trunk/spi/src/main/java/org/jboss/weld/ejb/spi/BusinessInterfaceDescriptor.java (from rev 3874, ri/trunk/spi/src/main/java/org/jboss/webbeans/ejb/spi/BusinessInterfaceDescriptor.java)
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/weld/ejb/spi/BusinessInterfaceDescriptor.java (rev 0)
+++ ri/trunk/spi/src/main/java/org/jboss/weld/ejb/spi/BusinessInterfaceDescriptor.java 2009-10-08 03:07:40 UTC (rev 3875)
@@ -0,0 +1,35 @@
+/*
+ * 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.ejb.spi;
+
+/**
+ * Represents the business interface of an EJB
+ *
+ * @author Pete Muir
+ *
+ * @param <T>
+ */
+public interface BusinessInterfaceDescriptor<T>
+{
+
+ /**
+ * Gets the business interface class
+ */
+ public Class<T> getInterface();
+
+}
\ No newline at end of file
Copied: ri/trunk/spi/src/main/java/org/jboss/weld/ejb/spi/EjbDescriptor.java (from rev 3874, ri/trunk/spi/src/main/java/org/jboss/webbeans/ejb/spi/EjbDescriptor.java)
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/weld/ejb/spi/EjbDescriptor.java (rev 0)
+++ ri/trunk/spi/src/main/java/org/jboss/weld/ejb/spi/EjbDescriptor.java 2009-10-08 03:07:40 UTC (rev 3875)
@@ -0,0 +1,90 @@
+/*
+ * 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.ejb.spi;
+
+import java.lang.reflect.Method;
+import java.util.Collection;
+
+
+/**
+ * EJB metadata from the EJB descriptor
+ *
+ * @author Pete Muir
+ *
+ * @param <T> the bean type
+ */
+public interface EjbDescriptor<T>
+{
+
+ /**
+ * Gets the EJB type
+ *
+ * @return The EJB Bean class
+ */
+ public Class<T> getBeanClass();
+
+ /**
+ * Gets the local business interfaces of the EJB
+ *
+ * @return An iterator over the local business interfaces
+ */
+ public Collection<BusinessInterfaceDescriptor<?>> getLocalBusinessInterfaces();
+
+ /**
+ * Get the EJB name
+ *
+ * @return
+ */
+ public String getEjbName();
+
+ /**
+ * Get the remove methods of the EJB
+ *
+ * @return An iterator over the remove methods
+ */
+ public Collection<Method> getRemoveMethods();
+
+ /**
+ * Indicates if the bean is a stateless session bean
+ *
+ * @return True if stateless, false otherwise
+ */
+ public boolean isStateless();
+
+ /**
+ * Indicates if the bean is a EJB 3.1 Singleton session bean
+ *
+ * @return True if the bean is a singleton, false otherwise
+ */
+ public boolean isSingleton();
+
+ /**
+ * Indicates if the EJB is a stateful session bean
+ *
+ * @return True if the bean is stateful, false otherwise
+ */
+ public boolean isStateful();
+
+ /**
+ * Indicates if the EJB is an MDB
+ *
+ * @return True if the bean is an MDB, false otherwise
+ */
+ public boolean isMessageDriven();
+
+}
Copied: ri/trunk/spi/src/main/java/org/jboss/weld/ejb/spi/EjbServices.java (from rev 3874, ri/trunk/spi/src/main/java/org/jboss/webbeans/ejb/spi/EjbServices.java)
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/weld/ejb/spi/EjbServices.java (rev 0)
+++ ri/trunk/spi/src/main/java/org/jboss/weld/ejb/spi/EjbServices.java 2009-10-08 03:07:40 UTC (rev 3875)
@@ -0,0 +1,55 @@
+/*
+ * 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.ejb.spi;
+
+import org.jboss.weld.bootstrap.api.Service;
+import org.jboss.weld.ejb.api.SessionObjectReference;
+
+/**
+ * A container should implement this interface to allow Web Beans to
+ * resolve EJB and discover EJBs
+ *
+ * {@link EjbServices} is a per-deployment service.
+ *
+ * @author Pete Muir
+ * @author Marius Bogoevici
+ *
+ */
+public interface EjbServices extends Service
+{
+
+ /**
+ * Request a reference to an EJB session object from the container. If the
+ * EJB being resolved is a stateful session bean, the container should ensure
+ * the session bean is created before this method returns.
+ *
+ * @param ejbDescriptor the ejb to resolve
+ * @return a reference to the session object
+ */
+ public SessionObjectReference resolveEjb(EjbDescriptor<?> ejbDescriptor);
+
+ /**
+ * Provides interceptor binding metadata to the container. This method should be
+ * called before any EJB object is created.
+ *
+ * @param ejbDescriptor the ejb to bound interceptors to
+ * @param interceptorBindings the interceptor bindings descriptor
+ */
+ public void registerInterceptors(EjbDescriptor<?> ejbDescriptor, InterceptorBindings interceptorBindings);
+
+}
Copied: ri/trunk/spi/src/main/java/org/jboss/weld/ejb/spi/InterceptorBindings.java (from rev 3874, ri/trunk/spi/src/main/java/org/jboss/webbeans/ejb/spi/InterceptorBindings.java)
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/weld/ejb/spi/InterceptorBindings.java (rev 0)
+++ ri/trunk/spi/src/main/java/org/jboss/weld/ejb/spi/InterceptorBindings.java 2009-10-08 03:07:40 UTC (rev 3875)
@@ -0,0 +1,81 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, 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.ejb.spi;
+
+import java.util.List;
+import java.util.Collection;
+import java.lang.reflect.Method;
+
+import javax.enterprise.inject.spi.Interceptor;
+import javax.enterprise.inject.spi.InterceptionType;
+import javax.interceptor.InterceptorBinding;
+
+/**
+ * @author Marius Bogoevici
+ */
+public interface InterceptorBindings
+{
+ /**
+ * Returns all interceptors that are bound to an EJB object through
+ * the {@link InterceptorBinding} mechanism and are
+ * enabled through the beans.xml file.
+ *
+ * This includes class and method-bound interceptors.The purpose of this
+ * method is to indicate what interceptors does the container need to
+ * interact with, for a given EJB.
+ *
+ * Note: in the case of an EJB, the expectation is that the interpretation
+ * of {link @javax.interceptor.Interceptors} is left to the container, and
+ * the interceptors provided by the binding are complementary
+ */
+ Collection<Interceptor<?>> getAllInterceptors();
+
+
+ /**
+ * Returns the interceptors that are applicable to a given {@link InterceptionType}
+ * and method (bound by {@link InterceptorBinding}).
+ * This includes class and method-bound interceptors, but no interceptors
+ * bound by EJB-specific mechanisms.
+ *
+ * @param interceptionType - the interception type (non-lifecycle)
+ * @param method - the method that is to be intercepted
+ * @return - an immutable list of interceptors applicable to the method (empty if no such
+ * interceptors exist)
+ * @throw IllegalArgumentException if interceptionType is not {@link InterceptionType.AROUND_INVOKE}
+ * or {@link InterceptionType.AROUND_TIMEOUT}
+ */
+ List<Interceptor<?>> getMethodInterceptors(InterceptionType interceptionType, Method method);
+
+
+ /**
+ * Returns the lifecycle interceptors that are applicable to a given {@link InterceptionType}
+ * (bound by {@link InterceptorBinding}).
+ *
+ * This includes class and method-bound interceptors, but no interceptors
+ * bound by EJB-specific mechanisms.
+ *
+ * @param interceptionType - the interception type (lifecycle)
+ * @param method - the method that is to be intercepted
+ * @return - an immutable list of interceptors applicable to the method (empty if no such
+ * interceptors exist)
+ * @throw IllegalArgumentException if interceptionType not {@link InterceptionType.AROUND_INVOKE}
+ * or {@link InterceptionType.AROUND_TIMEOUT}
+ */
+ List<Interceptor<?>> getLifecycleInterceptors(InterceptionType interceptionType);
+
+}
Copied: ri/trunk/spi/src/main/java/org/jboss/weld/ejb/spi/helpers (from rev 3874, ri/trunk/spi/src/main/java/org/jboss/webbeans/ejb/spi/helpers)
Modified: ri/trunk/spi/src/main/java/org/jboss/weld/ejb/spi/helpers/ForwadingBusinessInterfaceDescriptor.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/ejb/spi/helpers/ForwadingBusinessInterfaceDescriptor.java 2009-10-08 02:48:09 UTC (rev 3874)
+++ ri/trunk/spi/src/main/java/org/jboss/weld/ejb/spi/helpers/ForwadingBusinessInterfaceDescriptor.java 2009-10-08 03:07:40 UTC (rev 3875)
@@ -1,6 +1,6 @@
-package org.jboss.webbeans.ejb.spi.helpers;
+package org.jboss.weld.ejb.spi.helpers;
-import org.jboss.webbeans.ejb.spi.BusinessInterfaceDescriptor;
+import org.jboss.weld.ejb.spi.BusinessInterfaceDescriptor;
/**
Modified: ri/trunk/spi/src/main/java/org/jboss/weld/ejb/spi/helpers/ForwardingEjbDescriptor.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/ejb/spi/helpers/ForwardingEjbDescriptor.java 2009-10-08 02:48:09 UTC (rev 3874)
+++ ri/trunk/spi/src/main/java/org/jboss/weld/ejb/spi/helpers/ForwardingEjbDescriptor.java 2009-10-08 03:07:40 UTC (rev 3875)
@@ -1,10 +1,10 @@
-package org.jboss.webbeans.ejb.spi.helpers;
+package org.jboss.weld.ejb.spi.helpers;
import java.lang.reflect.Method;
import java.util.Collection;
-import org.jboss.webbeans.ejb.spi.BusinessInterfaceDescriptor;
-import org.jboss.webbeans.ejb.spi.EjbDescriptor;
+import org.jboss.weld.ejb.spi.BusinessInterfaceDescriptor;
+import org.jboss.weld.ejb.spi.EjbDescriptor;
/**
Modified: ri/trunk/spi/src/main/java/org/jboss/weld/ejb/spi/helpers/ForwardingEjbServices.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/ejb/spi/helpers/ForwardingEjbServices.java 2009-10-08 02:48:09 UTC (rev 3874)
+++ ri/trunk/spi/src/main/java/org/jboss/weld/ejb/spi/helpers/ForwardingEjbServices.java 2009-10-08 03:07:40 UTC (rev 3875)
@@ -14,12 +14,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.ejb.spi.helpers;
+package org.jboss.weld.ejb.spi.helpers;
-import org.jboss.webbeans.ejb.api.SessionObjectReference;
-import org.jboss.webbeans.ejb.spi.EjbDescriptor;
-import org.jboss.webbeans.ejb.spi.EjbServices;
-import org.jboss.webbeans.ejb.spi.InterceptorBindings;
+import org.jboss.weld.ejb.api.SessionObjectReference;
+import org.jboss.weld.ejb.spi.EjbDescriptor;
+import org.jboss.weld.ejb.spi.EjbServices;
+import org.jboss.weld.ejb.spi.InterceptorBindings;
/**
* An implementation of {@link EjbServices} which forwards all its method calls
Copied: ri/trunk/spi/src/main/java/org/jboss/weld/injection/spi/EjbInjectionServices.java (from rev 3874, ri/trunk/spi/src/main/java/org/jboss/webbeans/injection/spi/EjbInjectionServices.java)
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/weld/injection/spi/EjbInjectionServices.java (rev 0)
+++ ri/trunk/spi/src/main/java/org/jboss/weld/injection/spi/EjbInjectionServices.java 2009-10-08 03:07:40 UTC (rev 3875)
@@ -0,0 +1,50 @@
+/*
+ * 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.injection.spi;
+
+import javax.enterprise.inject.spi.InjectionPoint;
+
+import org.jboss.weld.bootstrap.api.Service;
+
+/**
+ * A container should implement this interface to allow Web Beans to
+ * resolve EJB.
+ *
+ * {@link EjbInjectionServices} is a per-module service.
+ *
+ * @author Pete Muir
+ *
+ */
+public interface EjbInjectionServices extends Service
+{
+
+ /**
+ * Resolve the value for the given @EJB injection point
+ *
+ * @param injectionPoint
+ * the injection point metadata
+ * @return an instance of the EJB
+ * @throws IllegalArgumentException
+ * if the injection point is not annotated with @EJB, or, if the
+ * injection point is a method that doesn't follow JavaBean
+ * conventions
+
+ */
+ public Object resolveEjb(InjectionPoint injectionPoint);
+
+}
Copied: ri/trunk/spi/src/main/java/org/jboss/weld/injection/spi/InjectionContext.java (from rev 3874, ri/trunk/spi/src/main/java/org/jboss/webbeans/injection/spi/InjectionContext.java)
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/weld/injection/spi/InjectionContext.java (rev 0)
+++ ri/trunk/spi/src/main/java/org/jboss/weld/injection/spi/InjectionContext.java 2009-10-08 03:07:40 UTC (rev 3875)
@@ -0,0 +1,34 @@
+/*
+ * 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.injection.spi;
+
+import javax.enterprise.inject.spi.InjectionTarget;
+
+/**
+ * @author pmuir
+ *
+ */
+public interface InjectionContext<T>
+{
+
+ public void proceed();
+
+ public T getTarget();
+
+ public InjectionTarget<T> getInjectionTarget();
+
+}
Copied: ri/trunk/spi/src/main/java/org/jboss/weld/injection/spi/InjectionServices.java (from rev 3874, ri/trunk/spi/src/main/java/org/jboss/webbeans/injection/spi/InjectionServices.java)
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/weld/injection/spi/InjectionServices.java (rev 0)
+++ ri/trunk/spi/src/main/java/org/jboss/weld/injection/spi/InjectionServices.java 2009-10-08 03:07:40 UTC (rev 3875)
@@ -0,0 +1,45 @@
+/*
+ * 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.injection.spi;
+
+import org.jboss.weld.bootstrap.api.Service;
+
+/**
+ * Provides callbacks to the container when Web Beans performs injection on an
+ * InjectionTarget, managed bean or session bean
+ *
+ * This service may be used to provide EE-style injection.
+ *
+ * {@link InjectionServices} is a per-BeanDeploymentArchive service.
+ *
+ * @author pmuir
+ *
+ */
+public interface InjectionServices extends Service
+{
+
+ /**
+ * Callback for injection.
+ *
+ * Call {@link InjectionContext#proceed()} to cause CDI-style injection to
+ * occur.
+ *
+ * @param injectionContext
+ */
+ public <T> void aroundInject(InjectionContext<T> injectionContext);
+
+}
Copied: ri/trunk/spi/src/main/java/org/jboss/weld/injection/spi/JpaInjectionServices.java (from rev 3874, ri/trunk/spi/src/main/java/org/jboss/webbeans/injection/spi/JpaInjectionServices.java)
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/weld/injection/spi/JpaInjectionServices.java (rev 0)
+++ ri/trunk/spi/src/main/java/org/jboss/weld/injection/spi/JpaInjectionServices.java 2009-10-08 03:07:40 UTC (rev 3875)
@@ -0,0 +1,67 @@
+/*
+ * 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.injection.spi;
+
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.persistence.EntityManager;
+import javax.persistence.EntityManagerFactory;
+
+import org.jboss.weld.bootstrap.api.Service;
+
+/**
+ * A container should implement this interface to allow the Web Beans RI to
+ * resolve JPA persistence units and discover entities
+ *
+ * {@link JpaInjectionServices} is a per-module service.
+ *
+ * @author Pete Muir
+ *
+ */
+public interface JpaInjectionServices extends Service
+{
+
+ /**
+ * Resolve the value for the given @PersistenceContext injection point
+ *
+ * @param injectionPoint
+ * the injection point metadata
+ * @return an instance of the entity manager
+ * @throws IllegalArgumentException
+ * if the injection point is not annotated with
+ * @PersistenceContext, or, if the injection point is a method
+ * that doesn't follow JavaBean conventions
+ * @throws IllegalStateException
+ * if no suitable persistence units can be resolved for injection
+ */
+ public EntityManager resolvePersistenceContext(InjectionPoint injectionPoint);
+
+ /**
+ * Resolve the value for the given @PersistenceUnit injection point
+ *
+ * @param injectionPoint
+ * the injection point metadata
+ * @return an instance of the entity manager
+ * @throws IllegalArgumentException
+ * if the injection point is not annotated with
+ * @PersistenceUnit, or, if the injection point is a method
+ * that doesn't follow JavaBean conventions
+ * @throws IllegalStateException
+ * if no suitable persistence units can be resolved for injection
+ */
+ public EntityManagerFactory resolvePersistenceUnit(InjectionPoint injectionPoint);
+
+}
Copied: ri/trunk/spi/src/main/java/org/jboss/weld/injection/spi/ResourceInjectionServices.java (from rev 3874, ri/trunk/spi/src/main/java/org/jboss/webbeans/injection/spi/ResourceInjectionServices.java)
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/weld/injection/spi/ResourceInjectionServices.java (rev 0)
+++ ri/trunk/spi/src/main/java/org/jboss/weld/injection/spi/ResourceInjectionServices.java 2009-10-08 03:07:40 UTC (rev 3875)
@@ -0,0 +1,63 @@
+/*
+ * 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.injection.spi;
+
+import javax.enterprise.inject.spi.InjectionPoint;
+
+import org.jboss.weld.bootstrap.api.Service;
+
+/**
+ * A container should implement this interface to allow the Web Beans RI to
+ * resolve Resources
+ *
+ * {@link ResourceInjectionServices} is per-module service.
+ *
+ * @author Pete Muir
+ *
+ */
+public interface ResourceInjectionServices extends Service
+{
+
+ /**
+ * Resolve the value for the given @Resource injection point
+ *
+ * @param injectionPoint
+ * the injection point metadata
+ * @return an instance of the resource
+ * @throws IllegalArgumentException
+ * if the injection point is not annotated with @Resource, or, if
+ * the injection point is a method that doesn't follow JavaBean
+ * conventions
+ * @throws IllegalStateException
+ * if no resource can be resolved for injection
+ */
+ public Object resolveResource(InjectionPoint injectionPoint);
+
+ /**
+ * Resolve the value for the given JNDI name and mapped name
+ *
+ * @param injectionPoint
+ * the injection point metadata
+ * @return an instance of the resource
+ * @throws IllegalStateException
+ * if no resource can be resolved for injection
+ * @throws IllegalArgumentException
+ * if both jndiName and mappedName are null
+ */
+ public Object resolveResource(String jndiName, String mappedName);
+
+}
\ No newline at end of file
Copied: ri/trunk/spi/src/main/java/org/jboss/weld/injection/spi/helpers (from rev 3874, ri/trunk/spi/src/main/java/org/jboss/webbeans/injection/spi/helpers)
Modified: ri/trunk/spi/src/main/java/org/jboss/weld/injection/spi/helpers/AbstractResourceServices.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/injection/spi/helpers/AbstractResourceServices.java 2009-10-08 02:48:09 UTC (rev 3874)
+++ ri/trunk/spi/src/main/java/org/jboss/weld/injection/spi/helpers/AbstractResourceServices.java 2009-10-08 03:07:40 UTC (rev 3875)
@@ -1,4 +1,4 @@
-package org.jboss.webbeans.injection.spi.helpers;
+package org.jboss.weld.injection.spi.helpers;
import java.beans.Introspector;
import java.lang.reflect.Field;
@@ -9,7 +9,7 @@
import javax.naming.Context;
import javax.naming.NamingException;
-import org.jboss.webbeans.bootstrap.api.Service;
+import org.jboss.weld.bootstrap.api.Service;
public abstract class AbstractResourceServices implements Service
{
Modified: ri/trunk/spi/src/main/java/org/jboss/weld/injection/spi/helpers/ForwardingJpaInjectionServices.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/injection/spi/helpers/ForwardingJpaInjectionServices.java 2009-10-08 02:48:09 UTC (rev 3874)
+++ ri/trunk/spi/src/main/java/org/jboss/weld/injection/spi/helpers/ForwardingJpaInjectionServices.java 2009-10-08 03:07:40 UTC (rev 3875)
@@ -14,13 +14,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.injection.spi.helpers;
+package org.jboss.weld.injection.spi.helpers;
import javax.enterprise.inject.spi.InjectionPoint;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
-import org.jboss.webbeans.injection.spi.JpaInjectionServices;
+import org.jboss.weld.injection.spi.JpaInjectionServices;
/**
* An implementation of {@link JpaInjectionServices} which forwards all its method calls
Modified: ri/trunk/spi/src/main/java/org/jboss/weld/injection/spi/helpers/ForwardingResourceInjectionServices.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/injection/spi/helpers/ForwardingResourceInjectionServices.java 2009-10-08 02:48:09 UTC (rev 3874)
+++ ri/trunk/spi/src/main/java/org/jboss/weld/injection/spi/helpers/ForwardingResourceInjectionServices.java 2009-10-08 03:07:40 UTC (rev 3875)
@@ -1,8 +1,8 @@
-package org.jboss.webbeans.injection.spi.helpers;
+package org.jboss.weld.injection.spi.helpers;
import javax.enterprise.inject.spi.InjectionPoint;
-import org.jboss.webbeans.injection.spi.ResourceInjectionServices;
+import org.jboss.weld.injection.spi.ResourceInjectionServices;
public abstract class ForwardingResourceInjectionServices implements ResourceInjectionServices
{
Copied: ri/trunk/spi/src/main/java/org/jboss/weld/manager/api (from rev 3874, ri/trunk/spi/src/main/java/org/jboss/webbeans/manager/api)
Modified: ri/trunk/spi/src/main/java/org/jboss/weld/manager/api/ExecutorServices.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/manager/api/ExecutorServices.java 2009-10-08 02:48:09 UTC (rev 3874)
+++ ri/trunk/spi/src/main/java/org/jboss/weld/manager/api/ExecutorServices.java 2009-10-08 03:07:40 UTC (rev 3875)
@@ -14,12 +14,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.manager.api;
+package org.jboss.weld.manager.api;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
-import org.jboss.webbeans.bootstrap.api.Service;
+import org.jboss.weld.bootstrap.api.Service;
/**
* Allows a custom TaskExecutor to be provided by the container. By default,
Modified: ri/trunk/spi/src/main/java/org/jboss/weld/manager/api/WebBeansManager.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/manager/api/WebBeansManager.java 2009-10-08 02:48:09 UTC (rev 3874)
+++ ri/trunk/spi/src/main/java/org/jboss/weld/manager/api/WebBeansManager.java 2009-10-08 03:07:40 UTC (rev 3875)
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.jboss.webbeans.manager.api;
+package org.jboss.weld.manager.api;
import java.io.Serializable;
import java.lang.annotation.Annotation;
@@ -25,7 +25,7 @@
import javax.enterprise.inject.spi.BeanManager;
import javax.enterprise.inject.spi.InjectionTarget;
-import org.jboss.webbeans.ejb.spi.EjbDescriptor;
+import org.jboss.weld.ejb.spi.EjbDescriptor;
/**
* Functionality provided by the Web Beans Manager over and above the JSR-299
Copied: ri/trunk/spi/src/main/java/org/jboss/weld/messaging (from rev 3874, ri/trunk/spi/src/main/java/org/jboss/webbeans/messaging)
Copied: ri/trunk/spi/src/main/java/org/jboss/weld/persistence/spi (from rev 3874, ri/trunk/spi/src/main/java/org/jboss/webbeans/persistence/spi)
Copied: ri/trunk/spi/src/main/java/org/jboss/weld/resources/spi/ResourceLoader.java (from rev 3874, ri/trunk/spi/src/main/java/org/jboss/webbeans/resources/spi/ResourceLoader.java)
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/weld/resources/spi/ResourceLoader.java (rev 0)
+++ ri/trunk/spi/src/main/java/org/jboss/weld/resources/spi/ResourceLoader.java 2009-10-08 03:07:40 UTC (rev 3875)
@@ -0,0 +1,64 @@
+/*
+ * 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.resources.spi;
+
+import java.net.URL;
+import java.util.Collection;
+
+import org.jboss.weld.bootstrap.api.Service;
+
+/**
+ * Resource loading/class creation services for Web Beans. By default an
+ * implementation which uses the Thread Context ClassLoader if available,
+ * otherwise the classloading of the implementation is used.
+ *
+ * The {@link ResourceLoader} is a per-deployment service.
+ *
+ * @author Pete Muir
+ *
+ */
+public interface ResourceLoader extends Service
+{
+ // Name of the resource loader
+ public static final String PROPERTY_NAME = ResourceLoader.class.getName();
+
+ /**
+ * Creates a class from a given FQCN
+ *
+ * @param name The name of the clsas
+ * @return The class
+ */
+ public Class<?> classForName(String name);
+
+ /**
+ * Gets a resource as a URL by name
+ *
+ * @param name The name of the resource
+ * @return An URL to the resource
+ */
+ public URL getResource(String name);
+
+ /**
+ * Gets resources as URLs by name
+ *
+ * @param name The name of the resource
+ * @return references to the URLS
+ */
+ public Collection<URL> getResources(String name);
+
+}
Copied: ri/trunk/spi/src/main/java/org/jboss/weld/resources/spi/ResourceLoadingException.java (from rev 3874, ri/trunk/spi/src/main/java/org/jboss/webbeans/resources/spi/ResourceLoadingException.java)
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/weld/resources/spi/ResourceLoadingException.java (rev 0)
+++ ri/trunk/spi/src/main/java/org/jboss/weld/resources/spi/ResourceLoadingException.java 2009-10-08 03:07:40 UTC (rev 3875)
@@ -0,0 +1,57 @@
+/**
+ *
+ */
+package org.jboss.weld.resources.spi;
+
+
+
+/**
+ * Exception thrown when errors occur while loading resource
+ *
+ * @author Pete Muir
+ *
+ */
+public class ResourceLoadingException extends RuntimeException
+{
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Constructor
+ */
+ public ResourceLoadingException()
+ {
+ super();
+ }
+
+ /**
+ * Constructor
+ *
+ * @param message The message
+ * @param throwable The exception
+ */
+ public ResourceLoadingException(String message, Throwable throwable)
+ {
+ super(message, throwable);
+ }
+
+ /**
+ * Constructor
+ *
+ * @param message The message
+ */
+ public ResourceLoadingException(String message)
+ {
+ super(message);
+ }
+
+ /**
+ * Constructor
+ *
+ * @param throwable The exception
+ */
+ public ResourceLoadingException(Throwable throwable)
+ {
+ super(throwable);
+ }
+
+}
\ No newline at end of file
Copied: ri/trunk/spi/src/main/java/org/jboss/weld/resources/spi/helpers (from rev 3874, ri/trunk/spi/src/main/java/org/jboss/webbeans/resources/spi/helpers)
Modified: ri/trunk/spi/src/main/java/org/jboss/weld/resources/spi/helpers/ForwardingResourceLoader.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/resources/spi/helpers/ForwardingResourceLoader.java 2009-10-08 02:48:09 UTC (rev 3874)
+++ ri/trunk/spi/src/main/java/org/jboss/weld/resources/spi/helpers/ForwardingResourceLoader.java 2009-10-08 03:07:40 UTC (rev 3875)
@@ -1,9 +1,9 @@
-package org.jboss.webbeans.resources.spi.helpers;
+package org.jboss.weld.resources.spi.helpers;
import java.net.URL;
import java.util.Collection;
-import org.jboss.webbeans.resources.spi.ResourceLoader;
+import org.jboss.weld.resources.spi.ResourceLoader;
/**
* An implementation of {@link ResourceLoader} which forwards all its method calls
Copied: ri/trunk/spi/src/main/java/org/jboss/weld/security/spi (from rev 3874, ri/trunk/spi/src/main/java/org/jboss/webbeans/security/spi)
Modified: ri/trunk/spi/src/main/java/org/jboss/weld/security/spi/SecurityServices.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/security/spi/SecurityServices.java 2009-10-08 02:48:09 UTC (rev 3874)
+++ ri/trunk/spi/src/main/java/org/jboss/weld/security/spi/SecurityServices.java 2009-10-08 03:07:40 UTC (rev 3875)
@@ -14,11 +14,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.security.spi;
+package org.jboss.weld.security.spi;
import java.security.Principal;
-import org.jboss.webbeans.bootstrap.api.Service;
+import org.jboss.weld.bootstrap.api.Service;
/**
* Responsible for accessing security related functionality the environment can
Copied: ri/trunk/spi/src/main/java/org/jboss/weld/servlet/api/ServletListener.java (from rev 3874, ri/trunk/spi/src/main/java/org/jboss/webbeans/servlet/api/ServletListener.java)
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/weld/servlet/api/ServletListener.java (rev 0)
+++ ri/trunk/spi/src/main/java/org/jboss/weld/servlet/api/ServletListener.java 2009-10-08 03:07:40 UTC (rev 3875)
@@ -0,0 +1,12 @@
+package org.jboss.weld.servlet.api;
+
+import javax.servlet.ServletContextListener;
+import javax.servlet.ServletRequestListener;
+import javax.servlet.http.HttpSessionListener;
+
+public interface ServletListener extends ServletContextListener, ServletRequestListener, HttpSessionListener
+{
+
+
+
+}
Copied: ri/trunk/spi/src/main/java/org/jboss/weld/servlet/api/ServletServices.java (from rev 3874, ri/trunk/spi/src/main/java/org/jboss/webbeans/servlet/api/ServletServices.java)
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/weld/servlet/api/ServletServices.java (rev 0)
+++ ri/trunk/spi/src/main/java/org/jboss/weld/servlet/api/ServletServices.java 2009-10-08 03:07:40 UTC (rev 3875)
@@ -0,0 +1,46 @@
+/*
+ * 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.servlet.api;
+
+import javax.servlet.ServletContext;
+
+import org.jboss.weld.bootstrap.api.Service;
+import org.jboss.weld.bootstrap.spi.BeanDeploymentArchive;
+
+/**
+ * Allows the container to identify BDA in use for a request. This method will
+ * be called, in the same thread as the request, every time Web Beans needs to
+ * identify a request.
+ *
+ * {@link ServletServices} is a per-deployment service.
+ *
+ * @author pmuir
+ *
+ */
+public interface ServletServices extends Service
+{
+
+ /**
+ * Get the BDA for the current request. The ServletContext is provided for
+ * context.
+ *
+ * @param ctx
+ * @return
+ */
+ public BeanDeploymentArchive getBeanDeploymentArchive(ServletContext ctx);
+
+}
Copied: ri/trunk/spi/src/main/java/org/jboss/weld/servlet/api/helpers (from rev 3874, ri/trunk/spi/src/main/java/org/jboss/webbeans/servlet/api/helpers)
Modified: ri/trunk/spi/src/main/java/org/jboss/weld/servlet/api/helpers/AbstractServletListener.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/servlet/api/helpers/AbstractServletListener.java 2009-10-08 02:48:09 UTC (rev 3874)
+++ ri/trunk/spi/src/main/java/org/jboss/weld/servlet/api/helpers/AbstractServletListener.java 2009-10-08 03:07:40 UTC (rev 3875)
@@ -1,10 +1,10 @@
-package org.jboss.webbeans.servlet.api.helpers;
+package org.jboss.weld.servlet.api.helpers;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletRequestEvent;
import javax.servlet.http.HttpSessionEvent;
-import org.jboss.webbeans.servlet.api.ServletListener;
+import org.jboss.weld.servlet.api.ServletListener;
/**
* No-op implementation of ServletListener
Modified: ri/trunk/spi/src/main/java/org/jboss/weld/servlet/api/helpers/ForwardingServletListener.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/servlet/api/helpers/ForwardingServletListener.java 2009-10-08 02:48:09 UTC (rev 3874)
+++ ri/trunk/spi/src/main/java/org/jboss/weld/servlet/api/helpers/ForwardingServletListener.java 2009-10-08 03:07:40 UTC (rev 3875)
@@ -1,10 +1,10 @@
-package org.jboss.webbeans.servlet.api.helpers;
+package org.jboss.weld.servlet.api.helpers;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletRequestEvent;
import javax.servlet.http.HttpSessionEvent;
-import org.jboss.webbeans.servlet.api.ServletListener;
+import org.jboss.weld.servlet.api.ServletListener;
public abstract class ForwardingServletListener implements ServletListener
{
Copied: ri/trunk/spi/src/main/java/org/jboss/weld/transaction/spi (from rev 3874, ri/trunk/spi/src/main/java/org/jboss/webbeans/transaction/spi)
Modified: ri/trunk/spi/src/main/java/org/jboss/weld/transaction/spi/TransactionServices.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/transaction/spi/TransactionServices.java 2009-10-08 02:48:09 UTC (rev 3874)
+++ ri/trunk/spi/src/main/java/org/jboss/weld/transaction/spi/TransactionServices.java 2009-10-08 03:07:40 UTC (rev 3875)
@@ -1,9 +1,9 @@
-package org.jboss.webbeans.transaction.spi;
+package org.jboss.weld.transaction.spi;
import javax.transaction.Synchronization;
import javax.transaction.UserTransaction;
-import org.jboss.webbeans.bootstrap.api.Service;
+import org.jboss.weld.bootstrap.api.Service;
/**
* <p>
Copied: ri/trunk/spi/src/main/java/org/jboss/weld/validation/spi (from rev 3874, ri/trunk/spi/src/main/java/org/jboss/webbeans/validation/spi)
Modified: ri/trunk/spi/src/main/java/org/jboss/weld/validation/spi/ValidationServices.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/validation/spi/ValidationServices.java 2009-10-08 02:48:09 UTC (rev 3874)
+++ ri/trunk/spi/src/main/java/org/jboss/weld/validation/spi/ValidationServices.java 2009-10-08 03:07:40 UTC (rev 3875)
@@ -14,11 +14,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.validation.spi;
+package org.jboss.weld.validation.spi;
import javax.validation.ValidatorFactory;
-import org.jboss.webbeans.bootstrap.api.Service;
+import org.jboss.weld.bootstrap.api.Service;
/**
* <p>
Copied: ri/trunk/spi/src/main/java/org/jboss/weld/ws (from rev 3874, ri/trunk/spi/src/main/java/org/jboss/webbeans/ws)
15 years, 1 month
Weld SVN: r3873 - in ri/trunk/core-api: src/main/java/org/jboss and 3 other directories.
by weld-commits@lists.jboss.org
Author: shane.bryzak(a)jboss.com
Date: 2009-10-07 22:46:12 -0400 (Wed, 07 Oct 2009)
New Revision: 3873
Added:
ri/trunk/core-api/src/main/java/org/jboss/weld/
ri/trunk/core-api/src/main/java/org/jboss/weld/conversation/
Removed:
ri/trunk/core-api/src/main/java/org/jboss/webbeans/conversation/
Modified:
ri/trunk/core-api/pom.xml
ri/trunk/core-api/src/main/java/org/jboss/weld/conversation/ConversationConcurrentAccessTimeout.java
ri/trunk/core-api/src/main/java/org/jboss/weld/conversation/ConversationIdGenerator.java
ri/trunk/core-api/src/main/java/org/jboss/weld/conversation/ConversationIdName.java
ri/trunk/core-api/src/main/java/org/jboss/weld/conversation/ConversationInactivityTimeout.java
ri/trunk/core-api/src/main/java/org/jboss/weld/conversation/ConversationManager.java
ri/trunk/core-api/src/main/java/org/jboss/weld/conversation/ConversationTerminator.java
Log:
rename core-api package
Modified: ri/trunk/core-api/pom.xml
===================================================================
--- ri/trunk/core-api/pom.xml 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/core-api/pom.xml 2009-10-08 02:46:12 UTC (rev 3873)
@@ -1,18 +1,18 @@
<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">
<parent>
- <artifactId>webbeans-parent</artifactId>
- <groupId>org.jboss.webbeans</groupId>
+ <artifactId>weld-parent</artifactId>
+ <groupId>org.jboss.weld</groupId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
- <groupId>org.jboss.webbeans</groupId>
- <artifactId>webbeans-api</artifactId>
+ <groupId>org.jboss.weld</groupId>
+ <artifactId>weld-api</artifactId>
<version>1.0.0-SNAPSHOT</version>
- <name>Web Beans Core API</name>
+ <name>Weld Core API</name>
<dependencies>
<dependency>
- <groupId>org.jboss.webbeans</groupId>
+ <groupId>org.jboss.weld</groupId>
<artifactId>jsr299-api</artifactId>
</dependency>
Copied: ri/trunk/core-api/src/main/java/org/jboss/weld/conversation (from rev 3872, ri/trunk/core-api/src/main/java/org/jboss/webbeans/conversation)
Modified: ri/trunk/core-api/src/main/java/org/jboss/weld/conversation/ConversationConcurrentAccessTimeout.java
===================================================================
--- ri/trunk/core-api/src/main/java/org/jboss/webbeans/conversation/ConversationConcurrentAccessTimeout.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/core-api/src/main/java/org/jboss/weld/conversation/ConversationConcurrentAccessTimeout.java 2009-10-08 02:46:12 UTC (rev 3873)
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.conversation;
+package org.jboss.weld.conversation;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.METHOD;
Modified: ri/trunk/core-api/src/main/java/org/jboss/weld/conversation/ConversationIdGenerator.java
===================================================================
--- ri/trunk/core-api/src/main/java/org/jboss/webbeans/conversation/ConversationIdGenerator.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/core-api/src/main/java/org/jboss/weld/conversation/ConversationIdGenerator.java 2009-10-08 02:46:12 UTC (rev 3873)
@@ -14,13 +14,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.conversation;
+package org.jboss.weld.conversation;
/**
* Generates conversation ID:s for the conversation manager
*
* @author Nicklas Karlsson
- * @see org.jboss.webbeans.conversation.ConversationManager#beginOrRestoreConversation(String)
+ * @see org.jboss.weld.conversation.ConversationManager#beginOrRestoreConversation(String)
*/
public interface ConversationIdGenerator
{
Modified: ri/trunk/core-api/src/main/java/org/jboss/weld/conversation/ConversationIdName.java
===================================================================
--- ri/trunk/core-api/src/main/java/org/jboss/webbeans/conversation/ConversationIdName.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/core-api/src/main/java/org/jboss/weld/conversation/ConversationIdName.java 2009-10-08 02:46:12 UTC (rev 3873)
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.conversation;
+package org.jboss.weld.conversation;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.METHOD;
Modified: ri/trunk/core-api/src/main/java/org/jboss/weld/conversation/ConversationInactivityTimeout.java
===================================================================
--- ri/trunk/core-api/src/main/java/org/jboss/webbeans/conversation/ConversationInactivityTimeout.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/core-api/src/main/java/org/jboss/weld/conversation/ConversationInactivityTimeout.java 2009-10-08 02:46:12 UTC (rev 3873)
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.conversation;
+package org.jboss.weld.conversation;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.METHOD;
Modified: ri/trunk/core-api/src/main/java/org/jboss/weld/conversation/ConversationManager.java
===================================================================
--- ri/trunk/core-api/src/main/java/org/jboss/webbeans/conversation/ConversationManager.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/core-api/src/main/java/org/jboss/weld/conversation/ConversationManager.java 2009-10-08 02:46:12 UTC (rev 3873)
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.conversation;
+package org.jboss.weld.conversation;
import java.util.Set;
@@ -24,7 +24,7 @@
* A conversation manager responsible for starting, resuming and ending conversations
*
* @author Nicklas Karlsson
- * @see org.jboss.webbeans.conversation.ConversationManager
+ * @see org.jboss.weld.conversation.ConversationManager
*/
public interface ConversationManager
{
Modified: ri/trunk/core-api/src/main/java/org/jboss/weld/conversation/ConversationTerminator.java
===================================================================
--- ri/trunk/core-api/src/main/java/org/jboss/webbeans/conversation/ConversationTerminator.java 2009-10-07 21:43:49 UTC (rev 3872)
+++ ri/trunk/core-api/src/main/java/org/jboss/weld/conversation/ConversationTerminator.java 2009-10-08 02:46:12 UTC (rev 3873)
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.webbeans.conversation;
+package org.jboss.weld.conversation;
import java.util.concurrent.Future;
15 years, 1 month
Weld SVN: r3872 - in ri/trunk: impl/src/main/java/org/jboss/webbeans/util and 1 other directories.
by weld-commits@lists.jboss.org
Author: marius.bogoevici
Date: 2009-10-07 17:43:49 -0400 (Wed, 07 Oct 2009)
New Revision: 3872
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ManagedBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/util/Reflections.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/interceptor/ejb3model/Ball.java
Log:
Make @Interceptors and @ExcludeClassInterceptors completely optional. Look for them only if they're on the classpath.
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ManagedBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ManagedBean.java 2009-10-07 19:55:47 UTC (rev 3871)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ManagedBean.java 2009-10-07 21:43:49 UTC (rev 3872)
@@ -19,6 +19,7 @@
import java.util.Set;
import java.util.List;
import java.util.ArrayList;
+import java.lang.annotation.Annotation;
import javax.enterprise.context.spi.CreationalContext;
import javax.enterprise.event.Observes;
@@ -26,8 +27,6 @@
import javax.enterprise.inject.spi.Decorator;
import javax.enterprise.inject.spi.InjectionPoint;
import javax.enterprise.inject.spi.AnnotatedMethod;
-import javax.interceptor.Interceptors;
-import javax.interceptor.ExcludeClassInterceptors;
import org.jboss.interceptor.proxy.InterceptorProxyCreatorImpl;
import org.jboss.interceptor.proxy.InterceptionHandlerFactory;
@@ -429,16 +428,16 @@
protected void initDeclaredInterceptors()
{
- if (manager.getDeclaredInterceptorsRegistry().getInterceptionModel(getType()) == null)
+ if (manager.getDeclaredInterceptorsRegistry().getInterceptionModel(getType()) == null && InterceptionUtils.supportsEjb3InterceptorDeclaration())
{
InterceptionModelBuilder<Class<?>, Class<?>> builder = InterceptionModelBuilder.newBuilderFor(getType(), (Class) Class.class);
Class<?>[] classDeclaredInterceptors = null;
- if (getAnnotatedItem().isAnnotationPresent(Interceptors.class))
+ if (getAnnotatedItem().isAnnotationPresent(InterceptionUtils.getInterceptorsAnnotationClass()))
{
- classDeclaredInterceptors = getType().getAnnotation(Interceptors.class).value();
+ Annotation interceptorsAnnotation = getType().getAnnotation(InterceptionUtils.getInterceptorsAnnotationClass());
+ classDeclaredInterceptors = Reflections.extractValues(interceptorsAnnotation);
}
-
if (classDeclaredInterceptors != null)
{
builder.interceptPostConstruct().with(classDeclaredInterceptors);
@@ -448,11 +447,11 @@
List<WBMethod<?, ?>> businessMethods = Beans.getInterceptableBusinessMethods(getAnnotatedItem());
for (WBMethod<?, ?> method : businessMethods)
{
- boolean excludeClassInterceptors = method.isAnnotationPresent(ExcludeClassInterceptors.class);
+ boolean excludeClassInterceptors = method.isAnnotationPresent(InterceptionUtils.getExcludeClassInterceptorsAnnotationClass());
Class<?>[] methodDeclaredInterceptors = null;
- if (method.isAnnotationPresent(Interceptors.class))
+ if (method.isAnnotationPresent(InterceptionUtils.getInterceptorsAnnotationClass()))
{
- methodDeclaredInterceptors = method.getAnnotation(Interceptors.class).value();
+ methodDeclaredInterceptors = Reflections.extractValues(method.getAnnotation(InterceptionUtils.getInterceptorsAnnotationClass()));
}
if (!excludeClassInterceptors && classDeclaredInterceptors != null)
{
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/util/Reflections.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/util/Reflections.java 2009-10-07 19:55:47 UTC (rev 3871)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/util/Reflections.java 2009-10-07 21:43:49 UTC (rev 3872)
@@ -41,6 +41,7 @@
import org.jboss.webbeans.log.Log;
import org.jboss.webbeans.log.Logging;
import org.jboss.webbeans.util.reflection.ParameterizedTypeImpl;
+import org.jboss.webbeans.DeploymentException;
/**
* Utility class for static reflection-type operations
@@ -55,8 +56,8 @@
public static final Type[] EMPTY_TYPES = {};
- public static final Annotation[] EMPTY_ANNOTATIONS = {};
-
+ public static final Annotation[] EMPTY_ANNOTATIONS = {};
+
public static class HierarchyDiscovery
{
@@ -899,4 +900,18 @@
}
}
+ public static Class<?>[] extractValues(Annotation annotation)
+ {
+ try
+ {
+ Class<?>[] valueClasses = (Class<?>[]) annotation.annotationType().getMethod("value").invoke(annotation);
+ return valueClasses;
+ }
+ catch (Exception e)
+ {
+ throw new DeploymentException("Cannot access values() on annotation", e);
+ }
+ }
+
+
}
Modified: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/interceptor/ejb3model/Ball.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/interceptor/ejb3model/Ball.java 2009-10-07 19:55:47 UTC (rev 3871)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/interceptor/ejb3model/Ball.java 2009-10-07 21:43:49 UTC (rev 3872)
@@ -39,10 +39,10 @@
public void pass()
{
played = true;
- };
+ }
public void lob()
{
played = true;
- };
+ }
}
15 years, 1 month
Weld SVN: r3871 - in ri/branches/1.0.0.PREVIEW5: api and 11 other directories.
by weld-commits@lists.jboss.org
Author: rogerk
Date: 2009-10-07 15:55:47 -0400 (Wed, 07 Oct 2009)
New Revision: 3871
Modified:
ri/branches/1.0.0.PREVIEW5/api/pom.xml
ri/branches/1.0.0.PREVIEW5/core-api/pom.xml
ri/branches/1.0.0.PREVIEW5/embedded-tck-runner/pom.xml
ri/branches/1.0.0.PREVIEW5/impl/pom.xml
ri/branches/1.0.0.PREVIEW5/inject-tck-runner/pom.xml
ri/branches/1.0.0.PREVIEW5/logging/pom.xml
ri/branches/1.0.0.PREVIEW5/osgi-bundle/pom.xml
ri/branches/1.0.0.PREVIEW5/parent/pom.xml
ri/branches/1.0.0.PREVIEW5/pom.xml
ri/branches/1.0.0.PREVIEW5/porting-package/pom.xml
ri/branches/1.0.0.PREVIEW5/spi/pom.xml
ri/branches/1.0.0.PREVIEW5/tests/pom.xml
ri/branches/1.0.0.PREVIEW5/version-matrix/pom.xml
Log:
pom version updates
Modified: ri/branches/1.0.0.PREVIEW5/api/pom.xml
===================================================================
--- ri/branches/1.0.0.PREVIEW5/api/pom.xml 2009-10-07 18:51:39 UTC (rev 3870)
+++ ri/branches/1.0.0.PREVIEW5/api/pom.xml 2009-10-07 19:55:47 UTC (rev 3871)
@@ -4,12 +4,12 @@
<parent>
<groupId>org.jboss.webbeans</groupId>
<artifactId>webbeans-parent</artifactId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0.PREVIEW5</version>
</parent>
<groupId>org.jboss.webbeans</groupId>
<artifactId>jsr299-api</artifactId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0.PREVIEW5</version>
<packaging>jar</packaging>
<name>JSR-299 API</name>
<url>http://www.seamframework.org/WebBeans</url>
Modified: ri/branches/1.0.0.PREVIEW5/core-api/pom.xml
===================================================================
--- ri/branches/1.0.0.PREVIEW5/core-api/pom.xml 2009-10-07 18:51:39 UTC (rev 3870)
+++ ri/branches/1.0.0.PREVIEW5/core-api/pom.xml 2009-10-07 19:55:47 UTC (rev 3871)
@@ -2,12 +2,12 @@
<parent>
<artifactId>webbeans-parent</artifactId>
<groupId>org.jboss.webbeans</groupId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0.PREVIEW5</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.webbeans</groupId>
<artifactId>webbeans-api</artifactId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0.PREVIEW5</version>
<name>Web Beans Core API</name>
<dependencies>
Modified: ri/branches/1.0.0.PREVIEW5/embedded-tck-runner/pom.xml
===================================================================
--- ri/branches/1.0.0.PREVIEW5/embedded-tck-runner/pom.xml 2009-10-07 18:51:39 UTC (rev 3870)
+++ ri/branches/1.0.0.PREVIEW5/embedded-tck-runner/pom.xml 2009-10-07 19:55:47 UTC (rev 3871)
@@ -2,7 +2,7 @@
<parent>
<artifactId>webbeans-parent</artifactId>
<groupId>org.jboss.webbeans</groupId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0.PREVIEW5</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.webbeans</groupId>
@@ -51,7 +51,7 @@
<dependency>
<groupId>org.jboss.jbossas</groupId>
<artifactId>jboss-as-component-matrix</artifactId>
- <version>5.2.0-SNAPSHOT</version>
+ <version>5.2.0.PREVIEW5</version>
<scope>import</scope>
<type>pom</type>
</dependency>
Modified: ri/branches/1.0.0.PREVIEW5/impl/pom.xml
===================================================================
--- ri/branches/1.0.0.PREVIEW5/impl/pom.xml 2009-10-07 18:51:39 UTC (rev 3870)
+++ ri/branches/1.0.0.PREVIEW5/impl/pom.xml 2009-10-07 19:55:47 UTC (rev 3871)
@@ -2,12 +2,12 @@
<parent>
<artifactId>webbeans-parent</artifactId>
<groupId>org.jboss.webbeans</groupId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0.PREVIEW5</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.webbeans</groupId>
<artifactId>webbeans-core</artifactId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0.PREVIEW5</version>
<name>Web Beans Core</name>
<dependencies>
Modified: ri/branches/1.0.0.PREVIEW5/inject-tck-runner/pom.xml
===================================================================
--- ri/branches/1.0.0.PREVIEW5/inject-tck-runner/pom.xml 2009-10-07 18:51:39 UTC (rev 3870)
+++ ri/branches/1.0.0.PREVIEW5/inject-tck-runner/pom.xml 2009-10-07 19:55:47 UTC (rev 3871)
@@ -2,7 +2,7 @@
<parent>
<artifactId>webbeans-parent</artifactId>
<groupId>org.jboss.webbeans</groupId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0.PREVIEW5</version>
<relativePath>../parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: ri/branches/1.0.0.PREVIEW5/logging/pom.xml
===================================================================
--- ri/branches/1.0.0.PREVIEW5/logging/pom.xml 2009-10-07 18:51:39 UTC (rev 3870)
+++ ri/branches/1.0.0.PREVIEW5/logging/pom.xml 2009-10-07 19:55:47 UTC (rev 3871)
@@ -2,12 +2,12 @@
<parent>
<artifactId>webbeans-parent</artifactId>
<groupId>org.jboss.webbeans</groupId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0.PREVIEW5</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.webbeans</groupId>
<artifactId>webbeans-logging</artifactId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0.PREVIEW5</version>
<name>Web Beans Logging</name>
<dependencies>
Modified: ri/branches/1.0.0.PREVIEW5/osgi-bundle/pom.xml
===================================================================
--- ri/branches/1.0.0.PREVIEW5/osgi-bundle/pom.xml 2009-10-07 18:51:39 UTC (rev 3870)
+++ ri/branches/1.0.0.PREVIEW5/osgi-bundle/pom.xml 2009-10-07 19:55:47 UTC (rev 3871)
@@ -21,7 +21,7 @@
<parent>
<artifactId>webbeans-parent</artifactId>
<groupId>org.jboss.webbeans</groupId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0.PREVIEW5</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -65,7 +65,7 @@
org.jboss.webbeans.jsf; include:="WebBeansPhaseListener"; version=${osgi.version},
javassist.util.proxy;version="3.8.1.GA"
</_exportcontents>
- <Import-Package>javax.annotation, javax.interceptor, *;resolution:=optional</Import-Package>
+ <Import-Package>javax.annotation, javax.interceptor.*, *;resolution:=optional</Import-Package>
<Private-Package>!javax.annotation.*, !javax.interceptor.*</Private-Package>
</instructions>
<!-- Maven uses the output directory (target/classes)
@@ -134,8 +134,20 @@
<artifactId>inject-api</artifactId>
<version>1.0.0-PRD</version>
</dependency>
+ <dependency>
+ <groupId>org.jboss.interceptors</groupId>
+ <artifactId>interceptors</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>1.1.1</version>
+ </dependency>
+
+
</dependencies>
</project>
Modified: ri/branches/1.0.0.PREVIEW5/parent/pom.xml
===================================================================
--- ri/branches/1.0.0.PREVIEW5/parent/pom.xml 2009-10-07 18:51:39 UTC (rev 3870)
+++ ri/branches/1.0.0.PREVIEW5/parent/pom.xml 2009-10-07 19:55:47 UTC (rev 3871)
@@ -3,12 +3,12 @@
<groupId>org.jboss.webbeans</groupId>
<artifactId>webbeans-parent</artifactId>
<packaging>pom</packaging>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0.PREVIEW5</version>
<parent>
<groupId>org.jboss.webbeans</groupId>
<artifactId>webbeans-version-matrix</artifactId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0.PREVIEW5</version>
<relativePath>../version-matrix</relativePath>
</parent>
Modified: ri/branches/1.0.0.PREVIEW5/pom.xml
===================================================================
--- ri/branches/1.0.0.PREVIEW5/pom.xml 2009-10-07 18:51:39 UTC (rev 3870)
+++ ri/branches/1.0.0.PREVIEW5/pom.xml 2009-10-07 19:55:47 UTC (rev 3871)
@@ -3,7 +3,7 @@
<groupId>org.jboss.webbeans</groupId>
<artifactId>webbeans-build-aggregator</artifactId>
<packaging>pom</packaging>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0.PREVIEW5</version>
<name>Web Beans Build Aggregator</name>
<url>http://www.seamframework.org/WebBeans</url>
@@ -56,10 +56,10 @@
<module>core-api</module>
<module>logging</module>
<module>impl</module>
- <module>tests</module>
- <module>porting-package</module>
- <module>inject-tck-runner</module>
- <module>jboss-tck-runner</module>
+<!-- <module>tests</module> -->
+<!-- <module>porting-package</module> -->
+<!-- <module>inject-tck-runner</module> -->
+<!-- <module>jboss-tck-runner</module> -->
<module>osgi-bundle</module>
</modules>
</profile>
Modified: ri/branches/1.0.0.PREVIEW5/porting-package/pom.xml
===================================================================
--- ri/branches/1.0.0.PREVIEW5/porting-package/pom.xml 2009-10-07 18:51:39 UTC (rev 3870)
+++ ri/branches/1.0.0.PREVIEW5/porting-package/pom.xml 2009-10-07 19:55:47 UTC (rev 3871)
@@ -2,12 +2,12 @@
<parent>
<artifactId>webbeans-parent</artifactId>
<groupId>org.jboss.webbeans</groupId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0.PREVIEW5</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.webbeans</groupId>
<artifactId>webbeans-porting-package</artifactId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0.PREVIEW5</version>
<name>Web Beans Porting Package for JSR-299 TCK</name>
<dependencies>
Modified: ri/branches/1.0.0.PREVIEW5/spi/pom.xml
===================================================================
--- ri/branches/1.0.0.PREVIEW5/spi/pom.xml 2009-10-07 18:51:39 UTC (rev 3870)
+++ ri/branches/1.0.0.PREVIEW5/spi/pom.xml 2009-10-07 19:55:47 UTC (rev 3871)
@@ -2,12 +2,12 @@
<parent>
<artifactId>webbeans-parent</artifactId>
<groupId>org.jboss.webbeans</groupId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0.PREVIEW5</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.webbeans</groupId>
<artifactId>webbeans-spi</artifactId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0.PREVIEW5</version>
<name>Web Beans Service Provider Interfaces</name>
<dependencies>
Modified: ri/branches/1.0.0.PREVIEW5/tests/pom.xml
===================================================================
--- ri/branches/1.0.0.PREVIEW5/tests/pom.xml 2009-10-07 18:51:39 UTC (rev 3870)
+++ ri/branches/1.0.0.PREVIEW5/tests/pom.xml 2009-10-07 19:55:47 UTC (rev 3871)
@@ -2,12 +2,12 @@
<parent>
<artifactId>webbeans-parent</artifactId>
<groupId>org.jboss.webbeans</groupId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0.PREVIEW5</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.webbeans</groupId>
<artifactId>webbeans-core-test</artifactId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0.PREVIEW5</version>
<name>Web Beans Core Tests</name>
<dependencies>
Modified: ri/branches/1.0.0.PREVIEW5/version-matrix/pom.xml
===================================================================
--- ri/branches/1.0.0.PREVIEW5/version-matrix/pom.xml 2009-10-07 18:51:39 UTC (rev 3870)
+++ ri/branches/1.0.0.PREVIEW5/version-matrix/pom.xml 2009-10-07 19:55:47 UTC (rev 3871)
@@ -3,7 +3,7 @@
<groupId>org.jboss.webbeans</groupId>
<artifactId>webbeans-version-matrix</artifactId>
<packaging>pom</packaging>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0.PREVIEW5</version>
<name>Web Beans Version Matrix</name>
<url>http://www.seamframework.org/WebBeans</url>
@@ -47,12 +47,12 @@
</pluginRepositories>
<properties>
- <jsr299.tck.version>1.0.0-SNAPSHOT</jsr299.tck.version>
- <webbeans.version>1.0.0-SNAPSHOT</webbeans.version>
- <webbeans.servlet.version>1.0.0-SNAPSHOT</webbeans.servlet.version>
- <webbeans.se.version>1.0.0-SNAPSHOT</webbeans.se.version>
- <webbeans.wicket.version>1.0.0-SNAPSHOT</webbeans.wicket.version>
- <jboss.test.harness.version>1.0.0-SNAPSHOT</jboss.test.harness.version>
+ <jsr299.tck.version>1.0.0.PREVIEW5</jsr299.tck.version>
+ <webbeans.version>1.0.0.PREVIEW5</webbeans.version>
+ <webbeans.servlet.version>1.0.0.PREVIEW5</webbeans.servlet.version>
+ <webbeans.se.version>1.0.0.PREVIEW5</webbeans.se.version>
+ <webbeans.wicket.version>1.0.0.PREVIEW5</webbeans.wicket.version>
+ <jboss.test.harness.version>1.0.0.PREVIEW5</jboss.test.harness.version>
<jetty.version>6.1.21</jetty.version>
<wicket.version>1.4.1</wicket.version>
</properties>
15 years, 1 month
Weld SVN: r3870 - ri/branches.
by weld-commits@lists.jboss.org
Author: rogerk
Date: 2009-10-07 14:51:39 -0400 (Wed, 07 Oct 2009)
New Revision: 3870
Added:
ri/branches/1.0.0.PREVIEW5/
Log:
1.0.0.PREVIEW5 branch
Copied: ri/branches/1.0.0.PREVIEW5 (from rev 3869, ri/trunk)
15 years, 1 month