org.olat.core.configuration
Class AbstractOLATModule

java.lang.Object
  extended by org.olat.core.logging.LogDelegator
      extended by org.olat.core.configuration.AbstractOLATModule
All Implemented Interfaces:
OLATModule, GenericEventListener
Direct Known Subclasses:
BusinessGroupModule, ContextHelpModule, I18nModule, RepositoryModule

public abstract class AbstractOLATModule
extends LogDelegator
implements OLATModule, GenericEventListener

Description:
Default/abstract class with helper methods.
The abstract olat module features reading and writing of configuration properties to config and properties files. The idea is that the system can be configured with default values either in the config xml file or by providing reasonable default values directly in the module code.

The developer should provide a GUI for each value that can be configured at runtime without the need of rebooting the entire system. But this is up to the programmer who implements the setter methods for the config values.

The getter methods will load the configuration in the following order:

  1. olatdata/system/configuration/fully.qualified.ClassName.properties
  2. falling back towebapp/WEB-INF/olat_config.xml
  3. falling back to default value defined in method call
The class does also provide save methods. Setting a config parameter will store it always in the user space config file olatdata/system/configuration/fully.qualified.ClassName.properties and not in the olat_config.xml, those are only the default values in case no other configuration.

To work properly in a cluster environment, the module will fire a ModuleConfiguratoinChangedEvent at the end of each save cycle. This event is catched automatically and the abstract method initFromChangedProperties() is called.

For more information on how the storing mechanism of the configuration works please have a look at the PersistedProperties class.

NOTE: This code will be refactored in the future. The olat_config.xml is a very old configuration concept. Target is to remove this file entirely and configure everything via Spring. In the future we try to achieve a better separation between code configuration (Spring, needs to be configured in xml files) and application configuration (properties, can be configured via GUI). If you want to use the properties mechanism in a spring loaded class, use the PersistedProperties class directly to read/write your application configuration.

Initial Date: 01.10.2007

Author:
Felix Jost, http://www.goodsolutions.ch, Florian Gnägi, http://www.frentix.com

Constructor Summary
AbstractOLATModule()
           
 
Method Summary
 void destroy()
          Destroy the module resources.
 void event(Event event)
           
 void init(com.anthonyeden.lib.config.Configuration moduleConfig)
          Initialize the module.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractOLATModule

public AbstractOLATModule()
Method Detail

init

public final void init(com.anthonyeden.lib.config.Configuration moduleConfig)
Initialize the module. Called by the framework at startup time

Specified by:
init in interface OLATModule

destroy

public void destroy()
Destroy the module resources. Called by the framework at shutdown time

Specified by:
destroy in interface OLATModule

event

public void event(Event event)
Specified by:
event in interface GenericEventListener
See Also:
GenericEventListener.event(org.olat.core.gui.control.Event)