org.norther.tammi.core.logger
Class AbstractLogger

java.lang.Object
  extended by org.norther.tammi.core.base.Adaptee
      extended by org.norther.tammi.core.config.DefaultConfigurable
          extended by org.norther.tammi.core.config.DefaultConfigurableFactory<Log>
              extended by org.norther.tammi.core.logger.AbstractLogger
All Implemented Interfaces:
Serializable, EventListener, NotificationBroadcaster, NotificationEmitter, Localizer, TraceListener, Manageable, MBeanDelegate, ObjectFactory<Log>, Refreshable, CacheClient<String,String>, Configurable, ConfigurableFactory<Log>, ResourceMap, Logger
Direct Known Subclasses:
AbstractThreadedLogger

public abstract class AbstractLogger
extends DefaultConfigurableFactory<Log>
implements Logger

An abstract implementation of Logger.

Version:
$Id: AbstractLogger.java,v 1.39 2010-06-22 17:50:21 cvsimp Exp $
Author:
Ilkka Priha
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class org.norther.tammi.core.config.DefaultConfigurable
DefaultConfigurable.Modified
 
Field Summary
protected static boolean traceOn
          The trace flag.
 
Fields inherited from class org.norther.tammi.core.base.Adaptee
ADAPTEE_NOTIF_DESCRIPTION, ADAPTEE_NOTIFICATIONS
 
Fields inherited from interface org.norther.tammi.acorn.locale.Localizer
ANY_NAME
 
Constructor Summary
AbstractLogger()
          Contructs a new logger.
 
Method Summary
protected  void activate(LoggerListener log, String name)
          Activates the specified logger listener.
 void addAppender(Object log, Object appender)
          Adds a new appender for the specified logger.
 void addFilter(String className)
          Adds an exception filter.
 void addResourceBundleName(String qualifier, String baseName)
          Adds a resource bundle name for the qualified name.
 void addResourceBundleNames(String qualifier, String[] baseNames)
          Adds resource bundle names for the qualified name.
 void clearAppenders(Object log)
          Clears appenders of the specified logger.
 void clearCached()
          Clears all cached entries without notifying.
 void clearFilters()
          Clears all exception filters.
 void clearResourceBundleNames()
          Clears all resource bundle names.
 void clearResourceBundleNames(String qualifier)
          Clears all resource bundle names of the qualified name.
 void expireCached(long timestamp)
          Expires all cached entries notifying them about expiration.
 void expireFraction(long timestamp, float fraction)
          Expires the specified fraction of cached entries notifying them about expiration.
 void flush()
          Flushes queued log entries.
 boolean getAdditivity(Object log)
          Gets the additivity of the specified logger.
protected  Object getAnonymousLogger(Log.Level level)
          Gets the logger for the specified level.
 String[] getAppenderNames(Object log)
          Gets appender names of the specified logger.
 int getBufferSize()
          Gets the log buffer size.
 ConcurrentMap<String,String> getCache(boolean... create)
          Gets and optionally creates the cache.
 String getDefaultBaseName()
          Gets the default base name.
 ObjectName getFallbackResourcesName()
          Gets the fallback resources of this map.
 String[] getFilters()
          Gets exception filters.
 Log getInstance(String className, ObjectName loader, Object[] params, String[] signature)
          Gets an instance of a named class using a specified class loader.
 Log.Level getLevel()
          Gets the root level.
 Log.Level getLevel(Object log)
          Gets the level of the specified logger.
 String getLocalizedMessage(Object msg)
          Gets a localized message for the default locale.
 String getLocalizedMessage(Object msg, Locale locale)
          Gets a localized message for the specified locale.
 String getLogClassName()
          Gets the log implementation class name.
 LogEntry.Encoding getLogEntryEncoding()
          Gets the log entry encoding.
 String getLoggerName(Log.Level level)
          Gets the logger name for the specified level.
protected  String getLoggerName(Object log)
          Gets the logger name for the specified log object.
