Class ConfigBase

java.lang.Object
no.polaric.core.ConfigBase
All Implemented Interfaces:
ServerConfig

public abstract class ConfigBase extends Object implements ServerConfig
Base class, implementing common methods of ServerConfig. This may be subclassed by application (e.g. by Main class)
  • Constructor Details

    • ConfigBase

      public ConfigBase()
  • Method Details

    • log

      public Logfile log()
      Get logfile
      Specified by:
      log in interface ServerConfig
    • setLogger

      protected void setLogger(Logfile lf)
    • config

      public Properties config()
      Get configuration properties.
      Specified by:
      config in interface ServerConfig
      Returns:
      Properties object.
    • setConfig

      protected void setConfig(Properties prop)
    • setProperty

      public void setProperty(String pname, String dvalue)
      Set a configuration property
      Specified by:
      setProperty in interface ServerConfig
      Parameters:
      pname - property name.
      dvalue - default value.
    • getProperty

      public String getProperty(String pname, String dvalue)
      Get a configuration property
      Specified by:
      getProperty in interface ServerConfig
      Parameters:
      pname - property name.
      dvalue - default value.
      Returns:
      The value of the property (or dval if not registered)
    • getBoolProperty

      public boolean getBoolProperty(String pname, boolean dvalue)
      Get boolean property
      Specified by:
      getBoolProperty in interface ServerConfig
      Parameters:
      pname - property name.
      dvalue - default value.
      Returns:
      The value of the property (or dval if not registered)
    • getIntProperty

      public int getIntProperty(String pname, int dvalue)
      Get integer property
      Specified by:
      getIntProperty in interface ServerConfig
      Parameters:
      pname - property name.
      dvalue - default value.
      Returns:
      The value of the property (or dval if not registered)
    • getPosProperty

      public double[] getPosProperty(String pname)
      Get position property (lat, long)
      Specified by:
      getPosProperty in interface ServerConfig
      Parameters:
      pname - property name.
      Returns:
      [lat, long] coordinate
    • properties

      public Map<String,Object> properties()
      Get plugin properties.
      Specified by:
      properties in interface ServerConfig
      Returns:
      A map of properties (name,value) to be used by plugins.