ch.qos.logback.core
Class ContextBase

java.lang.Object
  extended by ch.qos.logback.core.ContextBase
All Implemented Interfaces:
Context, PropertyContainer

public class ContextBase
extends Object
implements Context


Constructor Summary
ContextBase()
           
 
Method Summary
 long getBirthTime()
          The time at which this context was created, expressed in millisecond elapsed since the epoch (1.1.1970).
 Object getConfigurationLock()
          Object used for synchronization purposes.
 Map<String,String> getCopyOfPropertyMap()
          Get a copy of the property map
 ExecutorService getExecutorService()
          Every context has an ExecutorService which be invoked to execute certain tasks in a separate thread.
 String getName()
          Contexts are named objects.
 Object getObject(String key)
          A Context can act as a store for various objects used by LOGBack components.
 String getProperty(String key)
          Given a key, return the corresponding property value.
 StatusManager getStatusManager()
          Return the StatusManager instance in use.
 void putObject(String key, Object value)
          Store an object under 'key'.
 void putProperty(String key, String val)
          Set a property of this context.
 void reset()
          Clear the internal objectMap and all properties.
 void setName(String name)
          The context name can be set only if it is not already set, or if the current name is the default context name, namely "default", or if the current name and the old name are the same.
 void setStatusManager(StatusManager statusManager)
          Set the StatusManager for this context.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ContextBase

public ContextBase()
Method Detail

getStatusManager

public StatusManager getStatusManager()
Description copied from interface: Context
Return the StatusManager instance in use.

Specified by:
getStatusManager in interface Context
Returns:
the StatusManager instance in use.

setStatusManager

public void setStatusManager(StatusManager statusManager)
Set the StatusManager for this context. Note that by default this context is initialized with a BasicStatusManager. A null value for the 'statusManager' argument is not allowed.

A malicious attacker can set the status manager to a dummy instance, disabling internal error reporting.

Parameters:
statusManager - the new status manager

getCopyOfPropertyMap

public Map<String,String> getCopyOfPropertyMap()
Description copied from interface: Context
Get a copy of the property map

Specified by:
getCopyOfPropertyMap in interface Context
Returns:

putProperty

public void putProperty(String key,
                        String val)
Description copied from interface: Context
Set a property of this context.

Specified by:
putProperty in interface Context

getProperty

public String getProperty(String key)
Given a key, return the corresponding property value. If invoked with the special key "CONTEXT_NAME", the name of the context is returned.

Specified by:
getProperty in interface Context
Specified by:
getProperty in interface PropertyContainer
Parameters:
key -
Returns:

getObject

public Object getObject(String key)
Description copied from interface: Context
A Context can act as a store for various objects used by LOGBack components.

Specified by:
getObject in interface Context
Returns:
The object stored under 'key'.

putObject

public void putObject(String key,
                      Object value)
Description copied from interface: Context
Store an object under 'key'. If no object can be found, null is returned.

Specified by:
putObject in interface Context

getName

public String getName()
Description copied from interface: Context
Contexts are named objects.

Specified by:
getName in interface Context
Returns:
the name for this context

reset

public void reset()
Clear the internal objectMap and all properties.


setName

public void setName(String name)
             throws IllegalStateException
The context name can be set only if it is not already set, or if the current name is the default context name, namely "default", or if the current name and the old name are the same.

Specified by:
setName in interface Context
Throws:
IllegalStateException - if the context already has a name, other than "default".

getBirthTime

public long getBirthTime()
Description copied from interface: Context
The time at which this context was created, expressed in millisecond elapsed since the epoch (1.1.1970).

Specified by:
getBirthTime in interface Context
Returns:
The time as measured when this class was created.

getConfigurationLock

public Object getConfigurationLock()
Description copied from interface: Context
Object used for synchronization purposes. INTENDED FOR INTERNAL USAGE.

Specified by:
getConfigurationLock in interface Context

getExecutorService

public ExecutorService getExecutorService()
Description copied from interface: Context
Every context has an ExecutorService which be invoked to execute certain tasks in a separate thread.

Specified by:
getExecutorService in interface Context
Returns:
the executor for this context.

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2005-2012 QOS.ch. All Rights Reserved.