protected abstract  Object getNativeLogger(String name)
          Gets a named native logger.
 String getPlugInBaseName(String key)
          Gets the base name of the resource bundle class associated with the specified plug-in key.
 int getPollingInterval()
          Gets the interval of polling new enries for logging.
 long getRefreshed()
          Gets the last refresh timestamp.
 String[] getResourceBundleNames(String qualifier)
          Gets the qualified resource bundle names.
 ObjectName getResourceFinderName()
          Gets the resource finder of this map.
 ObjectName getSharedCacheName()
          Gets the the shared cache of this client.
 String getTimeZoneId()
          Gets the default time zone.
 boolean isCachingDisabled()
          Checks whether the caching is disabled.
 boolean isDefaultLogFactory()
          Checks whether a default log factory.
 boolean isLoaderSupported(String className)
          Checks if specified class loaders are supported for a named class.
 boolean isStackTrace()
          Gets the stack trace flag for all categories called through this logger instance.
 boolean isStaticTrace()
          Gets the trace flag for the static trace methods.
 boolean isSystemErrLogged()
          Checks if system err is to be logged by this logger.
 boolean isSystemOutLogged()
          Checks if system out is to be logged by this logger.
 void log(Log.Level level, long time, String msg, Object arg)
          Logs a message with a specific level, date and argument.
 void log(Log.Level level, long time, String msg, Object arg, Throwable cause)
          Logs a message with a specific level, date, argument and reason.
 void log(Log.Level level, Object msg)
          Logs a message with a specific level.
 void log(Log.Level level, String msg, Object arg)
          Logs a message with a specific level and argument.
 void log(Log.Level level, String msg, Object arg, Throwable reason)
          Logs a message with a specific level, argument and reason.
 void log(Object log, Log.Level level, long time, String msg, Object arg)
          Logs a message with a specific logger, level, date and argument.
 void log(Object log, Log.Level level, long time, String msg, Object arg, Throwable cause)
          Logs a message with a specific logger, level, date, argument and reason.
 void log(Object log, Log.Level level, Object msg)
          Logs a message with a specific logger and level.
 void log(Object log, Log.Level level, String msg, Object arg)
          Logs a message with a specific logger, level and argument.
 void log(Object log, Log.Level level, String msg, Object arg, Throwable cause)
          Logs a message with a specific logger, level, argument and reason.
 void postmanaged()
          This method is called when the implementing adaptee has been managed either during post-registration of the corresponding adapter MBean or just after it is explicitly added to the adapter MBean during run-time.
protected abstract  void push(LogEntry entry)
          Pushes a log entry into a queue.
 Set<String> qualifierSet()
          Returns a read-only set of resource qualifiers.
 void refresh()
          Refreshes the MBean.
 void removeAppender(Object log, String appender)
          Removes an appender from the specified logger.
 void removeCache()
          Removes the cache.
 void removeFilter(String className)
          Removes an exception filter.
 void removeResourceBundleName(String qualifier, String baseName)
          Removes a resource bundle name of the qualified name.
 Object resolveLocalizedObject(String name, String key, Locale... locale)
          Resolves a localized object for the qualified name, key and locale.
 Object resolveLocalizedResource(String name, String key, Locale... locale)
          Resolves a localized resource for the qualified name, key and locale.
 String resolveLocalizedString(String name, String key, Locale... locale)
          Resolves a localized string for the qualified name, key and locale.
 String[] resolveLocalizedStrings(String name, String key, Locale... locale)
          Resolves a localized string array for the qualified name, key and locale.
 LookupResourceBundle resolveResourceBundle(String name, Locale... locale)
          Resolves a resource bundle for the qualified name and locale.
 String resolveResourceBundleName(String name)
          Resolves a resource bundle name for the qualified name.
 void setAdditivity(Object log, boolean additivity)
          Sets the additivity of the specified logger.
 void setBufferSize(int size)
          Sets the log buffer size.
 void setCachingDisabled(boolean flag)
          Sets the caching disabled flag.
 void setDefaultBaseName(String baseName)
          Sets the default base name.
 void setDefaultLogFactory(boolean flag)
          Sets whether a default log factory.
 void setFallbackResourcesName(ObjectName finder)
          Sets the fallback resources of this map.
 void setFilters(String[] classNames)
          Sets exception filters.
 void setLevel(Log.Level level)
          Sets the root level.
 void setLevel(Object log, Log.Level level)
          Sets the level of the specified logger.
 void setLevelAsString(Object log, String level)
          Sets the level of the specified logger as a string.
 void setLevelAsString(String level)
          Sets the root level as a string.
 void setLogClassName(String className)
          Sets the log implementation class name.
 void setLogEntryEncoding(LogEntry.Encoding enc)
          Sets the log entry encoding.
 void setLoggerName(Log.Level level, String name)
          Sets the logger name for the specified level.
 void setPollingInterval(int msecs)
          Sets the interval of polling new enries for logging.
 void setResourceBundleName(String qualifier, String baseName)
          Sets a resource bundle name for the qualified name.
 void setResourceBundleNames(String qualifier, String[] baseNames)
          Sets the resource bundle names of the qualified name.
 void setResourceFinderName(ObjectName finder)
          Sets the resource finder of this map.
 void setSharedCacheName(ObjectName cache)
          Sets the shared cache of this client.
 void setStackTrace(boolean flag)
          Sets the stack trace flag for all categories called through this logger instance.
 void setStaticTrace(boolean flag)
          Sets the trace flag for static trace methods.
 void setSystemErrLogged(boolean flag)
          Sets if system err if to be logged by this logger.
 void setSystemOutLogged(boolean flag)
          Sets if system out is to be logged by this logger.
 void setTimeZoneId(String zone)
          Sets the default time zone.
 void unmanaged()
          This method is called when the implementing adaptee is unmanaged either during pre-deregistration of the corresponding adapter MBean or just before it is explicitly removed from the adapter MBean during run-time.
 
