Package org.jboss.util

Examples of org.jboss.util.CachePolicy


    * @param instance the SecurityDomain instance to bind
    */
   public synchronized void registerSecurityDomain(String securityDomain, SecurityDomain instance)
   {
      log.debug("Added "+securityDomain+", "+instance+" to map");
      CachePolicy authCache = lookupCachePolicy(securityDomain);
      SecurityDomainContext sdc = new SecurityDomainContext(instance, authCache);
      securityDomainCtxMap.put(securityDomain, sdc);
      // See if the security mgr supports an externalized cache policy
      setSecurityDomainCache(instance, authCache);
   }
View Full Code Here


    */
   private static CachePolicy getCachePolicy(String securityDomain)
   {
      if( securityDomain.startsWith(SECURITY_MGR_PATH) )
         securityDomain = securityDomain.substring(SECURITY_MGR_PATH.length()+1);
      CachePolicy cache = null;
      try
      {
         SecurityDomainContext sdc = lookupSecurityDomain(securityDomain);
         if( sdc != null )
            cache = sdc.getAuthenticationCache();
View Full Code Here

    looking up the CachePolicy for a domain. If this fails then the cacheJndiName
    location is treated as a single CachePolicy for all security domains.
    */
   private static CachePolicy lookupCachePolicy(String securityDomain)
   {
      CachePolicy authCache = null;
      String domainCachePath = cacheJndiName + '/' + securityDomain;
      try
      {
         InitialContext iniCtx = new InitialContext();
         authCache = (CachePolicy) iniCtx.lookup(domainCachePath);
View Full Code Here

         Constructor ctor = securityMgrClass.getConstructor(parameterTypes);
         CallbackHandler handler = (CallbackHandler) callbackHandlerClass.newInstance();
         Object[] args = {securityDomain, handler};
         AuthenticationManager securityMgr = (AuthenticationManager) ctor.newInstance(args);
         log.debug("Created securityMgr="+securityMgr);
         CachePolicy cachePolicy = lookupCachePolicy(securityDomain);
         sdc = new SecurityDomainContext(securityMgr, cachePolicy);
         // See if the security mgr supports an externalized cache policy
         setSecurityDomainCache(securityMgr, cachePolicy);
         if(deepCopySubjectMode)
            setDeepCopySubjectOption(securityMgr, true);
View Full Code Here

      byte[] clientChallenge = (byte[]) args[1];

      try
      {
         InitialContext iniCtx = new InitialContext();
         CachePolicy cache = (CachePolicy) iniCtx.lookup(cacheJndiName);
         SRPSessionKey key;
         if (userPrincipal instanceof SRPPrincipal)
         {
            SRPPrincipal srpPrincpal = (SRPPrincipal) userPrincipal;
            key = new SRPSessionKey(username, srpPrincpal.getSessionID());
         }
         else
         {
            key = new SRPSessionKey(username);
         }
         Object cacheCredential = cache.get(key);
         if (cacheCredential == null)
         {
            throw new SecurityException("No SRP session found for: " + key);
         }
         log.debug("Found SRP cache credential: " + cacheCredential);
View Full Code Here

      return initializer;
   }
  
   public CtClassCache createCache()
   {
      CachePolicy policy = null;
      if (policyClass == TimedCachePolicy.class)
         policy = new TimedCachePolicy(lifetime, true, resolution);
      else if (policyClass == LRUCachePolicy.class)
         policy = new LRUCachePolicy(min, max);
      else
      {
         try
         {
            policy = policyClass.newInstance();
         }
         catch(Exception e)
         {
            throw new IllegalStateException("Could not instantiate " + policyClass.getName(), e);
         }
      }
   
      try
      {
         policy.create();
         policy.start();
      }
      catch(Exception e)
      {
         throw new IllegalStateException("Error starting domain cache", e);
      }
View Full Code Here

      synchronized (getCacheLock())
      {
         BeanCacheSnapshot snapshot = (BeanCacheSnapshot)s;
         snapshot.m_passivatingBeans = 0;
         CachePolicy policy = getCache();
         if (policy instanceof Monitorable)
         {
            ((Monitorable)policy).sample(s);
         }
      }
View Full Code Here

      EnterpriseContext ctx;

      synchronized (getCacheLock())
      {
         CachePolicy cache = getCache();
         ctx = (EnterpriseContext)cache.get(id);
         if (ctx == null)
         {
            try
            {
               ctx = acquireContext();
               setKey(id, ctx);
               if (doActivate(ctx) == false)
                  // This is a recursive activation
                  return ctx;
               logActivation(id);
               // the cache will throw an IllegalStateException if we try to insert
               // something that is in the cache already, so we don't check here
               cache.insert(id, ctx);
            }
            catch (Throwable x)
            {
               log.debug("Activation failure", x);
               throw new NoSuchObjectException(x.getMessage());
View Full Code Here

/* 270 */         log.trace("SetCacheTimeOut:Failed to look up SecurityDomainCtx:" + securityDomain);
/*     */       }
/*     */     }
/* 273 */     if (securityDomainCtx != null)
/*     */     {
/* 275 */       CachePolicy cache = securityDomainCtx.getAuthenticationCache();
/* 276 */       if ((cache != null) && ((cache instanceof TimedCachePolicy)))
/*     */       {
/* 278 */         TimedCachePolicy tcp = (TimedCachePolicy)cache;
/* 279 */         synchronized (tcp)
/*     */         {
View Full Code Here

/* 266 */     SecurityConfiguration.setDeepCopySubjectMode(flag);
/*     */   }
/*     */
/*     */   public void setCacheTimeout(String securityDomain, int timeoutInSecs, int resInSecs)
/*     */   {
/* 279 */     CachePolicy cache = getCachePolicy(securityDomain);
/* 280 */     if ((cache != null) && ((cache instanceof TimedCachePolicy)))
/*     */     {
/* 282 */       TimedCachePolicy tcp = (TimedCachePolicy)cache;
/* 283 */       synchronized (tcp)
/*     */       {
View Full Code Here

TOP

Related Classes of org.jboss.util.CachePolicy

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.