[seam-commits] Seam SVN: r11300 - in modules/trunk: drools/src/main/java/org/jboss/seam/drools and 6 other directories.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Tue Jul 21 15:15:50 EDT 2009


Author: norman.richards at jboss.com
Date: 2009-07-21 15:15:49 -0400 (Tue, 21 Jul 2009)
New Revision: 11300

Modified:
   modules/trunk/beans/src/main/java/org/jboss/seam/beans/BeanManagerHelper.java
   modules/trunk/drools/src/main/java/org/jboss/seam/drools/ManagedWorkingMemory.java
   modules/trunk/faces/src/main/java/org/jboss/seam/faces/application/SeamViewHandler.java
   modules/trunk/faces/src/main/java/org/jboss/seam/faces/el/SeamFacesELResolver.java
   modules/trunk/faces/src/main/java/org/jboss/seam/faces/lifecycle/SeamPhaseListener.java
   modules/trunk/faces/src/main/java/org/jboss/seam/faces/lifecycle/SeamPreRenderViewListener.java
   modules/trunk/security/src/main/java/org/jboss/seam/security/Identity.java
   modules/trunk/security/src/main/java/org/jboss/seam/security/JpaTokenStore.java
   modules/trunk/security/src/main/java/org/jboss/seam/security/RememberMe.java
   modules/trunk/security/src/main/java/org/jboss/seam/security/SecurityEventMessages.java
   modules/trunk/security/src/main/java/org/jboss/seam/security/SecurityInterceptor.java
   modules/trunk/security/src/main/java/org/jboss/seam/security/management/IdentityManager.java
   modules/trunk/security/src/main/java/org/jboss/seam/security/management/JpaIdentityStore.java
   modules/trunk/security/src/main/java/org/jboss/seam/security/permission/EntityIdentifierStrategy.java
   modules/trunk/security/src/main/java/org/jboss/seam/security/permission/JpaPermissionStore.java
   modules/trunk/security/src/main/java/org/jboss/seam/security/permission/PermissionMapper.java
   modules/trunk/security/src/main/java/org/jboss/seam/security/permission/PersistentPermissionResolver.java
   modules/trunk/security/src/main/java/org/jboss/seam/security/permission/RuleBasedPermissionResolver.java
Log:
yet more compile fixes

Modified: modules/trunk/beans/src/main/java/org/jboss/seam/beans/BeanManagerHelper.java
===================================================================
--- modules/trunk/beans/src/main/java/org/jboss/seam/beans/BeanManagerHelper.java	2009-07-21 07:33:58 UTC (rev 11299)
+++ modules/trunk/beans/src/main/java/org/jboss/seam/beans/BeanManagerHelper.java	2009-07-21 19:15:49 UTC (rev 11300)
@@ -19,4 +19,16 @@
        return instance;
     }
     
+    
+    public static Object getInstanceByName(BeanManager manager, String name) {
+        Set<Bean<?>> beans = manager.getBeans(name);
+        if (beans.size()>0) {
+            if (beans.size()>1) {
+                throw new IllegalStateException("unable to uniquely resolve " + name);                    
+            }
+            return manager.getMostSpecializedBean(beans.iterator().next());
+        }
+        return null;
+    }
+    
 }

Modified: modules/trunk/drools/src/main/java/org/jboss/seam/drools/ManagedWorkingMemory.java
===================================================================
--- modules/trunk/drools/src/main/java/org/jboss/seam/drools/ManagedWorkingMemory.java	2009-07-21 07:33:58 UTC (rev 11299)
+++ modules/trunk/drools/src/main/java/org/jboss/seam/drools/ManagedWorkingMemory.java	2009-07-21 19:15:49 UTC (rev 11300)
@@ -1,15 +1,18 @@
 package org.jboss.seam.drools;
 
 import java.io.Serializable;
+import java.util.Set;
 
 import javax.annotation.PreDestroy;
 import javax.enterprise.context.ConversationScoped;
 import javax.enterprise.inject.Current;
 import javax.enterprise.inject.Produces;