Methods inherited from class org.norther.tammi.core.config.DefaultConfigurableFactory
getInstance, getInstance, getInstance
 
Methods inherited from class org.norther.tammi.core.config.DefaultConfigurable
addProperty, addProperty, addPropertyFilePath, addPropertyFilePath, checkConfiguration, clearProperties, containsProperty, getConfigKey, getConfiguration, getModifiedState, getProperties, getProperty, getPropertyFilePath, getPropertyFilePaths, indexOfProperty, loadConfiguration, loadConfiguration, loadConfiguration, modified, propertyMap, propertyMap, removeProperty, removeProperty, removePropertyFilePath, setConfigKey, setModifiedState, setProperties, setProperty, setPropertyFilePath, setPropertyFilePath, setPropertyFilePaths, setPropertyFilePaths, storeProperties, validateConfiguration
 
Methods inherited from class org.norther.tammi.core.base.Adaptee
addAdaptee, addNotificationListener, getAttributeSupport, getBroker, getCanonicalName, getDomain, getFactory, getLoader, getLog, getLog, getMBean, getMBeanServer, getNotificationInfo, getObjectName, getRegistrationTime, getSequenceNumber, hasListeners, isRegistered, premanaged, removeNotificationListener, removeNotificationListener, sendNotification, sendNotification, sendNotification, sendNotification, unregister
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.norther.tammi.core.logger.Logger
getLoggerClassName, isLogEnabled, isLogEnabled, release
 
Methods inherited from interface org.norther.tammi.core.base.ObjectFactory
getInstance, getInstance, getInstance
 
Methods inherited from interface org.norther.tammi.core.config.Configurable
addProperty, addProperty, addPropertyFilePath, addPropertyFilePath, clearProperties, containsProperty, getConfigKey, getProperties, getProperty, getPropertyFilePath, getPropertyFilePaths, indexOfProperty, propertyMap, propertyMap, removeProperty, removeProperty, removePropertyFilePath, setConfigKey, setProperties, setProperty, setPropertyFilePath, setPropertyFilePath, setPropertyFilePaths, setPropertyFilePaths, storeProperties
 

Field Detail

traceOn

protected static boolean traceOn
The trace flag.

Constructor Detail

AbstractLogger

public AbstractLogger()
Contructs a new logger.

Method Detail

postmanaged

public void postmanaged()
Description copied from interface: Manageable
This method is called when the implementing adaptee has been managed either during post-registration of the corresponding adapter MBean or just after it is explicitly added to the adapter MBean during run-time.

Specified by:
postmanaged in interface Manageable
Overrides:
postmanaged in class Adaptee

unmanaged

public void unmanaged()
               throws Exception
Description copied from interface: Manageable
This method is called when the implementing adaptee is unmanaged either during pre-deregistration of the corresponding adapter MBean or just before it is explicitly removed from the adapter MBean during run-time.

Specified by:
unmanaged in interface Manageable
Overrides:
unmanaged in class Adaptee
Throws:
Exception - if the adaptee refused to be unmanaged.

isStaticTrace

public boolean isStaticTrace()
Description copied from interface: Logger
Gets the trace flag for the static trace methods.

Specified by:
isStaticTrace in interface Logger
Returns:
true, if static trace is on.

setStaticTrace

public void setStaticTrace(boolean flag)
Description copied from interface: Logger
Sets the trace flag for static trace methods.

Specified by:
setStaticTrace in interface Logger
Parameters:
flag - the static trace on/off flag.

isStackTrace

public boolean isStackTrace()
Description copied from interface: Logger
Gets the stack trace flag for all categories called through this logger instance.

Specified by:
isStackTrace in interface Logger
Returns:
true, if stack trace in on.

setStackTrace

public void setStackTrace(boolean flag)
Description copied from interface: Logger
Sets the stack trace flag for all categories called through this logger instance.

Specified by:
setStackTrace in interface Logger
Parameters:
flag - the stack trace on/off flag.

getBufferSize

public int getBufferSize()
Description copied from interface: Logger
Gets the log buffer size.

Specified by:
getBufferSize in interface Logger
Returns:
the buffer size as a number of log entries.

