Class Configuration


  • public class Configuration
    extends java.lang.Object
    Initialize configuration with defaults from collector.properties, unless a configuration properties file is available.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String FIELDSEP  
    • Constructor Summary

      Constructors 
      Constructor Description
      Configuration()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void clear()
      clears all properties.
      boolean getBool​(Key key)
      Returns a boolean property (case insensitiv), e.g.
      int getInt​(Key key)
      Parse an integer property and translate the String "inf" into Integer.MAX_VALUE.
      long getLong​(Key key)
      Parse a long property.
      java.nio.file.Path getPath​(Key key)
      Returns a Path property, e.g.
      java.util.Properties getPropertiesCopy()
      Return a copy of all properties.
      java.lang.String getProperty​(java.lang.String key)
      Retrieves the value for key.
      java.lang.String getProperty​(java.lang.String key, java.lang.String def)
      Retrieves the value for key returning a default for non-existing keys.
      java.util.Set<SourceType> getSourceTypeSet​(Key key)
      Returns a SourceType as List, e.g.
      java.lang.String[] getStringArray​(Key key)
      Returns String[] from a property.
      java.net.URL getUrl​(Key key)
      Returns a URL property, e.g.
      java.net.URL[] getUrlArray​(Key key)
      Returns URL[] from a property.
      void load​(java.io.InputStream fis)
      Loads properties from the given stream.
      void loadAndCheckConfiguration​(java.nio.file.Path confPath)
      Load the configuration from the given path.
      void putAll​(java.util.Properties allProps)
      Add all given properties.
      void setProperty​(java.lang.String key, java.lang.String value)
      Sets the value for key.
      int size()
      Count of properties.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Configuration

        public Configuration()
    • Method Detail

      • getPropertiesCopy

        public java.util.Properties getPropertiesCopy()
        Return a copy of all properties.
      • load

        public void load​(java.io.InputStream fis)
                  throws java.io.IOException
        Loads properties from the given stream.
        Throws:
        java.io.IOException
      • getProperty

        public java.lang.String getProperty​(java.lang.String key)
        Retrieves the value for key.
      • getProperty

        public java.lang.String getProperty​(java.lang.String key,
                                            java.lang.String def)
        Retrieves the value for key returning a default for non-existing keys.
      • setProperty

        public void setProperty​(java.lang.String key,
                                java.lang.String value)
        Sets the value for key.
      • clear

        public void clear()
        clears all properties.
      • putAll

        public void putAll​(java.util.Properties allProps)
        Add all given properties.
      • size

        public int size()
        Count of properties.
      • getInt

        public int getInt​(Key key)
                   throws ConfigurationException
        Parse an integer property and translate the String "inf" into Integer.MAX_VALUE. Verifies that this enum is a Key for an integer value.
        Throws:
        ConfigurationException
      • getUrlArray

        public java.net.URL[] getUrlArray​(Key key)
                                   throws ConfigurationException
        Returns URL[] from a property. Commas seperate array elements, e.g., propertyname = a1.example.org, a2.example2.com, a3.example3.net
        Throws:
        ConfigurationException