[seam-commits] Seam SVN: r14193 - branches/enterprise/JBPAPP_5_1_1_JBPAPP-6925/src/main/org/jboss/seam/security/permission.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Thu Sep 15 11:24:57 EDT 2011


Author: smendenh at redhat.com
Date: 2011-09-15 11:24:56 -0400 (Thu, 15 Sep 2011)
New Revision: 14193

Modified:
   branches/enterprise/JBPAPP_5_1_1_JBPAPP-6925/src/main/org/jboss/seam/security/permission/ClassIdentifierStrategy.java
   branches/enterprise/JBPAPP_5_1_1_JBPAPP-6925/src/main/org/jboss/seam/security/permission/EntityIdentifierStrategy.java
   branches/enterprise/JBPAPP_5_1_1_JBPAPP-6925/src/main/org/jboss/seam/security/permission/IdentifierPolicy.java
   branches/enterprise/JBPAPP_5_1_1_JBPAPP-6925/src/main/org/jboss/seam/security/permission/PermissionMetadata.java
Log:
changes required to make JpaIdentityStore clusterable

Modified: branches/enterprise/JBPAPP_5_1_1_JBPAPP-6925/src/main/org/jboss/seam/security/permission/ClassIdentifierStrategy.java
===================================================================
--- branches/enterprise/JBPAPP_5_1_1_JBPAPP-6925/src/main/org/jboss/seam/security/permission/ClassIdentifierStrategy.java	2011-09-15 14:55:50 UTC (rev 14192)
+++ branches/enterprise/JBPAPP_5_1_1_JBPAPP-6925/src/main/org/jboss/seam/security/permission/ClassIdentifierStrategy.java	2011-09-15 15:24:56 UTC (rev 14193)
@@ -11,7 +11,7 @@
  * 
  * @author Shane Bryzak
  */
-public class ClassIdentifierStrategy implements IdentifierStrategy
+public class ClassIdentifierStrategy implements IdentifierStrategy, java.io.Serializable
 {
    private Map<Class,String> identifierNames = new ConcurrentHashMap<Class,String>();   
    

Modified: branches/enterprise/JBPAPP_5_1_1_JBPAPP-6925/src/main/org/jboss/seam/security/permission/EntityIdentifierStrategy.java
===================================================================
--- branches/enterprise/JBPAPP_5_1_1_JBPAPP-6925/src/main/org/jboss/seam/security/permission/EntityIdentifierStrategy.java	2011-09-15 14:55:50 UTC (rev 14192)
+++ branches/enterprise/JBPAPP_5_1_1_JBPAPP-6925/src/main/org/jboss/seam/security/permission/EntityIdentifierStrategy.java	2011-09-15 15:24:56 UTC (rev 14193)
@@ -19,23 +19,31 @@
  * 
  * @author Shane Bryzak
  */
-public class EntityIdentifierStrategy implements IdentifierStrategy
+public class EntityIdentifierStrategy implements IdentifierStrategy, java.io.Serializable
 {
-   private ValueExpression<EntityManager> entityManager;   
+   private transient ValueExpression<EntityManager> entityManager;   
    
-   private PersistenceProvider persistenceProvider;
+   private transient PersistenceProvider persistenceProvider;
    
    private Map<Class,String> identifierNames = new ConcurrentHashMap<Class,String>();
    
+	public void init()
+	{
+		if (persistenceProvider == null)
+		{
+			persistenceProvider = (PersistenceProvider) Component.getInstance(PersistenceProvider.class, true);
+		}
+
+	    if (entityManager == null)
+	    {
+	    	entityManager = Expressions.instance().createValueExpression("#{entityManager}", EntityManager.class);
+	    }
+		
+	}
+
    public EntityIdentifierStrategy()
    {
-      persistenceProvider = (PersistenceProvider) Component.getInstance(PersistenceProvider.class, true);
-      
-      if (entityManager == null)
-      {
-         entityManager = Expressions.instance().createValueExpression("#{entityManager}", 
-               EntityManager.class);
-      }         
+      init();  
    }
    
    public boolean canIdentify(Class targetClass)
@@ -45,6 +53,7 @@
 
    public String getIdentifier(Object target)
    {
+	  if(persistenceProvider == null) init();
       Object persProviderId = persistenceProvider.getId(target, lookupEntityManager());
       return String.format("%s:%s", getIdentifierName(target.getClass()), persProviderId);
    }
@@ -83,6 +92,7 @@
 
    private EntityManager lookupEntityManager()
    {
+	  if(entityManager == null) init();
       return entityManager.getValue();
    }
 }

Modified: branches/enterprise/JBPAPP_5_1_1_JBPAPP-6925/src/main/org/jboss/seam/security/permission/IdentifierPolicy.java
===================================================================
--- branches/enterprise/JBPAPP_5_1_1_JBPAPP-6925/src/main/org/jboss/seam/security/permission/IdentifierPolicy.java	2011-09-15 14:55:50 UTC (rev 14192)
+++ branches/enterprise/JBPAPP_5_1_1_JBPAPP-6925/src/main/org/jboss/seam/security/permission/IdentifierPolicy.java	2011-09-15 15:24:56 UTC (rev 14193)
@@ -25,7 +25,7 @@
 @Scope(APPLICATION)
 @BypassInterceptors
 @Install(precedence = Install.BUILT_IN)
-public class IdentifierPolicy
+public class IdentifierPolicy implements java.io.Serializable
 {
    private Map<Class,IdentifierStrategy> strategies = new ConcurrentHashMap<Class,IdentifierStrategy>();
    

Modified: branches/enterprise/JBPAPP_5_1_1_JBPAPP-6925/src/main/org/jboss/seam/security/permission/PermissionMetadata.java
===================================================================
--- branches/enterprise/JBPAPP_5_1_1_JBPAPP-6925/src/main/org/jboss/seam/security/permission/PermissionMetadata.java	2011-09-15 14:55:50 UTC (rev 14192)
+++ branches/enterprise/JBPAPP_5_1_1_JBPAPP-6925/src/main/org/jboss/seam/security/permission/PermissionMetadata.java	2011-09-15 15:24:56 UTC (rev 14193)
@@ -17,7 +17,7 @@
  *  
  * @author Shane Bryzak
  */
-public class PermissionMetadata
+public class PermissionMetadata implements java.io.Serializable
 {
    private Map<Class,Boolean> usesActionMask = new HashMap<Class,Boolean>();
    private Map<Class,Map<String,Long>> classActions = new HashMap<Class,Map<String,Long>>();



More information about the seam-commits mailing list