setBufferSize

public void setBufferSize(int size)
Description copied from interface: Logger
Sets the log buffer size.

Specified by:
setBufferSize in interface Logger
Parameters:
size - the buffer size as a number of log entries.

getPollingInterval

public int getPollingInterval()
Description copied from interface: Logger
Gets the interval of polling new enries for logging.

Specified by:
getPollingInterval in interface Logger
Returns:
the polling interval in msecs.

setPollingInterval

public void setPollingInterval(int msecs)
Description copied from interface: Logger
Sets the interval of polling new enries for logging.

Specified by:
setPollingInterval in interface Logger
Parameters:
msecs - the polling interval in msecs.

getTimeZoneId

public String getTimeZoneId()
Description copied from interface: Logger
Gets the default time zone.

Specified by:
getTimeZoneId in interface Logger
Returns:
the default time zone of log entries.

setTimeZoneId

public void setTimeZoneId(String zone)
Description copied from interface: Logger
Sets the default time zone.

Specified by:
setTimeZoneId in interface Logger
Parameters:
zone - the default time zone of log entries.

getLogEntryEncoding

public LogEntry.Encoding getLogEntryEncoding()
Description copied from interface: Logger
Gets the log entry encoding.

Specified by:
getLogEntryEncoding in interface Logger
Returns:
the log entry encoding.

setLogEntryEncoding

public void setLogEntryEncoding(LogEntry.Encoding enc)
Description copied from interface: Logger
Sets the log entry encoding.

Specified by:
setLogEntryEncoding in interface Logger
Parameters:
enc - the log entry encoding.

isDefaultLogFactory

public boolean isDefaultLogFactory()
Description copied from interface: Logger
Checks whether a default log factory.

Specified by:
isDefaultLogFactory in interface Logger
Returns:
true if a default factory, false otherwise.

setDefaultLogFactory

public void setDefaultLogFactory(boolean flag)
Description copied from interface: Logger
Sets whether a default log factory.

Specified by:
setDefaultLogFactory in interface Logger
Parameters:
flag - true if a default factory, false otherwise.

getLogClassName

public String getLogClassName()
Description copied from interface: Logger
Gets the log implementation class name.

Specified by:
getLogClassName in interface Logger
Returns:
the log class name.

setLogClassName

public void setLogClassName(String className)
Description copied from interface: Logger
Sets the log implementation class name.

Specified by:
setLogClassName in interface Logger
Parameters:
className - the log class name.

getLoggerName

public String getLoggerName(Log.Level level)
Description copied from interface: Logger
Gets the logger name for the specified level.

Specified by:
getLoggerName in interface Logger
Parameters:
level - the level.
Returns:
the logger or null for root.

setLoggerName

public void setLoggerName(Log.Level level,
                          String name)
Description copied from interface: Logger
Sets the logger name for the specified level.

Specified by:
setLoggerName in interface Logger
Parameters:
level - the level.
name - the logger name.

getLevel

public Log.Level getLevel()
Description copied from interface: Logger
Gets the root level.

Specified by:
getLevel in interface Logger
Returns:
the level.

setLevel

public void setLevel(Log.Level level)
Description copied from interface: Logger
Sets the root level.

Specified by:
setLevel in interface Logger
Parameters:
level - the level.

setLevelAsString

public void setLevelAsString(String level)
Description copied from interface: Logger
Sets the root level as a string.

Specified by:
setLevelAsString in interface Logger
Parameters:
level - the level as a string.

getLevel

public Log.Level getLevel(Object log)
Description copied from interface: Logger
Gets the level of the specified logger.

Specified by:
getLevel in interface Logger
Parameters:
log - the logger.
Returns:
the level.

setLevel

public void setLevel(Object log,
                     Log.Level level)
Description copied from interface: Logger
Sets the level of the specified logger.

Specified by:
setLevel in interface Logger
Parameters:
log - the logger.
level - the level.

setLevelAsString

public void setLevelAsString(Object log,
                             String level)
Description copied from interface: Logger
Sets the level of the specified logger as a string.

Specified by:
setLevelAsString in interface Logger
Parameters:
log - the logger.
level - the level as a string.

getAdditivity

public boolean getAdditivity(Object log)
Description copied from interface: Logger
Gets the additivity of the specified logger.

Specified by:
getAdditivity in interface Logger
Parameters:
log - the logger.
Returns:
the additivity.

setAdditivity

public void setAdditivity(Object log,
                          boolean additivity)
Description copied from interface: Logger
Sets the additivity of the specified logger.

Specified by:
setAdditivity in interface Logger
Parameters:
log - the logger.
additivity - the additivity.

addAppender

