Search in sources :

Example 1 with IElementAttributes

use of org.apache.jcs.engine.behavior.IElementAttributes in project nhin-d by DirectProject.

the class CertCacheFactory method applyCachePolicy.

/*
	 * Apply a policy to the cache
	 */
private void applyCachePolicy(JCS cache, CertStoreCachePolicy policy) throws CacheException {
    ICompositeCacheAttributes attributes = cache.getCacheAttributes();
    attributes.setMaxObjects(policy.getMaxItems());
    attributes.setUseLateral(false);
    attributes.setUseRemote(false);
    cache.setCacheAttributes(attributes);
    IElementAttributes eattributes = cache.getDefaultElementAttributes();
    eattributes.setMaxLifeSeconds(policy.getSubjectTTL());
    eattributes.setIsEternal(false);
    eattributes.setIsLateral(false);
    eattributes.setIsRemote(false);
    cache.setDefaultElementAttributes(eattributes);
}
Also used : ICompositeCacheAttributes(org.apache.jcs.engine.behavior.ICompositeCacheAttributes) IElementAttributes(org.apache.jcs.engine.behavior.IElementAttributes)

Example 2 with IElementAttributes

use of org.apache.jcs.engine.behavior.IElementAttributes in project nhin-d by DirectProject.

the class CacheableKeyStoreManagerCertificateStore method applyCachePolicy.

private void applyCachePolicy(CertStoreCachePolicy policy) {
    if (getCache() != null) {
        try {
            ICompositeCacheAttributes attributes = cache.getCacheAttributes();
            attributes.setMaxObjects(policy.getMaxItems());
            attributes.setUseLateral(false);
            attributes.setUseRemote(false);
            cache.setCacheAttributes(attributes);
            IElementAttributes eattributes = cache.getDefaultElementAttributes();
            eattributes.setMaxLifeSeconds(policy.getSubjectTTL());
            eattributes.setIsEternal(false);
            eattributes.setIsLateral(false);
            eattributes.setIsRemote(false);
            cache.setDefaultElementAttributes(eattributes);
        } catch (CacheException e) {
        // no-op
        }
    }
}
Also used : CacheException(org.apache.jcs.access.exception.CacheException) ICompositeCacheAttributes(org.apache.jcs.engine.behavior.ICompositeCacheAttributes) IElementAttributes(org.apache.jcs.engine.behavior.IElementAttributes)

Example 3 with IElementAttributes

use of org.apache.jcs.engine.behavior.IElementAttributes in project nhin-d by DirectProject.

the class DNSCertificateStore method applyCachePolicy.

private void applyCachePolicy(CertStoreCachePolicy policy) {
    if (getCache() != null) {
        try {
            ICompositeCacheAttributes attributes = cache.getCacheAttributes();
            attributes.setMaxObjects(policy.getMaxItems());
            attributes.setUseLateral(false);
            attributes.setUseRemote(false);
            cache.setCacheAttributes(attributes);
            IElementAttributes eattributes = cache.getDefaultElementAttributes();
            eattributes.setMaxLifeSeconds(policy.getSubjectTTL());
            eattributes.setIsEternal(false);
            eattributes.setIsLateral(false);
            eattributes.setIsRemote(false);
            cache.setDefaultElementAttributes(eattributes);
        } catch (CacheException e) {
        // TODO: Handle exception
        }
    }
}
Also used : CacheException(org.apache.jcs.access.exception.CacheException) ICompositeCacheAttributes(org.apache.jcs.engine.behavior.ICompositeCacheAttributes) IElementAttributes(org.apache.jcs.engine.behavior.IElementAttributes)

Example 4 with IElementAttributes

use of org.apache.jcs.engine.behavior.IElementAttributes in project nhin-d by DirectProject.

the class ConfigServiceCertificateStore method applyCachePolicy.

private void applyCachePolicy(CertStoreCachePolicy policy) {
    if (getCache() != null) {
        try {
            ICompositeCacheAttributes attributes = cache.getCacheAttributes();
            attributes.setMaxObjects(policy.getMaxItems());
            attributes.setUseLateral(false);
            attributes.setUseRemote(false);
            cache.setCacheAttributes(attributes);
            IElementAttributes eattributes = cache.getDefaultElementAttributes();
            eattributes.setMaxLifeSeconds(policy.getSubjectTTL());
            eattributes.setIsEternal(false);
            eattributes.setIsLateral(false);
            eattributes.setIsRemote(false);
            cache.setDefaultElementAttributes(eattributes);
        } catch (CacheException e) {
        // TODO: Handle exception
        }
    }
}
Also used : CacheException(org.apache.jcs.access.exception.CacheException) ICompositeCacheAttributes(org.apache.jcs.engine.behavior.ICompositeCacheAttributes) IElementAttributes(org.apache.jcs.engine.behavior.IElementAttributes)

Example 5 with IElementAttributes

use of org.apache.jcs.engine.behavior.IElementAttributes in project nhin-d by DirectProject.

the class ConfigServiceRESTCertificateStore method applyCachePolicy.

private void applyCachePolicy(CertStoreCachePolicy policy) {
    if (getCache() != null) {
        try {
            ICompositeCacheAttributes attributes = cache.getCacheAttributes();
            attributes.setMaxObjects(policy.getMaxItems());
            attributes.setUseLateral(false);
            attributes.setUseRemote(false);
            cache.setCacheAttributes(attributes);
            IElementAttributes eattributes = cache.getDefaultElementAttributes();
            eattributes.setMaxLifeSeconds(policy.getSubjectTTL());
            eattributes.setIsEternal(false);
            eattributes.setIsLateral(false);
            eattributes.setIsRemote(false);
            cache.setDefaultElementAttributes(eattributes);
        } catch (CacheException e) {
        // TODO: Handle exception
        }
    }
}
Also used : CacheException(org.apache.jcs.access.exception.CacheException) ICompositeCacheAttributes(org.apache.jcs.engine.behavior.ICompositeCacheAttributes) IElementAttributes(org.apache.jcs.engine.behavior.IElementAttributes)

Aggregations

ICompositeCacheAttributes (org.apache.jcs.engine.behavior.ICompositeCacheAttributes)6 IElementAttributes (org.apache.jcs.engine.behavior.IElementAttributes)6 CacheException (org.apache.jcs.access.exception.CacheException)5