org.apache.cocoon.util
Class Deprecation

java.lang.Object
  extended byorg.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 fatal log message always raises an exception, and can therefore be used when detecting old features that have been completely removed.

Version:
$Id: Deprecation.html 1304280 2012-03-23 11:18:01Z 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.
static Deprecation.LogLevel FATAL
          Fatal 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 Log logger
          The deprecation logger.
static Deprecation.LogLevel WARN
          Warning deprecation messages indicate features that will be removed in the next major version (e.g.
 
Constructor Summary
Deprecation()
           
 
Method Summary
static void setForbiddenLevel(Deprecation.LogLevel level)
           
static void setLogger(Log 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 Log 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

public static final Deprecation.LogLevel FATAL
Fatal 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(Log newLogger)

setForbiddenLevel

public static void setForbiddenLevel(Deprecation.LogLevel level)


Copyright 1999-2008 The Apache Software Foundation. All Rights Reserved.