Fork me on GitHub

Overview

This service uses a background thread to monitor a list of configuration files. A resource is loaded by using a resource name and an InputStreamLocator. The a SHA-1 hashcode is derived and compared to the previous hashcode. If a change is detected either the whole container or a list of services are reconfigured. This service allows reconfiguration support without using client/server communication.

Configuration

Role Configuration

          
  <role
    name="org.apache.fulcrum.yaafi.service.reconfiguration.ReconfigurationService"
    shorthand="ReconfigurationService"
    default-class="org.apache.fulcrum.yaafi.service.reconfiguration.ReconfigurationServiceImpl"
    early-init="true"
    description="Monitors configuration files to reconfigure YAAFI"
  />
          
        

Example Component Configuration

The following configuration checks every 5 seconds if the files have changed. Changing "TestComponentConfig" triggers the reconfiguration of the container whereas a change of "TestParameters.properties" would reconfigure the two listed services.

          
  <ReconfigurationService interval="5000">
    <entry>
      <location>./src/test/TestComponentConfig.xml</location>
    </entry>
    <entry>
      <location>./src/test/TestParameters.properties</location>
      <services>
        <service name="org.apache.fulcrum.yaafi.TestComponent"/>
        <service name="org.apache.fulcrum.yaafi.service.systemproperty.SystemPropertyService"/>
      </services>
    </entry>
  </ReconfigurationService>