Class OpenCardPropertyFileLoader

  • All Implemented Interfaces:
    OpenCardConfigurationProvider

    public class OpenCardPropertyFileLoader
    extends java.lang.Object
    implements OpenCardConfigurationProvider
    OpenCardPropertyFileLoader is a utility class that loads the opencard.properties file and merges the properties found in there with the system properties. Usually system properties will override properties found in the opencard.properties file. In case a property from the opencard.properties should override a system property you will have to use a second property using the first property's name plus the suffix .override and set it to true, e.g.

     OpenCard.trace = opencard.core:8
     
    To let this property always override the system property of the same name add

     OpenCard.trace.override = true
     
    Author:
    Mike Wendler (mwendler@de.ibm.com)
    See Also:
    OpenCardConfigurationProvider
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void load​(java.lang.String location)
      Tries to load a property file from location.
      void loadProperties()
      Loads OpenCard properties from a property file.
      • Methods inherited from class java.lang.Object

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

      • OpenCardPropertyFileLoader

        public OpenCardPropertyFileLoader()
    • Method Detail

      • load

        protected void load​(java.lang.String location)
        Tries to load a property file from location.
        Parameters:
        location - The path to the property file location.
      • loadProperties

        public void loadProperties()
                            throws OpenCardPropertyLoadingException
        Loads OpenCard properties from a property file. The following locations will be searched for a properties file (in that order):

        • [java.home]/lib/opencard.properties
        • [user.home]/.opencard.properties
        • [user.dir]/opencard.properties
        • [user.dir]/.opencard.properties

        NOTE that if a property file exists in several of these locations each one is being read. Conceptually this makes it possible to have a general property file, say in user.home, and more specific ones in the current directories which extend the general one.
        java.home is the directory of your java installation, user.home the user's home directory, and user.dir the current working directory.
        Specified by:
        loadProperties in interface OpenCardConfigurationProvider
        Throws:
        OpenCardPropertyLoadingException - thrown when no property file could be found