+import javax.enterprise.inject.spi.Bean;
 import javax.enterprise.inject.spi.BeanManager;
 
 import org.drools.RuleBase;
 import org.drools.StatefulSession;
+import org.drools.rule.Rule;
 import org.drools.spi.GlobalResolver;
 import org.jboss.seam.el.Expressions.ValueExpression;
 
@@ -73,15 +76,19 @@
 
    protected RuleBase getRuleBaseFromValueBinding()
    {
-      RuleBase ruleBase;
+      RuleBase ruleBase = null;
       if (this.ruleBase!=null)
       {
          ruleBase = this.ruleBase.getValue();
       }
       else if (ruleBaseName!=null)
       {
-         //deprecated stuff
-         ruleBase = (RuleBase) manager.getInstanceByName(ruleBaseName);
+         Set<Bean<?>> beans = manager.getBeans(ruleBaseName);
+         if (beans.size() == 1) {
+             //deprecated stuff
+             Bean<?> bean = beans.iterator().next();
+             ruleBase = (RuleBase) manager.getReference(bean, RuleBase.class, manager.createCreationalContext(bean));
+         }
       }
       else
       {

Modified: modules/trunk/faces/src/main/java/org/jboss/seam/faces/application/SeamViewHandler.java
===================================================================
--- modules/trunk/faces/src/main/java/org/jboss/seam/faces/application/SeamViewHandler.java	2009-07-21 07:33:58 UTC (rev 11299)
+++ modules/trunk/faces/src/main/java/org/jboss/seam/faces/application/SeamViewHandler.java	2009-07-21 19:15:49 UTC (rev 11300)
@@ -7,6 +7,7 @@
 import javax.faces.application.ViewHandlerWrapper;
 import javax.faces.context.FacesContext;
 
+import org.jboss.seam.beans.BeanManagerHelper;
 import org.jboss.seam.bridge.ManagerBridge;
 import org.jboss.seam.faces.lifecycle.ConvertStatusMessagesProcessor;
 
@@ -46,7 +47,8 @@
       if (context.getExternalContext().getSession(false) != null)
       {
          // QUESTION hmmm, we have to convert to faces messages now to leverage JSF's flash feature...I suppose that is okay
-         ManagerBridge.getProvider().getCurrentManager().getInstanceByType(ConvertStatusMessagesProcessor.class).execute();
+         BeanManagerHelper.getInstanceByType(ManagerBridge.getProvider().getCurrentManager(), 
+                 ConvertStatusMessagesProcessor.class).execute();
          // should I move this next step into TransferStatusMessagesListener?
          if (context.getMessages().hasNext())
          {

Modified: modules/trunk/faces/src/main/java/org/jboss/seam/faces/el/SeamFacesELResolver.java
===================================================================
--- modules/trunk/faces/src/main/java/org/jboss/seam/faces/el/SeamFacesELResolver.java	2009-07-21 07:33:58 UTC (rev 11299)
+++ modules/trunk/faces/src/main/java/org/jboss/seam/faces/el/SeamFacesELResolver.java	2009-07-21 19:15:49 UTC (rev 11300)
@@ -113,7 +113,8 @@
          if (beans.size() == 1)
          {
             context.setPropertyResolved(true);
-            return manager.getInstance(beans.iterator().next());
+            Bean<?> bean = beans.iterator().next();
+            return manager.getReference(bean, Object.class, manager.createCreationalContext(bean));
          }
       }
       

Modified: modules/trunk/faces/src/main/java/org/jboss/seam/faces/lifecycle/SeamPhaseListener.java
===================================================================
--- modules/trunk/faces/src/main/java/org/jboss/seam/faces/lifecycle/SeamPhaseListener.java	2009-07-21 07:33:58 UTC (rev 11299)
+++ modules/trunk/faces/src/main/java/org/jboss/seam/faces/lifecycle/SeamPhaseListener.java	2009-07-21 19:15:49 UTC (rev 11300)
@@ -4,6 +4,7 @@
 import javax.faces.event.PhaseId;
 import javax.faces.event.PhaseListener;
 
+import org.jboss.seam.beans.BeanManagerHelper;
 import org.jboss.seam.bridge.ManagerBridge;
 
 /**
@@ -32,7 +33,7 @@
 
    protected ManagedSeamPhaseListener getDelegate()
    {
-      return ManagerBridge.getProvider().getCurrentManager().getInstanceByType(ManagedSeamPhaseListener.class);
+      return BeanManagerHelper.getInstanceByType(ManagerBridge.getProvider().getCurrentManager(),ManagedSeamPhaseListener.class);
    }
 
 }

Modified: modules/trunk/faces/src/main/java/org/jboss/seam/faces/lifecycle/SeamPreRenderViewListener.java
===================================================================
--- modules/trunk/faces/src/main/java/org/jboss/seam/faces/lifecycle/SeamPreRenderViewListener.java	2009-07-21 07:33:58 UTC (rev 11299)
+++ modules/trunk/faces/src/main/java/org/jboss/seam/faces/lifecycle/SeamPreRenderViewListener.java	2009-07-21 19:15:49 UTC (rev 11300)
@@ -9,6 +9,7 @@
 import javax.faces.event.SystemEvent;
 import javax.faces.event.SystemEventListener;
 
+import org.jboss.seam.beans.BeanManagerHelper;
 import org.jboss.seam.bridge.ManagerBridge;
 
 /**
@@ -47,7 +48,7 @@
       BeanManager manager = ManagerBridge.getProvider().getCurrentManager();
       for (Class<? extends FacesSystemEventProcessor> processorType : processorTypes)
       {
-         boolean result = manager.getInstanceByType(processorType).execute();
+         boolean result = BeanManagerHelper.getInstanceByType(manager, processorType).execute();
          if (!result)
          {
             break;

Modified: modules/trunk/security/src/main/java/org/jboss/seam/security/Identity.java
===================================================================
--- modules/trunk/security/src/main/java/org/jboss/seam/security/Identity.java	2009-07-21 07:33:58 UTC (rev 11299)
+++ modules/trunk/security/src/main/java/org/jboss/seam/security/Identity.java	2009-07-21 19:15:49 UTC (rev 11300)
@@ -27,6 +27,7 @@
 import javax.security.auth.login.LoginContext;
 import javax.security.auth.login.LoginException;
 
+import org.jboss.seam.beans.BeanManagerHelper;
 import org.jboss.seam.el.Expressions;
 import org.jboss.seam.security.callbacks.AuthenticatorCallback;
 import org.jboss.seam.security.callbacks.IdentityCallback;
@@ -115,7 +116,7 @@
     */
    public boolean tryLogin()
    {
-      RequestSecurityState state = manager.getInstanceByType(RequestSecurityState.class);
+      RequestSecurityState state = BeanManagerHelper.getInstanceByType(manager, RequestSecurityState.class);
       
       if (!authenticating && getPrincipal() == null && credentials.isSet() && !state.isLoginTried())
       {
@@ -212,7 +213,7 @@
             // If authentication has already occurred during this request via a silent login,
             // and login() is explicitly called then we still want to raise the LOGIN_SUCCESSFUL event,
             // and then return.
-            RequestSecurityState state = manager.getInstanceByType(RequestSecurityState.class);
+            RequestSecurityState state = BeanManagerHelper.getInstanceByType(manager, RequestSecurityState.class);
             if (state.isSilentLogin())
             {
                manager.fireEvent(new LoggedInEvent(principal));
@@ -271,7 +272,7 @@
             {
                authenticate();
                
-               RequestSecurityState state = manager.getInstanceByType(RequestSecurityState.class);
+               RequestSecurityState state = BeanManagerHelper.getInstanceByType(manager, RequestSecurityState.class);
                if (isLoggedIn())
                {
                   state.setSilentLogin(true);
@@ -384,8 +385,9 @@
                   createCallbackHandler());
       }
       
-      Bean<Configuration> configBean = manager.getBeans(Configuration.class).iterator().next();
-      Configuration config = manager.getInstance(configBean);
+      @SuppressWarnings("unchecked")
+      Bean<Configuration> configBean = (Bean<Configuration>) manager.getBeans(Configuration.class).iterator().next();
+      Configuration config = (Configuration) manager.getReference(configBean, Configuration.class, manager.createCreationalContext(configBean));
       
       return new LoginContext(JaasConfiguration.DEFAULT_JAAS_CONFIG_NAME, getSubject(),
             createCallbackHandler(), config);
@@ -400,13 +402,14 @@
    {
       final Identity identity = this;
       final Authenticator authenticator;
-      final IdentityManager identityManager = manager.getInstanceByType(IdentityManager.class);
+      final IdentityManager identityManager = BeanManagerHelper.getInstanceByType(manager, IdentityManager.class);
       
-      Set<Bean<Authenticator>> authenticators = manager.getBeans(Authenticator.class);
+      Set<Bean<?>> authenticators = manager.getBeans(Authenticator.class);
       if (authenticators.size() == 1)
       {
-         Bean<Authenticator> authenticatorBean = authenticators.iterator().next();
-         authenticator = manager.getInstance(authenticatorBean);
+         @SuppressWarnings("unchecked")
+         Bean<Authenticator> authenticatorBean = (Bean<Authenticator>) authenticators.iterator().next();
+         authenticator = (Authenticator) manager.getReference(authenticatorBean, Authenticator.class, manager.createCreationalContext(authenticatorBean));
       }
       else if (authenticators.size() > 1)
       {

Modified: modules/trunk/security/src/main/java/org/jboss/seam/security/JpaTokenStore.java
===================================================================
--- modules/trunk/security/src/main/java/org/jboss/seam/security/JpaTokenStore.java	2009-07-21 07:33:58 UTC (rev 11299)
+++ modules/trunk/security/src/main/java/org/jboss/seam/security/JpaTokenStore.java	2009-07-21 19:15:49 UTC (rev 11300)
@@ -10,6 +10,7 @@
 import javax.persistence.NoResultException;
 import javax.persistence.Query;
 
+import org.jboss.seam.beans.BeanManagerHelper;
 import org.jboss.seam.security.annotations.TokenUsername;
 import org.jboss.seam.security.annotations.TokenValue;
 import org.jboss.seam.security.management.IdentityManagementException;
@@ -138,6 +139,6 @@
    
    private EntityManager lookupEntityManager()
    {
-      return manager.getInstanceByType(EntityManager.class);
+      return BeanManagerHelper.getInstanceByType(manager, EntityManager.class);
    }
 }

Modified: modules/trunk/security/src/main/java/org/jboss/seam/security/RememberMe.java
===================================================================
--- modules/trunk/security/src/main/java/org/jboss/seam/security/RememberMe.java	2009-07-21 07:33:58 UTC (rev 11299)
+++ modules/trunk/security/src/main/java/org/jboss/seam/security/RememberMe.java	2009-07-21 19:15:49 UTC (rev 11300)
@@ -12,8 +12,9 @@
 import javax.enterprise.inject.Named;
 import javax.enterprise.inject.spi.Bean;
 import javax.enterprise.inject.spi.BeanManager;
-import javax.event.Observes;
+import javax.enterprise.event.Observes;
 
+import org.jboss.seam.beans.BeanManagerHelper;
 import org.jboss.seam.security.events.CredentialsInitializedEvent;
 import org.jboss.seam.security.events.LoggedOutEvent;
 import org.jboss.seam.security.events.PostAuthenticateEvent;
@@ -66,24 +67,22 @@
    @Initializer
    void create()
    {
-      Bean<ManagedCookie> selectorBean = manager.getBeans(ManagedCookie.class).iterator().next();
-
       if (mode.equals(Mode.usernameOnly))
       {
-         usernameSelector = manager.getInstance(selectorBean);
+         usernameSelector = (ManagedCookie) BeanManagerHelper.getInstanceByType(manager, ManagedCookie.class);
          usernameSelector.setCookieName("org.jboss.seam.security.username");
          usernameSelector.setCookieEnabled(enabled);
       }
       else if (mode.equals(Mode.autoLogin))
       {
-         tokenSelector = manager.getInstance(selectorBean);
+         tokenSelector = (ManagedCookie) BeanManagerHelper.getInstanceByType(manager, ManagedCookie.class);
          tokenSelector.setCookieName("org.jboss.seam.security.authtoken");
          tokenSelector.setCookieEnabled(enabled);
          
          // Default to JpaTokenStore
          if (tokenStore == null)
          {
-            tokenStore = manager.getInstanceByType(JpaTokenStore.class);
+            tokenStore = BeanManagerHelper.getInstanceByType(manager,JpaTokenStore.class);
          }
       }
    }

Modified: modules/trunk/security/src/main/java/org/jboss/seam/security/SecurityEventMessages.java
===================================================================
--- modules/trunk/security/src/main/java/org/jboss/seam/security/SecurityEventMessages.java	2009-07-21 07:33:58 UTC (rev 11299)
+++ modules/trunk/security/src/main/java/org/jboss/seam/security/SecurityEventMessages.java	2009-07-21 19:15:49 UTC (rev 11300)
@@ -2,7 +2,7 @@
 
 import javax.enterprise.context.ApplicationScoped;
 import javax.enterprise.inject.Current;
-import javax.event.Observes;
+import javax.enterprise.event.Observes;
 
 import org.jboss.seam.international.StatusMessages;
 import org.jboss.seam.international.StatusMessage.Severity;

Modified: modules/trunk/security/src/main/java/org/jboss/seam/security/SecurityInterceptor.java
===================================================================
--- modules/trunk/security/src/main/java/org/jboss/seam/security/SecurityInterceptor.java	2009-07-21 07:33:58 UTC (rev 11299)
+++ modules/trunk/security/src/main/java/org/jboss/seam/security/SecurityInterceptor.java	2009-07-21 19:15:49 UTC (rev 11300)
@@ -15,6 +15,7 @@
 import javax.interceptor.Interceptor;
 import javax.interceptor.InvocationContext;
 
+import org.jboss.seam.beans.BeanManagerHelper;
 import org.jboss.seam.security.annotations.PermissionCheck;
 import org.jboss.seam.security.annotations.Restrict;
 import org.jboss.seam.security.annotations.RoleCheck;
@@ -161,7 +162,7 @@
          Restriction restriction = getRestriction(interfaceMethod);
          if ( restriction != null )
          {
-            Identity identity = manager.getInstanceByType(Identity.class);
+            Identity identity = BeanManagerHelper.getInstanceByType(manager, Identity.class);
             restriction.check(identity, invocation.getParameters());
          }
       }

Modified: modules/trunk/security/src/main/java/org/jboss/seam/security/management/IdentityManager.java
===================================================================
--- modules/trunk/security/src/main/java/org/jboss/seam/security/management/IdentityManager.java	2009-07-21 07:33:58 UTC (rev 11299)
+++ modules/trunk/security/src/main/java/org/jboss/seam/security/management/IdentityManager.java	2009-07-21 19:15:49 UTC (rev 11300)
@@ -13,6 +13,7 @@
 import javax.enterprise.inject.spi.Bean;
 import javax.enterprise.inject.spi.BeanManager;
 
+import org.jboss.seam.beans.BeanManagerHelper;
 import org.jboss.seam.security.Identity;
 import org.jboss.seam.security.util.Strings;
 import org.jboss.webbeans.log.Log;
@@ -56,8 +57,7 @@
       // Default to JpaIdentityStore
       if (identityStore == null)
       {
-         Bean<JpaIdentityStore> jpaIdentityStoreBean = manager.getBeans(JpaIdentityStore.class).iterator().next();
-         identityStore = manager.getInstance(jpaIdentityStoreBean);
+         identityStore = BeanManagerHelper.getInstanceByType(manager,JpaIdentityStore.class);
       }
       
       if (roleIdentityStore == null && identityStore != null)

Modified: modules/trunk/security/src/main/java/org/jboss/seam/security/management/JpaIdentityStore.java
===================================================================
--- modules/trunk/security/src/main/java/org/jboss/seam/security/management/JpaIdentityStore.java	2009-07-21 07:33:58 UTC (rev 11299)
+++ modules/trunk/security/src/main/java/org/jboss/seam/security/management/JpaIdentityStore.java	2009-07-21 19:15:49 UTC (rev 11300)
@@ -19,6 +19,7 @@
 import javax.persistence.NoResultException;
 import javax.persistence.PersistenceContext;
 
+import org.jboss.seam.beans.BeanManagerHelper;
 import org.jboss.seam.security.Role;
 import org.jboss.seam.security.SimplePrincipal;
 import org.jboss.seam.security.crypto.BinTools;
@@ -904,6 +905,6 @@
    
    protected PasswordHash getPasswordHash()
    {
-      return manager.getInstanceByType(PasswordHash.class);
+      return BeanManagerHelper.getInstanceByType(manager, PasswordHash.class);
    }
 }

Modified: modules/trunk/security/src/main/java/org/jboss/seam/security/permission/EntityIdentifierStrategy.java
===================================================================
--- modules/trunk/security/src/main/java/org/jboss/seam/security/permission/EntityIdentifierStrategy.java	2009-07-21 07:33:58 UTC (rev 11299)
+++ modules/trunk/security/src/main/java/org/jboss/seam/security/permission/EntityIdentifierStrategy.java	2009-07-21 19:15:49 UTC (rev 11300)
@@ -8,6 +8,7 @@
 import javax.persistence.Entity;
 import javax.persistence.EntityManager;
 
+import org.jboss.seam.beans.BeanManagerHelper;
 import org.jboss.seam.el.Expressions;
 import org.jboss.seam.security.annotations.permission.Identifier;
 import org.jboss.seam.security.util.Strings;
@@ -70,6 +71,6 @@
    private EntityManager lookupEntityManager()
    {
       //return entityManager.getValue();
-      return manager.getInstanceByType(EntityManager.class);
+      return BeanManagerHelper.getInstanceByType(manager, EntityManager.class);
    }
 }

Modified: modules/trunk/security/src/main/java/org/jboss/seam/security/permission/JpaPermissionStore.java
===================================================================
--- modules/trunk/security/src/main/java/org/jboss/seam/security/permission/JpaPermissionStore.java	2009-07-21 07:33:58 UTC (rev 11299)
+++ modules/trunk/security/src/main/java/org/jboss/seam/security/permission/JpaPermissionStore.java	2009-07-21 19:15:49 UTC (rev 11300)
@@ -16,6 +16,7 @@
 import javax.persistence.EntityManager;
 import javax.persistence.Query;
 
+import org.jboss.seam.beans.BeanManagerHelper;
 import org.jboss.seam.security.Role;
 import org.jboss.seam.security.SimplePrincipal;
 import org.jboss.seam.security.annotations.permission.PermissionAction;
@@ -527,8 +528,8 @@
    {
       boolean recipientIsRole = recipient instanceof Role;
          
-      JpaIdentityStore identityStore = manager.getInstanceByType(JpaIdentityStore.class);
-      JpaIdentityStoreConfig config = manager.getInstanceByType(JpaIdentityStoreConfig.class);
+      JpaIdentityStore identityStore = BeanManagerHelper.getInstanceByType(manager, JpaIdentityStore.class);
+      JpaIdentityStoreConfig config = BeanManagerHelper.getInstanceByType(manager, JpaIdentityStoreConfig.class);
       
       if (identityStore != null)
       {
@@ -550,8 +551,8 @@
    {
       identityManager.getRoleIdentityStore();
       
-      JpaIdentityStore identityStore = manager.getInstanceByType(JpaIdentityStore.class);
-      JpaIdentityStoreConfig config = manager.getInstanceByType(JpaIdentityStoreConfig.class);
+      JpaIdentityStore identityStore = BeanManagerHelper.getInstanceByType(manager, JpaIdentityStore.class);
+      JpaIdentityStoreConfig config = BeanManagerHelper.getInstanceByType(manager, JpaIdentityStoreConfig.class);
       
       if (principal instanceof String)
       {
@@ -753,7 +754,7 @@
 
    private EntityManager lookupEntityManager()
    {
-      return manager.getInstanceByType(EntityManager.class);
+      return BeanManagerHelper.getInstanceByType(manager, EntityManager.class);
    }
    
    public Class<?> getUserPermissionClass()

Modified: modules/trunk/security/src/main/java/org/jboss/seam/security/permission/PermissionMapper.java
===================================================================
--- modules/trunk/security/src/main/java/org/jboss/seam/security/permission/PermissionMapper.java	2009-07-21 07:33:58 UTC (rev 11299)
+++ modules/trunk/security/src/main/java/org/jboss/seam/security/permission/PermissionMapper.java	2009-07-21 19:15:49 UTC (rev 11300)
@@ -12,6 +12,7 @@
 import javax.enterprise.inject.spi.Bean;
 import javax.enterprise.inject.spi.BeanManager;
 
+import org.jboss.seam.beans.BeanManagerHelper;
 import org.jboss.seam.security.events.DefaultResolverChainCreatedEvent;
 
 /**
@@ -51,13 +52,13 @@
          Map<String,String> chains = resolverChains.get(target);
          if (chains != null && chains.containsKey(action))
          {
-            return (ResolverChain) manager.getInstanceByName(chains.get(action));
+                return (ResolverChain) BeanManagerHelper.getInstanceByName(manager, chains.get(action));
          }
       }
       
       if (defaultResolverChain != null && !"".equals(defaultResolverChain))
       {
-         return (ResolverChain) manager.getInstanceByName(defaultResolverChain);
+         return (ResolverChain) BeanManagerHelper.getInstanceByName(manager,defaultResolverChain);
       }
       
       return createDefaultResolverChain();
@@ -149,10 +150,10 @@
       {
          chain = new ResolverChain();
          
-         Set<Bean<PermissionResolver>> resolvers = manager.getBeans(PermissionResolver.class);
-         for (Bean<PermissionResolver> resolverBean : resolvers)
+         Set<Bean<?>> resolvers = manager.getBeans(PermissionResolver.class);
+         for (Bean<?> resolverBean :  resolvers)
          {
-            chain.getResolvers().add(manager.getInstance(resolverBean));
+            chain.getResolvers().add((PermissionResolver) manager.getReference(resolverBean, PermissionResolver.class, manager.createCreationalContext(resolverBean)));
          }
          
          // TODO fix

Modified: modules/trunk/security/src/main/java/org/jboss/seam/security/permission/PersistentPermissionResolver.java
===================================================================
--- modules/trunk/security/src/main/java/org/jboss/seam/security/permission/PersistentPermissionResolver.java	2009-07-21 07:33:58 UTC (rev 11299)
+++ modules/trunk/security/src/main/java/org/jboss/seam/security/permission/PersistentPermissionResolver.java	2009-07-21 19:15:49 UTC (rev 11300)
@@ -9,6 +9,7 @@
 import javax.enterprise.inject.Initializer;
 import javax.enterprise.inject.spi.BeanManager;
 
+import org.jboss.seam.beans.BeanManagerHelper;
 import org.jboss.seam.security.Identity;
 import org.jboss.seam.security.Role;
 import org.jboss.seam.security.SimplePrincipal;
@@ -38,7 +39,7 @@
    {
       if (permissionStore == null)
       {
-         permissionStore = manager.getInstanceByType(JpaPermissionStore.class);
+         permissionStore = BeanManagerHelper.getInstanceByType(manager, JpaPermissionStore.class);
       }
       
       if (permissionStore == null)

Modified: modules/trunk/security/src/main/java/org/jboss/seam/security/permission/RuleBasedPermissionResolver.java
===================================================================
--- modules/trunk/security/src/main/java/org/jboss/seam/security/permission/RuleBasedPermissionResolver.java	2009-07-21 07:33:58 UTC (rev 11299)
+++ modules/trunk/security/src/main/java/org/jboss/seam/security/permission/RuleBasedPermissionResolver.java	2009-07-21 19:15:49 UTC (rev 11300)
@@ -13,7 +13,7 @@
 import javax.enterprise.inject.Current;
 import javax.enterprise.inject.Initializer;
 import javax.enterprise.inject.spi.BeanManager;
-import javax.event.Observes;
+import javax.enterprise.event.Observes;
 
 import org.drools.FactHandle;
 import org.drools.RuleBase;



More information about the seam-commits mailing list