public void addAppender(Object log,
                        Object appender)
Description copied from interface: Logger
Adds a new appender for the specified logger.

Specified by:
addAppender in interface Logger
Parameters:
log - the logger.
appender - the appender class name.

getAppenderNames

public String[] getAppenderNames(Object log)
Description copied from interface: Logger
Gets appender names of the specified logger.

Specified by:
getAppenderNames in interface Logger
Parameters:
log - the logger.
Returns:
an array of appender names.

removeAppender

public void removeAppender(Object log,
                           String appender)
Description copied from interface: Logger
Removes an appender from the specified logger.

Specified by:
removeAppender in interface Logger
Parameters:
log - the logger.
appender - the appender name.

clearAppenders

public void clearAppenders(Object log)
Description copied from interface: Logger
Clears appenders of the specified logger.

Specified by:
clearAppenders in interface Logger
Parameters:
log - the logger.

getFilters

public String[] getFilters()
Description copied from interface: Logger
Gets exception filters.

Specified by:
getFilters in interface Logger
Returns:
an array of exception filters.

setFilters

public void setFilters(String[] classNames)
Description copied from interface: Logger
Sets exception filters.

Specified by:
setFilters in interface Logger
Parameters:
classNames - an array of exception filters.

addFilter

public void addFilter(String className)
Description copied from interface: Logger
Adds an exception filter.

Specified by:
addFilter in interface Logger
Parameters:
className - the class name of a filtered exception.

removeFilter

public void removeFilter(String className)
Description copied from interface: Logger
Removes an exception filter.

Specified by:
removeFilter in interface Logger
Parameters:
className - the class name of a filtered exception.

clearFilters

public void clearFilters()
Description copied from interface: Logger
Clears all exception filters.

Specified by:
clearFilters in interface Logger

log

public void log(Log.Level level,
                Object msg)
Description copied from interface: Logger
Logs a message with a specific level.

Specified by:
log in interface Logger
Parameters:
level - the level of the message.
msg - the message to log.

log

public void log(Log.Level level,
                String msg,
                Object arg)
Description copied from interface: Logger
Logs a message with a specific level and argument.

Specified by:
log in interface Logger
Parameters:
level - the level of the message.
msg - the message to log.
arg - the argument or cause.

log

public void log(Log.Level level,
                String msg,
                Object arg,
                Throwable reason)
Description copied from interface: Logger
Logs a message with a specific level, argument and reason.

Specified by:
log in interface Logger
Parameters:
level - the level of the message.
msg - the message to log.
arg - the argument.
reason - the cause.

log

public void log(Log.Level level,
                long time,
                String msg,
                Object arg)
Description copied from interface: Logger
Logs a message with a specific level, date and argument.

Specified by:
log in interface Logger
Parameters:
level - the level of the message.
time - the time of the event.
msg - the message to log.
arg - the argument or cause.

log

public void log(Log.Level level,
                long time,
                String msg,
                Object arg,
                Throwable cause)
Description copied from interface: Logger
Logs a message with a specific level, date, argument and reason.

Specified by:
log in interface Logger
Parameters:
level - the level of the message.
time - the time of the event.
msg - the message to log.
arg - the argument.
cause - the cause.

log

public void log(Object log,
                Log.Level level,
                Object msg)
Description copied from interface: Logger
Logs a message with a specific logger and level.

Specified by:
log in interface Logger
Parameters:
log - the logger.
level - the level of the message.
msg - the message to log.

log

public void log(Object log,
                Log.Level level,
                String msg,
                Object arg)
Description copied from interface: Logger
Logs a message with a specific logger, level and argument.

Specified by:
log in interface Logger
Parameters:
log - the logger.
level - the level of the message.
msg - the message to log.
arg - the argument or cause.

log

public void log(Object log,
                Log.Level level,
                String msg,
                Object arg,
                Throwable cause)
Description copied from interface: Logger
Logs a message with a specific logger, level, argument and reason.

Specified by:
log in interface Logger
Parameters:
log - the logger.
level - the level of the message.
msg - the message to log.
arg - the argument.
cause - the cause.

log

public void log(Object log,
                Log.Level level,
                long time,
                String msg,
                Object arg)
Description copied from interface: Logger
Logs a message with a specific logger, level, date and argument.

Specified by:
log in interface Logger
Parameters:
log - the logger.
level - the level of the message.
time - the time of the event.
msg - the message to log.
arg - the argument or cause.

log

public void log(Object log,
                Log.Level level,
                long time,
                String msg,
                Object arg,
                Throwable cause)
Description copied from interface: Logger
Logs a message with a specific logger, level, date, argument and reason.

