com.groiss.util
Class Settings

java.lang.Object
  extended by com.groiss.util.Settings

public class Settings
extends java.lang.Object

This class defines some settings of the server. The settings are read from the configuration file. This implies that the configuration must be loaded when this class is initialized.


Constructor Summary
Settings()
           
 
Method Summary
static java.util.Locale[] getAvailableLocales()
          Return the list of locales from the configuration.
static java.io.File getBaseDir()
          Return the base directory (from the configuration).
static java.lang.ClassLoader getClassLoader()
          Get the application class loader.
static java.text.NumberFormat getDecimalFormatter()
           
static ILogger getLogger()
          Get the logger.
static java.lang.String getServerId()
          Get the id of the server.
static java.io.File getTempDir()
          Return the temporary directory (from the configuration).
static void log(java.lang.String s, int level)
          Write a message to the log.
static void logError(java.lang.Throwable err)
          Log an error
static void logError(java.lang.Throwable err, java.lang.String errHeader)
          Prints a header line and a stack trace for the given Error or Exception
static void setAvailableLocales(java.util.Locale[] l)
          Change the list of locales.
static void setBaseDir(java.lang.String dir)
          Set the base directory.
static void setClassLoader(java.lang.ClassLoader cl)
          Set the application class loader.
static void setLogger(ILogger l)
          Set the logger.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Settings

public Settings()
Method Detail

setClassLoader

public static void setClassLoader(java.lang.ClassLoader cl)
Set the application class loader.

Parameters:
cl - a class loader

getClassLoader

public static java.lang.ClassLoader getClassLoader()
Get the application class loader.

Returns:
a class loader

setLogger

public static void setLogger(ILogger l)
Set the logger.

Parameters:
l - an ILogger object.

getLogger

public static ILogger getLogger()
Get the logger.

Returns:
an ILogger

log

public static void log(java.lang.String s,
                       int level)
Write a message to the log. The message is written when the current log level is greater or equal the given level.

Parameters:
s - the message
level - the log level

logError

public static void logError(java.lang.Throwable err)
Log an error

Parameters:
err - a throwable.

logError

public static void logError(java.lang.Throwable err,
                            java.lang.String errHeader)
Prints a header line and a stack trace for the given Error or Exception

Parameters:
err - a throwable.
errHeader - the text for the header line

getBaseDir

public static java.io.File getBaseDir()
Return the base directory (from the configuration).

Returns:
a File object

getTempDir

public static java.io.File getTempDir()
Return the temporary directory (from the configuration).

Returns:
a File object

setBaseDir

public static void setBaseDir(java.lang.String dir)
Set the base directory.

Parameters:
dir - the directory path

getServerId

public static java.lang.String getServerId()
Get the id of the server.

Returns:
a string containing the server name

getAvailableLocales

public static java.util.Locale[] getAvailableLocales()
Return the list of locales from the configuration.

Returns:
an array of Locale objects

setAvailableLocales

public static void setAvailableLocales(java.util.Locale[] l)
Change the list of locales.

Parameters:
l - an array of Locale objects

getDecimalFormatter

public static java.text.NumberFormat getDecimalFormatter()


Copyright © 2001-2006 Groiss Informatics GmbH. All Rights Reserved.