Jump to: navigation, search

Org.eclipse.higgins.configuration.api

This project defines interfaces used to enable a common configuration mechanism for Higgins components and subcomponents. The intent is to separate the act of configuration from the representation of configuration information (e.g., XML file, properties file, code, etc.), and to provide a programmatic way to configure each component.

All interfaces are in the org.eclipse.higgins.configuration.api package.

Details

  • Status: Available M0.8
  • Language: Java
  • Packaging: JAR

Backlog

  • Add methods to save configuration data (M0.9?)

Service

Responsibilities

  • Defines interfaces for configurable components and factories


IConfigurableComponent

A component that wants to be configured implements the IConfigurableComponent interface. This provides a single configure method that accepts map objects that contain configuration settings, represented as name/value pairs. The map provides a way to lookup the name of a setting and return its value. (The type of the value is not explicitly represented.)

public interface IConfigurableComponent
{
   public abstract void configure(final java.util.Map mapGlobalSettings,
                                 final String strComponentName,
                                 final java.util.Map mapComponentSettings)
                        throws Exception;
}

The two maps are used to represent general and component-specific settings, respectively. The strComponentName is simply an identifying string that may or may not be used by the component. The component is not required to remember settings.

TBD: Need more about the semantics. Does it matter whether component has already be configured? Should we advise that configure method should be synchronized?

IConfigurableComponentFactory

Factory classes must be able to create singleton and non-singleton instances of components.

public interface IConfigurableComponentFactory
{
   public abstract IConfigurableComponent getSingletonInstance();
   public abstract IConfigurableComponent getNewInstance();
}

IConfigurationHandler

This interface is for classes that fetch and/or create settings to to be passed to an IConfigurableComponent.

public interface IConfigurationHandler {
   public abstract void setConfigurationBase(String str);
   public abstract boolean configure(java.util.Map mapConfigurationSettings)
		           throws Exception;
   public abstract java.util.Map getSettings() 
                                 throws Exception;
}

The first method provides a way to set a directory path for finding configuration files.

The second is the method that causes the handler to acquire settings and create a map. This method returns a boolean to indicate whether the configuration settings were succesfully read/created.

The third method retrieves the created settings map.