You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by tv...@apache.org on 2007/05/05 08:58:51 UTC
svn commit: r535465 [2/49] - in /jakarta/turbine/fulcrum/trunk: ./ bsf/
bsf/src/java/org/apache/fulcrum/bsf/ bsf/src/test/ bsf/xdocs/ cache/
cache/src/java/org/apache/fulcrum/cache/
cache/src/java/org/apache/fulcrum/cache/impl/ cache/src/test/ cache/sr...
Modified: jakarta/turbine/fulcrum/trunk/bsf/project.properties
URL: http://svn.apache.org/viewvc/jakarta/turbine/fulcrum/trunk/bsf/project.properties?view=diff&rev=535465&r1=535464&r2=535465
==============================================================================
--- jakarta/turbine/fulcrum/trunk/bsf/project.properties (original)
+++ jakarta/turbine/fulcrum/trunk/bsf/project.properties Fri May 4 23:58:06 2007
@@ -1 +1,17 @@
+# 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.
Modified: jakarta/turbine/fulcrum/trunk/bsf/project.xml
URL: http://svn.apache.org/viewvc/jakarta/turbine/fulcrum/trunk/bsf/project.xml?view=diff&rev=535465&r1=535464&r2=535465
==============================================================================
--- jakarta/turbine/fulcrum/trunk/bsf/project.xml (original)
+++ jakarta/turbine/fulcrum/trunk/bsf/project.xml Fri May 4 23:58:06 2007
@@ -1,4 +1,22 @@
<?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.
+-->
<project>
<extend>${basedir}/../project.xml</extend>
<id>fulcrum-bsf</id>
@@ -11,26 +29,26 @@
<tag>FULCRUM_BSF_1_0_2</tag>
</version>
</versions>
-
- <dependencies>
+
+ <dependencies>
<dependency>
<groupId>bsf</groupId>
<artifactId>bsf</artifactId>
<version>2.3.0</version>
- </dependency>
-
+ </dependency>
+
<!-- Needed only for testing -->
<dependency>
<groupId>fulcrum</groupId>
<artifactId>fulcrum-testcontainer</artifactId>
<version>1.0.5</version>
</dependency>
-
+
<dependency>
<groupId>fulcrum</groupId>
<artifactId>fulcrum-yaafi</artifactId>
<version>1.0.4</version>
- </dependency>
+ </dependency>
</dependencies>
Modified: jakarta/turbine/fulcrum/trunk/bsf/src/java/org/apache/fulcrum/bsf/BSFService.java
URL: http://svn.apache.org/viewvc/jakarta/turbine/fulcrum/trunk/bsf/src/java/org/apache/fulcrum/bsf/BSFService.java?view=diff&rev=535465&r1=535464&r2=535465
==============================================================================
--- jakarta/turbine/fulcrum/trunk/bsf/src/java/org/apache/fulcrum/bsf/BSFService.java (original)
+++ jakarta/turbine/fulcrum/trunk/bsf/src/java/org/apache/fulcrum/bsf/BSFService.java Fri May 4 23:58:06 2007
@@ -1,19 +1,22 @@
package org.apache.fulcrum.bsf;
/*
- * Copyright 2001-2004 The Apache Software Foundation.
+ * 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
*
- * 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
*
- * 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.
+ * 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.avalon.framework.component.Component;
Modified: jakarta/turbine/fulcrum/trunk/bsf/src/java/org/apache/fulcrum/bsf/DefaultBSFService.java
URL: http://svn.apache.org/viewvc/jakarta/turbine/fulcrum/trunk/bsf/src/java/org/apache/fulcrum/bsf/DefaultBSFService.java?view=diff&rev=535465&r1=535464&r2=535465
==============================================================================
--- jakarta/turbine/fulcrum/trunk/bsf/src/java/org/apache/fulcrum/bsf/DefaultBSFService.java (original)
+++ jakarta/turbine/fulcrum/trunk/bsf/src/java/org/apache/fulcrum/bsf/DefaultBSFService.java Fri May 4 23:58:06 2007
@@ -1,19 +1,22 @@
package org.apache.fulcrum.bsf;
/*
- * Copyright 2001-2004 The Apache Software Foundation.
+ * 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
*
- * 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
*
- * 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.
+ * 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.File;
Modified: jakarta/turbine/fulcrum/trunk/bsf/src/test/TestComponentConfig.xml
URL: http://svn.apache.org/viewvc/jakarta/turbine/fulcrum/trunk/bsf/src/test/TestComponentConfig.xml?view=diff&rev=535465&r1=535464&r2=535465
==============================================================================
--- jakarta/turbine/fulcrum/trunk/bsf/src/test/TestComponentConfig.xml (original)
+++ jakarta/turbine/fulcrum/trunk/bsf/src/test/TestComponentConfig.xml Fri May 4 23:58:06 2007
@@ -1,4 +1,23 @@
+<?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.
+-->
<componentConfig>
<bsf use-property-file="true"
scriptsDirectory="WEB-INF/scripts" defaultExtension="py"/>
-</componentConfig>
\ No newline at end of file
+</componentConfig>
Modified: jakarta/turbine/fulcrum/trunk/bsf/src/test/TestRoleConfig.xml
URL: http://svn.apache.org/viewvc/jakarta/turbine/fulcrum/trunk/bsf/src/test/TestRoleConfig.xml?view=diff&rev=535465&r1=535464&r2=535465
==============================================================================
--- jakarta/turbine/fulcrum/trunk/bsf/src/test/TestRoleConfig.xml (original)
+++ jakarta/turbine/fulcrum/trunk/bsf/src/test/TestRoleConfig.xml Fri May 4 23:58:06 2007
@@ -1,7 +1,26 @@
+<?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.
+-->
<!-- This configuration file for Avalon components is used for testing the TestComponent -->
<role-list>
<role
name="org.apache.fulcrum.bsf.BSFService"
shorthand="bsf"
default-class="org.apache.fulcrum.bsf.DefaultBSFService"/>
-</role-list>
\ No newline at end of file
+</role-list>
Modified: jakarta/turbine/fulcrum/trunk/bsf/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jakarta/turbine/fulcrum/trunk/bsf/xdocs/changes.xml?view=diff&rev=535465&r1=535464&r2=535465
==============================================================================
--- jakarta/turbine/fulcrum/trunk/bsf/xdocs/changes.xml (original)
+++ jakarta/turbine/fulcrum/trunk/bsf/xdocs/changes.xml Fri May 4 23:58:06 2007
@@ -1,4 +1,22 @@
<?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.
+-->
<document>
<properties>
<title>Fulcrum BSF</title>
@@ -9,7 +27,7 @@
<release version="1.0.3" date="2004-11-24">
<action dev="epugh" type="add">
Initial conversion to Avalon component.
- </action>
+ </action>
</release>
</body>
Modified: jakarta/turbine/fulcrum/trunk/bsf/xdocs/index.xml
URL: http://svn.apache.org/viewvc/jakarta/turbine/fulcrum/trunk/bsf/xdocs/index.xml?view=diff&rev=535465&r1=535464&r2=535465
==============================================================================
--- jakarta/turbine/fulcrum/trunk/bsf/xdocs/index.xml (original)
+++ jakarta/turbine/fulcrum/trunk/bsf/xdocs/index.xml Fri May 4 23:58:06 2007
@@ -1,4 +1,22 @@
<?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.
+-->
<document>
@@ -13,14 +31,14 @@
<p>
This Service functions as a BSF component.
</p>
-
+
<p>
- It is written
- for use in Turbine but it can be used in any container compatible
+ It is written
+ for use in Turbine but it can be used in any container compatible
with Avalon's ECM container.
- </p>
+ </p>
</section>
-
+
<section name="Configuration">
<p>
@@ -85,11 +103,11 @@
<p>
You can also place an expiration time on your objects so the Service will
automatically remove them when they expire. If you don't specify an expiration
- time, the Service uses 5 seconds. To see an example, look at the
+ time, the Service uses 5 seconds. To see an example, look at the
test case <a href="xref-test/org/apache/fulcrum/cache/CacheTest.html">CacheTest</a>
</p>
- </section>
+ </section>
</body>
</document>
Modified: jakarta/turbine/fulcrum/trunk/bsf/xdocs/navigation.xml
URL: http://svn.apache.org/viewvc/jakarta/turbine/fulcrum/trunk/bsf/xdocs/navigation.xml?view=diff&rev=535465&r1=535464&r2=535465
==============================================================================
--- jakarta/turbine/fulcrum/trunk/bsf/xdocs/navigation.xml (original)
+++ jakarta/turbine/fulcrum/trunk/bsf/xdocs/navigation.xml Fri May 4 23:58:06 2007
@@ -1,4 +1,22 @@
<?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="cache"
href="http://jakarta.apache.org/turbine/fulcrum/cache/">
@@ -15,4 +33,4 @@
<item name="Main" href="/index.html"/>
</menu>
</body>
-</project>
\ No newline at end of file
+</project>
Modified: jakarta/turbine/fulcrum/trunk/build-gump.xml
URL: http://svn.apache.org/viewvc/jakarta/turbine/fulcrum/trunk/build-gump.xml?view=diff&rev=535465&r1=535464&r2=535465
==============================================================================
--- jakarta/turbine/fulcrum/trunk/build-gump.xml (original)
+++ jakarta/turbine/fulcrum/trunk/build-gump.xml Fri May 4 23:58:06 2007
@@ -1,19 +1,38 @@
+<?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.
+-->
<!--
WARNING: This file is generated! Do not edit by hand!
-
+
-->
<project name="maven" default="jar" basedir=".">
<target
name="jar">
-
+
<property name="build.dir" value="target"/>
<property name="build.dest" value="${maven.build.dir}/classes"/>
-
+
<mkdir dir="${maven.build.dest}"/>
-
+
<javac
destdir="${maven.build.dest}"
excludes="**/package.html"
@@ -32,7 +51,7 @@
basedir="${maven.build.dest}"
excludes="**/package.html"
/>
-
+
</target>
</project>
Modified: jakarta/turbine/fulcrum/trunk/cache/maven.xml
URL: http://svn.apache.org/viewvc/jakarta/turbine/fulcrum/trunk/cache/maven.xml?view=diff&rev=535465&r1=535464&r2=535465
==============================================================================
--- jakarta/turbine/fulcrum/trunk/cache/maven.xml (original)
+++ jakarta/turbine/fulcrum/trunk/cache/maven.xml Fri May 4 23:58:06 2007
@@ -1,3 +1,22 @@
+<?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 default="jar:jar" xmlns:maven="jelly:maven" xmlns:j="jelly:core" xmlns:util="jelly:util" xmlns:ant="jelly:ant">
<preGoal name="site">
@@ -12,4 +31,4 @@
</ant:copy>
</preGoal>
-</project>
\ No newline at end of file
+</project>
Modified: jakarta/turbine/fulcrum/trunk/cache/project.properties
URL: http://svn.apache.org/viewvc/jakarta/turbine/fulcrum/trunk/cache/project.properties?view=diff&rev=535465&r1=535464&r2=535465
==============================================================================
--- jakarta/turbine/fulcrum/trunk/cache/project.properties (original)
+++ jakarta/turbine/fulcrum/trunk/cache/project.properties Fri May 4 23:58:06 2007
@@ -1,6 +1,22 @@
-#Uncomment to reduce how long a test takes.
+# 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.
+# Uncomment to reduce how long a test takes.
maven.junit.sysproperties=fulcrum.cache.skip.long.tests
fulcrum.cache.skip.long.tests=true
-#Help debug failing tests.
+# Help debug failing tests.
maven.junit.usefile=false
Modified: jakarta/turbine/fulcrum/trunk/cache/project.xml
URL: http://svn.apache.org/viewvc/jakarta/turbine/fulcrum/trunk/cache/project.xml?view=diff&rev=535465&r1=535464&r2=535465
==============================================================================
--- jakarta/turbine/fulcrum/trunk/cache/project.xml (original)
+++ jakarta/turbine/fulcrum/trunk/cache/project.xml Fri May 4 23:58:06 2007
@@ -1,4 +1,22 @@
<?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.
+-->
<project>
<extend>${basedir}/../project.xml</extend>
<id>fulcrum-cache</id>
@@ -11,7 +29,7 @@
<tag>FULCRUM_CACHE_1_0_5</tag>
</version>
</versions>
- <dependencies>
+ <dependencies>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
@@ -23,13 +41,13 @@
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.1</version>
- </dependency>
+ </dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.0.4</version>
- </dependency>
+ </dependency>
<!-- For a more recent release of JCS and to make gump happy: -->
<dependency>
@@ -43,7 +61,7 @@
<groupId>ehcache</groupId>
<artifactId>ehcache</artifactId>
<version>1.2beta4</version>
- </dependency>
+ </dependency>
<dependency>
<groupId>jcs</groupId>
@@ -75,14 +93,14 @@
<report>maven-developer-activity-plugin</report>
<report>maven-file-activity-plugin</report>
<report>maven-multiproject-plugin</report>
- <report>maven-faq-plugin</report>
+ <report>maven-faq-plugin</report>
<report>maven-pmd-plugin</report>
<!-- report>maven-simian-plugin</report -->
<report>maven-javadoc-plugin</report>
- <report>maven-jxr-plugin</report>
+ <report>maven-jxr-plugin</report>
<report>maven-junit-report-plugin</report>
- </reports>
+ </reports>
</project>
Modified: jakarta/turbine/fulcrum/trunk/cache/src/java/org/apache/fulcrum/cache/CachedObject.java
URL: http://svn.apache.org/viewvc/jakarta/turbine/fulcrum/trunk/cache/src/java/org/apache/fulcrum/cache/CachedObject.java?view=diff&rev=535465&r1=535464&r2=535465
==============================================================================
--- jakarta/turbine/fulcrum/trunk/cache/src/java/org/apache/fulcrum/cache/CachedObject.java (original)
+++ jakarta/turbine/fulcrum/trunk/cache/src/java/org/apache/fulcrum/cache/CachedObject.java Fri May 4 23:58:06 2007
@@ -1,19 +1,22 @@
package org.apache.fulcrum.cache;
/*
- * Copyright 2001-2006 The Apache Software Foundation.
+ * 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
*
- * 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
*
- * 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.
+ * 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;
@@ -27,7 +30,7 @@
* have their default age set.
* @author <a href="mailto:mbryson@mont.mindspring.com">Dave Bryson</a>
* @author <a href="mailto:hps@intermeta.de">Henning P. Schmiedehausen</a>
- * @author <a href="mailto:epugh@upstate.com">Eric Pugh</a>
+ * @author <a href="mailto:epugh@upstate.com">Eric Pugh</a>
* @version $Id$
*/
public class CachedObject
Modified: jakarta/turbine/fulcrum/trunk/cache/src/java/org/apache/fulcrum/cache/DefaultGlobalCacheService.java
URL: http://svn.apache.org/viewvc/jakarta/turbine/fulcrum/trunk/cache/src/java/org/apache/fulcrum/cache/DefaultGlobalCacheService.java?view=diff&rev=535465&r1=535464&r2=535465
==============================================================================
--- jakarta/turbine/fulcrum/trunk/cache/src/java/org/apache/fulcrum/cache/DefaultGlobalCacheService.java (original)
+++ jakarta/turbine/fulcrum/trunk/cache/src/java/org/apache/fulcrum/cache/DefaultGlobalCacheService.java Fri May 4 23:58:06 2007
@@ -1,19 +1,22 @@
package org.apache.fulcrum.cache;
/*
- * Copyright 2001-2004 The Apache Software Foundation.
+ * 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
*
- * 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
*
- * 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.
+ * 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.ByteArrayOutputStream;
@@ -80,7 +83,7 @@
* cacheCheckFrequency (default - 5 seconds)
*/
private long cacheCheckFrequency;
-
+
/**
* cacheInitialSize (default - 20)
*/
@@ -173,25 +176,25 @@
{
cache.remove(id);
}
-
+
/**
* Returns a copy of keys to objects in the cache as a list.
- *
+ *
* Note that keys to expired objects are not returned.
- *
+ *
* @return A List of <code>String</code>'s representing the keys to objects
* in the cache.
*/
public List getKeys() {
ArrayList keys = new ArrayList(cache.size());
synchronized (this) {
- for (Iterator itr = cache.keySet().iterator(); itr.hasNext();)
+ for (Iterator itr = cache.keySet().iterator(); itr.hasNext();)
{
String key = (String) itr.next();
try {
/* CachedObject obj = */ getObject(key);
} catch (ObjectExpiredException oee) {
- // this is OK we just do not want this key
+ // this is OK we just do not want this key
continue;
}
keys.add(new String(key));
@@ -199,25 +202,25 @@
}
return (List)keys;
}
-
+
/**
- * Returns a copy of the non-expired CachedObjects
+ * Returns a copy of the non-expired CachedObjects
* in the cache as a list.
- *
- * @return A List of <code>CachedObject</code> objects
+ *
+ * @return A List of <code>CachedObject</code> objects
* held in the cache
*/
public List getCachedObjects() {
ArrayList objects = new ArrayList(cache.size());
synchronized (this) {
- for (Iterator itr = cache.keySet().iterator(); itr.hasNext();)
+ for (Iterator itr = cache.keySet().iterator(); itr.hasNext();)
{
String key = (String) itr.next();
CachedObject obj = null;
try {
obj = getObject(key);
} catch (ObjectExpiredException oee) {
- // this is OK we just do not want this object
+ // this is OK we just do not want this object
continue;
}
objects.add(obj);
@@ -225,8 +228,8 @@
}
return (List)objects;
}
-
-
+
+
/**
* Circle through the cache and remove stale objects. Frequency
* is determined by the cacheCheckFrequency property.
@@ -245,7 +248,7 @@
{
if (!continueThread) return;
}
-
+
clearCache();
}
}
@@ -350,7 +353,7 @@
// Start housekeeping thread.
continueThread = true;
housekeeping = new Thread(this);
- // Indicate that this is a system thread. JVM will quit only when
+ // Indicate that this is a system thread. JVM will quit only when
// there are no more active user threads. Settings threads spawned
// internally by Turbine as daemons allows commandline applications
// using Turbine to terminate in an orderly manner.
@@ -373,7 +376,7 @@
}
/**
- * The name used to specify this component in TurbineResources.properties
+ * The name used to specify this component in TurbineResources.properties
* @deprecated part of the pre-avalon compatibility layer
*/
protected String getName()
Modified: jakarta/turbine/fulcrum/trunk/cache/src/java/org/apache/fulcrum/cache/EHCacheService.java
URL: http://svn.apache.org/viewvc/jakarta/turbine/fulcrum/trunk/cache/src/java/org/apache/fulcrum/cache/EHCacheService.java?view=diff&rev=535465&r1=535464&r2=535465
==============================================================================
--- jakarta/turbine/fulcrum/trunk/cache/src/java/org/apache/fulcrum/cache/EHCacheService.java (original)
+++ jakarta/turbine/fulcrum/trunk/cache/src/java/org/apache/fulcrum/cache/EHCacheService.java Fri May 4 23:58:06 2007
@@ -1,21 +1,24 @@
-/*
- * Copyright 2001-2004 The Apache Software Foundation.
- *
- * 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.
- */
-
package org.apache.fulcrum.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 net.sf.ehcache.Cache;
import net.sf.ehcache.CacheManager;
@@ -24,14 +27,14 @@
* @author <a href="mailto:epugh@opensourceconnections.com">Eric Pugh</a>
*
*/
-public interface EHCacheService
+public interface EHCacheService
{
/** avalon idiom */
public static final String ROLE = EHCacheService.class.getName();
-
+
public CacheManager getCacheManager();
-
+
public Cache getCache(String cache);
-
-
+
+
}
Modified: jakarta/turbine/fulcrum/trunk/cache/src/java/org/apache/fulcrum/cache/GlobalCacheService.java
URL: http://svn.apache.org/viewvc/jakarta/turbine/fulcrum/trunk/cache/src/java/org/apache/fulcrum/cache/GlobalCacheService.java?view=diff&rev=535465&r1=535464&r2=535465
==============================================================================
--- jakarta/turbine/fulcrum/trunk/cache/src/java/org/apache/fulcrum/cache/GlobalCacheService.java (original)
+++ jakarta/turbine/fulcrum/trunk/cache/src/java/org/apache/fulcrum/cache/GlobalCacheService.java Fri May 4 23:58:06 2007
@@ -1,23 +1,24 @@
package org.apache.fulcrum.cache;
-
/*
- * Copyright 2001-2004 The Apache Software Foundation.
- *
- * 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
+ * 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
+ * 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.
+ * 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.IOException;
import java.util.List;
@@ -25,7 +26,7 @@
/**
* GlobalCacheService interface.
- *
+ *
* @todo This GlobalCacheService should be usable by both the DefaultEHCacheService
* and the DefaultGlobalCache. The CacheObject class from GCS and the Element class
* from EHCS are very similar.
@@ -66,23 +67,23 @@
* @param id The String id for the object.
*/
void removeObject(String id);
-
+
/**
* Returns a copy of keys to objects in the cache as a list.
- *
+ *
* Note that keys to expired objects are not returned.
- *
+ *
* @return A List of <code>String</code>'s representing the keys to objects
* in the cache.
*/
public List getKeys();
-
+
/**
- * Returns a copy of the non-expired CachedObjects
+ * Returns a copy of the non-expired CachedObjects
* in the cache as a list.
- *
- * @return A List of <code>CachedObject</code> objects
+ *
+ * @return A List of <code>CachedObject</code> objects
* held in the cache
*/
public List getCachedObjects();
Modified: jakarta/turbine/fulcrum/trunk/cache/src/java/org/apache/fulcrum/cache/ObjectExpiredException.java
URL: http://svn.apache.org/viewvc/jakarta/turbine/fulcrum/trunk/cache/src/java/org/apache/fulcrum/cache/ObjectExpiredException.java?view=diff&rev=535465&r1=535464&r2=535465
==============================================================================
--- jakarta/turbine/fulcrum/trunk/cache/src/java/org/apache/fulcrum/cache/ObjectExpiredException.java (original)
+++ jakarta/turbine/fulcrum/trunk/cache/src/java/org/apache/fulcrum/cache/ObjectExpiredException.java Fri May 4 23:58:06 2007
@@ -1,22 +1,23 @@
package org.apache.fulcrum.cache;
-
/*
- * Copyright 2001-2004 The Apache Software Foundation.
+ * 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
*
- * 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
*
- * 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.
+ * 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.
*/
-
/**
* Exception thrown when an item either does not exist or has expired
Modified: jakarta/turbine/fulcrum/trunk/cache/src/java/org/apache/fulcrum/cache/Refreshable.java
URL: http://svn.apache.org/viewvc/jakarta/turbine/fulcrum/trunk/cache/src/java/org/apache/fulcrum/cache/Refreshable.java?view=diff&rev=535465&r1=535464&r2=535465
==============================================================================
--- jakarta/turbine/fulcrum/trunk/cache/src/java/org/apache/fulcrum/cache/Refreshable.java (original)
+++ jakarta/turbine/fulcrum/trunk/cache/src/java/org/apache/fulcrum/cache/Refreshable.java Fri May 4 23:58:06 2007
@@ -1,22 +1,23 @@
package org.apache.fulcrum.cache;
-
/*
- * Copyright 2001-2004 The Apache Software Foundation.
+ * 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
*
- * 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
*
- * 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.
+ * 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.
*/
-
/**
* This is the interface for objects you want to refresh themselves
Modified: jakarta/turbine/fulcrum/trunk/cache/src/java/org/apache/fulcrum/cache/RefreshableCachedObject.java
URL: http://svn.apache.org/viewvc/jakarta/turbine/fulcrum/trunk/cache/src/java/org/apache/fulcrum/cache/RefreshableCachedObject.java?view=diff&rev=535465&r1=535464&r2=535465
==============================================================================
--- jakarta/turbine/fulcrum/trunk/cache/src/java/org/apache/fulcrum/cache/RefreshableCachedObject.java (original)
+++ jakarta/turbine/fulcrum/trunk/cache/src/java/org/apache/fulcrum/cache/RefreshableCachedObject.java Fri May 4 23:58:06 2007
@@ -1,19 +1,22 @@
package org.apache.fulcrum.cache;
/*
- * Copyright 2001-2006 The Apache Software Foundation.
+ * 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
*
- * 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
*
- * 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.
+ * 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.
*/
/**
Modified: jakarta/turbine/fulcrum/trunk/cache/src/java/org/apache/fulcrum/cache/impl/DefaultEHCacheService.java
URL: http://svn.apache.org/viewvc/jakarta/turbine/fulcrum/trunk/cache/src/java/org/apache/fulcrum/cache/impl/DefaultEHCacheService.java?view=diff&rev=535465&r1=535464&r2=535465
==============================================================================
--- jakarta/turbine/fulcrum/trunk/cache/src/java/org/apache/fulcrum/cache/impl/DefaultEHCacheService.java (original)
+++ jakarta/turbine/fulcrum/trunk/cache/src/java/org/apache/fulcrum/cache/impl/DefaultEHCacheService.java Fri May 4 23:58:06 2007
@@ -1,21 +1,24 @@
+package org.apache.fulcrum.cache.impl;
+
/*
- * Copyright 2001-2004 The Apache Software Foundation.
- *
- * 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
+ * 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
+ * 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.
+ * 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.
*/
-package org.apache.fulcrum.cache.impl;
-
import net.sf.ehcache.Cache;
import net.sf.ehcache.CacheManager;
@@ -41,11 +44,11 @@
protected Log logger = LogFactory.getLog(DefaultEHCacheService.class.getName());
private CacheManager cacheManager;
-
+
public CacheManager getCacheManager(){
return cacheManager;
}
-
+
public Cache getCache(String cacheName){
return cacheManager.getCache(cacheName);
}
@@ -63,7 +66,7 @@
* @see org.apache.avalon.framework.activity.Initializable#initialize()
*/
public void initialize() throws Exception {
-
+
cacheManager = CacheManager.create();
logger.debug("EHCacheService started!");
}
@@ -75,8 +78,8 @@
cacheManager.shutdown();
cacheManager = null;
logger.debug("EHCacheService stopped!");
-
+
}
-
-}
\ No newline at end of file
+
+}
Modified: jakarta/turbine/fulcrum/trunk/cache/src/java/org/apache/fulcrum/cache/impl/JCSCacheService.java
URL: http://svn.apache.org/viewvc/jakarta/turbine/fulcrum/trunk/cache/src/java/org/apache/fulcrum/cache/impl/JCSCacheService.java?view=diff&rev=535465&r1=535464&r2=535465
==============================================================================
--- jakarta/turbine/fulcrum/trunk/cache/src/java/org/apache/fulcrum/cache/impl/JCSCacheService.java (original)
+++ jakarta/turbine/fulcrum/trunk/cache/src/java/org/apache/fulcrum/cache/impl/JCSCacheService.java Fri May 4 23:58:06 2007
@@ -1,370 +1,373 @@
-package org.apache.fulcrum.cache.impl;
-
-/*
- * Copyright 2006 The Apache Software Foundation.
- *
- * 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 java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.ObjectOutputStream;
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.avalon.framework.activity.Disposable;
-import org.apache.avalon.framework.activity.Initializable;
-import org.apache.avalon.framework.configuration.Configurable;
-import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.avalon.framework.configuration.ConfigurationException;
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
-import org.apache.avalon.framework.thread.ThreadSafe;
-import org.apache.fulcrum.cache.CachedObject;
-import org.apache.fulcrum.cache.GlobalCacheService;
-import org.apache.fulcrum.cache.ObjectExpiredException;
-import org.apache.fulcrum.cache.RefreshableCachedObject;
-import org.apache.jcs.JCS;
-import org.apache.jcs.access.exception.CacheException;
-import org.apache.jcs.engine.ElementAttributes;
-
-/**
- * Default implementation of JCSCacheService
- *
- * @author <a href="mailto:tv@apache.org">Thomas Vandahl</a>
- * @version $Id:$
- */
-public class JCSCacheService
- extends AbstractLogEnabled
- implements GlobalCacheService, Runnable, Configurable, Disposable, Initializable, ThreadSafe
-{
- /**
- * Cache check frequency in Millis (1000 Millis = 1 second).
- * Value must be > 0.
- * Default = 5 seconds
- */
- public static final long DEFAULT_CACHE_CHECK_FREQUENCY = 5000; // 5 seconds
-
- /**
- * cacheCheckFrequency (default - 5 seconds)
- */
- private long cacheCheckFrequency;
-
- /**
- * Instance of the JCS cache
- */
- private JCS cacheManager;
-
- /**
- * JCS region to use
- */
- private String region;
-
- /**
- * Path name of the JCS configuration file
- */
- private String configFile;
-
- /**
- * Constant value which provides a group name
- */
- private static String group = "default_group";
-
- /** thread for refreshing stale items in the cache */
- private Thread refreshing;
-
- /** flag to stop the housekeeping thread when the component is disposed. */
- private boolean continueThread;
-
- // ---------------- Avalon Lifecycle Methods ---------------------
-
- /**
- * @see org.apache.avalon.framework.configuration.Configurable#configure(org.apache.avalon.framework.configuration.Configuration)
- */
- public void configure(Configuration config) throws ConfigurationException
- {
- cacheCheckFrequency = config.getChild("cacheCheckFrequency").getValueAsLong(DEFAULT_CACHE_CHECK_FREQUENCY);
- region = config.getChild("region").getValue("fulcrum");
- configFile = config.getChild("configurationFile").getValue("/cache.ccf");
- }
-
- /**
- * @see org.apache.avalon.framework.activity.Initializable#initialize()
- */
- public void initialize() throws Exception
- {
- JCS.setConfigFilename(configFile);
- cacheManager = JCS.getInstance(region);
-
- // Start housekeeping thread.
- continueThread = true;
- refreshing = new Thread(this);
-
- // Indicate that this is a system thread. JVM will quit only when
- // there are no more active user threads. Settings threads spawned
- // internally by Turbine as daemons allows commandline applications
- // using Turbine to terminate in an orderly manner.
- refreshing.setDaemon(true);
- refreshing.setName("JCSCacheService Refreshing");
- refreshing.start();
-
- getLogger().debug("JCSCacheService started.");
- }
-
- /**
- * @see org.apache.avalon.framework.activity.Disposable#dispose()
- */
- public void dispose()
- {
- try
- {
- cacheManager.remove();
- }
- catch (CacheException e)
- {
- // do nothing
- }
-
- continueThread = false;
- refreshing.interrupt();
-
- cacheManager = null;
- getLogger().debug("JCSCacheService stopped.");
- }
-
- /**
- * @see org.apache.fulcrum.cache.GlobalCacheService#getObject(java.lang.String)
- */
- public CachedObject getObject(String id) throws ObjectExpiredException
- {
- CachedObject obj = (CachedObject) cacheManager.getFromGroup(id, group);
-
- if (obj == null)
- {
- // Not in the cache.
- throw new ObjectExpiredException();
- }
-
- if (obj.isStale())
- {
- if (obj instanceof RefreshableCachedObject)
- {
- RefreshableCachedObject rco = (RefreshableCachedObject) obj;
- if (rco.isUntouched())
- {
- // Do not refresh an object that has exceeded TimeToLive
- removeObject(id);
- throw new ObjectExpiredException();
- }
-
- // Refresh Object
- rco.refresh();
- if (rco.isStale())
- {
- // Object is Expired, remove it from cache.
- removeObject(id);
- throw new ObjectExpiredException();
- }
- }
- else
- {
- // Expired.
- removeObject(id);
- throw new ObjectExpiredException();
- }
- }
-
- if (obj instanceof RefreshableCachedObject)
- {
- // notify it that it's being accessed.
- RefreshableCachedObject rco = (RefreshableCachedObject) obj;
- rco.touch();
- }
-
- return obj;
- }
-
- /**
- * @see org.apache.fulcrum.cache.GlobalCacheService#addObject(java.lang.String, org.apache.fulcrum.cache.CachedObject)
- */
- public void addObject(String id, CachedObject o)
- {
- try
- {
- if (!(o.getContents() instanceof Serializable))
- {
- getLogger().warn("Object with id [" + id + "] is not serializable. Expect problems with auxiliary caches.");
- }
-
- ElementAttributes attrib = (ElementAttributes)cacheManager.getElementAttributes();
-
- if (o instanceof RefreshableCachedObject)
- {
- attrib.setIsEternal(true);
- }
- else
- {
- attrib.setIsEternal(false);
- attrib.setMaxLifeSeconds((o.getExpires() + 500)/ 1000);
- }
-
- attrib.setLastAccessTimeNow();
-
- // I know this is not nice, but setCreateTime() is missing and the fields are public ...
- attrib.createTime = System.currentTimeMillis();
- cacheManager.putInGroup(id, group, o, attrib);
- }
- catch (CacheException e)
- {
- getLogger().error("Could not add object " + id + " to cache", e);
- }
- }
-
- /**
- * @see org.apache.fulcrum.cache.GlobalCacheService#removeObject(java.lang.String)
- */
- public void removeObject(String id)
- {
- cacheManager.remove(id, group);
- }
-
- /**
- * @see org.apache.fulcrum.cache.GlobalCacheService#getKeys()
- */
- public List getKeys()
- {
- ArrayList keys = new ArrayList();
-
- keys.addAll(cacheManager.getGroupKeys(group));
- return keys;
- }
-
- /**
- * @see org.apache.fulcrum.cache.GlobalCacheService#getCachedObjects()
- */
- public List getCachedObjects()
- {
- ArrayList values = new ArrayList();
-
- for (Iterator i = cacheManager.getGroupKeys(group).iterator(); i.hasNext();)
- {
- Object o = cacheManager.getFromGroup(i.next(), group);
- if (o != null)
- {
- values.add(o);
- }
- }
-
- return values;
- }
-
- /**
- * Circle through the cache and refresh stale objects. Frequency
- * is determined by the cacheCheckFrequency property.
- */
- public void run()
- {
- while (continueThread)
- {
- // Sleep for amount of time set in cacheCheckFrequency -
- // default = 5 seconds.
- try
- {
- Thread.sleep(cacheCheckFrequency);
- }
- catch (InterruptedException exc)
- {
- if (!continueThread) return;
- }
-
- for (Iterator i = cacheManager.getGroupKeys(group).iterator(); i.hasNext();)
- {
- String key= (String)i.next();
- CachedObject o = (CachedObject)cacheManager.getFromGroup(key, group);
- if (o == null)
- {
- removeObject(key);
- }
- else
- {
- if (o instanceof RefreshableCachedObject)
- {
- RefreshableCachedObject rco = (RefreshableCachedObject) o;
- if (rco.isUntouched())
- {
- cacheManager.remove(key, group);
- }
- else if (rco.isStale())
- {
- rco.refresh();
- }
- }
- }
- }
- }
- }
-
- /**
- * @see org.apache.fulcrum.cache.GlobalCacheService#getCacheSize()
- */
- public int getCacheSize() throws IOException
- {
- // This is evil!
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- ObjectOutputStream out = new ObjectOutputStream(baos);
- Set keys = cacheManager.getGroupKeys(group);
-
- for (Iterator i = keys.iterator(); i.hasNext();)
- {
- out.writeObject(cacheManager.getFromGroup(i.next(), group));
- }
-
- out.flush();
-
- //
- // Subtract 4 bytes from the length, because the serialization
- // magic number (2 bytes) and version number (2 bytes) are
- // both written to the stream before the object
- //
- int objectsize = baos.toByteArray().length - 4 * keys.size();
- return objectsize;
- }
-
- /**
- * @see org.apache.fulcrum.cache.GlobalCacheService#getNumberOfObjects()
- */
- public int getNumberOfObjects()
- {
- int count = 0;
-
- for (Iterator i = cacheManager.getGroupKeys(group).iterator(); i.hasNext();)
- {
- if (cacheManager.getFromGroup(i.next(), group) != null)
- {
- count++;
- }
- }
-
- return count;
- }
-
- /**
- * @see org.apache.fulcrum.cache.GlobalCacheService#flushCache()
- */
- public void flushCache()
- {
- cacheManager.invalidateGroup(group);
- }
-}
+package org.apache.fulcrum.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 java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.avalon.framework.activity.Disposable;
+import org.apache.avalon.framework.activity.Initializable;
+import org.apache.avalon.framework.configuration.Configurable;
+import org.apache.avalon.framework.configuration.Configuration;
+import org.apache.avalon.framework.configuration.ConfigurationException;
+import org.apache.avalon.framework.logger.AbstractLogEnabled;
+import org.apache.avalon.framework.thread.ThreadSafe;
+import org.apache.fulcrum.cache.CachedObject;
+import org.apache.fulcrum.cache.GlobalCacheService;
+import org.apache.fulcrum.cache.ObjectExpiredException;
+import org.apache.fulcrum.cache.RefreshableCachedObject;
+import org.apache.jcs.JCS;
+import org.apache.jcs.access.exception.CacheException;
+import org.apache.jcs.engine.ElementAttributes;
+
+/**
+ * Default implementation of JCSCacheService
+ *
+ * @author <a href="mailto:tv@apache.org">Thomas Vandahl</a>
+ * @version $Id:$
+ */
+public class JCSCacheService
+ extends AbstractLogEnabled
+ implements GlobalCacheService, Runnable, Configurable, Disposable, Initializable, ThreadSafe
+{
+ /**
+ * Cache check frequency in Millis (1000 Millis = 1 second).
+ * Value must be > 0.
+ * Default = 5 seconds
+ */
+ public static final long DEFAULT_CACHE_CHECK_FREQUENCY = 5000; // 5 seconds
+
+ /**
+ * cacheCheckFrequency (default - 5 seconds)
+ */
+ private long cacheCheckFrequency;
+
+ /**
+ * Instance of the JCS cache
+ */
+ private JCS cacheManager;
+
+ /**
+ * JCS region to use
+ */
+ private String region;
+
+ /**
+ * Path name of the JCS configuration file
+ */
+ private String configFile;
+
+ /**
+ * Constant value which provides a group name
+ */
+ private static String group = "default_group";
+
+ /** thread for refreshing stale items in the cache */
+ private Thread refreshing;
+
+ /** flag to stop the housekeeping thread when the component is disposed. */
+ private boolean continueThread;
+
+ // ---------------- Avalon Lifecycle Methods ---------------------
+
+ /**
+ * @see org.apache.avalon.framework.configuration.Configurable#configure(org.apache.avalon.framework.configuration.Configuration)
+ */
+ public void configure(Configuration config) throws ConfigurationException
+ {
+ cacheCheckFrequency = config.getChild("cacheCheckFrequency").getValueAsLong(DEFAULT_CACHE_CHECK_FREQUENCY);
+ region = config.getChild("region").getValue("fulcrum");
+ configFile = config.getChild("configurationFile").getValue("/cache.ccf");
+ }
+
+ /**
+ * @see org.apache.avalon.framework.activity.Initializable#initialize()
+ */
+ public void initialize() throws Exception
+ {
+ JCS.setConfigFilename(configFile);
+ cacheManager = JCS.getInstance(region);
+
+ // Start housekeeping thread.
+ continueThread = true;
+ refreshing = new Thread(this);
+
+ // Indicate that this is a system thread. JVM will quit only when
+ // there are no more active user threads. Settings threads spawned
+ // internally by Turbine as daemons allows commandline applications
+ // using Turbine to terminate in an orderly manner.
+ refreshing.setDaemon(true);
+ refreshing.setName("JCSCacheService Refreshing");
+ refreshing.start();
+
+ getLogger().debug("JCSCacheService started.");
+ }
+
+ /**
+ * @see org.apache.avalon.framework.activity.Disposable#dispose()
+ */
+ public void dispose()
+ {
+ try
+ {
+ cacheManager.remove();
+ }
+ catch (CacheException e)
+ {
+ // do nothing
+ }
+
+ continueThread = false;
+ refreshing.interrupt();
+
+ cacheManager = null;
+ getLogger().debug("JCSCacheService stopped.");
+ }
+
+ /**
+ * @see org.apache.fulcrum.cache.GlobalCacheService#getObject(java.lang.String)
+ */
+ public CachedObject getObject(String id) throws ObjectExpiredException
+ {
+ CachedObject obj = (CachedObject) cacheManager.getFromGroup(id, group);
+
+ if (obj == null)
+ {
+ // Not in the cache.
+ throw new ObjectExpiredException();
+ }
+
+ if (obj.isStale())
+ {
+ if (obj instanceof RefreshableCachedObject)
+ {
+ RefreshableCachedObject rco = (RefreshableCachedObject) obj;
+ if (rco.isUntouched())
+ {
+ // Do not refresh an object that has exceeded TimeToLive
+ removeObject(id);
+ throw new ObjectExpiredException();
+ }
+
+ // Refresh Object
+ rco.refresh();
+ if (rco.isStale())
+ {
+ // Object is Expired, remove it from cache.
+ removeObject(id);
+ throw new ObjectExpiredException();
+ }
+ }
+ else
+ {
+ // Expired.
+ removeObject(id);
+ throw new ObjectExpiredException();
+ }
+ }
+
+ if (obj instanceof RefreshableCachedObject)
+ {
+ // notify it that it's being accessed.
+ RefreshableCachedObject rco = (RefreshableCachedObject) obj;
+ rco.touch();
+ }
+
+ return obj;
+ }
+
+ /**
+ * @see org.apache.fulcrum.cache.GlobalCacheService#addObject(java.lang.String, org.apache.fulcrum.cache.CachedObject)
+ */
+ public void addObject(String id, CachedObject o)
+ {
+ try
+ {
+ if (!(o.getContents() instanceof Serializable))
+ {
+ getLogger().warn("Object with id [" + id + "] is not serializable. Expect problems with auxiliary caches.");
+ }
+
+ ElementAttributes attrib = (ElementAttributes)cacheManager.getElementAttributes();
+
+ if (o instanceof RefreshableCachedObject)
+ {
+ attrib.setIsEternal(true);
+ }
+ else
+ {
+ attrib.setIsEternal(false);
+ attrib.setMaxLifeSeconds((o.getExpires() + 500)/ 1000);
+ }
+
+ attrib.setLastAccessTimeNow();
+
+ // I know this is not nice, but setCreateTime() is missing and the fields are public ...
+ attrib.createTime = System.currentTimeMillis();
+ cacheManager.putInGroup(id, group, o, attrib);
+ }
+ catch (CacheException e)
+ {
+ getLogger().error("Could not add object " + id + " to cache", e);
+ }
+ }
+
+ /**
+ * @see org.apache.fulcrum.cache.GlobalCacheService#removeObject(java.lang.String)
+ */
+ public void removeObject(String id)
+ {
+ cacheManager.remove(id, group);
+ }
+
+ /**
+ * @see org.apache.fulcrum.cache.GlobalCacheService#getKeys()
+ */
+ public List getKeys()
+ {
+ ArrayList keys = new ArrayList();
+
+ keys.addAll(cacheManager.getGroupKeys(group));
+ return keys;
+ }
+
+ /**
+ * @see org.apache.fulcrum.cache.GlobalCacheService#getCachedObjects()
+ */
+ public List getCachedObjects()
+ {
+ ArrayList values = new ArrayList();
+
+ for (Iterator i = cacheManager.getGroupKeys(group).iterator(); i.hasNext();)
+ {
+ Object o = cacheManager.getFromGroup(i.next(), group);
+ if (o != null)
+ {
+ values.add(o);
+ }
+ }
+
+ return values;
+ }
+
+ /**
+ * Circle through the cache and refresh stale objects. Frequency
+ * is determined by the cacheCheckFrequency property.
+ */
+ public void run()
+ {
+ while (continueThread)
+ {
+ // Sleep for amount of time set in cacheCheckFrequency -
+ // default = 5 seconds.
+ try
+ {
+ Thread.sleep(cacheCheckFrequency);
+ }
+ catch (InterruptedException exc)
+ {
+ if (!continueThread) return;
+ }
+
+ for (Iterator i = cacheManager.getGroupKeys(group).iterator(); i.hasNext();)
+ {
+ String key= (String)i.next();
+ CachedObject o = (CachedObject)cacheManager.getFromGroup(key, group);
+ if (o == null)
+ {
+ removeObject(key);
+ }
+ else
+ {
+ if (o instanceof RefreshableCachedObject)
+ {
+ RefreshableCachedObject rco = (RefreshableCachedObject) o;
+ if (rco.isUntouched())
+ {
+ cacheManager.remove(key, group);
+ }
+ else if (rco.isStale())
+ {
+ rco.refresh();
+ }
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * @see org.apache.fulcrum.cache.GlobalCacheService#getCacheSize()
+ */
+ public int getCacheSize() throws IOException
+ {
+ // This is evil!
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ ObjectOutputStream out = new ObjectOutputStream(baos);
+ Set keys = cacheManager.getGroupKeys(group);
+
+ for (Iterator i = keys.iterator(); i.hasNext();)
+ {
+ out.writeObject(cacheManager.getFromGroup(i.next(), group));
+ }
+
+ out.flush();
+
+ //
+ // Subtract 4 bytes from the length, because the serialization
+ // magic number (2 bytes) and version number (2 bytes) are
+ // both written to the stream before the object
+ //
+ int objectsize = baos.toByteArray().length - 4 * keys.size();
+ return objectsize;
+ }
+
+ /**
+ * @see org.apache.fulcrum.cache.GlobalCacheService#getNumberOfObjects()
+ */
+ public int getNumberOfObjects()
+ {
+ int count = 0;
+
+ for (Iterator i = cacheManager.getGroupKeys(group).iterator(); i.hasNext();)
+ {
+ if (cacheManager.getFromGroup(i.next(), group) != null)
+ {
+ count++;
+ }
+ }
+
+ return count;
+ }
+
+ /**
+ * @see org.apache.fulcrum.cache.GlobalCacheService#flushCache()
+ */
+ public void flushCache()
+ {
+ cacheManager.invalidateGroup(group);
+ }
+}
Modified: jakarta/turbine/fulcrum/trunk/cache/src/test/TestComponentConfig.xml
URL: http://svn.apache.org/viewvc/jakarta/turbine/fulcrum/trunk/cache/src/test/TestComponentConfig.xml?view=diff&rev=535465&r1=535464&r2=535465
==============================================================================
--- jakarta/turbine/fulcrum/trunk/cache/src/test/TestComponentConfig.xml (original)
+++ jakarta/turbine/fulcrum/trunk/cache/src/test/TestComponentConfig.xml Fri May 4 23:58:06 2007
@@ -1,3 +1,22 @@
+<?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.
+-->
<componentConfig>
<cache cacheInitialSize="20" cacheCheckFrequency="5"/>
<ehcache/>
@@ -6,4 +25,4 @@
<region>Cache_Test</region>
<configurationFile>/cache.ccf</configurationFile>
</jcscache>
-</componentConfig>
\ No newline at end of file
+</componentConfig>
Modified: jakarta/turbine/fulcrum/trunk/cache/src/test/TestRoleConfig.xml
URL: http://svn.apache.org/viewvc/jakarta/turbine/fulcrum/trunk/cache/src/test/TestRoleConfig.xml?view=diff&rev=535465&r1=535464&r2=535465
==============================================================================
--- jakarta/turbine/fulcrum/trunk/cache/src/test/TestRoleConfig.xml (original)
+++ jakarta/turbine/fulcrum/trunk/cache/src/test/TestRoleConfig.xml Fri May 4 23:58:06 2007
@@ -1,17 +1,36 @@
+<?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.
+-->
<!-- This configuration file for Avalon components is used for testing the TestComponent -->
<role-list>
<role
name="org.apache.fulcrum.cache.GlobalCacheService"
shorthand="cache"
default-class="org.apache.fulcrum.cache.DefaultGlobalCacheService"/>
-
+
<role
name="org.apache.fulcrum.cache.EHCacheService"
shorthand="ehcache"
- default-class="org.apache.fulcrum.cache.impl.DefaultEHCacheService"/>
+ default-class="org.apache.fulcrum.cache.impl.DefaultEHCacheService"/>
<role
name="org.apache.fulcrum.cache.GlobalCacheService_JCS"
shorthand="jcscache"
default-class="org.apache.fulcrum.cache.impl.JCSCacheService"/>
-</role-list>
\ No newline at end of file
+</role-list>
Modified: jakarta/turbine/fulcrum/trunk/cache/src/test/cache.ccf
URL: http://svn.apache.org/viewvc/jakarta/turbine/fulcrum/trunk/cache/src/test/cache.ccf?view=diff&rev=535465&r1=535464&r2=535465
==============================================================================
--- jakarta/turbine/fulcrum/trunk/cache/src/test/cache.ccf (original)
+++ jakarta/turbine/fulcrum/trunk/cache/src/test/cache.ccf Fri May 4 23:58:06 2007
@@ -1,13 +1,29 @@
-# Java Caching System configuration
-
-jcs.default=
-jcs.default.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes
-jcs.default.cacheattributes.MaxObjects=100
-jcs.default.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache
-jcs.default.elementattributes=org.apache.jcs.engine.ElementAttributes
-
-jcs.region.Cache_Test=
-jcs.region.Cache_Test.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes
-jcs.region.Cache_Test.cacheattributes.MaxObjects=100
-jcs.region.Cache_Test.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache
-jcs.region.Cache_Test.elementattributes=org.apache.jcs.engine.ElementAttributes
+# 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.
+# Java Caching System configuration
+
+jcs.default=
+jcs.default.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes
+jcs.default.cacheattributes.MaxObjects=100
+jcs.default.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache
+jcs.default.elementattributes=org.apache.jcs.engine.ElementAttributes
+
+jcs.region.Cache_Test=
+jcs.region.Cache_Test.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes
+jcs.region.Cache_Test.cacheattributes.MaxObjects=100
+jcs.region.Cache_Test.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache
+jcs.region.Cache_Test.elementattributes=org.apache.jcs.engine.ElementAttributes
Modified: jakarta/turbine/fulcrum/trunk/cache/src/test/org/apache/fulcrum/cache/CacheTest.java
URL: http://svn.apache.org/viewvc/jakarta/turbine/fulcrum/trunk/cache/src/test/org/apache/fulcrum/cache/CacheTest.java?view=diff&rev=535465&r1=535464&r2=535465
==============================================================================
--- jakarta/turbine/fulcrum/trunk/cache/src/test/org/apache/fulcrum/cache/CacheTest.java (original)
+++ jakarta/turbine/fulcrum/trunk/cache/src/test/org/apache/fulcrum/cache/CacheTest.java Fri May 4 23:58:06 2007
@@ -1,18 +1,20 @@
-
/*
- * Copyright 2000-2004 The Apache Software Foundation.
- *
- * 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
+ * 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
+ * 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.
+ * 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.
*/
package org.apache.fulcrum.cache;
@@ -31,19 +33,19 @@
* CacheTest
*
* @author <a href="paulsp@apache.org">Paul Spencer</a>
- * @author <a href="epugh@upstate.com">Eric Pugh</a>
+ * @author <a href="epugh@upstate.com">Eric Pugh</a>
* @author <a href="mailto:peter@courcoux.biz">Peter Courcoux</a>
* @version $Id$
*/
public class CacheTest extends BaseUnitTest
{
-
+
private GlobalCacheService globalCache = null;
private static final String cacheKey = "CacheKey";
private static final String cacheKey_2 = "CacheKey_2";
public static final String SKIP_TESTS_KEY = "fulcrum.cache.skip.long.tests";
private static final Log LOG = LogFactory.getLog(CacheTest.class);
-
+
/**
* Defines the testcase name for JUnit.
@@ -221,7 +223,7 @@
{
String testString = new String("This is a test");
CachedObject cacheObject = null;
- // Create and add Object that expires in 1 turbine Refresh + 1 millis
+ // Create and add Object that expires in 1 turbine Refresh + 1 millis
cacheObject = new CachedObject(testString, (getCacheRefresh() * 5) + 1);
assertNotNull("Failed to create a cachable object", cacheObject);
globalCache.addObject(cacheKey, cacheObject);
@@ -416,12 +418,12 @@
((RefreshableCachedObject) retrievedObject).getContents());
/*
* @todo this is not working for some reason
-
- assertTrue(
- "Object did not refresh.",
- (((RefreshableObject) ((RefreshableCachedObject) retrievedObject).getContents()).getRefreshCount()
- > 0));
- */
+ *
+ * assertTrue(
+ * "Object did not refresh.",
+ * (((RefreshableObject) ((RefreshableCachedObject) retrievedObject).getContents()).getRefreshCount()
+ * > 0));
+ */
}
catch (ObjectExpiredException e)
{
@@ -458,7 +460,7 @@
}
/**
* Test that we can get a list of the keys in the cache
- *
+ *
* @return
*/
public void testCacheGetKeyList() {
@@ -472,12 +474,12 @@
Object key = itr.next();
assertTrue("Key was not an instance of String.", (key instanceof String));
}
-
+
}
-
+
/**
* Test that we can get a list of the keys in the cache
- *
+ *
* @return
*/
public void testCacheGetCachedObjects() {
@@ -492,14 +494,14 @@
assertNotNull("Object was null.", obj);
assertTrue("Object was not an instance of CachedObject", (obj instanceof CachedObject));
}
-
+
}
-
+
/**
- * Test that the retrieved list is safe from
+ * Test that the retrieved list is safe from
* ConcurrentModificationException's being thrown if the cache
* is updated while we are iterating over the List.
- *
+ *
* @return
*/
public void testCacheModification() {
@@ -512,7 +514,7 @@
try {
for (Iterator itr = keys.iterator(); itr.hasNext();) {
Object key = itr.next();
- globalCache.addObject("date4", new CachedObject(new Date()));
+ globalCache.addObject("date4", new CachedObject(new Date()));
}
} catch (ConcurrentModificationException cme)
{
@@ -522,26 +524,26 @@
try {
for (Iterator itr = objects.iterator(); itr.hasNext();) {
Object obj = itr.next();
- globalCache.addObject("date4", new CachedObject(new Date()));
+ globalCache.addObject("date4", new CachedObject(new Date()));
}
} catch (ConcurrentModificationException cme)
{
fail("Caught ConcurrentModificationException adding to cache.");
}
}
-
-
+
+
/**
- * Down cast the interface to the concreate object in order to grab the
+ * Down cast the interface to the concreate object in order to grab the
* cache check frequency.
* @return the refresh requency in milliseconds
*/
private long getCacheRefresh()
- {
- return ((DefaultGlobalCacheService) globalCache).getCacheCheckFrequency()*1000;
+ {
+ return ((DefaultGlobalCacheService) globalCache).getCacheCheckFrequency()*1000;
}
-
- /**
+
+ /**
* How long until it expires
* @return the cache refresh plus 1000.
*/
@@ -549,7 +551,7 @@
{
return getCacheRefresh() + 1000;
}
-
+
private long getTestTimeToLive()
{
Modified: jakarta/turbine/fulcrum/trunk/cache/src/test/org/apache/fulcrum/cache/EHCacheTest.java
URL: http://svn.apache.org/viewvc/jakarta/turbine/fulcrum/trunk/cache/src/test/org/apache/fulcrum/cache/EHCacheTest.java?view=diff&rev=535465&r1=535464&r2=535465
==============================================================================
--- jakarta/turbine/fulcrum/trunk/cache/src/test/org/apache/fulcrum/cache/EHCacheTest.java (original)
+++ jakarta/turbine/fulcrum/trunk/cache/src/test/org/apache/fulcrum/cache/EHCacheTest.java Fri May 4 23:58:06 2007
@@ -1,18 +1,20 @@
-
/*
- * Copyright 2000-2004 The Apache Software Foundation.
- *
- * 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
+ * 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
+ * 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.
+ * 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.
*/
package org.apache.fulcrum.cache;
@@ -25,16 +27,16 @@
/**
* EHCacheTest
*
- * @author <a href="epugh@opensourceconnections.com">Eric Pugh</a>
+ * @author <a href="epugh@opensourceconnections.com">Eric Pugh</a>
* @version $Id: CacheTest.java 223198 2004-11-09 08:30:41Z epugh $
*/
public class EHCacheTest extends BaseUnitTest
{
-
+
private EHCacheService ehCacheService = null;
private static final String cacheKey = "CacheKey";
private static final String cacheKey_2 = "CacheKey_2";
-
+
/**
* Defines the testcase name for JUnit.
@@ -91,7 +93,7 @@
"Retrieved the deleted cached object 1 and did not get expected ObjectExpiredException",
retrievedObject);
}
-
+
catch (Exception e)
{
throw e;
@@ -142,7 +144,7 @@
ehCache.remove(cacheKey);
ehCache.remove(cacheKey_2);
}
-
+
/**
* Verify that an object expiration
* when it now longer exists in cache.
@@ -168,7 +170,7 @@
assertNotNull("Did not retrieved a cached object", retrievedObject);
assertEquals("Did not retrieved correct cached object", cacheObject, retrievedObject);
}
-
+
catch (Exception e)
{
throw e;
@@ -190,5 +192,5 @@
}
// Remove objects
ehCache.remove(cacheKey);
- }
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org