xdocs/UpgradingFrom2x.xml (72 lines of code) (raw):

<?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>Upgrading from JCS 2.x to 3.0</title> <author email="tv@apache.org">Thomas Vandahl</author> </properties> <body> <section name="Upgrading from JCS 2.x to 3.0"> <p> This document lists a number of things that changed in Commons JCS 3.0. </p> <subsection name="Minimum Java Requirements"> <p> JCS 3.x requires Java 8 to run. It was tested successfully with JDK 14. </p> </subsection> <subsection name="Package Names and Maven Coordinates"> <p> The Apache Commons project requires a change of the package names and Maven coordinates on a major release. So in all your code replace <source><![CDATA[ import org.apache.commons.jcs.*; ]]></source> with <source><![CDATA[ import org.apache.commons.jcs3.*; ]]></source> The Maven coordinates change from <source><![CDATA[ <dependency> <groupId>org.apache.commons.jcs</groupId> <artifactId>commons-jcs-core</artifactId> <version>2.2.1</version> </dependency> ]]></source> to <source><![CDATA[ <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-jcs3-core</artifactId> <version>3.0</version> </dependency> ]]></source> </p> </subsection> <subsection name="Adjusting the Configuration"> <p> Here again, change all package names in configuration entries from e.g. <source><![CDATA[ jcs.default.cacheattributes=org.apache.commons.jcs.engine.CompositeCacheAttributes ]]></source> to <source><![CDATA[ jcs.default.cacheattributes=org.apache.commons.jcs3.engine.CompositeCacheAttributes ]]></source> </p> </subsection> <subsection name="Logging Abstraction"> <p> JCS 3.0 uses its own log abstraction layer. As newer and better log systems become available, JCS is no longer limited to commons-logging. As a result, JCS now uses java.util.logging as default and does not depend on commons-logging anymore. </p> <p> Optionally, JCS can use Log4j2 as a log system. You can activate it by providing log4j-core as a dependency, a log configuration such as log4j2.xml and a system property <source><![CDATA[ -Djcs.logSystem=log4j2 ]]></source> As log initialization occurs very early in the startup process, be sure to add this property before accessing any of JCS' classes. </p> <p> JCS uses the Java SPI mechanism to find its log systems. If you want to roll your own, you will need to implement a <code>org.apache.commons.jcs.log.Log</code> object and a <code>org.apache.commons.jcs.log.LogFactory</code> and provide the implementation class in a text file <code>META-INF/services/org.apache.commons.jcs.log.LogFactory</code> in your code. Choose a name for your log system and activate it via the system property as described above. </p> </subsection> </section> </body> </document>