Skip to content

Commit

Permalink
WELD-567
Browse files Browse the repository at this point in the history
  • Loading branch information
pmuir committed Aug 5, 2010
1 parent acb6172 commit c00e3ad
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
Expand Up @@ -18,9 +18,11 @@

import static org.jboss.weld.logging.messages.BeanMessage.BEAN_NOT_EE_RESOURCE_PRODUCER;
import static org.jboss.weld.logging.messages.BeanMessage.INVALID_RESOURCE_PRODUCER_FIELD;
import static org.jboss.weld.logging.messages.BeanMessage.NON_DEPENDENT_RESOURCE_PRODUCER_FIELD;

import java.io.Serializable;

import javax.enterprise.context.Dependent;
import javax.enterprise.context.spi.Contextual;
import javax.enterprise.context.spi.CreationalContext;

Expand All @@ -33,6 +35,7 @@
import org.jboss.weld.bean.proxy.ProxyFactory;
import org.jboss.weld.bootstrap.BeanDeployerEnvironment;
import org.jboss.weld.ejb.EJBApiAbstraction;
import org.jboss.weld.exceptions.DefinitionException;
import org.jboss.weld.exceptions.IllegalStateException;
import org.jboss.weld.introspector.WeldField;
import org.jboss.weld.manager.BeanManagerImpl;
Expand Down Expand Up @@ -121,6 +124,10 @@ public void initialize(BeanDeployerEnvironment environment)

protected void checkEEResource()
{
if (!getScope().equals(Dependent.class))
{
throw new DefinitionException(NON_DEPENDENT_RESOURCE_PRODUCER_FIELD, this);
}
EJBApiAbstraction ejbApiAbstraction = beanManager.getServices().get(EJBApiAbstraction.class);
PersistenceApiAbstraction persistenceApiAbstraction = beanManager.getServices().get(PersistenceApiAbstraction.class);
WSApiAbstraction wsApiAbstraction = beanManager.getServices().get(WSApiAbstraction.class);
Expand Down
Expand Up @@ -136,6 +136,7 @@ public enum BeanMessage
@MessageId("000098") PRODUCER_METHOD_WITH_WILDCARD_RETURN_TYPE_MUST_BE_DEPENDENT,
@MessageId("000099") CANNOT_LOAD_CLASS,
@MessageId("001500") PROXY_DESERIALIZATION_FAILURE,
@MessageId("001501") BEAN_INSTANCE_NOT_SET_ON_PROXY;
@MessageId("001501") BEAN_INSTANCE_NOT_SET_ON_PROXY,
@MessageId("001502") NON_DEPENDENT_RESOURCE_PRODUCER_FIELD;

}
Expand Up @@ -100,3 +100,4 @@ PRODUCER_METHOD_WITH_WILDCARD_RETURN_TYPE_MUST_BE_DEPENDENT=A producer method wi
CANNOT_LOAD_CLASS=Cannot load class {0} during deserialization of proxy
PROXY_DESERIALIZATION_FAILURE=Failed to deserialize proxy object
BEAN_INSTANCE_NOT_SET_ON_PROXY=Method call requires a BeanInstance which has not been set for this proxy
NON_DEPENDENT_RESOURCE_PRODUCER_FIELD=Resource producer field [{0}] must be @Dependent scoped

0 comments on commit c00e3ad

Please sign in to comment.