Specified by:
log in interface Logger
Parameters:
log - the logger.
level - the level of the message.
time - the time of the event.
msg - the message to log.
arg - the argument.
cause - the cause.

isSystemOutLogged

public boolean isSystemOutLogged()
Description copied from interface: Logger
Checks if system out is to be logged by this logger.

Specified by:
isSystemOutLogged in interface Logger
Returns:
true if logged, false otherwise,

setSystemOutLogged

public void setSystemOutLogged(boolean flag)
Description copied from interface: Logger
Sets if system out is to be logged by this logger.

Specified by:
setSystemOutLogged in interface Logger
Parameters:
flag - true if logged, false otherwise,

isSystemErrLogged

public boolean isSystemErrLogged()
Description copied from interface: Logger
Checks if system err is to be logged by this logger.

Specified by:
isSystemErrLogged in interface Logger
Returns:
true if logged, false otherwise,

setSystemErrLogged

public void setSystemErrLogged(boolean flag)
Description copied from interface: Logger
Sets if system err if to be logged by this logger.

Note that echo will be automatically off.

Specified by:
setSystemErrLogged in interface Logger
Parameters:
flag - true if logged, false otherwise,

getLocalizedMessage

public String getLocalizedMessage(Object msg)
Description copied from interface: Logger
Gets a localized message for the default locale.

Specified by:
getLocalizedMessage in interface Logger
Parameters:
msg - the message to localize.
Returns:
the localized message or the original one if not available.

getLocalizedMessage

public String getLocalizedMessage(Object msg,
                                  Locale locale)
Description copied from interface: Logger
Gets a localized message for the specified locale.

Specified by:
getLocalizedMessage in interface Logger
Parameters:
msg - the message to localize.
locale - the locale to apply.
Returns:
the localized message or the original one if not available.

flush

public void flush()
Description copied from interface: Logger
Flushes queued log entries.

Specified by:
flush in interface Logger

getInstance

public Log getInstance(String className,
                       ObjectName loader,
                       Object[] params,
                       String[] signature)
                throws ConstructionException
Description copied from interface: ObjectFactory
Gets an instance of a named class using a specified class loader. Parameters for its constructor are given as an array of objects, primitive types must be wrapped with a corresponding class.

Class loaders are supported only if the isLoaderSupported method returns true. Otherwise the loader parameter is ignored.

Specified by:
getInstance in interface ObjectFactory<Log>
Overrides:
getInstance in class DefaultConfigurableFactory<Log>
Parameters:
className - the name of the class.
loader - the class loader.
params - an array containing the parameters of the constructor.
signature - an array containing the signature of the constructor.
Returns:
the instance.
Throws:
ConstructionException - if construction fails.

isLoaderSupported

public boolean isLoaderSupported(String className)
Description copied from interface: ObjectFactory
Checks if specified class loaders are supported for a named class.

Specified by:
isLoaderSupported in interface ObjectFactory<Log>
Overrides:
isLoaderSupported in class DefaultConfigurableFactory<Log>
Parameters:
className - the name of the class.
Returns:
true if class loaders are supported, false otherwise.

isCachingDisabled

public boolean isCachingDisabled()
Description copied from interface: CacheClient
Checks whether the caching is disabled.

Specified by:
isCachingDisabled in interface CacheClient<String,String>
Returns:
true if the caching is disabled, true otherwise.

setCachingDisabled

public void setCachingDisabled(boolean flag)
Description copied from interface: CacheClient
Sets the caching disabled flag.

Specified by:
setCachingDisabled in interface CacheClient<String,String>
Parameters:
flag - the caching disabled flag.

expireCached

public void expireCached(long timestamp)
Description copied from interface: CacheClient
Expires all cached entries notifying them about expiration.

Specified by:
expireCached in interface CacheClient<String,String>
Parameters:
timestamp - the timestamp of the expiration.

expireFraction

public void expireFraction(long timestamp,
                           float fraction)
Description copied from interface: CacheClient
Expires the specified fraction of cached entries notifying them about expiration.

Specified by:
expireFraction in interface CacheClient<String,String>
Parameters:
timestamp - the timestamp of the expiration.
fraction - the fraction of entries to expire (0.0..1.0).

clearCached

public void clearCached()
Description copied from interface: CacheClient
Clears all cached entries without notifying.

Specified by:
clearCached in interface CacheClient<String,String>

getCache

public ConcurrentMap<String,String> getCache(boolean... create)
Description copied from interface: CacheClient
Gets and optionally creates the cache.

Specified by:
getCache in interface CacheClient<String,String>
Parameters:
create - true to create a missing cache.
Returns:
the cache or null if disabled.

removeCache

public void removeCache()
Description copied from interface: CacheClient
Removes the cache.

