SecurityCurrent.java

00001 
00029 package org.objectweb.security.context;
00030 
00035 public class SecurityCurrent {
00036 
00040     private static InheritableThreadLocal threadCtx;
00041 
00045     private static SecurityContext sctx = null;
00046 
00050     static {
00051         threadCtx = new InheritableThreadLocal();
00052         threadCtx.set(new SecurityContext());
00053     }
00054 
00058     private static SecurityCurrent current = new SecurityCurrent();
00059 
00064     public static SecurityCurrent getCurrent() {
00065         return current;
00066     }
00067 
00072     public void setSecurityContext(SecurityContext ctx) {
00073         threadCtx.set(ctx);
00074     }
00075 
00080     public void setGlobalSecurityContext(SecurityContext ctx) {
00081         sctx = ctx;
00082     }
00083 
00089     public SecurityContext getSecurityContext() {
00090         if (sctx != null) {
00091             return sctx;
00092         } else {
00093             return (SecurityContext) threadCtx.get();
00094         }
00095     }
00096 
00097 }

Generated on Tue Feb 15 15:06:03 2005 for JOnAS by  doxygen 1.3.9.1