Example usage for org.apache.shiro.cache.ehcache EhCacheManager setCacheManager

List of usage examples for org.apache.shiro.cache.ehcache EhCacheManager setCacheManager

Introduction

In this page you can find the example usage for org.apache.shiro.cache.ehcache EhCacheManager setCacheManager.

Prototype

public void setCacheManager(net.sf.ehcache.CacheManager manager) 

Source Link

Document

Sets the wrapped Ehcache net.sf.ehcache.CacheManager CacheManager instance.

Usage

From source file:com.whatlookingfor.core.config.ShiroConfiguration.java

License:Apache License

/**
 * ??/*from ww  w . j ava  2  s  .  c  om*/
 * @return EhCacheManager
 */
@Bean(name = "shiroCacheManager")
public EhCacheManager shiroCacheManager() {
    EhCacheManager ehCacheManager = new EhCacheManager();
    ehCacheManager.setCacheManager(cacheManager().getObject());
    return ehCacheManager;
}

From source file:org.killbill.billing.util.glue.EhCacheManagerProvider.java

License:Apache License

@Override
public EhCacheManager get() {
    final EhCacheManager shiroEhCacheManager = new EhCacheManager();
    // Same EhCache manager instance as the rest of the system
    shiroEhCacheManager.setCacheManager(ehCacheCacheManager);

    if (securityManager instanceof DefaultSecurityManager) {
        // For RBAC only (see also KillbillJdbcTenantRealmProvider)
        ((DefaultSecurityManager) securityManager).setCacheManager(shiroEhCacheManager);
    }/*from w  w  w. j  a v a  2  s  .c  o m*/

    return shiroEhCacheManager;
}

From source file:org.obiba.mica.security.SecurityManagerFactory.java

License:Open Source License

private void initializeCacheManager(DefaultWebSecurityManager dsm) {
    if (dsm.getCacheManager() == null) {
        EhCacheManager ehCacheManager = new EhCacheManager();
        ehCacheManager.setCacheManager(cacheManager);
        dsm.setCacheManager(ehCacheManager);
    }/*from ww  w . j ava  2s .c om*/
}

From source file:org.owasp.dependencytrack.config.SecurityConfiguration.java

License:Open Source License

public EhCacheManager cacheManager() {
    EhCacheManager ehCacheManager = new EhCacheManager();
    ehCacheManager.setCacheManager(new EhCacheManagerFactoryBean().getObject());
    return ehCacheManager;
}

From source file:org.sonatype.nexus.security.internal.DefaultSecuritySystem.java

License:Open Source License

@Override
public synchronized void start() throws Exception {
    checkState(!started, "Already started");

    log.info("Starting");

    // FIXME: Sort out overlap in responsibility between lifecycle here and RealmManagerImpl
    // FIXME: Wonder if a provider to handle configuration of RealmSecurityManager here is better?

    // prepare security manager
    if (realmSecurityManager instanceof Initializable) {
        ((Initializable) realmSecurityManager).init();
    }// w  w w. ja  v  a  2s . co m

    // prepare shiro cache
    EhCacheManager shiroCacheManager = new EhCacheManager();
    shiroCacheManager.setCacheManager(cacheManager);
    realmSecurityManager.setCacheManager(shiroCacheManager);

    // TODO: Sort out better means to invoke lifecycle here, realm-manager is only here for start/stop now
    realmManager.start();

    started = true;
}

From source file:org.sonatype.security.DefaultSecuritySystem.java

License:Open Source License

public synchronized void start() {
    if (started) {
        throw new IllegalStateException(
                getClass().getName() + " was already started, same instance is not re-startable!");
    }// w w w . j a  v  a2  s  .c  om
    // reload the config
    this.securityConfiguration.clearCache();

    // setup the CacheManager ( this could be injected if we where less coupled with ehcache)
    // The plexus wrapper can interpolate the config
    EhCacheManager ehCacheManager = new EhCacheManager();
    ehCacheManager.setCacheManager(cacheManager);
    this.getSecurityManager().setCacheManager(ehCacheManager);

    if (org.apache.shiro.util.Initializable.class.isInstance(this.getSecurityManager())) {
        ((org.apache.shiro.util.Initializable) this.getSecurityManager()).init();
    }
    this.setSecurityManagerRealms();
    started = true;
}