Jump to: navigation, search

Org.eclipse.higgins.configuration.xml

{{#eclipseproject:technology.higgins|eclipse_custom_style.css}} This project implements a configuration handler that processes an XML file. Each setting is represented by name, type, and value. A list of SettingHandlers is provided, which maps type names to the classes that know how to process that value type.

Details

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

Plans

Service

Setting Handlers

A list of types and the setting handler classes that support them:

  • boolean -- BooleanHandler
  • context factory -- ContextFactoryHandler
  • file -- FileHandler
  • IdAS -- IdentityAttributeServiceHandler
  • instance of IConfigurableComponent -- InstanceHandler
  • keystore -- KeyStoreHandler
  • list -- ListHandler
  • map -- MapHandler
  • private key -- PrivateKeyHandler
  • singleton instance of IConfigurableComponent -- SingletonHandler
  • string -- StringHandler
  • uri -- URIHandler
  • X.509 certificate -- CertificateHandler

Configuration File Structure

The structure of the configuration file is as follows:

<Configuration ...>
  <SettingHandlers> ... </SettingHandlers>
  <Setting Name="..." Type="htf:map"> ... </Setting>
</Configuration>

The outer element can be anything you like.

There must be a "SettingHandlers" element, which is a list of SettingHandler elements. Each SettingHandler element has three attributes: type, class, and handler. The class name indicates what kind of object that will be created when an setting with the given type string is processed. The handler class tells the class that is responsible for reading the setting element value and creating the corresponding object.

<SettingHandlers>
  <SettingHandler Type="htf:map" Class="java.util.Map" Handler="org.eclipse.higgins.configuration.xml.MapHandler">
  <SettingHandler Type="xsd:string" Class="java.lang.String" Handler="org.eclipse.higgins.configuration.xml.StringHandler">
  ...
</SettingHandlers>

Each setting must specify its name and type attributes. The value of the element depends on the type. For example, a map or list will have multiple setting elements as its value. A string, on the other hand, will simply contain a string as its value.

Some examples:

<Setting Name="TokenServiceIssuerURI" Type="xsd:anyURI">https://localhost/TokenService/services/Trust</Setting>
<Setting Name="STSKeyStore" Type="htf:keystore">
   <!-- The type of the Key Store -->
   <Setting Name="Type" Type="xsd:string">JKS</Setting>
   <!-- The file that contains the Key Store
	- location relative to the Configuration directory -->
   <Setting Name="File" Type="htf:file">localhost.jks</Setting>
   <!-- The password for the Key Store -->
   <Setting Name="Password" Type="xsd:string">changeit</Setting>
</Setting>

As each setting is processed, it is given the map of settings that already exist. Therefore, one setting can use a setting that was defined earlier in the file. (For example, a certificate or private key might need to refer to the key store that was set in the example above.)

A map setting named "ComponentSettings" is used to hold values needed for particular components that are instantiated by this configuration file. For each "instance" or "singleton", there should be a setting (of type map) in "ComponentSettings" with the same name. This map is passed to the IConfigurableComponent's configure method in the mapComponentSettings parameter.



See Also

Links