API properties

The general API configuration resides within the jollyday.properties file contained in the provided jar file. You have two options to overload these properties.

You can specify a comma separated list of URLs with the system property de.jollyday.config.urls which point to properties files to overload the basic properties.

Example: -Dde.jollyday.config.urls=file:/some/path/new.properties,http://myserver/some/path/further.properties,jar:file:myLibrary.jar!/my.properties

You can specify a comma separated list of classes which implement the ConfigurationProvider interface with the system property de.jollyday.config.providers. This will overload the basic and the URL specified properties.

Example: -Dde.jollyday.config.providers=some.package.name.MyConfigurationProvider,some.other.package.AnotherConfigurationProvider

You can do both where each will overload the other. The order of loading properties is Base, URLs and ConfigurationProvider.

  • Manager implementation

    A Manager implementation extends the abstract Manager class and does the actual holiday parsing. The basic API properties are used to define the Manager implementation class used for the specific country the Manager is created for.

    manager.impl=de.jollyday.impl.DefaultHolidayManager

    This configuration defines an Manager implementation class used as a default for every country. You can define a Manager implementation on a per country base.

    manager.impl=de.jollyday.impl.DefaultHolidayManager
    manager.impl.us=de.jollyday.impl.MyXMLManager

    This will let the MyXMLManager class be used for calculating US holidays and the XMLManager for all other countries.

  • Parser implementation

    A parser implementation is used for parsing the XML file content. There are several parsers configured depending on the class to parse the info from.

    parser.impl.de.jollyday.config.Fixed=de.jollyday.parser.impl.FixedParser
    parser.impl.de.jollyday.config.FixedWeekdayInMonth=de.jollyday.parser.impl.FixedWeekdayInMonthParser
    parser.impl.de.jollyday.config.IslamicHoliday=de.jollyday.parser.impl.IslamicHolidayParser
    parser.impl.de.jollyday.config.ChristianHoliday=de.jollyday.parser.impl.ChristianHolidayParser
    parser.impl.de.jollyday.config.RelativeToFixed=de.jollyday.parser.impl.RelativeToFixedParser
    parser.impl.de.jollyday.config.RelativeToWeekdayInMonth=de.jollyday.parser.impl.RelativeToWeekdayInMonthParser
    parser.impl.de.jollyday.config.FixedWeekdayBetweenFixed=de.jollyday.parser.impl.FixedWeekdayBetweenFixedParser

    The configuration property name starts with parser.impl and finishes with the XML class name. The value is the parser implementation class name which implements the HolidayParser interface.

XML Configuration

The XML configuration file contained in the JAR file looks in this area like this:

<?xml version="1.0" encoding="UTF-8"?>
<tns:Configuration hierarchy="us" description="United States" xmlns:tns="http://www.example.org/Holiday" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.example.org/Holiday Holiday.xsd ">
  
  <!-- These are the nationwide common holidays. -->
  
  <tns:Holidays>
          <tns:Fixed month="JANUARY" day="1" />
          <tns:Fixed month="JULY" day="4" />
          <tns:Fixed month="NOVEMBER" day="11" />
          <tns:Fixed month="DECEMBER" day="25" />
          <tns:FixedWeekday which="LAST" weekday="MONDAY" month="MAY" />
          <tns:FixedWeekday which="FIRST" weekday="MONDAY" month="SEPTEMBER" />
          <tns:FixedWeekday which="FOURTH" weekday="THURSDAY" month="NOVEMBER"/>
  </tns:Holidays>

  -SNIP-
  
  <!-- These are the additional NY holidays -->
  
  <tns:SubConfigurations hierarchy="ny" description="New York">
        <tns:Holidays>
                <tns:Fixed month="FEBRUARY" day="12"/>
                <tns:RelativeToWeekdayInMonth weekday="TUESDAY" when="AFTER">
                        <tns:FixedWeekday which="FIRST" weekday="MONDAY" month="NOVEMBER"/>
                </tns:RelativeToWeekdayInMonth>
                <tns:FixedWeekday which="THIRD" weekday="MONDAY" month="JANUARY" />
                <tns:FixedWeekday which="THIRD" weekday="MONDAY" month="FEBRUARY" />
                <tns:FixedWeekday which="SECOND" weekday="MONDAY" month="OCTOBER" />
                <tns:ChristianHoliday type="EASTER_MONDAY"/>
        </tns:Holidays>
        
        <!-- These are the additional NYC holidays. -->
        
        <tns:SubConfigurations hierarchy="nyc" description="New York City">
                <tns:Holidays>
                        <tns:FixedWeekday which="FIRST" weekday="THURSDAY" month="JUNE"/>
                </tns:Holidays>
        </tns:SubConfigurations>
  </tns:SubConfigurations>
  
  -SNIP-
</tns:Configuration>