Starmapper Site : UnifiedConfigurationModel

HomePage :: Categories :: PageIndex :: RecentChanges :: RecentlyCommented :: Login/Register

Unified Configuration Model

Before Starmapper can do anything, it needs to be told what to do. That's what the command line and configuration files are for. Each config file contains description of one drawing session, with information such as location of files to read, output image size and format, the Plotter to use, and so on (strictly speaking the file is just a persistent version of parameters passed from command line, but I'll get to it). Then Starmapper needs to read this file and start processing. But since Starmapper is just a library, handling of config files is not really in scope; previous versions delegated this work to applications, which were supposed to collect the data and give it to Starmapper. This resulted in much duplication and differences between each application's format (well, not really, but the duplication was bad anyway).

So that's why Starmapper3 switched to so-called Unified Configuration Model. It consists of two things:

The properties form a hierarchy and each property is accessible via a path, for example regions.reg1.name - the path is usually given in dotted notation, where the leftmost part is the topmost (most general) in the hierarchy, but that's purely for human convenience; see javadocs for Config class for details how it's handled internally - the only thing you need to know is that there's a hierarchy, unless you want programmatic access to the configuration API.

There's no common interface for formats - each format class needs to have a public constructor that takes a String (the config's location) and implement Iterable<Pair<Path, String>>, which returns an Iterator of pairs of path-in-hierarchy and value (in textual form, the conversions - and validations - are done later). There needs to be one item returned from the Iterator per configuration property (in any order). Most of the formats perform direct, or almost direct, mapping, so the implementation is really easy.

For particular formats the mappings are as follows:

One warning, though: the values are converted to proper type and validated, but the system is assumed to be extensible, so it doesn't complain if you set a value for a property that Starmapper doesn't use (should it?...).

The command line and stuff

The command line (of starmapper-app-cli) also is part of the Unified Configuration Model. The values given from command line overwrite values read from a config file (which in turn overwrite defaults). Each property is set by passing the path in dotted notation prefixed with minus sign and followed by the value, e.g. -regions.reg1.name Elezi. All such "switches" should be given before the config file's name (not after, because first non-switch argument is taken as a file name and all arguments that follow are region numbers).

Config values

The list of config values/paths recognized by Starmapper is documented in javadocs for Config class (look for public static fields named SET_*). The list, along with additional settings from various components, is repeated on AvailableSettings page.

There are no comments on this page. [Add comment]

Valid XHTML 1.0 Transitional :: Valid CSS :: Powered by Wikka Wakka Wiki 1.1.6.3
SourceForge.net Logo
Page was generated in 0.5438 seconds