Deactivating old spring-cache repository. Moved to archiva-components.
diff --git a/Jenkinsfile b/Jenkinsfile
deleted file mode 100644
index 5f264a1..0000000
--- a/Jenkinsfile
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-asfStandardBuild()
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..de74d00
--- /dev/null
+++ b/README.md
@@ -0,0 +1,6 @@
+This project has been moved to
+org.apache.archiva.components.archiva-components-spring-cache
+
+Git:
+https://gitbox.apache.org/repos/asf/archiva-components.git
+
diff --git a/pom.xml b/pom.xml
deleted file mode 100644
index cfdfdf5..0000000
--- a/pom.xml
+++ /dev/null
@@ -1,75 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one
- ~ or more contributor license agreements. See the NOTICE file
- ~ distributed with this work for additional information
- ~ regarding copyright ownership. The ASF licenses this file
- ~ to you under the Apache License, Version 2.0 (the
- ~ "License"); you may not use this file except in compliance
- ~ with the License. You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing,
- ~ software distributed under the License is distributed on an
- ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- ~ KIND, either express or implied. See the License for the
- ~ specific language governing permissions and limitations
- ~ under the License.
- -->
-<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/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.archiva.redback.components</groupId>
- <artifactId>redback-components</artifactId>
- <version>2.5-SNAPSHOT</version>
- </parent>
- <groupId>org.apache.archiva.redback.components.cache</groupId>
- <artifactId>spring-cache</artifactId>
- <name>Redback Components :: Spring Cache Component</name>
- <version>2.3-SNAPSHOT</version>
- <packaging>pom</packaging>
-
- <description>Cache API with various implementations : simple HashMap, ehcache, oscache. Based on Spring container.</description>
- <url>${webUrl}/spring-cache/</url>
- <properties>
- <scmBrowseUrl>https://gitbox.apache.org/repos/asf?a=tree;p=archiva-redback-components-spring-cache.git</scmBrowseUrl>
- <site.staging.base>${project.basedir}/../site</site.staging.base>
- </properties>
-
- <scm>
- <connection>scm:git:http://gitbox.apache.org/repos/asf/archiva-redback-components-spring-cache.git</connection>
- <developerConnection>scm:git:https://gitbox.apache.org/repos/asf/archiva-redback-components-spring-cache.git</developerConnection>
- <url>${scmBrowseUrl}</url>
- </scm>
-
- <modules>
- <module>spring-cache-api</module>
- <module>spring-cache-test</module>
- <module>spring-cache-providers</module>
- </modules>
- <dependencies>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
- </dependencies>
-
- <reporting>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jxr-plugin</artifactId>
- <reportSets>
- <reportSet>
- <id>aggregate</id>
- <inherited>false</inherited>
- <reports>
- <report>aggregate</report>
- </reports>
- </reportSet>
- </reportSets>
- </plugin>
- </plugins>
- </reporting>
-</project>
diff --git a/spring-cache-api/pom.xml b/spring-cache-api/pom.xml
deleted file mode 100644
index 963db84..0000000
--- a/spring-cache-api/pom.xml
+++ /dev/null
@@ -1,69 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one
- ~ or more contributor license agreements. See the NOTICE file
- ~ distributed with this work for additional information
- ~ regarding copyright ownership. The ASF licenses this file
- ~ to you under the Apache License, Version 2.0 (the
- ~ "License"); you may not use this file except in compliance
- ~ with the License. You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing,
- ~ software distributed under the License is distributed on an
- ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- ~ KIND, either express or implied. See the License for the
- ~ specific language governing permissions and limitations
- ~ under the License.
- -->
-<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/maven-v4_0_0.xsd">
-
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.archiva.redback.components.cache</groupId>
- <artifactId>spring-cache</artifactId>
- <version>2.3-SNAPSHOT</version>
- </parent>
-
- <artifactId>spring-cache-api</artifactId>
-
- <name>Redback Components :: Spring Cache API</name>
- <properties>
- <site.staging.base>${project.parent.basedir}/../site</site.staging.base>
- </properties>
- <description>Common Cache API.</description>
-
- <url>${webUrl}/spring-cache/${project.artifactId}</url>
-
- <scm>
- <url>${scmBrowseUrl};f=${project.artifactId}</url>
- </scm>
-
- <dependencies>
- <dependency>
- <groupId>commons-lang</groupId>
- <artifactId>commons-lang</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
- <dependency>
- <groupId>javax.inject</groupId>
- <artifactId>javax.inject</artifactId>
- </dependency>
- <dependency>
- <groupId>javax.annotation</groupId>
- <artifactId>javax.annotation-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-context</artifactId>
- </dependency>
-
- </dependencies>
-
-</project>
diff --git a/spring-cache-api/src/main/java/org/apache/archiva/redback/components/cache/AbstractCache.java b/spring-cache-api/src/main/java/org/apache/archiva/redback/components/cache/AbstractCache.java
deleted file mode 100644
index d8d39a8..0000000
--- a/spring-cache-api/src/main/java/org/apache/archiva/redback/components/cache/AbstractCache.java
+++ /dev/null
@@ -1,75 +0,0 @@
-package org.apache.archiva.redback.components.cache;
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/**
- * @author Olivier Lamy
- * @since 2.1
- */
-public abstract class AbstractCache<V,T>
- implements Cache<V,T>
-{
- private int timeToIdleSeconds = 0;
-
- private int timeToLiveSeconds = 0;
-
- private int maxElementsInMemory = 0;
-
- private int maxElementsOnDisk = 0;
-
- public int getTimeToIdleSeconds()
- {
- return timeToIdleSeconds;
- }
-
- public void setTimeToIdleSeconds( int timeToIdleSeconds )
- {
- this.timeToIdleSeconds = timeToIdleSeconds;
- }
-
- public int getTimeToLiveSeconds()
- {
- return timeToLiveSeconds;
- }
-
- public void setTimeToLiveSeconds( int timeToLiveSeconds )
- {
- this.timeToLiveSeconds = timeToLiveSeconds;
- }
-
- public int getMaxElementsInMemory()
- {
- return maxElementsInMemory;
- }
-
- public void setMaxElementsInMemory( int maxElementsInMemory )
- {
- this.maxElementsInMemory = maxElementsInMemory;
- }
-
- public int getMaxElementsOnDisk()
- {
- return maxElementsOnDisk;
- }
-
- public void setMaxElementsOnDisk( int maxElementsOnDisk )
- {
- this.maxElementsOnDisk = maxElementsOnDisk;
- }
-}
diff --git a/spring-cache-api/src/main/java/org/apache/archiva/redback/components/cache/AbstractCacheStatistics.java b/spring-cache-api/src/main/java/org/apache/archiva/redback/components/cache/AbstractCacheStatistics.java
deleted file mode 100644
index eb8c368..0000000
--- a/spring-cache-api/src/main/java/org/apache/archiva/redback/components/cache/AbstractCacheStatistics.java
+++ /dev/null
@@ -1,80 +0,0 @@
-package org.apache.archiva.redback.components.cache;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/**
- *
- * @author Olivier Lamy
- */
-public abstract class AbstractCacheStatistics
- implements CacheStatistics
-{
-
- private long cacheHits;
-
- private long cacheMiss;
-
- public AbstractCacheStatistics()
- {
- this.cacheHits = 0;
- this.cacheMiss = 0;
- }
-
- public long getCacheHits()
- {
- return this.cacheHits;
- }
-
- public long getCacheMiss()
- {
- return this.cacheMiss;
- }
-
- public double getCacheHitRate()
- {
- return cacheHits == 0 && cacheMiss == 0 ? 0 : (double) cacheHits / (double) ( cacheHits + cacheMiss );
- }
-
- public abstract long getSize();
-
- public void hit()
- {
- this.cacheHits++;
- }
-
- public void miss()
- {
- this.cacheMiss++;
- }
-
- public void clear()
- {
- this.cacheHits = 0;
- this.cacheMiss = 0;
- }
-
- /**
- * @return default implementation return 0
- */
- public long getInMemorySize()
- {
- return 0;
- }
-}
diff --git a/spring-cache-api/src/main/java/org/apache/archiva/redback/components/cache/Cache.java b/spring-cache-api/src/main/java/org/apache/archiva/redback/components/cache/Cache.java
deleted file mode 100644
index 8dee894..0000000
--- a/spring-cache-api/src/main/java/org/apache/archiva/redback/components/cache/Cache.java
+++ /dev/null
@@ -1,110 +0,0 @@
-package org.apache.archiva.redback.components.cache;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/**
- * Cache interface.
- *
- * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
- */
-public interface Cache<V,T>
-{
- /**
- * Tests to see if the provided key exists within the cache.
- * <p/>
- * NOTE: Due to synchronization issues, if this method returns true, a subsequent request
- * to the {@link #get(Object)} method on the same key might return null as the period of time
- * between the 2 request might have been long enough for the underlying Cache implementation
- * to remove the key.
- *
- * @param key the key to test.
- * @return true if the key exists.
- */
- boolean hasKey( V key );
-
- /**
- * Get the value of the specified key, if it exists in the cache.
- *
- * @param key the key to fetch the contents of.
- * @return the value of the key, or null if not found.
- */
- T get( V key );
-
-
-
- /**
- * Put the specified value into the cache under the provided key.
- *
- * @param key the key to put the value into
- * @param value the object to place into the cache.
- * @return the previous value for the key, or null if the key contained no value.
- */
- T put( V key, T value );
-
-
-
- /**
- * Register the specified value into the cache under the provided key.
- * <p/>
- * This {@link #register(Object, Object)} method is just an optimized version of the {@link #put(Object, Object)}
- * method, but does not return the previous value contained with the specified key.
- *
- * @param key the key to put the value into
- * @param value the object to place into the cache.
- */
- void register( V key, T value );
-
- /**
- * Remove the specified key and value from the cache.
- *
- * @param key the key to the value to remove.
- * @return the value of the key that was removed.
- */
- T remove( V key );
-
- /**
- * Clear the cache of all entries.
- */
- void clear();
-
- /**
- * Obtain a set of Statistics about the performance of the cache.
- *
- * @return the cache statistics.
- */
- CacheStatistics getStatistics();
-
- void setTimeToIdleSeconds( int timeToIdleSeconds );
-
- void setTimeToLiveSeconds( int timeToLiveSeconds );
-
- int getTimeToIdleSeconds();
-
- int getTimeToLiveSeconds();
-
- int getMaxElementsInMemory();
-
- void setMaxElementsInMemory( int maxElementsInMemory );
-
- int getMaxElementsOnDisk();
-
- void setMaxElementsOnDisk( int maxElementsOnDisk );
-
-}
diff --git a/spring-cache-api/src/main/java/org/apache/archiva/redback/components/cache/CacheException.java b/spring-cache-api/src/main/java/org/apache/archiva/redback/components/cache/CacheException.java
deleted file mode 100644
index 8c3639c..0000000
--- a/spring-cache-api/src/main/java/org/apache/archiva/redback/components/cache/CacheException.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package org.apache.archiva.redback.components.cache;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/**
- * CacheException
- *
- * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
- *
- */
-public class CacheException
- extends Exception
-{
-
- public CacheException()
- {
- super();
- }
-
- public CacheException( String message, Throwable cause )
- {
- super( message, cause );
- }
-
- public CacheException( String message )
- {
- super( message );
- }
-
- public CacheException( Throwable cause )
- {
- super( cause );
- }
-
-}
diff --git a/spring-cache-api/src/main/java/org/apache/archiva/redback/components/cache/CacheHints.java b/spring-cache-api/src/main/java/org/apache/archiva/redback/components/cache/CacheHints.java
deleted file mode 100644
index b0a66b1..0000000
--- a/spring-cache-api/src/main/java/org/apache/archiva/redback/components/cache/CacheHints.java
+++ /dev/null
@@ -1,145 +0,0 @@
-package org.apache.archiva.redback.components.cache;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.commons.lang.CharSet;
-
-import java.io.File;
-
-
-/**
- * CacheHints
- *
- * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
- *
- */
-public class CacheHints
-{
- /* To Other Plexus Cache Developers.
- *
- * When considering if there is an appropriate value to put into this hints object,
- * consider if it is available in 2 or more cache providers.
- */
-
- /**
- * The name of the cache.
- */
- private String name;
-
- /**
- * To allow the cache to use the disk (or not)
- */
- private boolean overflowToDisk = false;
-
- /**
- * The path on disk to overflow cache into.
- */
- private File diskOverflowPath = null;
-
- /**
- * To set the maximum number of elements that the cache tracks.
- */
- private int maxElements = 1000;
-
- /**
- * To set the maximum number of seconds that the element can exist in the cache, regardless of how
- * popular and active it may be.
- */
- private int maxSecondsInCache = 0;
-
- /**
- * To set the maximum number of seconds that the element can exist idle in the cache.
- */
- private int idleExpirationSeconds = 600;
-
- public CacheHints()
- {
- super();
- }
-
- public File getDiskOverflowPath()
- {
- return diskOverflowPath;
- }
-
- public int getIdleExpirationSeconds()
- {
- return idleExpirationSeconds;
- }
-
- public int getMaxElements()
- {
- return maxElements;
- }
-
- public int getMaxSecondsInCache()
- {
- return maxSecondsInCache;
- }
-
- public String getName()
- {
- return name;
- }
-
- public boolean isOverflowToDisk()
- {
- return overflowToDisk;
- }
-
- public void setDiskOverflowPath( File diskOverflowPath )
- {
- this.diskOverflowPath = diskOverflowPath;
- }
-
- public void setIdleExpirationSeconds( int idleExpirationSeconds )
- {
- this.idleExpirationSeconds = idleExpirationSeconds;
- }
-
- public void setMaxElements( int maxElements )
- {
- this.maxElements = maxElements;
- }
-
- public void setMaxSecondsInCache( int maxSecondsInCache )
- {
- this.maxSecondsInCache = maxSecondsInCache;
- }
-
- public void setName( String name )
- {
- CharSet illegal = CharSet.getInstance( ":/\\\"' " );
- for ( int i = 0; i < name.length(); i++ )
- {
- char c = name.charAt( i );
- if ( illegal.contains( c ) )
- {
- throw new IllegalArgumentException( "Name cannot contain characters from the set [" + illegal + "]" );
- }
- }
- this.name = name;
- }
-
- public void setOverflowToDisk( boolean overflowToDisk )
- {
- this.overflowToDisk = overflowToDisk;
- }
-}
diff --git a/spring-cache-api/src/main/java/org/apache/archiva/redback/components/cache/CacheStatistics.java b/spring-cache-api/src/main/java/org/apache/archiva/redback/components/cache/CacheStatistics.java
deleted file mode 100644
index 4f61a33..0000000
--- a/spring-cache-api/src/main/java/org/apache/archiva/redback/components/cache/CacheStatistics.java
+++ /dev/null
@@ -1,68 +0,0 @@
-package org.apache.archiva.redback.components.cache;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/**
- * CacheStatistics
- *
- * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
- */
-public interface CacheStatistics
-{
- /**
- * Return the number of hits to content present in the cache.
- *
- * @return the number of hits to content present in the cache.
- */
- long getCacheHits();
-
- /**
- * Return the number of hits to keys that are not (yet) in the cache.
- *
- * @return the number of requests for content missing from the cache.
- */
- long getCacheMiss();
-
- /**
- * Compute for the efficiency of this cache.
- *
- * @return the ratio of cache hits to the cache misses to queries for cache objects
- */
- double getCacheHitRate();
-
- /**
- * Return the size (items number) of the current cache.
- *
- * @return the size (items number) of the current cache.
- */
- long getSize();
-
- /**
- * Clear the statistics of the cache.
- */
- void clear();
-
- /**
- * return the memory used by the cache in memory
- * <b>can be not implemented by some caches implementation</b>
- * @since 2.0
- */
- long getInMemorySize();
-}
diff --git a/spring-cache-api/src/main/java/org/apache/archiva/redback/components/cache/CacheableWrapper.java b/spring-cache-api/src/main/java/org/apache/archiva/redback/components/cache/CacheableWrapper.java
deleted file mode 100644
index 3455e04..0000000
--- a/spring-cache-api/src/main/java/org/apache/archiva/redback/components/cache/CacheableWrapper.java
+++ /dev/null
@@ -1,62 +0,0 @@
-package org.apache.archiva.redback.components.cache;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.io.Serializable;
-
-/**
- * CacheableWrapper
- *
- * @author Olivier Lamy
- *
- */
-public class CacheableWrapper<T>
- implements Serializable
-{
- private T value;
-
- private long storedTime;
-
- public CacheableWrapper( T value, long storedTime )
- {
- this.value = value;
- this.storedTime = storedTime;
- }
-
- public T getValue()
- {
- return value;
- }
-
- public void setValue( T value )
- {
- this.value = value;
- }
-
- public long getStoredTime()
- {
- return storedTime;
- }
-
- public void setStoredTime( long storedTime )
- {
- this.storedTime = storedTime;
- }
-}
diff --git a/spring-cache-api/src/main/java/org/apache/archiva/redback/components/cache/builder/CacheBuilder.java b/spring-cache-api/src/main/java/org/apache/archiva/redback/components/cache/builder/CacheBuilder.java
deleted file mode 100644
index 055dad9..0000000
--- a/spring-cache-api/src/main/java/org/apache/archiva/redback/components/cache/builder/CacheBuilder.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package org.apache.archiva.redback.components.cache.builder;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.archiva.redback.components.cache.Cache;
-
-
-/**
- * CacheBuilder Interface, for obtaining caches from spring using beans names or clazz names.
- *
- * @author Olivier Lamy
- *
- * @since 3 February, 2007
- */
-public interface CacheBuilder<V,T>
-{
- /**
- * @param roleHint
- * @return
- */
- Cache<V,T> getCache( String roleHint );
-
- /**
- * @param clazz
- * @return
- */
- Cache<V,T> getCache( Class clazz );
-
-}
diff --git a/spring-cache-api/src/main/java/org/apache/archiva/redback/components/cache/builder/DefaultCacheBuilder.java b/spring-cache-api/src/main/java/org/apache/archiva/redback/components/cache/builder/DefaultCacheBuilder.java
deleted file mode 100644
index 1c4f75d..0000000
--- a/spring-cache-api/src/main/java/org/apache/archiva/redback/components/cache/builder/DefaultCacheBuilder.java
+++ /dev/null
@@ -1,93 +0,0 @@
-package org.apache.archiva.redback.components.cache.builder;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.archiva.redback.components.cache.Cache;
-import org.apache.archiva.redback.components.cache.impl.NoCacheCache;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.context.ApplicationContext;
-import org.springframework.stereotype.Service;
-
-import javax.annotation.PostConstruct;
-import javax.annotation.PreDestroy;
-import javax.inject.Inject;
-
-/**
- * Ability to obtain cache
- *
- * @author Olivier Lamy
- *
- */
-@Service
-public class DefaultCacheBuilder<V,T>
- implements CacheBuilder<V,T>
-{
-
- private Logger log = LoggerFactory.getLogger( getClass() );
-
- private Cache<V,T> defaultCache;
-
- private Cache<V,T> noCache = new NoCacheCache<V,T>();
-
- @Inject
- private ApplicationContext applicationContext;
-
- @PostConstruct
- public void initialize()
- {
- if ( this.applicationContext.containsBean( "cache#default" ) )
- {
- this.defaultCache = this.applicationContext.getBean( "cache#default", Cache.class );
-
- }
- else
- {
- log.info( "Cache with role-hint default doesn't exists, default will be no cache" );
- this.defaultCache = new NoCacheCache();
- }
- }
-
- public Cache<V,T> getCache( String roleHint )
- {
- if ( this.applicationContext.containsBean( "cache#" + roleHint ) )
- {
- return this.applicationContext.getBean( "cache#" + roleHint, Cache.class );
- }
-
- return this.getDefaultCache();
- }
-
- public Cache<V,T> getCache( Class clazz )
- {
- return this.getCache( clazz.getName() );
- }
-
- @PreDestroy
- public void dispose()
- {
- // TODO dispose default ?
- }
-
- public Cache<V,T> getDefaultCache()
- {
- return defaultCache == null ? this.noCache : this.defaultCache;
- }
-}
diff --git a/spring-cache-api/src/main/java/org/apache/archiva/redback/components/cache/factory/CacheCreator.java b/spring-cache-api/src/main/java/org/apache/archiva/redback/components/cache/factory/CacheCreator.java
deleted file mode 100644
index 87b4b5a..0000000
--- a/spring-cache-api/src/main/java/org/apache/archiva/redback/components/cache/factory/CacheCreator.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package org.apache.archiva.redback.components.cache.factory;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.archiva.redback.components.cache.Cache;
-import org.apache.archiva.redback.components.cache.CacheException;
-import org.apache.archiva.redback.components.cache.CacheHints;
-
-/**
- * CacheCreator - an interface for CacheCreators
- *
- * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
- *
- */
-public interface CacheCreator
-{
- /**
- * Create a Cache, initialize it, and return it.
- *
- * @param cacheHint the cache hints to use.
- * @return the created cache.
- * @throws CacheException if there was a cache creation error.
- */
- public Cache createCache( CacheHints hints ) throws CacheException;
-}
diff --git a/spring-cache-api/src/main/java/org/apache/archiva/redback/components/cache/factory/CacheFactory.java b/spring-cache-api/src/main/java/org/apache/archiva/redback/components/cache/factory/CacheFactory.java
deleted file mode 100644
index 71a7f62..0000000
--- a/spring-cache-api/src/main/java/org/apache/archiva/redback/components/cache/factory/CacheFactory.java
+++ /dev/null
@@ -1,140 +0,0 @@
-package org.apache.archiva.redback.components.cache.factory;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.archiva.redback.components.cache.Cache;
-import org.apache.archiva.redback.components.cache.CacheException;
-import org.apache.archiva.redback.components.cache.CacheHints;
-import org.apache.archiva.redback.components.cache.impl.NoCacheCache;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.IOException;
-import java.net.URL;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Properties;
-
-/**
- * CacheFactory - dynamic cache creation (and tracking) facility for non-plexus objects to use.
- *
- * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
- */
-public class CacheFactory
-{
- static class CacheFactoryHolder
- {
- static CacheFactory instance = new CacheFactory();
- }
-
- private static Map caches;
-
- private static CacheCreator creator;
-
- private Logger logger = LoggerFactory.getLogger( getClass() );
-
- private CacheFactory()
- {
- caches = new HashMap();
-
- try
- {
- ClassLoader classLoader = this.getClass().getClassLoader();
-
- if ( classLoader == null )
- {
- classLoader = ClassLoader.getSystemClassLoader();
- }
-
- Enumeration cachePropResources = classLoader.getResources( "META-INF/plexus-cache.properties" );
-
- if ( cachePropResources.hasMoreElements() )
- {
- URL propURL = (URL) cachePropResources.nextElement();
- Properties props = new Properties();
-
- props.load( propURL.openStream() );
- String creatorImpl = props.getProperty( "cache.creator" );
-
- Class creatorClass = classLoader.loadClass( creatorImpl );
- creator = (CacheCreator) creatorClass.newInstance();
- }
-
- if ( cachePropResources.hasMoreElements() )
- {
- logger.error( "More than 1 CacheCreator provider exists in classpath. Using first one found [{}].",
- creator.getClass().getName() );
- }
- }
- catch ( IOException e )
- {
- throw new ExceptionInInitializerError( e );
- }
- catch ( ClassNotFoundException e )
- {
- throw new ExceptionInInitializerError( e );
- }
- catch ( InstantiationException e )
- {
- throw new ExceptionInInitializerError( e );
- }
- catch ( IllegalAccessException e )
- {
- throw new ExceptionInInitializerError( e );
- }
- }
-
- public static CacheFactory getInstance()
- {
- return CacheFactoryHolder.instance;
- }
-
- public void setCacheCreatorFactory( CacheCreator creator )
- {
- CacheFactory.creator = creator;
- }
-
- public Cache getCache( String id, CacheHints hints )
- throws CacheException
- {
- if ( creator == null )
- {
- return new NoCacheCache();
- }
-
- if ( caches.containsKey( id ) )
- {
- return (Cache) caches.get( id );
- }
-
- if ( hints == null )
- {
- // Setup some defaults.
- hints = new CacheHints();
- hints.setName( id );
- }
-
- Cache cache = CacheFactory.creator.createCache( hints );
-
- caches.put( id, cache );
- return (Cache) cache;
- }
-}
diff --git a/spring-cache-api/src/main/java/org/apache/archiva/redback/components/cache/impl/NoCacheCache.java b/spring-cache-api/src/main/java/org/apache/archiva/redback/components/cache/impl/NoCacheCache.java
deleted file mode 100644
index a29da23..0000000
--- a/spring-cache-api/src/main/java/org/apache/archiva/redback/components/cache/impl/NoCacheCache.java
+++ /dev/null
@@ -1,110 +0,0 @@
-package org.apache.archiva.redback.components.cache.impl;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.archiva.redback.components.cache.AbstractCache;
-import org.apache.archiva.redback.components.cache.CacheStatistics;
-import org.apache.archiva.redback.components.cache.Cache;
-
-
-/**
- * Simple no-op provider of a Cache.
- * <p/>
- * Nothing is stored, nothing is tracked, no statistics even.
- *
- * @author Olivier Lamy
- * @since 5 February, 2007
- */
-public class NoCacheCache<V, T>
- extends AbstractCache<V, T>
- implements Cache<V, T>
-{
- static final class NoStats
- implements CacheStatistics
- {
-
- public void clear()
- {
- /* do nothing */
- }
-
- public double getCacheHitRate()
- {
- return 0;
- }
-
- public long getCacheHits()
- {
- return 0;
- }
-
- public long getCacheMiss()
- {
- return 0;
- }
-
- public long getSize()
- {
- return 0;
- }
-
- public long getInMemorySize()
- {
- return 0;
- }
- }
-
- private CacheStatistics stats = new NoStats();
-
- public void clear()
- {
- /* do nothing */
- }
-
- public T get( V key )
- {
- return null;
- }
-
- public CacheStatistics getStatistics()
- {
- return stats;
- }
-
- public boolean hasKey( V key )
- {
- return false;
- }
-
- public T put( V key, T value )
- {
- return null;
- }
-
- public void register( V key, T value )
- {
- /* do nothing */
- }
-
- public T remove( V key )
- {
- return null;
- }
-}
diff --git a/spring-cache-api/src/main/resources/META-INF/spring-context.xml b/spring-cache-api/src/main/resources/META-INF/spring-context.xml
deleted file mode 100644
index 0c0e128..0000000
--- a/spring-cache-api/src/main/resources/META-INF/spring-context.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-<?xml version="1.0"?>
-
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one
- ~ or more contributor license agreements. See the NOTICE file
- ~ distributed with this work for additional information
- ~ regarding copyright ownership. The ASF licenses this file
- ~ to you under the Apache License, Version 2.0 (the
- ~ "License"); you may not use this file except in compliance
- ~ with the License. You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing,
- ~ software distributed under the License is distributed on an
- ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- ~ KIND, either express or implied. See the License for the
- ~ specific language governing permissions and limitations
- ~ under the License.
- -->
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:context="http://www.springframework.org/schema/context"
- xsi:schemaLocation="http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
- http://www.springframework.org/schema/context
- http://www.springframework.org/schema/context/spring-context-3.0.xsd">
-
- <context:annotation-config />
- <context:component-scan
- base-package="org.apache.archiva.redback.components.cache.builder"/>
-
-</beans>
\ No newline at end of file
diff --git a/spring-cache-providers/pom.xml b/spring-cache-providers/pom.xml
deleted file mode 100644
index 6e31def..0000000
--- a/spring-cache-providers/pom.xml
+++ /dev/null
@@ -1,59 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one
- ~ or more contributor license agreements. See the NOTICE file
- ~ distributed with this work for additional information
- ~ regarding copyright ownership. The ASF licenses this file
- ~ to you under the Apache License, Version 2.0 (the
- ~ "License"); you may not use this file except in compliance
- ~ with the License. You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing,
- ~ software distributed under the License is distributed on an
- ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- ~ KIND, either express or implied. See the License for the
- ~ specific language governing permissions and limitations
- ~ under the License.
- -->
-<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/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.archiva.redback.components.cache</groupId>
- <artifactId>spring-cache</artifactId>
- <version>2.3-SNAPSHOT</version>
- </parent>
- <artifactId>spring-cache-providers</artifactId>
- <name>Redback Components :: Spring Cache Providers</name>
- <packaging>pom</packaging>
- <description>Commons Cache API Providers Parent Pom.</description>
- <properties>
- <site.staging.base>${project.parent.basedir}/../site</site.staging.base>
- </properties>
- <url>${webUrl}/spring-cache/${project.artifactId}</url>
-
- <scm>
- <url>${scmBrowseUrl};f=${project.artifactId}</url>
- </scm>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.archiva.redback.components.cache</groupId>
- <artifactId>spring-cache-api</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.archiva.redback.components.cache</groupId>
- <artifactId>spring-cache-test</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <modules>
- <module>spring-cache-hashmap</module>
- <module>spring-cache-ehcache</module>
- <module>spring-cache-oscache</module>
- </modules>
-</project>
diff --git a/spring-cache-providers/spring-cache-ehcache/pom.xml b/spring-cache-providers/spring-cache-ehcache/pom.xml
deleted file mode 100644
index ae0af52..0000000
--- a/spring-cache-providers/spring-cache-ehcache/pom.xml
+++ /dev/null
@@ -1,71 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one
- ~ or more contributor license agreements. See the NOTICE file
- ~ distributed with this work for additional information
- ~ regarding copyright ownership. The ASF licenses this file
- ~ to you under the Apache License, Version 2.0 (the
- ~ "License"); you may not use this file except in compliance
- ~ with the License. You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing,
- ~ software distributed under the License is distributed on an
- ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- ~ KIND, either express or implied. See the License for the
- ~ specific language governing permissions and limitations
- ~ under the License.
- -->
-<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/maven-v4_0_0.xsd">
-
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.archiva.redback.components.cache</groupId>
- <artifactId>spring-cache-providers</artifactId>
- <version>2.3-SNAPSHOT</version>
- </parent>
-
- <artifactId>spring-cache-ehcache</artifactId>
- <name>Redback Components :: Spring Cache Provider :: ehcache</name>
-
- <description>Commons Cache API : ehcache implementation.</description>
- <properties>
- <site.staging.base>${project.parent.parent.basedir}/../site</site.staging.base>
- </properties>
-
- <url>${webUrl}/spring-cache/spring-cache-providers/${project.artifactId}</url>
-
- <dependencies>
- <dependency>
- <groupId>net.sf.ehcache</groupId>
- <artifactId>ehcache</artifactId>
- <version>2.7.5</version>
- <exclusions>
- <exclusion>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>commons-lang</groupId>
- <artifactId>commons-lang</artifactId>
- </dependency>
- <dependency>
- <groupId>javax.annotation</groupId>
- <artifactId>javax.annotation-api</artifactId>
- </dependency>
- <dependency>
- <groupId>javax.inject</groupId>
- <artifactId>javax.inject</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-test</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
-</project>
diff --git a/spring-cache-providers/spring-cache-ehcache/src/main/java/org/apache/archiva/redback/components/cache/ehcache/EhcacheCache.java b/spring-cache-providers/spring-cache-ehcache/src/main/java/org/apache/archiva/redback/components/cache/ehcache/EhcacheCache.java
deleted file mode 100644
index e370047..0000000
--- a/spring-cache-providers/spring-cache-ehcache/src/main/java/org/apache/archiva/redback/components/cache/ehcache/EhcacheCache.java
+++ /dev/null
@@ -1,528 +0,0 @@
-package org.apache.archiva.redback.components.cache.ehcache;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import net.sf.ehcache.Cache;
-import net.sf.ehcache.CacheManager;
-import net.sf.ehcache.Element;
-import net.sf.ehcache.Status;
-import net.sf.ehcache.config.CacheConfiguration;
-import net.sf.ehcache.config.Configuration;
-import net.sf.ehcache.config.DiskStoreConfiguration;
-import net.sf.ehcache.config.MemoryUnit;
-import net.sf.ehcache.store.MemoryStoreEvictionPolicy;
-import org.apache.archiva.redback.components.cache.CacheStatistics;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.annotation.PostConstruct;
-import javax.annotation.PreDestroy;
-
-/**
- * EhcacheCache
- * configuration document available <a href="http://www.ehcache.org/documentation/configuration/index">EhcacheUserGuide</a>
- *
- * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
- */
-public class EhcacheCache<V, T>
- implements org.apache.archiva.redback.components.cache.Cache<V, T>
-{
-
- private Logger log = LoggerFactory.getLogger( getClass() );
-
- class Stats
- implements CacheStatistics
- {
- public void clear()
- {
- // TODO not supported anymore
- //ehcache.getStatistics().clearStatistics();
- }
-
- public double getCacheHitRate()
- {
- double hits = getCacheHits();
- double miss = getCacheMiss();
-
- if ( ( hits == 0 ) && ( hits == 0 ) )
- {
- return 0.0;
- }
-
- return hits / ( hits + miss );
- }
-
- public long getCacheHits()
- {
- return ehcache.getStatistics().cacheHitCount();//.getCacheHits();
- }
-
- public long getCacheMiss()
- {
- return ehcache.getStatistics().cacheMissCount();// .getCacheMisses();
- }
-
- public long getSize()
- {
- //
- return ehcache.getStatistics().getSize();
- }
-
- public long getInMemorySize()
- {
- return ehcache.getStatistics().getLocalHeapSizeInBytes();
- //return ehcache.calculateInMemorySize();
- }
- }
-
- /**
- * how often to run the disk store expiry thread. A large number of 120 seconds plus is recommended
- */
- private long diskExpiryThreadIntervalSeconds = 600;
-
- /**
- * Whether to persist the cache to disk between JVM restarts.
- */
- private boolean diskPersistent = true;
-
- /**
- * Location on disk for the ehcache store.
- */
- private String diskStorePath = System.getProperty( "java.io.tmpdir" ) + "/ehcache";
-
- private boolean eternal = false;
-
- private int maxElementsInMemory = 0;
-
- private String memoryEvictionPolicy = "LRU";
-
- private String name = "cache";
-
- /**
- * Flag indicating when to use the disk store.
- */
- private boolean overflowToDisk = false;
-
- private int timeToIdleSeconds = 600;
-
- private int timeToLiveSeconds = 300;
-
- /**
- * @since 2.0
- */
- private boolean overflowToOffHeap = false;
-
- /**
- * @since 2.0
- */
- private long maxBytesLocalHeap;
-
- /**
- * @since 2.0
- */
- private long maxBytesLocalOffHeap;
-
- private boolean failOnDuplicateCache = false;
-
- /**
- * @since 2.1
- */
- private int maxElementsOnDisk;
-
- /**
- * @since 2.1
- */
- //private String persistenceStrategy = PersistenceConfiguration.Strategy.LOCALTEMPSWAP.name();
-
- /**
- * @since 2.1
- */
- //private boolean synchronousWrites = false;
-
- private boolean statisticsEnabled = true;
-
- private CacheManager cacheManager = null;//CacheManager.getInstance();
-
- private net.sf.ehcache.Cache ehcache;
-
- private Stats stats;
-
- public void clear()
- {
- ehcache.removeAll();
- stats.clear();
- }
-
- @PostConstruct
- public void initialize()
- {
- stats = new Stats();
-
- boolean cacheManagerExists = CacheManager.getCacheManager( getName() ) != null;
-
- if ( cacheManagerExists )
- {
- if ( failOnDuplicateCache )
- {
- throw new RuntimeException( "A previous cacheManager with name [" + getName() + "] exists." );
- }
- else
- {
- log.warn( "skip duplicate cache {}", getName() );
- cacheManager = CacheManager.getCacheManager( getName() );
- }
- }
- else
- {
- this.cacheManager = new CacheManager( new Configuration().name( getName() ).diskStore(
- new DiskStoreConfiguration().path( getDiskStorePath() ) ) );
- }
-
- boolean cacheExists = cacheManager.cacheExists( getName() );
-
- if ( cacheExists )
- {
- if ( failOnDuplicateCache )
- {
- throw new RuntimeException( "A previous cache with name [" + getName() + "] exists." );
- }
- else
- {
- log.warn( "skip duplicate cache {}", getName() );
- ehcache = cacheManager.getCache( getName() );
- }
- }
-
- if ( !cacheExists )
- {
- CacheConfiguration cacheConfiguration =
- new CacheConfiguration().name( getName() ).memoryStoreEvictionPolicy(
- getMemoryStoreEvictionPolicy() ).eternal( isEternal() ).timeToLiveSeconds(
- getTimeToLiveSeconds() ).timeToIdleSeconds(
- getTimeToIdleSeconds() ).diskExpiryThreadIntervalSeconds(
- getDiskExpiryThreadIntervalSeconds() ).overflowToOffHeap(
- isOverflowToOffHeap() ).maxEntriesLocalDisk( getMaxElementsOnDisk() ).diskPersistent(
- isDiskPersistent() ).overflowToDisk( overflowToDisk );
-
- if ( getMaxElementsInMemory() > 0 )
- {
- cacheConfiguration = cacheConfiguration.maxEntriesLocalHeap( getMaxElementsInMemory() );
- }
-
- if ( getMaxBytesLocalHeap() > 0 )
- {
- cacheConfiguration = cacheConfiguration.maxBytesLocalHeap( getMaxBytesLocalHeap(), MemoryUnit.BYTES );
- }
- if ( getMaxBytesLocalOffHeap() > 0 )
- {
- cacheConfiguration =
- cacheConfiguration.maxBytesLocalOffHeap( getMaxBytesLocalOffHeap(), MemoryUnit.BYTES );
- }
-
- ehcache = new Cache( cacheConfiguration );
-
- cacheManager.addCache( ehcache );
- // TODO not supported anymore?
- //ehcache.setStatisticsEnabled( statisticsEnabled );
- }
- }
-
- @PreDestroy
- public void dispose()
- {
- if ( cacheManager.getStatus().equals( Status.STATUS_ALIVE ) )
- {
- log.info( "Disposing cache: {}", ehcache );
- if ( this.ehcache != null )
- {
- cacheManager.removeCache( this.ehcache.getName() );
- ehcache = null;
- }
- }
- else
- {
- log.debug( "Not disposing cache, because cacheManager is not alive: {}", ehcache );
- }
- }
-
- public T get( V key )
- {
- if ( key == null )
- {
- return null;
- }
-
- Element elem = ehcache.get( key );
- if ( elem == null )
- {
- return null;
- }
- return (T) elem.getObjectValue();
- }
-
- public long getDiskExpiryThreadIntervalSeconds()
- {
- return diskExpiryThreadIntervalSeconds;
- }
-
- public String getDiskStorePath()
- {
- return diskStorePath;
- }
-
- public int getMaxElementsInMemory()
- {
- return maxElementsInMemory;
- }
-
- public String getMemoryEvictionPolicy()
- {
- return memoryEvictionPolicy;
- }
-
- public MemoryStoreEvictionPolicy getMemoryStoreEvictionPolicy()
- {
- return MemoryStoreEvictionPolicy.fromString( memoryEvictionPolicy );
- }
-
- public String getName()
- {
- return name;
- }
-
- public CacheStatistics getStatistics()
- {
- return stats;
- }
-
- public int getTimeToIdleSeconds()
- {
- return timeToIdleSeconds;
- }
-
- public int getTimeToLiveSeconds()
- {
- return timeToLiveSeconds;
- }
-
- public boolean hasKey( V key )
- {
- return ehcache.isKeyInCache( key );
- }
-
- public boolean isDiskPersistent()
- {
- return diskPersistent;
- }
-
- public boolean isEternal()
- {
- return eternal;
- }
-
- public boolean isOverflowToDisk()
- {
- return overflowToDisk;
- }
-
- public void register( V key, T value )
- {
- ehcache.put( new Element( key, value ) );
- }
-
- public T put( V key, T value )
- {
- // Multiple steps done to satisfy Cache API requirement for Previous object return.
- Element elem = null;
- Object previous = null;
- elem = ehcache.get( key );
- if ( elem != null )
- {
- previous = elem.getObjectValue();
- }
- elem = new Element( key, value );
- ehcache.put( elem );
- return (T) previous;
- }
-
- public T remove( V key )
- {
- Element elem = null;
- Object previous = null;
- elem = ehcache.get( key );
- if ( elem != null )
- {
- previous = elem.getObjectValue();
- ehcache.remove( key );
- }
-
- return (T) previous;
- }
-
- public void setDiskExpiryThreadIntervalSeconds( long diskExpiryThreadIntervalSeconds )
- {
- this.diskExpiryThreadIntervalSeconds = diskExpiryThreadIntervalSeconds;
- }
-
- public void setDiskPersistent( boolean diskPersistent )
- {
- this.diskPersistent = diskPersistent;
- }
-
- public void setDiskStorePath( String diskStorePath )
- {
- this.diskStorePath = diskStorePath;
- }
-
- public void setEternal( boolean eternal )
- {
- this.eternal = eternal;
- }
-
-
- public void setMaxElementsInMemory( int maxElementsInMemory )
- {
- this.maxElementsInMemory = maxElementsInMemory;
- if ( this.ehcache != null )
- {
- this.ehcache.getCacheConfiguration().setMaxElementsInMemory( this.maxElementsInMemory );
- this.ehcache.getCacheConfiguration().setMaxEntriesLocalHeap( this.maxElementsInMemory );
-
- }
- }
-
- public void setMemoryEvictionPolicy( String memoryEvictionPolicy )
- {
- this.memoryEvictionPolicy = memoryEvictionPolicy;
- }
-
- public void setName( String name )
- {
- this.name = name;
- }
-
- public void setOverflowToDisk( boolean overflowToDisk )
- {
- this.overflowToDisk = overflowToDisk;
- }
-
- public void setTimeToIdleSeconds( int timeToIdleSeconds )
- {
- if ( this.ehcache != null )
- {
- this.ehcache.getCacheConfiguration().setTimeToIdleSeconds( timeToIdleSeconds );
- }
- this.timeToIdleSeconds = timeToIdleSeconds;
- }
-
- public void setTimeToLiveSeconds( int timeToLiveSeconds )
- {
- if ( this.ehcache != null )
- {
- this.ehcache.getCacheConfiguration().setTimeToLiveSeconds( timeToIdleSeconds );
- }
- this.timeToLiveSeconds = timeToLiveSeconds;
- }
-
- public boolean isStatisticsEnabled()
- {
- return statisticsEnabled;
- }
-
- public void setStatisticsEnabled( boolean statisticsEnabled )
- {
- this.statisticsEnabled = statisticsEnabled;
- }
-
- public boolean isFailOnDuplicateCache()
- {
- return failOnDuplicateCache;
- }
-
- public void setFailOnDuplicateCache( boolean failOnDuplicateCache )
- {
- this.failOnDuplicateCache = failOnDuplicateCache;
- }
-
- public boolean isOverflowToOffHeap()
- {
- return overflowToOffHeap;
- }
-
- public void setOverflowToOffHeap( boolean overflowToOffHeap )
- {
- this.overflowToOffHeap = overflowToOffHeap;
- }
-
- public long getMaxBytesLocalHeap()
- {
- return maxBytesLocalHeap;
- }
-
- public void setMaxBytesLocalHeap( long maxBytesLocalHeap )
- {
- this.maxBytesLocalHeap = maxBytesLocalHeap;
- }
-
- public long getMaxBytesLocalOffHeap()
- {
- return maxBytesLocalOffHeap;
- }
-
- public void setMaxBytesLocalOffHeap( long maxBytesLocalOffHeap )
- {
- this.maxBytesLocalOffHeap = maxBytesLocalOffHeap;
- }
-
- public int getMaxElementsOnDisk()
- {
- return maxElementsOnDisk;
- }
-
- public void setMaxElementsOnDisk( int maxElementsOnDisk )
- {
- this.maxElementsOnDisk = maxElementsOnDisk;
- if ( this.ehcache != null )
- {
- this.ehcache.getCacheConfiguration().setMaxElementsOnDisk( this.maxElementsOnDisk );
- this.ehcache.getCacheConfiguration().maxEntriesLocalDisk( this.maxElementsOnDisk );
- }
- }
-
- /*public String getPersistenceStrategy()
- {
- return persistenceStrategy;
- }
-
- public void setPersistenceStrategy( String persistenceStrategy )
- {
- this.persistenceStrategy = persistenceStrategy;
- }
-
- public boolean isSynchronousWrites()
- {
- return synchronousWrites;
- }
-
- public void setSynchronousWrites( boolean synchronousWrites )
- {
- this.synchronousWrites = synchronousWrites;
- }*/
-}
diff --git a/spring-cache-providers/spring-cache-ehcache/src/main/java/org/apache/archiva/redback/components/cache/ehcache/EhcacheCreator.java b/spring-cache-providers/spring-cache-ehcache/src/main/java/org/apache/archiva/redback/components/cache/ehcache/EhcacheCreator.java
deleted file mode 100644
index 7283949..0000000
--- a/spring-cache-providers/spring-cache-ehcache/src/main/java/org/apache/archiva/redback/components/cache/ehcache/EhcacheCreator.java
+++ /dev/null
@@ -1,73 +0,0 @@
-package org.apache.archiva.redback.components.cache.ehcache;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.archiva.redback.components.cache.Cache;
-import org.apache.commons.lang.SystemUtils;
-import org.apache.archiva.redback.components.cache.CacheException;
-import org.apache.archiva.redback.components.cache.CacheHints;
-import org.apache.archiva.redback.components.cache.factory.CacheCreator;
-
-import java.io.File;
-
-/**
- * EhcacheCreator - runtime creation of an ehcache.
- *
- * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
- *
- */
-public class EhcacheCreator
- implements CacheCreator
-{
-
- public Cache createCache( CacheHints hints )
- throws CacheException
- {
- EhcacheCache cache = new EhcacheCache();
-
- cache.setName( hints.getName() );
-
- cache.setDiskPersistent( hints.isOverflowToDisk() );
- if ( hints.isOverflowToDisk() )
- {
- File overflowPath = null;
-
- if ( hints.getDiskOverflowPath() != null )
- {
- overflowPath = hints.getDiskOverflowPath();
- }
- else
- {
- File tmpDir = SystemUtils.getJavaIoTmpDir();
- overflowPath = new File( tmpDir, "ehcache/" + hints.getName() );
- }
-
- cache.setDiskStorePath( overflowPath.getAbsolutePath() );
- }
-
- cache.setMaxElementsInMemory( hints.getMaxElements() );
- cache.setTimeToLiveSeconds( hints.getMaxSecondsInCache() );
- cache.setTimeToIdleSeconds( hints.getIdleExpirationSeconds() );
-
- cache.initialize();
-
- return cache;
- }
-}
diff --git a/spring-cache-providers/spring-cache-ehcache/src/main/resources/META-INF/plexus-cache.properties b/spring-cache-providers/spring-cache-ehcache/src/main/resources/META-INF/plexus-cache.properties
deleted file mode 100644
index 42d5899..0000000
--- a/spring-cache-providers/spring-cache-ehcache/src/main/resources/META-INF/plexus-cache.properties
+++ /dev/null
@@ -1,17 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-cache.creator=org.apache.archiva.redback.components.cache.ehcache.EhcacheCreator
\ No newline at end of file
diff --git a/spring-cache-providers/spring-cache-ehcache/src/main/resources/META-INF/spring-context.xml b/spring-cache-providers/spring-cache-ehcache/src/main/resources/META-INF/spring-context.xml
deleted file mode 100644
index 6e2aa01..0000000
--- a/spring-cache-providers/spring-cache-ehcache/src/main/resources/META-INF/spring-context.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0"?>
-
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one
- ~ or more contributor license agreements. See the NOTICE file
- ~ distributed with this work for additional information
- ~ regarding copyright ownership. The ASF licenses this file
- ~ to you under the Apache License, Version 2.0 (the
- ~ "License"); you may not use this file except in compliance
- ~ with the License. You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing,
- ~ software distributed under the License is distributed on an
- ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- ~ KIND, either express or implied. See the License for the
- ~ specific language governing permissions and limitations
- ~ under the License.
- -->
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:context="http://www.springframework.org/schema/context"
- xsi:schemaLocation="http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
- http://www.springframework.org/schema/context
- http://www.springframework.org/schema/context/spring-context-3.0.xsd"
- default-lazy-init="true">
-
- <context:annotation-config />
- <context:component-scan
- base-package="org.apache.archiva.redback.components.cache.ehcache"/>
-
-</beans>
\ No newline at end of file
diff --git a/spring-cache-providers/spring-cache-ehcache/src/test/java/org/apache/archiva/redback/components/cache/ehcache/EhCacheDiskPathTest.java b/spring-cache-providers/spring-cache-ehcache/src/test/java/org/apache/archiva/redback/components/cache/ehcache/EhCacheDiskPathTest.java
deleted file mode 100644
index ba5cb6d..0000000
--- a/spring-cache-providers/spring-cache-ehcache/src/test/java/org/apache/archiva/redback/components/cache/ehcache/EhCacheDiskPathTest.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package org.apache.archiva.redback.components.cache.ehcache;
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import junit.framework.TestCase;
-import org.apache.archiva.redback.components.cache.Cache;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-
-import javax.inject.Inject;
-import javax.inject.Named;
-import java.io.File;
-
-/**
- * @author Olivier Lamy
- */
-@RunWith( SpringJUnit4ClassRunner.class )
-@ContextConfiguration( locations = { "classpath*:/spring-context-disk.xml" } )
-public class EhCacheDiskPathTest
- extends TestCase
-{
- @Inject
- @Named( value = "cache#test-cache-int-disk" )
- Cache<String, Integer> cache;
-
- @Test
- public void testDisk()
- throws Exception
- {
- for ( int i = 0; i < 1000; i++ )
- {
- cache.put( Integer.toString( i ), i );
- }
- File cacheDiskFile = new File( System.getProperty( "basedir" ), "target/ehcache-test-store-disk-int" );
- assertTrue( cacheDiskFile.exists() );
- assertTrue( cacheDiskFile.isDirectory() );
- // length on folder return 0 on windows
- assertTrue( cacheDiskFile.listFiles().length > 0 );
- }
-}
diff --git a/spring-cache-providers/spring-cache-ehcache/src/test/java/org/apache/archiva/redback/components/cache/ehcache/EhcacheCacheTest.java b/spring-cache-providers/spring-cache-ehcache/src/test/java/org/apache/archiva/redback/components/cache/ehcache/EhcacheCacheTest.java
deleted file mode 100644
index 8938c59..0000000
--- a/spring-cache-providers/spring-cache-ehcache/src/test/java/org/apache/archiva/redback/components/cache/ehcache/EhcacheCacheTest.java
+++ /dev/null
@@ -1,92 +0,0 @@
-package org.apache.archiva.redback.components.cache.ehcache;
-
-/*
- * Copyright 2001-2007 The Codehaus.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import org.apache.archiva.redback.components.cache.Cache;
-import org.apache.archiva.redback.components.cache.ehcache.EhcacheCache;
-import org.apache.archiva.redback.components.cache.test.AbstractCacheTestCase;
-import org.apache.archiva.redback.components.cache.test.examples.wine.Wine;
-import org.springframework.test.annotation.DirtiesContext;
-
-import javax.inject.Inject;
-import javax.inject.Named;
-
-/**
- * EhcacheCacheTest
- *
- * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
- */
-@DirtiesContext( classMode = DirtiesContext.ClassMode.AFTER_CLASS )
-public class EhcacheCacheTest
- extends AbstractCacheTestCase
-{
-
- @Inject
- @Named(value = "cache#ehcache")
- Cache<String, Integer> cache;
-
- @Inject
- @Named(value = "cache#alwaysrefresh")
- Cache<String, Wine> cachealwaysrefresh;
-
- @Inject
- @Named(value = "cache#onesecondrefresh")
- Cache<String, Wine> cacheonesecondrefresh;
-
- @Inject
- @Named(value = "cache#onesecondrefresh")
- Cache<String, Wine> cachetwosecondrefresh;
-
- @Inject
- @Named(value = "cache#neverrefresh")
- Cache<String, Wine> cacheneversecondrefresh;
-
- @Override
- public Cache<String, Integer> getCache()
- {
- return cache;
- }
-
- public Cache<String, Wine> getAlwaysRefresCache()
- throws Exception
- {
- return cachealwaysrefresh;
- }
-
- public Cache<String, Wine> getNeverRefresCache()
- throws Exception
- {
- return cacheneversecondrefresh;
- }
-
- public Cache<String, Wine> getOneSecondRefresCache()
- throws Exception
- {
- return cacheonesecondrefresh;
- }
-
- public Cache<String, Wine> getTwoSecondRefresCache()
- throws Exception
- {
- return cachetwosecondrefresh;
- }
-
- public Class getCacheClass()
- {
- return EhcacheCache.class;
- }
-}
diff --git a/spring-cache-providers/spring-cache-ehcache/src/test/resources/spring-context-disk.xml b/spring-cache-providers/spring-cache-ehcache/src/test/resources/spring-context-disk.xml
deleted file mode 100644
index a0ecd2b..0000000
--- a/spring-cache-providers/spring-cache-ehcache/src/test/resources/spring-context-disk.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-<?xml version="1.0"?>
-
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one
- ~ or more contributor license agreements. See the NOTICE file
- ~ distributed with this work for additional information
- ~ regarding copyright ownership. The ASF licenses this file
- ~ to you under the Apache License, Version 2.0 (the
- ~ "License"); you may not use this file except in compliance
- ~ with the License. You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing,
- ~ software distributed under the License is distributed on an
- ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- ~ KIND, either express or implied. See the License for the
- ~ specific language governing permissions and limitations
- ~ under the License.
- -->
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
-
-
- <bean name="cache#test-cache-int-disk" class="org.apache.archiva.redback.components.cache.ehcache.EhcacheCache">
- <property name="diskExpiryThreadIntervalSeconds" value="600"/>
- <property name="diskPersistent" value="true"/>
- <property name="diskStorePath" value="./target/ehcache-test-store-disk-int"/>
- <property name="eternal" value="true"/>
- <!--property name="maxElementsInMemory" value="1"/-->
- <property name="memoryEvictionPolicy" value="LRU"/>
- <property name="name" value="test-cache-int-disk"/>
- <property name="overflowToDisk" value="true"/>
- <property name="timeToIdleSeconds" value="6000"/>
- <property name="timeToLiveSeconds" value="3000"/>
- <property name="maxElementsOnDisk" value="10000"/>
- <property name="maxBytesLocalHeap" value="1"/>
- </bean>
-
-</beans>
\ No newline at end of file
diff --git a/spring-cache-providers/spring-cache-ehcache/src/test/resources/spring-context.xml b/spring-cache-providers/spring-cache-ehcache/src/test/resources/spring-context.xml
deleted file mode 100644
index 9a83d1b..0000000
--- a/spring-cache-providers/spring-cache-ehcache/src/test/resources/spring-context.xml
+++ /dev/null
@@ -1,92 +0,0 @@
-<?xml version="1.0"?>
-
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one
- ~ or more contributor license agreements. See the NOTICE file
- ~ distributed with this work for additional information
- ~ regarding copyright ownership. The ASF licenses this file
- ~ to you under the Apache License, Version 2.0 (the
- ~ "License"); you may not use this file except in compliance
- ~ with the License. You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing,
- ~ software distributed under the License is distributed on an
- ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- ~ KIND, either express or implied. See the License for the
- ~ specific language governing permissions and limitations
- ~ under the License.
- -->
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
-
-
- <bean name="cache#ehcache" class="org.apache.archiva.redback.components.cache.ehcache.EhcacheCache">
- <property name="diskExpiryThreadIntervalSeconds" value="600"/>
- <property name="diskPersistent" value="false"/>
- <property name="diskStorePath" value="./target/ehcache-test-store"/>
- <property name="eternal" value="false"/>
- <property name="maxElementsInMemory" value="1000"/>
- <property name="memoryEvictionPolicy" value="LRU"/>
- <property name="name" value="test-cache"/>
- <property name="overflowToDisk" value="false"/>
- <property name="timeToIdleSeconds" value="600"/>
- <property name="timeToLiveSeconds" value="300"/>
- </bean>
-
- <bean name="cache#alwaysrefresh" class="org.apache.archiva.redback.components.cache.ehcache.EhcacheCache">
- <property name="diskExpiryThreadIntervalSeconds" value="600"/>
- <property name="diskPersistent" value="false"/>
- <property name="diskStorePath" value="./target/ehcache-test-store"/>
- <property name="eternal" value="false"/>
- <property name="maxElementsInMemory" value="1000"/>
- <property name="memoryEvictionPolicy" value="LRU"/>
- <property name="name" value="alwaysrefresh"/>
- <property name="overflowToDisk" value="false"/>
- <property name="timeToIdleSeconds" value="0"/>
- <property name="timeToLiveSeconds" value="1"/>
- </bean>
-
- <bean name="cache#neverrefresh" class="org.apache.archiva.redback.components.cache.ehcache.EhcacheCache">
- <property name="diskExpiryThreadIntervalSeconds" value="600"/>
- <property name="diskPersistent" value="false"/>
- <property name="diskStorePath" value="./target/ehcache-test-store"/>
- <property name="eternal" value="true"/>
- <property name="maxElementsInMemory" value="1000"/>
- <property name="memoryEvictionPolicy" value="LRU"/>
- <property name="name" value="neverrefresh"/>
- <property name="overflowToDisk" value="false"/>
- <property name="timeToIdleSeconds" value="0"/>
- <property name="timeToLiveSeconds" value="0"/>
- </bean>
-
- <bean name="cache#onesecondrefresh" class="org.apache.archiva.redback.components.cache.ehcache.EhcacheCache">
- <property name="diskExpiryThreadIntervalSeconds" value="600"/>
- <property name="diskPersistent" value="false"/>
- <property name="diskStorePath" value="./target/ehcache-test-store"/>
- <property name="eternal" value="false"/>
- <property name="maxElementsInMemory" value="1000"/>
- <property name="memoryEvictionPolicy" value="LRU"/>
- <property name="name" value="onesecondrefresh"/>
- <property name="overflowToDisk" value="false"/>
- <property name="timeToIdleSeconds" value="1"/>
- <property name="timeToLiveSeconds" value="1"/>
- </bean>
-
- <bean name="cache#twosecondrefresh" class="org.apache.archiva.redback.components.cache.ehcache.EhcacheCache">
- <property name="diskExpiryThreadIntervalSeconds" value="600"/>
- <property name="diskPersistent" value="false"/>
- <property name="diskStorePath" value="./target/ehcache-test-store"/>
- <property name="eternal" value="false"/>
- <property name="maxElementsInMemory" value="1000"/>
- <property name="memoryEvictionPolicy" value="LRU"/>
- <property name="name" value="onesecondrefresh"/>
- <property name="overflowToDisk" value="false"/>
- <property name="timeToIdleSeconds" value="2"/>
- <property name="timeToLiveSeconds" value="2"/>
- </bean>
-
-</beans>
\ No newline at end of file
diff --git a/spring-cache-providers/spring-cache-hashmap/pom.xml b/spring-cache-providers/spring-cache-hashmap/pom.xml
deleted file mode 100644
index 757ceae..0000000
--- a/spring-cache-providers/spring-cache-hashmap/pom.xml
+++ /dev/null
@@ -1,62 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one
- ~ or more contributor license agreements. See the NOTICE file
- ~ distributed with this work for additional information
- ~ regarding copyright ownership. The ASF licenses this file
- ~ to you under the Apache License, Version 2.0 (the
- ~ "License"); you may not use this file except in compliance
- ~ with the License. You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing,
- ~ software distributed under the License is distributed on an
- ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- ~ KIND, either express or implied. See the License for the
- ~ specific language governing permissions and limitations
- ~ under the License.
- -->
-<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/maven-v4_0_0.xsd">
-
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.archiva.redback.components.cache</groupId>
- <artifactId>spring-cache-providers</artifactId>
- <version>2.3-SNAPSHOT</version>
- </parent>
-
- <artifactId>spring-cache-hashmap</artifactId>
-
- <name>Redback Components :: Spring Cache Provider :: hashmap</name>
-
- <description>Commons Cache API : simple in memory HashMap implementation.</description>
- <properties>
- <site.staging.base>${project.parent.parent.basedir}/../site</site.staging.base>
- </properties>
-
- <url>${webUrl}/spring-cache/spring-cache-providers/${project.artifactId}</url>
-
- <dependencies>
-<!--
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-aop</artifactId>
- </dependency>
--->
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-context</artifactId>
- </dependency>
- <dependency>
- <groupId>javax.annotation</groupId>
- <artifactId>javax.annotation-api</artifactId>
- </dependency>
- <dependency>
- <groupId>javax.inject</groupId>
- <artifactId>javax.inject</artifactId>
- </dependency>
- </dependencies>
-
-</project>
diff --git a/spring-cache-providers/spring-cache-hashmap/src/main/java/org/apache/archiva/redback/components/cache/hashmap/HashMapCache.java b/spring-cache-providers/spring-cache-hashmap/src/main/java/org/apache/archiva/redback/components/cache/hashmap/HashMapCache.java
deleted file mode 100644
index d71e309..0000000
--- a/spring-cache-providers/spring-cache-hashmap/src/main/java/org/apache/archiva/redback/components/cache/hashmap/HashMapCache.java
+++ /dev/null
@@ -1,379 +0,0 @@
-package org.apache.archiva.redback.components.cache.hashmap;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.archiva.redback.components.cache.AbstractCache;
-import org.apache.archiva.redback.components.cache.AbstractCacheStatistics;
-import org.apache.archiva.redback.components.cache.Cache;
-import org.apache.archiva.redback.components.cache.CacheStatistics;
-import org.apache.archiva.redback.components.cache.CacheableWrapper;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.stereotype.Service;
-
-import javax.annotation.PostConstruct;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-/**
- * <p>
- * HashMapCache - this is a Cache implementation taken from the Archiva project.
- * </p>
- * <p/>
- * <p>
- * Original class written by Edwin Punzalan for purposes of addressing the
- * jira ticket <a href="http://jira.codehaus.org/browse/MRM-39">MRM-39</a>
- * </p>
- * <p>
- * Configure the refreshTime in seconds value configure a ttl of object life in cache.
- * Object get( Object key ) :
- * <ul>
- * <li> < 0 : method will always return null (no cache)</li>
- * <li> = 0 : first stored object will be return (infinite life in the cache)</li>
- * <li> > 0 : after a live (stored time) of refreshTime the object will be remove from the cache
- * and a no object will be returned by the method</li>
- * </ul>
- * </p>
- *
- * @author Edwin Punzalan
- * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
- */
-@Service("cache#hashmap")
-public class HashMapCache<V,T>
- extends AbstractCache<V,T>
- implements Cache<V,T>
-{
-
- private Logger log = LoggerFactory.getLogger( getClass() );
-
- class Stats
- extends AbstractCacheStatistics
- implements CacheStatistics
- {
-
- public Stats()
- {
- super();
- }
-
- public long getSize()
- {
- synchronized ( cache )
- {
- return cache.size();
- }
- }
-
- }
-
- private Map<V,CacheableWrapper<T>> cache;
-
- /**
- *
- */
- private double cacheHitRatio = 1.0;
-
- /**
- *
- */
- private int cacheMaxSize = 0;
-
- /**
- *
- *
- */
- private int refreshTime;
-
- private Stats stats;
-
- public HashMapCache()
- {
- // noop
- }
-
- /**
- * Empty the cache and reset the cache hit rate
- */
- public void clear()
- {
- synchronized ( cache )
- {
- stats.clear();
- cache.clear();
- }
- }
-
- /**
- * Check for a cached object and return it if it exists. Returns null when the keyed object is not found
- *
- * @param key the key used to map the cached object
- * @return the object mapped to the given key, or null if no cache object is mapped to the given key
- */
- public T get( V key )
- {
- CacheableWrapper<T> retValue = null;
- // prevent search
- if ( !this.isCacheAvailable() )
- {
- return null;
- }
- synchronized ( cache )
- {
- if ( cache.containsKey( key ) )
- {
- // remove and put: this promotes it to the top since we use a linked hash map
- retValue = cache.remove( key );
-
- if ( needRefresh( retValue ) )
- {
- stats.miss();
- return null;
- }
- else
- {
- cache.put( key, retValue );
- stats.hit();
- }
- }
- else
- {
- stats.miss();
- }
- }
-
- return retValue == null ? null : retValue.getValue();
- }
-
-
-
- protected boolean needRefresh( CacheableWrapper cacheableWrapper )
- {
- if ( cacheableWrapper == null )
- {
- return true;
- }
- if ( this.getRefreshTime() == 0 )
- {
- return false;
- }
- boolean result =
- ( System.currentTimeMillis() - cacheableWrapper.getStoredTime() ) > ( this.getRefreshTime() * 1000 );
-
- log.debug( "{} is uptodate {}", cacheableWrapper, result );
-
- return result;
- }
-
- public CacheStatistics getStatistics()
- {
- return stats;
- }
-
- /**
- * Check if the specified key is already mapped to an object.
- *
- * @param key the key used to map the cached object
- * @return true if the cache contains an object associated with the given key
- */
- public boolean hasKey( V key )
- {
- // prevent search
- if ( !this.isCacheAvailable() )
- {
- return false;
- }
- boolean contains;
- synchronized ( cache )
- {
- contains = cache.containsKey( key );
-
- if ( contains )
- {
- stats.hit();
- }
- else
- {
- stats.miss();
- }
- }
-
- return contains;
- }
-
- @PostConstruct
- public void initialize()
- {
- stats = new Stats();
-
- if ( cacheMaxSize > 0 )
- {
- cache = new LinkedHashMap<>( cacheMaxSize );
- }
- else
- {
- cache = new LinkedHashMap<>();
- }
- }
-
- /**
- * Cache the given value and map it using the given key
- *
- * @param key the object to map the valued object
- * @param value the object to cache
- */
- public T put( V key, T value )
- {
- CacheableWrapper<T> ret = null;
-
- // remove and put: this promotes it to the top since we use a linked hash map
- synchronized ( cache )
- {
- if ( cache.containsKey( key ) )
- {
- cache.remove( key );
- }
-
- ret = cache.put( key, new CacheableWrapper<>( value, System.currentTimeMillis() ) );
- }
-
- manageCache();
-
- return ret == null ? null : ret.getValue();
- }
-
- /**
- * Cache the given value and map it using the given key
- *
- * @param key the object to map the valued object
- * @param value the object to cache
- */
- public void register( V key, T value )
- {
- // remove and put: this promotes it to the top since we use a linked hash map
- synchronized ( cache )
- {
- if ( cache.containsKey( key ) )
- {
- cache.remove( key );
- }
-
- cache.put( key, new CacheableWrapper<>( value, System.currentTimeMillis() ) );
- }
-
- manageCache();
- }
-
- public T remove( V key )
- {
- synchronized ( cache )
- {
- if ( cache.containsKey( key ) )
- {
- return cache.remove( key ).getValue();
- }
- }
-
- return null;
- }
-
- private void manageCache()
- {
- synchronized ( cache )
- {
- Iterator iterator = cache.entrySet().iterator();
- if ( cacheMaxSize == 0 )
- {
- // desired HitRatio is reached, we can trim the cache to conserve memory
- if ( cacheHitRatio <= stats.getCacheHitRate() )
- {
- iterator.next();
- iterator.remove();
- }
- }
- else if ( cache.size() > cacheMaxSize )
- {
- // maximum cache size is reached
- while ( cache.size() > cacheMaxSize )
- {
- iterator.next();
- iterator.remove();
- }
- }
- else
- {
- // even though the max has not been reached, the desired HitRatio is already reached,
- // so we can trim the cache to conserve memory
- if ( cacheHitRatio <= stats.getCacheHitRate() )
- {
- iterator.next();
- iterator.remove();
- }
- }
- }
- }
-
-
- public int getRefreshTime()
- {
- return refreshTime;
- }
-
- /**
- *
- */
- public void setRefreshTime( int refreshTime )
- {
- this.refreshTime = refreshTime;
- }
-
- /**
- * @return
- */
- protected boolean isCacheAvailable()
- {
- return this.getRefreshTime() >= 0;
- }
-
- public double getCacheHitRatio()
- {
- return cacheHitRatio;
- }
-
- public void setCacheHitRatio( double cacheHitRatio )
- {
- this.cacheHitRatio = cacheHitRatio;
- }
-
- public int getCacheMaxSize()
- {
- return cacheMaxSize;
- }
-
- public void setCacheMaxSize( int cacheMaxSize )
- {
- this.cacheMaxSize = cacheMaxSize;
- }
-
- public Stats getStats()
- {
- return stats;
- }
-}
diff --git a/spring-cache-providers/spring-cache-hashmap/src/main/java/org/apache/archiva/redback/components/cache/hashmap/HashMapCacheCreator.java b/spring-cache-providers/spring-cache-hashmap/src/main/java/org/apache/archiva/redback/components/cache/hashmap/HashMapCacheCreator.java
deleted file mode 100644
index 3765cdf..0000000
--- a/spring-cache-providers/spring-cache-hashmap/src/main/java/org/apache/archiva/redback/components/cache/hashmap/HashMapCacheCreator.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package org.apache.archiva.redback.components.cache.hashmap;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.archiva.redback.components.cache.Cache;
-import org.apache.archiva.redback.components.cache.CacheException;
-import org.apache.archiva.redback.components.cache.CacheHints;
-import org.apache.archiva.redback.components.cache.factory.CacheCreator;
-
-/**
- * HashMapCacheCreator
- *
- * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
- *
- */
-public class HashMapCacheCreator
- implements CacheCreator
-{
- public Cache createCache( CacheHints cacheHint )
- throws CacheException
- {
- // Supports NO CacheHints.
-
- HashMapCache cache = new HashMapCache();
-
- cache.initialize();
-
- return cache;
- }
-}
diff --git a/spring-cache-providers/spring-cache-hashmap/src/main/resources/META-INF/plexus-cache.properties b/spring-cache-providers/spring-cache-hashmap/src/main/resources/META-INF/plexus-cache.properties
deleted file mode 100644
index 9ab7360..0000000
--- a/spring-cache-providers/spring-cache-hashmap/src/main/resources/META-INF/plexus-cache.properties
+++ /dev/null
@@ -1,17 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-cache.creator=org.apache.archiva.redback.components.cache.hashmap.HashMapCacheCreator
\ No newline at end of file
diff --git a/spring-cache-providers/spring-cache-hashmap/src/main/resources/META-INF/spring-context.xml b/spring-cache-providers/spring-cache-hashmap/src/main/resources/META-INF/spring-context.xml
deleted file mode 100644
index de928d6..0000000
--- a/spring-cache-providers/spring-cache-hashmap/src/main/resources/META-INF/spring-context.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-<?xml version="1.0"?>
-
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one
- ~ or more contributor license agreements. See the NOTICE file
- ~ distributed with this work for additional information
- ~ regarding copyright ownership. The ASF licenses this file
- ~ to you under the Apache License, Version 2.0 (the
- ~ "License"); you may not use this file except in compliance
- ~ with the License. You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing,
- ~ software distributed under the License is distributed on an
- ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- ~ KIND, either express or implied. See the License for the
- ~ specific language governing permissions and limitations
- ~ under the License.
- -->
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:context="http://www.springframework.org/schema/context"
- xsi:schemaLocation="http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
- http://www.springframework.org/schema/context
- http://www.springframework.org/schema/context/spring-context-3.0.xsd">
-
- <context:annotation-config />
- <context:component-scan
- base-package="org.apache.archiva.redback.components.cache.hashmap"/>
-
-</beans>
\ No newline at end of file
diff --git a/spring-cache-providers/spring-cache-hashmap/src/test/java/org/apache/archiva/redback/components/cache/hashmap/HashMapCacheTest.java b/spring-cache-providers/spring-cache-hashmap/src/test/java/org/apache/archiva/redback/components/cache/hashmap/HashMapCacheTest.java
deleted file mode 100644
index 4ed0d79..0000000
--- a/spring-cache-providers/spring-cache-hashmap/src/test/java/org/apache/archiva/redback/components/cache/hashmap/HashMapCacheTest.java
+++ /dev/null
@@ -1,90 +0,0 @@
-package org.apache.archiva.redback.components.cache.hashmap;
-
-/*
- * Copyright 2001-2007 The Codehaus.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import org.apache.archiva.redback.components.cache.Cache;
-import org.apache.archiva.redback.components.cache.hashmap.HashMapCache;
-import org.apache.archiva.redback.components.cache.test.AbstractCacheTestCase;
-import org.apache.archiva.redback.components.cache.test.examples.wine.Wine;
-
-import javax.inject.Inject;
-import javax.inject.Named;
-
-/**
- * HashMapCacheTest
- *
- * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
- */
-public class HashMapCacheTest
- extends AbstractCacheTestCase
-{
- @Inject
- @Named(value = "cache#hashmap")
- Cache<String, Integer> cache;
-
- @Inject
- @Named(value = "cache#alwaysrefresh")
- Cache<String, Wine> cachealwaysrefresh;
-
- @Inject
- @Named( value = "cache#never" )
- Cache<String, Wine> cachenever;
-
- @Inject
- @Named(value = "cache#onesecondrefresh")
- Cache<String, Wine> cacheonesecondrefresh;
-
- @Inject
- @Named(value = "cache#twosecondrefresh")
- Cache<String, Wine> cachetwosecondrefresh;
-
- @Override
- public Cache<String, Integer> getCache()
- {
- return cache;
- }
-
- public Cache<String, Wine> getAlwaysRefresCache()
- throws Exception
- {
- return cachealwaysrefresh;
- }
-
- public Cache<String, Wine> getNeverRefresCache()
- throws Exception
- {
- return cachenever;
- }
-
- public Cache<String, Wine> getOneSecondRefresCache()
- throws Exception
- {
- return cacheonesecondrefresh;
- }
-
- public Cache<String, Wine> getTwoSecondRefresCache()
- throws Exception
- {
- return cachetwosecondrefresh;
- }
-
- public Class getCacheClass()
- {
- return HashMapCache.class;
- }
-
-}
\ No newline at end of file
diff --git a/spring-cache-providers/spring-cache-hashmap/src/test/resources/spring-context.xml b/spring-cache-providers/spring-cache-hashmap/src/test/resources/spring-context.xml
deleted file mode 100644
index cf68634..0000000
--- a/spring-cache-providers/spring-cache-hashmap/src/test/resources/spring-context.xml
+++ /dev/null
@@ -1,57 +0,0 @@
-<?xml version="1.0"?>
-
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one
- ~ or more contributor license agreements. See the NOTICE file
- ~ distributed with this work for additional information
- ~ regarding copyright ownership. The ASF licenses this file
- ~ to you under the Apache License, Version 2.0 (the
- ~ "License"); you may not use this file except in compliance
- ~ with the License. You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing,
- ~ software distributed under the License is distributed on an
- ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- ~ KIND, either express or implied. See the License for the
- ~ specific language governing permissions and limitations
- ~ under the License.
- -->
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
-
-
- <bean name="cache#hashmap" class="org.apache.archiva.redback.components.cache.hashmap.HashMapCache">
- <property name="cacheHitRatio" value="1.0"/>
- <property name="cacheMaxSize" value="0"/>
- <property name="refreshTime" value="0"/>
- </bean>
-
- <bean name="cache#never" class="org.apache.archiva.redback.components.cache.hashmap.HashMapCache">
- <property name="cacheHitRatio" value="1.0"/>
- <property name="cacheMaxSize" value="0"/>
- <property name="refreshTime" value="0"/>
- </bean>
-
- <bean name="cache#alwaysrefresh" class="org.apache.archiva.redback.components.cache.hashmap.HashMapCache">
- <property name="cacheHitRatio" value="1.0"/>
- <property name="cacheMaxSize" value="0"/>
- <property name="refreshTime" value="-1"/>
- </bean>
-
- <bean name="cache#onesecondrefresh" class="org.apache.archiva.redback.components.cache.hashmap.HashMapCache">
- <property name="cacheHitRatio" value="1.0"/>
- <property name="cacheMaxSize" value="0"/>
- <property name="refreshTime" value="1"/>
- </bean>
-
- <bean name="cache#twosecondrefresh" class="org.apache.archiva.redback.components.cache.hashmap.HashMapCache">
- <property name="cacheHitRatio" value="1.0"/>
- <property name="cacheMaxSize" value="0"/>
- <property name="refreshTime" value="2"/>
- </bean>
-
-</beans>
\ No newline at end of file
diff --git a/spring-cache-providers/spring-cache-oscache/pom.xml b/spring-cache-providers/spring-cache-oscache/pom.xml
deleted file mode 100644
index f594eef..0000000
--- a/spring-cache-providers/spring-cache-oscache/pom.xml
+++ /dev/null
@@ -1,63 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
--->
-<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/maven-v4_0_0.xsd">
-
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.archiva.redback.components.cache</groupId>
- <artifactId>spring-cache-providers</artifactId>
- <version>2.3-SNAPSHOT</version>
- </parent>
-
- <artifactId>spring-cache-oscache</artifactId>
-
- <name>Redback Components :: Spring Cache Provider :: oscache</name>
-
- <description>Commons Cache API : oscache implementation.</description>
- <properties>
- <site.staging.base>${project.parent.parent.basedir}/../site</site.staging.base>
- </properties>
-
- <url>${webUrl}/spring-cache/spring-cache-providers/${project.artifactId}</url>
-
- <dependencies>
- <dependency>
- <groupId>opensymphony</groupId>
- <artifactId>oscache</artifactId>
- <version>2.4</version>
- <exclusions>
- <exclusion>
- <groupId>javax.jms</groupId>
- <artifactId>jms</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>commons-lang</groupId>
- <artifactId>commons-lang</artifactId>
- </dependency>
- <dependency>
- <groupId>javax.annotation</groupId>
- <artifactId>javax.annotation-api</artifactId>
- </dependency>
- <dependency>
- <groupId>javax.inject</groupId>
- <artifactId>javax.inject</artifactId>
- </dependency>
-
- </dependencies>
-
-</project>
diff --git a/spring-cache-providers/spring-cache-oscache/src/main/java/org/apache/archiva/redback/components/cache/oscache/OsCacheCache.java b/spring-cache-providers/spring-cache-oscache/src/main/java/org/apache/archiva/redback/components/cache/oscache/OsCacheCache.java
deleted file mode 100644
index feba3da..0000000
--- a/spring-cache-providers/spring-cache-oscache/src/main/java/org/apache/archiva/redback/components/cache/oscache/OsCacheCache.java
+++ /dev/null
@@ -1,422 +0,0 @@
-package org.apache.archiva.redback.components.cache.oscache;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import com.opensymphony.oscache.base.CacheEntry;
-import com.opensymphony.oscache.base.NeedsRefreshException;
-import com.opensymphony.oscache.general.GeneralCacheAdministrator;
-import org.apache.archiva.redback.components.cache.AbstractCache;
-import org.apache.archiva.redback.components.cache.Cache;
-import org.apache.archiva.redback.components.cache.CacheStatistics;
-
-import javax.annotation.PostConstruct;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-
-/**
- * For configuration see documentation : http://opensymphony.com/oscache/wiki/Configuration.html
- *
- * @author @author Olivier Lamy
- */
-public class OsCacheCache<V, T>
- extends AbstractCache<V, T>
- implements Cache<V, T>
-{
-
- private GeneralCacheAdministrator generalCacheAdministrator;
-
- private OsCacheStatistics osCacheStatistics;
-
- //---------------------------------------------
- // Configuration attributes
- //---------------------------------------------
-
- /**
- * use memory cache
- */
- private boolean cacheMemory = true;
-
- /**
- * maximum item numbers default value -1 means unlimited
- */
- private int capacity = -1;
-
- /**
- * cache algorithm
- */
- private String cacheAlgorithm;
-
- /**
- *
- */
- private boolean blockingCache = false;
-
- /**
- *
- */
- private boolean cacheUnlimitedDisk = false;
-
- /**
- *
- */
- private String cachePersistenceClass;
-
- /**
- *
- */
- private String cachePath;
-
- /**
- *
- */
- private boolean cachePersistenceOverflowOnly = false;
-
- /**
- * A default one will be added to provided CacheStatistics
- */
- private List cacheEventListeners;
-
- /**
- *
- */
- private String cacheKey;
-
- /**
- *
- */
- private boolean cacheUseHostDomainInKey = false;
-
- /**
- * in order to add some other osCache properties
- */
- private Map additionnalProperties;
-
- /**
- * default Value {@link CacheEntry#INDEFINITE_EXPIRY}
- */
- private int refreshPeriod = CacheEntry.INDEFINITE_EXPIRY;
-
- //---------------------------------------------
- // Component lifecycle
- //---------------------------------------------
- @PostConstruct
- public void initialize()
- {
- Properties cacheProperties = new Properties();
- if ( this.getAdditionnalProperties() != null )
- {
- cacheProperties.putAll( this.getAdditionnalProperties() );
- }
- if ( this.getCacheAlgorithm() != null )
- {
- cacheProperties.put( GeneralCacheAdministrator.CACHE_ALGORITHM_KEY, this.getCacheAlgorithm() );
- }
- cacheProperties.put( GeneralCacheAdministrator.CACHE_BLOCKING_KEY, Boolean.toString( this.isBlockingCache() ) );
- cacheProperties.put( GeneralCacheAdministrator.CACHE_CAPACITY_KEY, Integer.toString( this.getCapacity() ) );
- cacheProperties.put( GeneralCacheAdministrator.CACHE_DISK_UNLIMITED_KEY,
- Boolean.toString( this.isCacheUnlimitedDisk() ) );
-
- String cacheEventListenersAsString = this.getCacheEventListenersAsString();
- if ( cacheEventListenersAsString != null )
- {
- cacheProperties.put( GeneralCacheAdministrator.CACHE_ENTRY_EVENT_LISTENERS_KEY,
- cacheEventListenersAsString );
- }
- cacheProperties.put( GeneralCacheAdministrator.CACHE_MEMORY_KEY, Boolean.toString( this.isCacheMemory() ) );
- cacheProperties.put( GeneralCacheAdministrator.CACHE_PERSISTENCE_OVERFLOW_KEY,
- Boolean.toString( this.isCachePersistenceOverflowOnly() ) );
-
- if ( this.getCachePersistenceClass() != null )
- {
- cacheProperties.put( GeneralCacheAdministrator.PERSISTENCE_CLASS_KEY, this.getCachePersistenceClass() );
- }
-
- cacheProperties.put( "cache.unlimited.disk", Boolean.toString( this.isCacheUnlimitedDisk() ) );
- if ( this.getCachePath() != null )
- {
- cacheProperties.put( "cache.path", this.getCachePath() );
- }
- if ( this.getCacheKey() != null )
- {
- cacheProperties.put( "cache.key", this.getCacheKey() );
- }
- cacheProperties.put( "cache.use.host.domain.in.key", Boolean.toString( this.isCacheUseHostDomainInKey() ) );
- this.generalCacheAdministrator = new GeneralCacheAdministrator( cacheProperties );
- this.osCacheStatistics = new OsCacheStatistics( this.generalCacheAdministrator.getCache() );
- }
-
- //---------------------------------------------
- // Interface implementation
- //---------------------------------------------
-
- public void clear()
- {
- this.generalCacheAdministrator.flushAll();
- }
-
- public T get( V key )
- {
- try
- {
- T object = null;
- if ( this.getRefreshPeriod() >= 0 )
- {
- object = (T) this.generalCacheAdministrator.getFromCache( key.toString(), this.getRefreshPeriod() );
- }
- else
- {
- object = (T) this.generalCacheAdministrator.getFromCache( key.toString() );
- }
- if ( object != null )
- {
- this.osCacheStatistics.hit();
- }
- else
- {
- this.osCacheStatistics.miss();
- }
- return object;
- }
- catch ( NeedsRefreshException e )
- {
- this.generalCacheAdministrator.cancelUpdate( key.toString() );
- this.osCacheStatistics.miss();
- return null;
- }
- }
-
-
- public CacheStatistics getStatistics()
- {
- // osCacheStatistics to update ??
- return this.osCacheStatistics;
- }
-
- public boolean hasKey( V key )
- {
- // TODO if null increase/decrease statistics ?
- return this.get( key ) == null;
- }
-
- public void register( V key, T value )
- {
- this.generalCacheAdministrator.putInCache( key.toString(), value );
- }
-
- public T put( V key, T value )
- {
- Object previous = null;
- try
- {
- previous = this.generalCacheAdministrator.getFromCache( key.toString(), this.getRefreshPeriod() );
- }
- catch ( NeedsRefreshException e )
- {
- // ignore this because the content will be updated
- }
- this.generalCacheAdministrator.putInCache( key.toString(), value );
- return (T) previous;
- }
-
- public T remove( V key )
- {
- Object previous = null;
- try
- {
- previous = this.generalCacheAdministrator.getFromCache( key.toString(), this.getRefreshPeriod() );
-
- }
- catch ( NeedsRefreshException e )
- {
- // ignore this because the content will be updated
- }
- this.generalCacheAdministrator.cancelUpdate( key.toString() );
- this.generalCacheAdministrator.flushEntry( key.toString() );
- return (T) previous;
- }
-
- //---------------------------------------------
- // getters/setters
- //---------------------------------------------
-
- public Map getAdditionnalProperties()
- {
- return additionnalProperties;
- }
-
- public void setAdditionnalProperties( Map additionnalProperties )
- {
- this.additionnalProperties = additionnalProperties;
- }
-
- public boolean isBlockingCache()
- {
- return blockingCache;
- }
-
- public void setBlockingCache( boolean blockingCache )
- {
- this.blockingCache = blockingCache;
- }
-
- public String getCacheAlgorithm()
- {
- return cacheAlgorithm == null ? "com.opensymphony.oscache.base.algorithm.UnlimitedCache" : cacheAlgorithm;
- }
-
- public void setCacheAlgorithm( String cacheAlgorithm )
- {
- this.cacheAlgorithm = cacheAlgorithm;
- }
-
- public List getCacheEventListeners()
- {
- return cacheEventListeners;
- }
-
- /**
- * @return list values in a String separated with comma
- */
- private String getCacheEventListenersAsString()
- {
- if ( this.getCacheEventListeners() == null )
- {
- return null;
- }
- if ( this.getCacheEventListeners().isEmpty() )
- {
- return null;
- }
- StringBuilder stringBuffer = new StringBuilder();
- for ( Iterator iterator = this.getCacheEventListeners().iterator(); iterator.hasNext(); )
- {
- stringBuffer.append( iterator.next() ).append( ',' );
- }
- return stringBuffer.toString().substring( 0, stringBuffer.toString().length() - 1 );
- }
-
- public void setCacheEventListeners( List cacheEventListeners )
- {
- this.cacheEventListeners = cacheEventListeners;
- }
-
- public String getCacheKey()
- {
- return cacheKey == null ? "cacheKey" : cacheKey;
- }
-
- public void setCacheKey( String cacheKey )
- {
- this.cacheKey = cacheKey;
- }
-
- public boolean isCacheMemory()
- {
- return cacheMemory;
- }
-
- public void setCacheMemory( boolean cacheMemory )
- {
- this.cacheMemory = cacheMemory;
- }
-
- public String getCachePath()
- {
- return cachePath;
- }
-
- public void setCachePath( String cachePath )
- {
- this.cachePath = cachePath;
- }
-
- public String getCachePersistenceClass()
- {
- return cachePersistenceClass;
- }
-
- public void setCachePersistenceClass( String cachePersistenceClass )
- {
- this.cachePersistenceClass = cachePersistenceClass;
- }
-
- public boolean isCachePersistenceOverflowOnly()
- {
- return cachePersistenceOverflowOnly;
- }
-
- public void setCachePersistenceOverflowOnly( boolean cachePersistenceOverflowOnly )
- {
- this.cachePersistenceOverflowOnly = cachePersistenceOverflowOnly;
- }
-
- public boolean isCacheUnlimitedDisk()
- {
- return cacheUnlimitedDisk;
- }
-
- public void setCacheUnlimitedDisk( boolean cacheUnlimitedDisk )
- {
- this.cacheUnlimitedDisk = cacheUnlimitedDisk;
- }
-
- public boolean isCacheUseHostDomainInKey()
- {
- return cacheUseHostDomainInKey;
- }
-
- public void setCacheUseHostDomainInKey( boolean cacheUseHostDomainInKey )
- {
- this.cacheUseHostDomainInKey = cacheUseHostDomainInKey;
- }
-
- public int getCapacity()
- {
- return capacity;
- }
-
- public void setCapacity( int capacity )
- {
- this.capacity = capacity;
- }
-
- public GeneralCacheAdministrator getGeneralCacheAdministrator()
- {
- return generalCacheAdministrator;
- }
-
- public void setGeneralCacheAdministrator( GeneralCacheAdministrator generalCacheAdministrator )
- {
- this.generalCacheAdministrator = generalCacheAdministrator;
- }
-
- public int getRefreshPeriod()
- {
- return refreshPeriod;
- }
-
- public void setRefreshPeriod( int refreshPeriod )
- {
- this.refreshPeriod = refreshPeriod;
- }
-
-}
diff --git a/spring-cache-providers/spring-cache-oscache/src/main/java/org/apache/archiva/redback/components/cache/oscache/OsCacheCreator.java b/spring-cache-providers/spring-cache-oscache/src/main/java/org/apache/archiva/redback/components/cache/oscache/OsCacheCreator.java
deleted file mode 100644
index 0426781..0000000
--- a/spring-cache-providers/spring-cache-oscache/src/main/java/org/apache/archiva/redback/components/cache/oscache/OsCacheCreator.java
+++ /dev/null
@@ -1,75 +0,0 @@
-package org.apache.archiva.redback.components.cache.oscache;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.archiva.redback.components.cache.CacheException;
-import org.apache.archiva.redback.components.cache.CacheHints;
-import org.apache.commons.lang.SystemUtils;
-import org.apache.archiva.redback.components.cache.Cache;
-import org.apache.archiva.redback.components.cache.factory.CacheCreator;
-
-import java.io.File;
-
-/**
- * OsCacheCreator
- *
- * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
- *
- */
-public class OsCacheCreator
- implements CacheCreator
-{
-
- public Cache createCache( CacheHints hints )
- throws CacheException
- {
- OsCacheCache cache = new OsCacheCache();
-
- cache.setCacheKey( hints.getName() );
-
- cache.setCachePersistenceOverflowOnly( hints.isOverflowToDisk() );
- if ( hints.isOverflowToDisk() )
- {
- File overflowPath = null;
-
- if ( hints.getDiskOverflowPath() != null )
- {
- overflowPath = hints.getDiskOverflowPath();
- }
- else
- {
- File tmpDir = SystemUtils.getJavaIoTmpDir();
- overflowPath = new File( tmpDir, "oscache/" + hints.getName() );
- }
-
- cache.setCachePath( overflowPath.getAbsolutePath() );
- }
-
- cache.setCapacity( hints.getMaxElements() );
- cache.setRefreshPeriod( hints.getIdleExpirationSeconds() );
-
- // Does not support: hints.getMaxSecondsInCache()
-
- cache.initialize();
-
- return cache;
- }
-
-}
diff --git a/spring-cache-providers/spring-cache-oscache/src/main/java/org/apache/archiva/redback/components/cache/oscache/OsCacheStatistics.java b/spring-cache-providers/spring-cache-oscache/src/main/java/org/apache/archiva/redback/components/cache/oscache/OsCacheStatistics.java
deleted file mode 100644
index 39edac0..0000000
--- a/spring-cache-providers/spring-cache-oscache/src/main/java/org/apache/archiva/redback/components/cache/oscache/OsCacheStatistics.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package org.apache.archiva.redback.components.cache.oscache;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.archiva.redback.components.cache.CacheStatistics;
-import org.apache.archiva.redback.components.cache.AbstractCacheStatistics;
-
-import com.opensymphony.oscache.base.Cache;
-
-/**
- *
- * @author Olivier Lamy
- */
-public class OsCacheStatistics
- extends AbstractCacheStatistics
- implements CacheStatistics
-{
-
- private Cache cache;
-
- protected OsCacheStatistics( Cache cache )
- {
- super();
- this.cache = cache;
- }
-
- /**
- * @see org.apache.archiva.redback.components.cache.AbstractCacheStatistics#getSize()
- */
- public long getSize()
- {
- return this.cache.getNbEntries();
- }
-
-}
diff --git a/spring-cache-providers/spring-cache-oscache/src/main/resources/META-INF/plexus-cache.properties b/spring-cache-providers/spring-cache-oscache/src/main/resources/META-INF/plexus-cache.properties
deleted file mode 100644
index aec3c36..0000000
--- a/spring-cache-providers/spring-cache-oscache/src/main/resources/META-INF/plexus-cache.properties
+++ /dev/null
@@ -1,17 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-cache.creator=org.apache.archiva.redback.components.cache.oscache.OsCacheCreator
\ No newline at end of file
diff --git a/spring-cache-providers/spring-cache-oscache/src/main/resources/META-INF/spring-context.xml b/spring-cache-providers/spring-cache-oscache/src/main/resources/META-INF/spring-context.xml
deleted file mode 100644
index ce72aff..0000000
--- a/spring-cache-providers/spring-cache-oscache/src/main/resources/META-INF/spring-context.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-<?xml version="1.0"?>
-
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one
- ~ or more contributor license agreements. See the NOTICE file
- ~ distributed with this work for additional information
- ~ regarding copyright ownership. The ASF licenses this file
- ~ to you under the Apache License, Version 2.0 (the
- ~ "License"); you may not use this file except in compliance
- ~ with the License. You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing,
- ~ software distributed under the License is distributed on an
- ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- ~ KIND, either express or implied. See the License for the
- ~ specific language governing permissions and limitations
- ~ under the License.
- -->
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:context="http://www.springframework.org/schema/context"
- xsi:schemaLocation="http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
- http://www.springframework.org/schema/context
- http://www.springframework.org/schema/context/spring-context-3.0.xsd">
-
- <context:annotation-config />
- <context:component-scan
- base-package="org.apache.archiva.redback.components.cache.oscache"/>
-
-</beans>
\ No newline at end of file
diff --git a/spring-cache-providers/spring-cache-oscache/src/test/java/org/apache/archiva/redback/components/cache/oscache/OsCacheCacheTest.java b/spring-cache-providers/spring-cache-oscache/src/test/java/org/apache/archiva/redback/components/cache/oscache/OsCacheCacheTest.java
deleted file mode 100644
index 6480ae5..0000000
--- a/spring-cache-providers/spring-cache-oscache/src/test/java/org/apache/archiva/redback/components/cache/oscache/OsCacheCacheTest.java
+++ /dev/null
@@ -1,91 +0,0 @@
-package org.apache.archiva.redback.components.cache.oscache;
-
-/*
- * Copyright 2001-2007 The Codehaus.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import org.apache.archiva.redback.components.cache.Cache;
-import org.apache.archiva.redback.components.cache.oscache.OsCacheCache;
-import org.apache.archiva.redback.components.cache.test.AbstractCacheTestCase;
-import org.apache.archiva.redback.components.cache.test.examples.wine.Wine;
-
-import javax.inject.Inject;
-import javax.inject.Named;
-
-/**
- * Tests for OsCacheCache.
- *
- * @author Olivier Lamy
- * @since 3 February, 2007
- */
-public class OsCacheCacheTest
- extends AbstractCacheTestCase
-{
-
- @Inject
- @Named(value = "cache#oscache")
- Cache<String, Integer> cache;
-
- @Inject
- @Named(value = "cache#alwaysrefresh")
- Cache<String, Wine> cachealwaysrefresh;
-
- @Inject
- @Named(value = "cache#onesecondrefresh")
- Cache<String, Wine> cacheonesecondrefresh;
-
- @Inject
- @Named(value = "cache#twosecondrefresh")
- Cache<String, Wine> cachetwosecondrefresh;
-
- @Inject
- @Named(value = "cache#neverrefresh")
- Cache<String, Wine> cacheneversecondrefresh;
-
- @Override
- public Cache<String, Integer> getCache()
- {
- return cache;
- }
-
- public Cache<String, Wine> getAlwaysRefresCache()
- throws Exception
- {
- return cachealwaysrefresh;
- }
-
- public Cache<String, Wine> getNeverRefresCache()
- throws Exception
- {
- return cacheneversecondrefresh;
- }
-
- public Cache<String, Wine> getOneSecondRefresCache()
- throws Exception
- {
- return cacheonesecondrefresh;
- }
-
- public Cache<String, Wine> getTwoSecondRefresCache()
- throws Exception
- {
- return cachetwosecondrefresh;
- }
-
- public Class getCacheClass()
- {
- return OsCacheCache.class;
- }
-}
diff --git a/spring-cache-providers/spring-cache-oscache/src/test/resources/spring-context.xml b/spring-cache-providers/spring-cache-oscache/src/test/resources/spring-context.xml
deleted file mode 100644
index 8c61c14..0000000
--- a/spring-cache-providers/spring-cache-oscache/src/test/resources/spring-context.xml
+++ /dev/null
@@ -1,61 +0,0 @@
-<?xml version="1.0"?>
-
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one
- ~ or more contributor license agreements. See the NOTICE file
- ~ distributed with this work for additional information
- ~ regarding copyright ownership. The ASF licenses this file
- ~ to you under the Apache License, Version 2.0 (the
- ~ "License"); you may not use this file except in compliance
- ~ with the License. You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing,
- ~ software distributed under the License is distributed on an
- ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- ~ KIND, either express or implied. See the License for the
- ~ specific language governing permissions and limitations
- ~ under the License.
- -->
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:context="http://www.springframework.org/schema/context"
- xsi:schemaLocation="http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
- http://www.springframework.org/schema/context
- http://www.springframework.org/schema/context/spring-context-3.0.xsd">
-
-
- <bean name="cache#default" class="org.apache.archiva.redback.components.cache.oscache.OsCacheCache">
- <property name="cacheKey" value="default"/>
- </bean>
-
- <bean name="cache#oscache" class="org.apache.archiva.redback.components.cache.oscache.OsCacheCache">
- <property name="cacheKey" value="oscache"/>
- </bean>
-
- <bean name="cache#neverrefresh" class="org.apache.archiva.redback.components.cache.oscache.OsCacheCache">
- <property name="cacheKey" value="neverrefresh"/>
- <property name="refreshPeriod" value="-2"/>
- </bean>
-
- <bean name="cache#alwaysrefresh" class="org.apache.archiva.redback.components.cache.oscache.OsCacheCache">
- <property name="cacheKey" value="alwaysrefresh"/>
- <property name="refreshPeriod" value="0"/>
- </bean>
-
- <bean name="cache#onesecondrefresh" class="org.apache.archiva.redback.components.cache.oscache.OsCacheCache">
- <property name="cacheKey" value="onesecondrefresh"/>
- <property name="refreshPeriod" value="1"/>
- </bean>
-
- <bean name="cache#twosecondrefresh" class="org.apache.archiva.redback.components.cache.oscache.OsCacheCache">
- <property name="cacheKey" value="onesecondrefresh"/>
- <property name="refreshPeriod" value="15"/>
- </bean>
-
- <bean name="cache#wine" class="org.apache.archiva.redback.components.cache.oscache.OsCacheCache">
- </bean>
-
-</beans>
\ No newline at end of file
diff --git a/spring-cache-providers/src/site/site.xml b/spring-cache-providers/src/site/site.xml
deleted file mode 100644
index 4d28055..0000000
--- a/spring-cache-providers/src/site/site.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one
- ~ or more contributor license agreements. See the NOTICE file
- ~ distributed with this work for additional information
- ~ regarding copyright ownership. The ASF licenses this file
- ~ to you under the Apache License, Version 2.0 (the
- ~ "License"); you may not use this file except in compliance
- ~ with the License. You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing,
- ~ software distributed under the License is distributed on an
- ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- ~ KIND, either express or implied. See the License for the
- ~ specific language governing permissions and limitations
- ~ under the License.
- -->
-<project name="Spring Cache Component">
-
- <publishDate format="dd MMM yyyy" position="none" />
- <version position="left" />
- <body>
- <menu ref="parent" />
- <menu ref="modules" />
- </body>
-</project>
diff --git a/spring-cache-test/pom.xml b/spring-cache-test/pom.xml
deleted file mode 100644
index 8c8912b..0000000
--- a/spring-cache-test/pom.xml
+++ /dev/null
@@ -1,80 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one
- ~ or more contributor license agreements. See the NOTICE file
- ~ distributed with this work for additional information
- ~ regarding copyright ownership. The ASF licenses this file
- ~ to you under the Apache License, Version 2.0 (the
- ~ "License"); you may not use this file except in compliance
- ~ with the License. You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing,
- ~ software distributed under the License is distributed on an
- ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- ~ KIND, either express or implied. See the License for the
- ~ specific language governing permissions and limitations
- ~ under the License.
- -->
-<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/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.archiva.redback.components.cache</groupId>
- <artifactId>spring-cache</artifactId>
- <version>2.3-SNAPSHOT</version>
- </parent>
- <artifactId>spring-cache-test</artifactId>
- <name>Redback Components :: Spring Cache Tests</name>
- <packaging>jar</packaging>
-
- <description>Commons Test Cache API.</description>
- <properties>
- <site.staging.base>${project.parent.basedir}/../site</site.staging.base>
- </properties>
-
- <url>${webUrl}/spring-cache/${project.artifactId}</url>
-
- <scm>
- <url>${scmBrowseUrl};f=${project.artifactId}</url>
- </scm>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.archiva.redback.components.cache</groupId>
- <artifactId>spring-cache-api</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-test</artifactId>
- <scope>compile</scope>
- </dependency>
-
- <!-- JUNIT 5 -->
- <dependency>
- <groupId>org.junit.platform</groupId>
- <artifactId>junit-platform-launcher</artifactId>
- <version>${junit.platform.version}</version>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>org.junit.platform</groupId>
- <artifactId>junit-platform-console-standalone</artifactId>
- <version>${junit.platform.version}</version>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>org.junit.jupiter</groupId>
- <artifactId>junit-jupiter-engine</artifactId>
- <version>${junit.jupiter.version}</version>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>org.junit.vintage</groupId>
- <artifactId>junit-vintage-engine</artifactId>
- <version>${junit.jupiter.version}</version>
- <scope>compile</scope>
- </dependency>
-</dependencies>
-</project>
diff --git a/spring-cache-test/src/main/java/org/apache/archiva/redback/components/cache/test/AbstractCacheTestCase.java b/spring-cache-test/src/main/java/org/apache/archiva/redback/components/cache/test/AbstractCacheTestCase.java
deleted file mode 100644
index 12b904b..0000000
--- a/spring-cache-test/src/main/java/org/apache/archiva/redback/components/cache/test/AbstractCacheTestCase.java
+++ /dev/null
@@ -1,251 +0,0 @@
-package org.apache.archiva.redback.components.cache.test;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import junit.framework.TestCase;
-import org.apache.archiva.redback.components.cache.Cache;
-import org.apache.archiva.redback.components.cache.CacheStatistics;
-import org.apache.archiva.redback.components.cache.CacheException;
-import org.apache.archiva.redback.components.cache.factory.CacheFactory;
-import org.apache.archiva.redback.components.cache.test.examples.wine.Wine;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.logging.ConsoleHandler;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- * AbstractCacheTestCase
- *
- * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
- *
- */
-@RunWith( SpringJUnit4ClassRunner.class )
-@ContextConfiguration( locations = {"classpath*:/META-INF/spring-context.xml","classpath*:/spring-context.xml"} )
-public abstract class AbstractCacheTestCase
- extends TestCase
-{
- static
- {
- Logger logger = Logger.getLogger( "org.codehaus.plexus.cache" );
- logger.setLevel( Level.ALL );
- ConsoleHandler handler = new ConsoleHandler();
- handler.setLevel( Level.ALL );
- logger.addHandler( handler );
- }
-
- protected Cache<String,Integer> cache;
-
- @Before
- public void setUp()
- throws Exception
- {
- super.setUp();
- cache = getCache();
- }
-
-
- public abstract Cache<String,Integer> getCache();
-
- @Test
- public void testSimplePutGet()
- {
- Integer fooInt = Integer.valueOf( 42 );
- cache.put( "foo", fooInt );
-
- Integer val = cache.get( "foo" );
- assertEquals( 42, val.intValue() );
-
- assertNull( cache.get( "bar" ) );
- }
-
- @Test
- public void testLargePutGet()
- {
- EnglishNumberFormat fmt = new EnglishNumberFormat();
-
- for ( int i = 4500; i <= 5000; i++ )
- {
- String key = fmt.toText( i );
- cache.put( key, Integer.valueOf( i ) );
- }
-
- // Put some holes into the list.
- List<String> removedKeys = new ArrayList<>();
- removedKeys.add( fmt.toText( 4600 ) );
- removedKeys.add( fmt.toText( 4700 ) );
- removedKeys.add( fmt.toText( 4800 ) );
-
- Iterator<String> it = removedKeys.iterator();
- while ( it.hasNext() )
- {
- cache.remove( it.next() );
- }
-
- // Some direct gets
- assertEquals( Integer.valueOf( 4590 ), cache.get( "four thousand five hundred ninety" ) );
- assertEquals( Integer.valueOf( 4912 ), cache.get( "four thousand nine hundred twelve" ) );
- int DIRECT = 2;
-
- // Fetch the list repeatedly
- int ITERS = 100;
- int LOW = 4590;
- int HIGH = 4810;
- for ( int iter = 0; iter < ITERS; iter++ )
- {
- for ( int num = LOW; num < HIGH; num++ )
- {
- String key = fmt.toText( num );
- Integer expected = Integer.valueOf( num );
- Integer val = cache.get( key );
-
- // Intentionally removed entries?
- if ( removedKeys.contains( key ) )
- {
- assertNull( "Removed key [" + key + "] should have no value.", val );
- }
- else
- {
- assertEquals( expected, val );
- }
- }
- }
-
- // Test the statistics.
- CacheStatistics stats = cache.getStatistics();
-
- int expectedHits = ( ( ( HIGH - LOW - removedKeys.size() ) * ITERS ) + DIRECT );
- int expectedMiss = ( ITERS * removedKeys.size() );
-
- /* Due to the nature of how the various providers do their work, the expected values
- * should be viewed as minimum values, not exact values.
- */
- assertTrue( "Cache hit count should exceed [" + expectedHits + "], but was actually [" + stats.getCacheHits()
- + "]", expectedHits <= stats.getCacheHits() );
-
- assertTrue( "Cache miss count should exceed [" + expectedMiss + "], but was actually [" + stats.getCacheMiss()
- + "]", expectedMiss <= stats.getCacheMiss() );
-
- /* For the same reason as above, the hit rate is completely un-testable.
- * Leaving this commented so that future developers understand the reason we are not
- * testing this value.
-
- double expectedHitRate = (double) expectedHits / (double) ( expectedHits + expectedMiss );
- assertTrue( "Cache hit rate should exceed [" + expectedHitRate + "], but was actually ["
- + stats.getCacheHitRate() + "]", expectedHitRate <= stats.getCacheHitRate() );
-
- */
- }
-
- public abstract Cache<String,Wine> getAlwaysRefresCache()
- throws Exception;
-
- @Test
- public void testAlwaysRefresh()
- throws Exception
- {
- Wine wine = new Wine( "bordeaux", "west/south of France" );
- String key = wine.getName();
- Cache<String,Wine> cache = this.getAlwaysRefresCache();
- cache.put( key, wine );
- Thread.sleep( 1001 );
- assertNull( cache.get( key ) );
- }
-
- public abstract Cache<String,Wine> getNeverRefresCache()
- throws Exception;
-
- @Test
- public void testNeverRefresh()
- throws Exception
- {
- Cache<String,Wine> cache = this.getNeverRefresCache();
- Wine wine = new Wine( "bordeaux", "west/south of France" );
- String key = wine.getName();
- cache.put( key, wine );
- //Thread.sleep( 1200 );
- Wine o = cache.get( key );
- assertNotNull( o );
- assertEquals( wine.hashCode(), o.hashCode() );
- }
-
- public abstract Cache<String,Wine> getOneSecondRefresCache()
- throws Exception;
-
- @Test
- public void testOneSecondRefresh()
- throws Exception
- {
- Cache<String,Wine> cache = this.getOneSecondRefresCache();
- Wine wine = new Wine( "bordeaux", "west/south of France" );
- String key = wine.getName();
- cache.put( key, wine );
- Thread.sleep( 1200 );
- assertNull( cache.get( key ) );
- }
-
- public abstract Cache<String,Wine> getTwoSecondRefresCache()
- throws Exception;
-
- @Test
- public void testTwoSecondRefresh()
- throws Exception
- {
- Cache<String,Wine> cache = this.getTwoSecondRefresCache();
- Wine wine = new Wine( "bordeaux", "west/south of France" );
- String key = wine.getName();
- cache.put( key, wine );
- Thread.sleep( 500 );
- Wine o = cache.get( key );
- assertNotNull( o );
- assertEquals( wine.hashCode(), o.hashCode() );
- }
-
- public abstract Class getCacheClass();
-
- @Test
- public void testCacheFactory() throws CacheException
- {
- Cache<String,Integer> cache = CacheFactory.getInstance().getCache( "foo-factory-test", null );
-
- // This test is only here to ensure that the provider implements a Creator class.
- assertNotNull( "Cache should not be null", cache );
- assertEquals( "Cache class", getCacheClass().getName(), cache.getClass().getName() );
- assertTrue( "Cache should be assignable from", getCacheClass().isAssignableFrom( cache.getClass() ) );
-
- // Now do some basic set/get functions to test if the cache has been initialized (or not).
- assertNull( cache.get( "bad wolf" ) );
-
- Integer fooInt = Integer.valueOf( 42 );
- cache.put( "foo", fooInt );
-
- Integer val = cache.get( "foo" );
- assertEquals( 42, val.intValue() );
-
- assertNull( cache.get( "bar" ) );
- }
-}
diff --git a/spring-cache-test/src/main/java/org/apache/archiva/redback/components/cache/test/EnglishNumberFormat.java b/spring-cache-test/src/main/java/org/apache/archiva/redback/components/cache/test/EnglishNumberFormat.java
deleted file mode 100644
index 367cb70..0000000
--- a/spring-cache-test/src/main/java/org/apache/archiva/redback/components/cache/test/EnglishNumberFormat.java
+++ /dev/null
@@ -1,165 +0,0 @@
-package org.apache.archiva.redback.components.cache.test;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.commons.lang.StringUtils;
-import org.apache.commons.lang.math.NumberUtils;
-
-/**
- * EnglishNumberFormat - Silly utility to generate text from numbers.
- * Used in the generation of large data sets for the Cache testing.
- *
- * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
- *
- */
-public class EnglishNumberFormat
-{
- public static final String[] basic = { // basic numbers from 1 to 19
- null, // zero
- "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", "eleven", "twelve", "thirteen",
- "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen" };
-
- public static final String[] tens = { // numbers representing the 2nd digit
- null, // zeroty ??
- null, // ten
- "twenty", "thirty", "fourty", "fifty", "sixty", "seventy", "eighty", "ninety" };
-
- public static final String[] dreds = { // number multiples
- null, // tendred ??
- "hundred", "thousand", "million", "billion", "trillion", "quadrillion", "quintillion" };
-
- public String toText( long number )
- {
- // Special case
- if ( number == 0 )
- {
- return "zero";
- }
-
- // Quick return - single digit
- if ( number <= 9 )
- {
- return basic[(int) number];
- }
-
- NumberText txt = new NumberText();
- Digits digits = new Digits( number );
- int multi = 1;
- int offset = 0;
-
- while ( digits.at( offset ) >= 0 )
- {
- // Handle last 2 digits first.
- int first = digits.at( offset );
- int second = digits.at( offset + 1 );
- int third = digits.at( offset + 2 );
-
- if ( second >= 0 )
- {
- int basicDigits = ( second * 10 ) + first;
-
- if ( basicDigits <= 19 )
- {
- txt.prepend( basic[basicDigits] );
- }
- else
- {
- txt.prepend( basic[first] );
- txt.prepend( tens[second] );
- }
- }
- else
- {
- txt.prepend( basic[first] );
- }
-
- if ( third > 0 )
- {
- txt.prepend( basic[third] + " " + dreds[1] );
- }
-
- offset += 3;
- multi++;
- txt.setPotentialMultiple( dreds[multi] );
- }
-
- return txt.toString();
- }
-
- static final class NumberText
- {
- private StringBuilder txt;
-
- private String potentialMulti = null;
-
- public NumberText()
- {
- txt = new StringBuilder();
- }
-
- public void setPotentialMultiple( String multiple )
- {
- potentialMulti = multiple;
- }
-
- public void prepend( String name )
- {
- if ( name != null )
- {
- if ( potentialMulti != null )
- {
- txt.insert( 0, potentialMulti + " " );
- potentialMulti = null;
- }
-
- if ( txt.length() > 0 )
- {
- name += " ";
- }
- txt.insert( 0, name );
- }
- }
-
- public String toString()
- {
- return txt.toString();
- }
- }
-
- static final class Digits
- {
- private String digits;
-
- public Digits( long number )
- {
- digits = StringUtils.reverse( String.valueOf( number ) );
- }
-
- public int at( int offset )
- {
- if ( offset >= digits.length() )
- {
- return ( -1 );
- }
-
- return NumberUtils.toInt( "" + digits.charAt( offset ) );
- }
- }
-}
diff --git a/spring-cache-test/src/main/java/org/apache/archiva/redback/components/cache/test/examples/wine/AbstractTestWineService.java b/spring-cache-test/src/main/java/org/apache/archiva/redback/components/cache/test/examples/wine/AbstractTestWineService.java
deleted file mode 100644
index 7784500..0000000
--- a/spring-cache-test/src/main/java/org/apache/archiva/redback/components/cache/test/examples/wine/AbstractTestWineService.java
+++ /dev/null
@@ -1,66 +0,0 @@
-package org.apache.archiva.redback.components.cache.test.examples.wine;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import junit.framework.TestCase;
-import org.apache.archiva.redback.components.cache.Cache;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-
-import javax.inject.Inject;
-import javax.inject.Named;
-
-/**
- *
- *
- * @author Olivier Lamy
- */
- @RunWith( SpringJUnit4ClassRunner.class )
-@ContextConfiguration( locations = {"classpath*:/META-INF/spring-context.xml","classpath*:/spring-context.xml"} )
-public abstract class AbstractTestWineService
- extends TestCase
-{
- @Inject
- WineService wineService;
-
- @Inject @Named(value = "cache#wine")
- Cache cache;
-
- @Test
- public void testBordeaux()
- throws Exception
- {
- //cache.clear();
- //cache.getStatistics().clear();
- Wine firstWine = wineService.getWine( "bordeaux" );
- assertEquals( 1, cache.getStatistics().getSize() );
- Wine secondWine = wineService.getWine( "bordeaux" );
- // testing on hashCode to be sure it's the same object
- assertEquals( firstWine.hashCode(), secondWine.hashCode() );
-
- // clear
- cache.clear();
- secondWine = wineService.getWine( "bordeaux" );
- // after clear a new instance of wine has been created not same hashCode
- assertFalse( firstWine.hashCode() == secondWine.hashCode() );
- }
-}
diff --git a/spring-cache-test/src/main/java/org/apache/archiva/redback/components/cache/test/examples/wine/DefaultWineService.java b/spring-cache-test/src/main/java/org/apache/archiva/redback/components/cache/test/examples/wine/DefaultWineService.java
deleted file mode 100644
index 42ffdcf..0000000
--- a/spring-cache-test/src/main/java/org/apache/archiva/redback/components/cache/test/examples/wine/DefaultWineService.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package org.apache.archiva.redback.components.cache.test.examples.wine;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.archiva.redback.components.cache.builder.CacheBuilder;
-import org.springframework.stereotype.Service;
-
-import javax.inject.Inject;
-
-/**
- * @author Olivier Lamy
- * @since 5 February, 2007
- */
-@Service
-public class DefaultWineService
- implements WineService
-{
- @Inject
- private CacheBuilder<String, Wine> cacheBuilder;
-
- @Inject
- private WineDao wineDao;
-
- public Wine getWine( String name )
- {
- Wine wine = cacheBuilder.getCache( Wine.class ).get( name );
- if ( wine == null )
- {
- wine = wineDao.getWine( name );
- cacheBuilder.getCache( Wine.class ).put( name, wine );
- }
- return wine;
- }
-
-}
diff --git a/spring-cache-test/src/main/java/org/apache/archiva/redback/components/cache/test/examples/wine/MockWineDao.java b/spring-cache-test/src/main/java/org/apache/archiva/redback/components/cache/test/examples/wine/MockWineDao.java
deleted file mode 100644
index 4104b0d..0000000
--- a/spring-cache-test/src/main/java/org/apache/archiva/redback/components/cache/test/examples/wine/MockWineDao.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package org.apache.archiva.redback.components.cache.test.examples.wine;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.springframework.stereotype.Repository;
-
-/**
- * @since 5 February, 2007
- *
- * @author Olivier Lamy
- */
-@Repository
-public class MockWineDao
- implements WineDao
-{
-
- public Wine getWine( String name )
- {
- if ( name.equals( "bordeaux" ) )
- {
- return new Wine( "bordeaux", "west/south of France" );
- }
- if ( name.equals( "bourgogne" ) )
- {
- return new Wine( "bourgogne", "center of France" );
- }
- return null;
- }
-
-}
diff --git a/spring-cache-test/src/main/java/org/apache/archiva/redback/components/cache/test/examples/wine/Wine.java b/spring-cache-test/src/main/java/org/apache/archiva/redback/components/cache/test/examples/wine/Wine.java
deleted file mode 100644
index 1f679ed..0000000
--- a/spring-cache-test/src/main/java/org/apache/archiva/redback/components/cache/test/examples/wine/Wine.java
+++ /dev/null
@@ -1,71 +0,0 @@
-package org.apache.archiva.redback.components.cache.test.examples.wine;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.io.Serializable;
-
-/**
- * @since 5 February, 2007
- *
- * @author Olivier Lamy
- */
-public class Wine
- implements Serializable
-{
- private String name;
-
- private String localisation;
-
- public Wine( String name, String localisation )
- {
- this.name = name;
- this.localisation = localisation;
- }
-
- public String getLocalisation()
- {
- return localisation;
- }
-
- public void setLocalisation( String localisation )
- {
- this.localisation = localisation;
- }
-
- public String getName()
- {
- return name;
- }
-
- public void setName( String name )
- {
- this.name = name;
- }
-
- @Override
- public String toString()
- {
- final StringBuilder sb = new StringBuilder( "Wine{" );
- sb.append( "name='" ).append( name ).append( '\'' );
- sb.append( ", localisation='" ).append( localisation ).append( '\'' );
- sb.append( '}' );
- return sb.toString();
- }
-}
diff --git a/spring-cache-test/src/main/java/org/apache/archiva/redback/components/cache/test/examples/wine/WineDao.java b/spring-cache-test/src/main/java/org/apache/archiva/redback/components/cache/test/examples/wine/WineDao.java
deleted file mode 100644
index 153f61a..0000000
--- a/spring-cache-test/src/main/java/org/apache/archiva/redback/components/cache/test/examples/wine/WineDao.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package org.apache.archiva.redback.components.cache.test.examples.wine;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/**
- * @author Olivier Lamy
- *
- * @since 5 February, 2007
- */
-public interface WineDao
-{
- Wine getWine( String name );
-}
diff --git a/spring-cache-test/src/main/java/org/apache/archiva/redback/components/cache/test/examples/wine/WineService.java b/spring-cache-test/src/main/java/org/apache/archiva/redback/components/cache/test/examples/wine/WineService.java
deleted file mode 100644
index 6e02262..0000000
--- a/spring-cache-test/src/main/java/org/apache/archiva/redback/components/cache/test/examples/wine/WineService.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package org.apache.archiva.redback.components.cache.test.examples.wine;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/**
- * @author Olivier Lamy
- *
- * @since 5 February, 2007
- */
-public interface WineService
-{
- Wine getWine( String name );
-}
diff --git a/spring-cache-test/src/main/resources/META-INF/spring-context.xml b/spring-cache-test/src/main/resources/META-INF/spring-context.xml
deleted file mode 100644
index 05b8758..0000000
--- a/spring-cache-test/src/main/resources/META-INF/spring-context.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-<?xml version="1.0"?>
-
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one
- ~ or more contributor license agreements. See the NOTICE file
- ~ distributed with this work for additional information
- ~ regarding copyright ownership. The ASF licenses this file
- ~ to you under the Apache License, Version 2.0 (the
- ~ "License"); you may not use this file except in compliance
- ~ with the License. You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing,
- ~ software distributed under the License is distributed on an
- ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- ~ KIND, either express or implied. See the License for the
- ~ specific language governing permissions and limitations
- ~ under the License.
- -->
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:context="http://www.springframework.org/schema/context"
- xsi:schemaLocation="http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
- http://www.springframework.org/schema/context
- http://www.springframework.org/schema/context/spring-context-3.0.xsd">
-
- <context:annotation-config />
- <context:component-scan
- base-package="org.codehaus.plexus.cache.test.examples.wine"/>
-
-</beans>
\ No newline at end of file
diff --git a/spring-cache-test/src/test/java/org/codehaus/plexus/cache/test/EnglishNumberFormatTest.java b/spring-cache-test/src/test/java/org/codehaus/plexus/cache/test/EnglishNumberFormatTest.java
deleted file mode 100644
index 4f7a8f8..0000000
--- a/spring-cache-test/src/test/java/org/codehaus/plexus/cache/test/EnglishNumberFormatTest.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package org.codehaus.plexus.cache.test;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import junit.framework.TestCase;
-import org.apache.archiva.redback.components.cache.test.EnglishNumberFormat;
-
-/**
- * EnglishNumberFormatTest
- *
- * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
- *
- */
-public class EnglishNumberFormatTest
- extends TestCase
-{
- public void testConversion()
- {
- EnglishNumberFormat fmt = new EnglishNumberFormat();
-
- assertEquals( "zero", fmt.toText( 0 ) );
- assertEquals( "one", fmt.toText( 1 ) );
- assertEquals( "fourty two", fmt.toText( 42 ) );
- assertEquals( "one hundred", fmt.toText( 100 ) );
- assertEquals( "one thousand twenty four", fmt.toText( 1024 ) );
- assertEquals( "one million eight hundred twenty two", fmt.toText( 1000822 ) );
- assertEquals( "sixteen million four hundred twenty thousand eight hundred sixty one", fmt.toText( 16420861 ) );
- }
-}
diff --git a/src/site/site.xml b/src/site/site.xml
deleted file mode 100644
index 1fc4dc6..0000000
--- a/src/site/site.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one
- ~ or more contributor license agreements. See the NOTICE file
- ~ distributed with this work for additional information
- ~ regarding copyright ownership. The ASF licenses this file
- ~ to you under the Apache License, Version 2.0 (the
- ~ "License"); you may not use this file except in compliance
- ~ with the License. You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing,
- ~ software distributed under the License is distributed on an
- ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- ~ KIND, either express or implied. See the License for the
- ~ specific language governing permissions and limitations
- ~ under the License.
- -->
-
-<project name="Spring Cache Component" >
-
- <publishDate format="yyyy-MM-dd" position="none" />
-
- <body>
- <menu ref="modules" />
- <menu ref="reports" />
- <menu ref="ASF" />
- <breadcrumbs>
- <item name="Redback Components" href="../index.html" />
- <item name="Spring Cache" href="index.html" />
- </breadcrumbs>
- </body>
-</project>
diff --git a/src/site/xdoc/index.xml.vm b/src/site/xdoc/index.xml.vm
deleted file mode 100644
index c4c864f..0000000
--- a/src/site/xdoc/index.xml.vm
+++ /dev/null
@@ -1,66 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one
- ~ or more contributor license agreements. See the NOTICE file
- ~ distributed with this work for additional information
- ~ regarding copyright ownership. The ASF licenses this file
- ~ to you under the Apache License, Version 2.0 (the
- ~ "License"); you may not use this file except in compliance
- ~ with the License. You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing,
- ~ software distributed under the License is distributed on an
- ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- ~ KIND, either express or implied. See the License for the
- ~ specific language governing permissions and limitations
- ~ under the License.
- -->
-<document>
- <properties>
- <title>Spring Cache</title>
- <author email="olamy@codehaus.org">Olivier Lamy</author>
- </properties>
- <body>
- <section name="Spring Cache">
- <p>General Purpose is to provide a cache api with differents providers :
- <ul>
- <li>simple hashmap</li>
- <li>ehcache</li>
- <li>oscache</li>
- </ul>
- </p>
- <subsection name="Use Case">
- <p>Typical use case for this API could be the following : you have an functionnal API which create objects by using a requirement on a DAO plexus components. Before asking the DAO layer (webServices, Jdbc access ...), you want to ask if the data exists in a cache if yes the cached value is return if not the DAO layer is used and the result put in the cache for future use.
- </p>
- </subsection>
- <subsection name="Test Case Sample">
- <p>Look at he test case AbstractTestWineService in the module plexus-cache-test. A service called WineService explains this. The default implementation has two requirements :
- <ul>
- <li>WineDao (DAO layer)</li>
- <li>CacheBuilder</li>
- </ul>
- </p>
- <p>CacheBuilder can build a cache for the bean you ask (in the sample it's Wine)
- <source>
-cacheBuilder.getCache( Wine.class )
- </source>
- This will use the following algorithm to provide the Cache implementation :
- <ul>
- <li>search the Spring Cache with roleHint Wine.class.getName()</li>
- <li>if not found : lookup the Spring component Cache with name cache#default</li>
- <li>if not found : return NoCacheCache implementation in order to prevent NPE</li>
- </ul>
- </p>
- </subsection>
- </section>
- <section name="Submodules" >
- <ul>
-#foreach( $module in $project.modules )
- <li><a href="$module/index.html">$module</a></li>
-#end
- </ul>
- </section>
- </body>
-</document>