directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cp...@apache.org
Subject [3/4] directory-fortress-core git commit: Changed roleutil to just use cache
Date Wed, 09 Mar 2016 20:19:59 GMT
Changed roleutil to just use cache

Project: http://git-wip-us.apache.org/repos/asf/directory-fortress-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/directory-fortress-core/commit/3d51b9cf
Tree: http://git-wip-us.apache.org/repos/asf/directory-fortress-core/tree/3d51b9cf
Diff: http://git-wip-us.apache.org/repos/asf/directory-fortress-core/diff/3d51b9cf

Branch: refs/heads/master
Commit: 3d51b9cfd38e5f2989989ce59e3154a29d4c9a01
Parents: 1cb659c
Author: clp207 <clp207@psu.edu>
Authored: Sun Mar 6 20:27:42 2016 -0500
Committer: clp207 <clp207@psu.edu>
Committed: Wed Mar 9 15:03:41 2016 -0500

----------------------------------------------------------------------
 .../directory/fortress/core/impl/RoleUtil.java  | 27 +++++++++++++++-----
 1 file changed, 21 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/3d51b9cf/src/main/java/org/apache/directory/fortress/core/impl/RoleUtil.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/impl/RoleUtil.java b/src/main/java/org/apache/directory/fortress/core/impl/RoleUtil.java
index cec2653..1749eef 100755
--- a/src/main/java/org/apache/directory/fortress/core/impl/RoleUtil.java
+++ b/src/main/java/org/apache/directory/fortress/core/impl/RoleUtil.java
@@ -23,24 +23,23 @@ package org.apache.directory.fortress.core.impl;
 import java.util.List;
 import java.util.Set;
 import java.util.TreeSet;
-import java.util.concurrent.locks.ReadWriteLock;
 
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.lang.StringUtils;
+import org.apache.directory.fortress.core.GlobalIds;
+import org.apache.directory.fortress.core.SecurityException;
+import org.apache.directory.fortress.core.ValidationException;
 import org.apache.directory.fortress.core.model.Graphable;
 import org.apache.directory.fortress.core.model.Hier;
 import org.apache.directory.fortress.core.model.ParentUtil;
 import org.apache.directory.fortress.core.model.Relationship;
 import org.apache.directory.fortress.core.model.Role;
 import org.apache.directory.fortress.core.model.UserRole;
+import org.apache.directory.fortress.core.util.cache.Cache;
+import org.apache.directory.fortress.core.util.cache.CacheMgr;
 import org.jgrapht.graph.SimpleDirectedGraph;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.apache.directory.fortress.core.GlobalIds;
-import org.apache.directory.fortress.core.SecurityException;
-import org.apache.directory.fortress.core.ValidationException;
-import org.apache.directory.fortress.core.util.cache.Cache;
-import org.apache.directory.fortress.core.util.cache.CacheMgr;
 
 
 /**
@@ -382,6 +381,21 @@ final class RoleUtil implements ParentUtil
      */
     private static SimpleDirectedGraph<String, Relationship> getGraph( String contextId
)
     {
+        String key = getKey( contextId );
+    	
+        SimpleDirectedGraph<String, Relationship> graph = ( SimpleDirectedGraph<String,
Relationship> ) roleCache
+                .get( key );
+    	
+        if(graph == null){
+        	LOG.info("Graph was null, creating...");
+            return loadGraph( contextId );
+        }
+        else{
+            LOG.info("Graph found in cache, retruning...");
+            return graph;
+        }
+    	
+    	/*
         ReadWriteLock hierLock = HierUtil.getLock( contextId, HierUtil.Type.ROLE );
         String key = getKey( contextId );
 
@@ -412,5 +426,6 @@ final class RoleUtil implements ParentUtil
         {
             hierLock.readLock().unlock();
         }
+        */
     }
 }


Mime
View raw message