Class Settings

java.lang.Object
com.groiss.util.Settings
All Implemented Interfaces:
Lifecycle, Service

public class Settings extends Object implements Service
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.
  • Field Details

  • Constructor Details

    • Settings

      public Settings()
  • Method Details

    • setClassLoader

      public static void setClassLoader(ClassLoader cl)
      Set the application class loader.
      Parameters:
      cl - a class loader
    • getClassLoader

      public static ClassLoader getClassLoader()
      Get the application class loader.
      Returns:
      a class loader
    • log

      @Deprecated public static void log(String s, int level)
      Deprecated.
      use own Logger instead
      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

      @Deprecated public static void logError(Throwable err)
      Deprecated.
      use own Logger instead
      Log an error
      Parameters:
      err - a throwable.
    • logError

      @Deprecated public static void logError(Throwable err, String errHeader)
      Deprecated.
      use own Logger instead
      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 File getBaseDir()
      Return the base directory (from the configuration).
      Returns:
      a File object
    • getVarDir

      public static File getVarDir()
    • getLocalDir

      public static File getLocalDir()
    • getTempDir

      public static File getTempDir()
      Return the temporary directory (from the configuration or default if none is configured).
      Returns:
      a File object
    • getFormClassDir

      public static File getFormClassDir()
      Return the directory holding the form classes (from the configuration or default if none is configured).
      Returns:
      a File object
    • setBaseDir

      @Deprecated(since="11.0", forRemoval=true) public static void setBaseDir(String dir)
      Deprecated, for removal: This API element is subject to removal in a future version.
      shall never be called by API programmers therefore will be removed in future versions
      Set the base directory.
      Parameters:
      dir - the directory path
    • getServerId

      public static String getServerId()
      Get the id of the server.
      Returns:
      a string containing the server name
    • getAvailableLocales

      public static Locale[] getAvailableLocales()
      Return the list of locales from the configuration.
      Returns:
      an array of Locale objects
    • setAvailableLocales

      public static void setAvailableLocales(Locale[] l)
      Change the list of locales.
      Parameters:
      l - an array of Locale objects
    • getDecimalFormatter

      public static NumberFormat getDecimalFormatter()
    • getLocalNumberFormatter

      public static NumberFormat getLocalNumberFormatter()
    • startup

      public void startup()
      Description copied from interface: Lifecycle
      This method is called when the object is "started".
      Specified by:
      startup in interface Lifecycle
    • shutdown

      public void shutdown()
      Description copied from interface: Lifecycle
      This method is called on shutdown.
      Specified by:
      shutdown in interface Lifecycle
    • isRunning

      public boolean isRunning()
      Description copied from interface: Service
      Ask the object if it has been started
      Specified by:
      isRunning in interface Service
      Returns:
      true if running.
    • reconfigure

      public void reconfigure()
      Description copied from interface: Service
      Reconfigure the service. We suggest, to implement this method, if you want to reconfigure the service from other components.
      Specified by:
      reconfigure in interface Service
    • getProcessRelations

      public static Map<String,Pair<String,String>> getProcessRelations()
      Returns the list of process relations.
      Returns:
      a map with the relation-key and a pair of names for each relation.
    • getProcessRelation

      public static Pair<String,String> getProcessRelation(String key)
    • getProcessRelationText

      public static String getProcessRelationText(String key, boolean forward)
    • getProcessRelationsList

      public static List<Pair<String,String>> getProcessRelationsList()
    • getDecimalFormatter

      public static NumberFormat getDecimalFormatter(String maxDigitSettings, NumberFormat original)
      returns a NumberFormat where the max. fraction and integer digits are set as defined in the passed parameter. all other settings are copied from the passed NumberFormat
      Parameters:
      maxDigitSettings - the settings for the max. fraction and integer digits. e.g. 18,8 means 10 integer digits and 8 fraction digits
      original - the reference-number-format - all other settings are copied from this format
    • getShadowedFiles

      public static MultiMap<String,String> getShadowedFiles()
      Checks the classpath for duplicate entries.
      Returns:
      MultiMap containing all duplicate entries (key) and their occurances (value)
    • getEPShadowFiles

      public static String getEPShadowFiles() throws IOException
      Check if @enterprise resources are shadowed.
      Returns:
      null if resources are not loaded from jar file, empty string if no shadowing, else string containing shadow paths.
      Throws:
      IOException
    • getJarArchive

      public static File getJarArchive(Class<?> clazz)
      Get the jar archive the given class is loaded from.
    • getBootClasspath

      public static List<File> getBootClasspath()
    • getSystemClasspath

      public static List<File> getSystemClasspath()
    • getApplicationClasspath

      public static List<File> getApplicationClasspath()
    • getClasspath

      public static List<File> getClasspath()
    • getLocation

      public static Pair<URL,ClassLoader> getLocation(String resourceName)
    • getLevel

      @Deprecated public static int getLevel()
      Deprecated.
      use own Logger instead
      Returns:
      the current root-loglevel
    • logError

      @Deprecated public static void logError(Throwable e, String msg, int level)
      Deprecated.
      use own Logger instead
      writes logstatements to the root-logger
      Parameters:
      e - the exception
      msg - the message
      level - the level
    • getLogFile

      public static File getLogFile()
      returns the current log-file
      Returns:
      the file log-messages are written to
    • getErrorLogFile

      public static File getErrorLogFile()
      returns the current-error-file
      Returns:
      the file errors are writen to
    • getLogWriter

      public static PrintWriter getLogWriter()
      Returns:
      a printwriter which writes to the log, the default loglevel is INFO
      See Also:
      • LogOutputStream
    • getMessageDigestAlgorithmName

      public static String getMessageDigestAlgorithmName()
      Returns the Name of the MessageDigest algorithm used by the system (e.g. in DMS)
    • getMessageDigest

      public static MessageDigest getMessageDigest()
      Returns a new instance of the MessageDigest used by the system (e.g. in DMS)
    • getFormPackage

      public static String getFormPackage()
      return the name of the form class package (either com.dec.avw.appl. or com.groiss.forms.)
    • isFormclass

      public static boolean isFormclass(String classname)
    • removeFormPackageName

      public static String removeFormPackageName(String classname)
    • getResourceDir

      public static String getResourceDir()
      We store the resources of an application in the "classes" directory of the application. The method returns the constant "classes".
    • getTextCharset

      public static String getTextCharset()
    • getVersion

      public static String getVersion()
      Returns a detailed version number containing the @enterprise implementation-version e.g.: "11.0.1234"