You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by ta...@apache.org on 2004/06/30 18:11:46 UTC
cvs commit: jakarta-jetspeed-2/components/page-manager/src/java/org/apache/jetspeed/profiler/impl JetspeedProfiler.java
taylor 2004/06/30 09:11:46
Modified: components/page-manager/src/java/org/apache/jetspeed/profiler/impl
JetspeedProfiler.java
Log:
cache principal/rule, temporily until we can introduce a cache component
CVS: ----------------------------------------------------------------------
CVS: PR:
CVS: If this change addresses a PR in the problem report tracking
CVS: database, then enter the PR number(s) here.
CVS: Obtained from:
CVS: If this change has been taken from another system, such as NCSA,
CVS: then name the system in this line, otherwise delete it.
CVS: Submitted by:
CVS: If this code has been contributed to Apache by someone else; i.e.,
CVS: they sent us a patch or a new module, then include their name/email
CVS: address here. If this is your work then delete this line.
CVS: Reviewed by:
CVS: If we are doing pre-commit code reviews and someone else has
CVS: reviewed your changes, include their name(s) here.
CVS: If you have not had it reviewed then delete this line.
Revision Changes Path
1.2 +12 -4 jakarta-jetspeed-2/components/page-manager/src/java/org/apache/jetspeed/profiler/impl/JetspeedProfiler.java
Index: JetspeedProfiler.java
===================================================================
RCS file: /home/cvs/jakarta-jetspeed-2/components/page-manager/src/java/org/apache/jetspeed/profiler/impl/JetspeedProfiler.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- JetspeedProfiler.java 28 May 2004 22:05:08 -0000 1.1
+++ JetspeedProfiler.java 30 Jun 2004 16:11:46 -0000 1.2
@@ -17,7 +17,9 @@
import java.security.Principal;
import java.util.Collection;
+import java.util.HashMap;
import java.util.Iterator;
+import java.util.Map;
import java.util.Properties;
import javax.security.auth.Subject;
@@ -69,6 +71,8 @@
private String anonymousUser = "anon";
PersistenceStore persistentStore;
+
+ private Map principalRules = new HashMap();
public JetspeedProfiler(PersistenceStore persistentStore, PageManager pageManager)
{
@@ -215,12 +219,16 @@
*/
private PrincipalRule lookupPrincipalRule(String principal)
{
- // TODO: implement caching
-
+ PrincipalRule pr = (PrincipalRule)principalRules.get(principal);
+ if (pr != null)
+ {
+ return pr;
+ }
Filter filter = persistentStore.newFilter();
filter.addEqualTo("principalName", principal);
Object query = persistentStore.newQuery(principalRuleClass, filter);
- PrincipalRule pr = (PrincipalRule) persistentStore.getObjectByQuery(query);
+ pr = (PrincipalRule) persistentStore.getObjectByQuery(query);
+ principalRules.put(principal, pr);
return pr;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org