re-added accidental removal of Ehcache-backed impl
This commit is contained in:
Scott Battaglia 2009-10-14 15:59:51 +00:00
parent 111190063d
commit 30c2d9e3c9
3 changed files with 88 additions and 0 deletions

View File

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>cas-client</artifactId>
<groupId>org.jasig.cas</groupId>
<version>3.1.9-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.jasig.cas</groupId>
<artifactId>cas-client-support-distributed</artifactId>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>org.jasig.cas</groupId>
<artifactId>cas-client-core</artifactId>
<version>${project.version}</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache</artifactId>
<version>${ehcache.version}</version>
<scope>compile</scope>
<type>jar</type>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,50 @@
/*
* Copyright 2007 The JA-SIG Collaborative. All rights reserved. See license
* distributed with this file and available online at
* http://www.ja-sig.org/products/cas/overview/license/index.html
*/
package org.jasig.cas.client.proxy;
import net.sf.ehcache.Cache;
import net.sf.ehcache.Element;
import net.sf.ehcache.CacheManager;
/**
* @author Scott Battaglia
* @version $Revision$ $Date$
* @since 3.1.9
*/
public final class EhcacheBackedProxyGrantingTicketStorageImpl implements ProxyGrantingTicketStorage {
public static final String EHCACHE_CACHE_NAME = "org.jasig.cas.client.proxy.EhcacheBackedProxyGrantingTicketStorageImpl.cache";
final Cache cache;
public EhcacheBackedProxyGrantingTicketStorageImpl() {
this(CacheManager.create().getCache(EHCACHE_CACHE_NAME));
}
public EhcacheBackedProxyGrantingTicketStorageImpl(final Cache cache) {
this.cache = cache;
}
public void save(final String proxyGrantingTicketIou, final String proxyGrantingTicket) {
final Element element = new Element(proxyGrantingTicketIou, proxyGrantingTicket);
this.cache.put(element);
}
public String retrieve(final String proxyGrantingTicketIou) {
final Element element = this.cache.get(proxyGrantingTicketIou);
if (element == null) {
return null;
}
return (String) element.getValue();
}
public void cleanUp() {
return;
}
}

View File

@ -131,6 +131,7 @@
<module>cas-client-integration-atlassian</module>
<module>cas-client-support-distributed-ehcache</module>
<module>cas-client-support-distributed-memcached</module>
<module>cas-client-support-distributed-ehcache</module>
</modules>
<properties>