Specified by:
removeCache in interface CacheClient<String,String>

getSharedCacheName

public ObjectName getSharedCacheName()
Description copied from interface: CacheClient
Gets the the shared cache of this client.

Specified by:
getSharedCacheName in interface CacheClient<String,String>
Returns:
the object name of the shared cache or a query.

setSharedCacheName

public void setSharedCacheName(ObjectName cache)
Description copied from interface: CacheClient
Sets the shared cache of this client. If it is not set, the default one will be used.

Specified by:
setSharedCacheName in interface CacheClient<String,String>
Parameters:
cache - the object name of the shared cache or a query.

refresh

public void refresh()
Description copied from interface: Refreshable
Refreshes the MBean.

Specified by:
refresh in interface Refreshable

getRefreshed

public long getRefreshed()
Description copied from interface: Refreshable
Gets the last refresh timestamp.

Specified by:
getRefreshed in interface Refreshable
Returns:
the timestamp of the last refresh.

getResourceFinderName

public ObjectName getResourceFinderName()
Description copied from interface: ResourceMap
Gets the resource finder of this map.

Specified by:
getResourceFinderName in interface ResourceMap
Returns:
the object name of the resource finder or a query.

setResourceFinderName

public void setResourceFinderName(ObjectName finder)
Description copied from interface: ResourceMap
Sets the resource finder of this map. If it is not set, the default one will be used.

Specified by:
setResourceFinderName in interface ResourceMap
Parameters:
finder - the object name of the resource finder or a query.

getPlugInBaseName

public String getPlugInBaseName(String key)
Description copied from interface: ResourceMap
Gets the base name of the resource bundle class associated with the specified plug-in key.

Specified by:
getPlugInBaseName in interface ResourceMap
Parameters:
key - the plug-in key.
Returns:
the base name of the resource bundle class.

getFallbackResourcesName

public ObjectName getFallbackResourcesName()
Description copied from interface: ResourceMap
Gets the fallback resources of this map.

Specified by:
getFallbackResourcesName in interface ResourceMap
Returns:
the object name of the fallback resources or a query.

setFallbackResourcesName

public void setFallbackResourcesName(ObjectName finder)
Description copied from interface: ResourceMap
Sets the fallback resources of this map.

Specified by:
setFallbackResourcesName in interface ResourceMap
Parameters:
finder - the object name of the fallback resources or a query.

getDefaultBaseName

public String getDefaultBaseName()
Description copied from interface: ResourceMap
Gets the default base name.

Specified by:
getDefaultBaseName in interface ResourceMap
Returns:
the base name of the default bundle or null.

setDefaultBaseName

public void setDefaultBaseName(String baseName)
Description copied from interface: ResourceMap
Sets the default base name.

Specified by:
setDefaultBaseName in interface ResourceMap
Parameters:
baseName - the base name of the default bundle.

getResourceBundleNames

public String[] getResourceBundleNames(String qualifier)
Description copied from interface: ResourceMap
Gets the qualified resource bundle names.

Specified by:
getResourceBundleNames in interface ResourceMap
Parameters:
qualifier - the resource qualifier.
Returns:
the base names of the resource bundles or null.

setResourceBundleNames

public void setResourceBundleNames(String qualifier,
                                   String[] baseNames)
Description copied from interface: ResourceMap
Sets the resource bundle names of the qualified name.

Specified by:
setResourceBundleNames in interface ResourceMap
Parameters:
qualifier - the resource qualifier.
baseNames - the base names of the resource bundles.

setResourceBundleName

public void setResourceBundleName(String qualifier,
                                  String baseName)
Description copied from interface: ResourceMap
Sets a resource bundle name for the qualified name.

Specified by:
setResourceBundleName in interface ResourceMap
Parameters:
qualifier - the resource qualifier.
baseName - the base name of the resource bundle.

addResourceBundleNames

public void addResourceBundleNames(String qualifier,
                                   String[] baseNames)
Description copied from interface: ResourceMap
Adds resource bundle names for the qualified name.

Specified by:
addResourceBundleNames in interface ResourceMap
Parameters:
qualifier - the resource qualifier.
baseNames - the base names of the resource bundles.

addResourceBundleName

public void addResourceBundleName(String qualifier,
                                  String baseName)
Description copied from interface: ResourceMap
Adds a resource bundle name for the qualified name.

Specified by:
addResourceBundleName in interface ResourceMap
Parameters:
qualifier - the resource qualifier.
baseName - the base name of the resource bundle.

removeResourceBundleName

public void removeResourceBundleName(String qualifier,
                                     String baseName)
Description copied from interface: ResourceMap
Removes a resource bundle name of the qualified name.

