org.apache.cocoon.util
Class Deprecation

java.lang.Object
  extended by org.apache.cocoon.util.Deprecation

public class Deprecation
extends Object

This class provides a special static "deprecation" logger. All deprecated code should use this logger to log messages into the deprecation logger. This makes it easier for users to find out if they're using deprecated stuff.

Additionally, it is possible to set the forbidden level of deprecation messages (default is to forbid ERROR, i.e. allow up to WARN). Messages equal to or above the forbidden level will lead to throwing a DeprecationException. Setting the forbidden level to FATAL_ERROR allows running legacy applications using deprecated features (tolerant mode), and setting the forbidden level to DEBUG will run in strict mode, forbidding all deprecations.

Note that according to the above, issuing a fatalError log always raises an exception, and can therefore be used when detecting old features that have been totally removed.

Version:
$Id: Deprecation.html 1304258 2012-03-23 10:09:27Z ilgrosso $

Nested Class Summary
static class Deprecation.LogLevel
           
 
Field Summary
static Deprecation.LogLevel DEBUG
          Debug deprecation messages indicate features that are no more considered "current" or "best practice", but for which no removal is currently foreseen.
static Deprecation.LogLevel ERROR
          Error deprecation messages indicate features that will be removed in the next minor version (e.g. 2.1.6 --> 2.1.7).
static Deprecation.LogLevel FATAL_ERROR
          Fatal error deprecation messages indicate features that used to exist but have been removed in the current version.
static Deprecation.LogLevel INFO
          Info deprecation messages indicate features that are no more considered "current" or "best practice", and that will probably be removed in future releases.
static Logger logger
          The deprecation logger.
static Deprecation.LogLevel WARN
          Warning deprecation messages indicate features that will be removed in the next major version (e.g. 2.1.x --> 2.2.0).
 
Constructor Summary
Deprecation()
           
 
Method Summary
static void setForbiddenLevel(Deprecation.LogLevel level)
           
static void setLogger(Logger newLogger)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

public static final Logger logger
The deprecation logger.


DEBUG

public static final Deprecation.LogLevel DEBUG
Debug deprecation messages indicate features that are no more considered "current" or "best practice", but for which no removal is currently foreseen.


INFO

public static final Deprecation.LogLevel INFO
Info deprecation messages indicate features that are no more considered "current" or "best practice", and that will probably be removed in future releases.


WARN

public static final Deprecation.LogLevel WARN
Warning deprecation messages indicate features that will be removed in the next major version (e.g. 2.1.x --> 2.2.0). Such features should not be used if the application is planned to be migrated to newer Cocoon versions.


ERROR

public static final Deprecation.LogLevel ERROR
Error deprecation messages indicate features that will be removed in the next minor version (e.g. 2.1.6 --> 2.1.7). Although still functional, users are stronly invited to not use them.


FATAL_ERROR

public static final Deprecation.LogLevel FATAL_ERROR
Fatal error deprecation messages indicate features that used to exist but have been removed in the current version. Logging such a message always throws a DeprecationException.

Constructor Detail

Deprecation

public Deprecation()
Method Detail

setLogger

public static void setLogger(Logger newLogger)

setForbiddenLevel

public static void setForbiddenLevel(Deprecation.LogLevel level)


Copyright © 1999-2010 The Apache Software Foundation. All Rights Reserved.