The Preference Store uses the default scope (PreferenceScope.DEFAULT) to retrieve static preferences from an SPI. Default scoped preferences are looked up on the API before falling back to its own SPI.
The following interfaces are available to be implemented to provide default preferences for one moduleId and multiple preferenceIds scoped by the moduleId:
When a call on PreferenceScope.DEFAULT is performed, all preferences provided by the SPI's implementors will be loaded into the preferences cache. Note that a new initialization for the SPI will only take place after the preference store caches are flushed.
Find the code of the interface to be implemented in the public Javadoc of the according provider classes mentioned above or here:
/**
* An implementor of this interface can provide default preferences for one moduleId and
* multiple preferenceIds scoped by the moduleId.<br>
* <br>
* To publish an implementor to the engine a file named by the interface's factory has to be created in
* the '/META-INF/services' folder of the jar.<br>
* In this case: org.eclipse.stardust.engine.core.spi.preferences.IStaticConfigurationProvider$Factory<br>
* This file needs to contain the qualified class name of the implementor of the factory interface.<br>
* <br>
* This pattern follows the concept of the JDK6 ServiceLoader
*
*/
public interface IStaticConfigurationProvider
{
/**
* @return the moduleId which the static preferences are provided for.
*/
String getModuleId();
/**
* @return the preferenceIds for which the static configuration provider provides preferences for.
*/
List/*<String>*/ getPreferenceIds();
/**
* @param preferencesId the preferencesId to lookup default preferences for.
* @return a map containing default preferences for the specified preferencesId.
*/
Map/*<String, Serializable>*/ getPreferenceDefaults(String preferencesId);
/**
* The factory interface for IStaticConfigurationProvider
*/
interface Factory
{
IStaticConfigurationProvider getProvider();
}
}