Specified by:
removeResourceBundleName in interface ResourceMap
Parameters:
qualifier - the resource qualifier.
baseName - the base name of the resource bundle.

clearResourceBundleNames

public void clearResourceBundleNames(String qualifier)
Description copied from interface: ResourceMap
Clears all resource bundle names of the qualified name.

Specified by:
clearResourceBundleNames in interface ResourceMap
Parameters:
qualifier - the resource qualifier.

clearResourceBundleNames

public void clearResourceBundleNames()
Description copied from interface: ResourceMap
Clears all resource bundle names.

Specified by:
clearResourceBundleNames in interface ResourceMap

qualifierSet

public Set<String> qualifierSet()
Description copied from interface: ResourceMap
Returns a read-only set of resource qualifiers.

Specified by:
qualifierSet in interface ResourceMap
Returns:
a set of qualifiers.

resolveResourceBundleName

public String resolveResourceBundleName(String name)
Description copied from interface: ResourceMap
Resolves a resource bundle name for the qualified name. The fully qualified name is checked first. If it fails, the plain base name is tried. If it fails too, the packages of the qualified name are applied to defined base names by starting from the most specific one. If also the packages fail, fallback resources are applied. Finally, the default base name is applied if nothing else matches.

Specified by:
resolveResourceBundleName in interface ResourceMap
Parameters:
name - the qualified name.
Returns:
the base name of the resource bundle or null.

resolveResourceBundle

public LookupResourceBundle resolveResourceBundle(String name,
                                                  Locale... locale)
Description copied from interface: ResourceMap
Resolves a resource bundle for the qualified name and locale. The fully qualified name is checked first. If it fails, the plain base name is tried. If it fails too, the packages of the qualified name are applied to defined base names by starting from the most specific one. If also the packages fail, fallback resources are applied. Finally, the default base name is applied if nothing else matches.

Specified by:
resolveResourceBundle in interface ResourceMap
Parameters:
name - the qualified name.
locale - the locale.
Returns:
the resource bundle or null.

resolveLocalizedResource

public Object resolveLocalizedResource(String name,
                                       String key,
                                       Locale... locale)
Description copied from interface: Localizer
Resolves a localized resource for the qualified name, key and locale. A localized resource mapped to the key and defined for the most specific package of the qualified name is returned. If no qualified resource is available, the key is returned unmodified.

If the qualified name is a wildcard "*", the first mapped resource regardless of its package is returned.

Specified by:
resolveLocalizedResource in interface Localizer
Parameters:
name - the qualified name.
key - the resource key.
locale - the locale.
Returns:
the localized resource or the key if not found.

resolveLocalizedObject

public Object resolveLocalizedObject(String name,
                                     String key,
                                     Locale... locale)
Description copied from interface: Localizer
Resolves a localized object for the qualified name, key and locale.

Specified by:
resolveLocalizedObject in interface Localizer
Parameters:
name - the qualified name.
key - the resource key.
locale - the locale.
Returns:
the localized object or the key if not found.

resolveLocalizedString

public String resolveLocalizedString(String name,
                                     String key,
                                     Locale... locale)
Description copied from interface: Localizer
Resolves a localized string for the qualified name, key and locale.

Specified by:
resolveLocalizedString in interface Localizer
Parameters:
name - the qualified name.
key - the resource key.
locale - the locale.
Returns:
the localized string or the key if not found.

resolveLocalizedStrings

public String[] resolveLocalizedStrings(String name,
                                        String key,
                                        Locale... locale)
Description copied from interface: Localizer
Resolves a localized string array for the qualified name, key and locale.

Specified by:
resolveLocalizedStrings in interface Localizer
Parameters:
name - the qualified name.
key - the resource key.
locale - the locale.
Returns:
the localized string array or the key in an array if not found.

activate

protected void activate(LoggerListener log,
                        String name)
                 throws ConstructionException
Activates the specified logger listener.

Parameters:
log - the logger listener.
name - the logger name.
Throws:
ConstructionException - if failed.

getLoggerName

protected String getLoggerName(Object log)
Gets the logger name for the specified log object.

Parameters:
log - the log object.
Returns:
the name of the logger.

push

protected abstract void push(LogEntry entry)
Pushes a log entry into a queue.

Parameters:
entry - a log entry.

getNativeLogger

protected abstract Object getNativeLogger(String name)
Gets a named native logger.

Parameters:
name - the logger name.
Returns:
the native logger.

getAnonymousLogger

protected Object getAnonymousLogger(Log.Level level)
Gets the logger for the specified level.

Parameters:
level - the level.
Returns:
the logger or null for root.


Copyright © 2004 The Norther Organization. All rights reserved.