Next: Cinema-MX Modules Up: XML Loading and Configuration Previous: Loading

##
Configuration

As well as loading modules its also possible to configure them. At the current time, the configuration can come in one of two forms, which are a properties list, or a tree structure. For example in Listing 8 the configuration which is used for input module, is shown. It defines ``parsers'' which are used to output sequence data. This configurability means that it's to possible to add new ``parsers'' (perhaps inappropriately named as they are used for both input and output of sequences) Cinema-MX, by altering the configuration for this module.

    [label=lst:props, caption=Configuring Parsers]
    <properties>
      <paramname>PIR</paramname>
        <value>uk.ac.man.bioinf.io.parsers.PIRProteinAlignmentParser</value>
      </param>
      <param>
        <paramname>MOT</paramname>
        <value>uk.ac.man.bioinf.io.parsers.MotProteinParser</value>
      </param>
    </properties>

The second type of configuration is a simple tree structure, which can be seen in Listing 9. In this case the menu system is being configured. In this case most of the configuration has been elided. Generally speaking the properties configuration is to be preferred because its much simpler, but the tree structure is much more versatile, and means that tricks, such as providing additional semantics to the keys of the properties lists are not necessary.

    [language=HTML, caption=Configuring the menu system, label=lst:trees]
    <tree>
      <!- The File Menu ->
      <node>
        <value>File</value>
        <node>
          <!- Provides the open alignment ->
          <name>SEQ_INPUT</name>
        </node>
        <node>
          <!- Provides the save alignment ->
          <name>SEQ_OUTPUT</name>
        </node>
        <node>
          <!- Provides the exit menu ->
          <name>CINEMA_CORE_GUI</name>
        </node>
      </node>
    </tree>

In order for the modules to access this configuration two methods (see Listing 10) are provided by the `XMLModule` class which all the Cinema-MX modules extend from. The standard Java `Properties` class has been used here. Sadly Java does not provide a standard Tree class, so a simple one has been provided.

    [label=lst:config, caption=The XML methods]
    public Properties getConfigProperties();
    public ConfigNode getConfigTree();

Next: Cinema-MX Modules Up: XML Loading and Configuration Previous: Loading