Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.ensembl.registry
Class RegistryLoaderIni

    java.lang.Object
      org.ensembl.registry.RegistryLoaderIni

All Implemented Interfaces:
  RegistryLoader

public class RegistryLoaderIni
extends java.lang.Object
implements RegistryLoader

Loads a registry with DriverGroups defined in "ini" style configuration files. The loader understands ".ini" style configuration files which define blocks that contain key-value pairs. The blocks define either default values or DriverGroups. For example:

            # default values that will be used by all subsequent groups unless they are overriden.
            [default]
            host localhost
            port 6000
            user anonymous
            connection_pool_size 4
            type species

            [ensembl_compara]
            aliases compara
            type compara

            # define a 'homo_sapiens' species group
            [homo_sapiens]
            aliases human
            ensembl_prefix ENS

            [cat]
            database_prefix tmp_cat_db

            [kangaroo]
            core.database kanga_core
            variation.database kanga_variation

            # define a rat group that only has a core database but no variation database
            [rat]
            core.host ensembldb.ensembl.org
            core.user anonymous
            core.database_prefix rattus_norvegicus_core
            user bob
            password bobspassword

Description:

- [block] - if block is "default" then the following properties are used as default values in the following groups. If block is not "default" then it defines a group which should be accessable from the registry. This example defines the groups ensembl_compara, homo_sapiens, cat, kangaroo and rat.
- type - type of driver group, should be "species" or "compara". Default is "species" if property is ommitted.
- aliases - list names, separated by white spaces, that can be passed to `getDriverGroup(String)` to retrieve a DriverGroup. In the example above we can use both "homo_sapiens" and "human" to retrieve the homo_sapiens group.
- host,port,user,connection_pool_size - values used to specify a database.
- database_prefix - the prefix used to match the database. If this isn't specified the group name is used instead.
- core.database_prefix, variation.database_prefix - database name prefixes for the specified EnsemblDrivers. The highest versioned database name matching the prefixes will be used by the respective driver.
- core.database, variation.database - specific database names to use for the driver.
- ensembl_prefix - this is the Ensembl stable id prefix for the species
- schema_version - specifies the version of the schema the database is stored in. This is not needed for released ensembl databases as the version can be determined from the database name. However, if you use ensj with a database that does not follow the ensembl database naming convention of SPECIES_SCHEMA-VERSION_RELEASE you must tell ensj which schema version it is.

Author:
  Craig Melsopp

Constructor Summary
`RegistryLoaderIni(byte[] config, java.lang.String configDescription)` Loads DriverGroups for configuration stored in byte array.
`RegistryLoaderIni(java.io.InputStream config, java.lang.String configDescription)` Loads DriverGroups for configuration defined in _srcConfig_.
`RegistryLoaderIni(java.lang.String url)` Loads DriverGroups for configuration at _url_.
`RegistryLoaderIni(java.lang.String[] urls, ServerDriverFactory serverDriverFactory, boolean includeDefaultGroups)` Load driver groups defined in the _urls_.
`RegistryLoaderIni(java.lang.String url, ServerDriverFactory serverDriverFactory)` Loads DriverGroups for configuration at _url_ Providing a serverDriverFactory that is used in other parts of your code can lead to faster performance as the caches only need to be populated once.
`RegistryLoaderIni(java.net.URL url)` Loads DriverGroups defined in the configuration file _url_.

Method Summary
`void` | `load(Registry registry)` Adds a copy of all loaded DriverGroups keyed on name and alias to the _registry_.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### RegistryLoaderIni

    public RegistryLoaderIni(java.io.InputStream config,
                             java.lang.String configDescription)
                      throws ConfigurationException,
                             java.io.IOException

  Loads DriverGroups for configuration defined in _srcConfig_.

Parameters:
  `config` - configuration.
  `configDescription` - description of configuration.
Throws:
  `ConfigurationException`
  `java.io.IOException`

### RegistryLoaderIni

    public RegistryLoaderIni(byte[] config,
                             java.lang.String configDescription)
                      throws ConfigurationException,
                             java.io.IOException

  Loads DriverGroups for configuration stored in byte array. This can be used for loading configuration values from a a String like this: `new RegistryLoaderIni(string.getBytes(), "my config")`.

Parameters:
  `config` - configuration as byte array.
  `configDescription` - description of configuration.
Throws:
  `ConfigurationException`
  `java.io.IOException`

### RegistryLoaderIni

    public RegistryLoaderIni(java.lang.String url,
                             ServerDriverFactory serverDriverFactory)
                      throws java.io.IOException

  Loads DriverGroups for configuration at _url_ Providing a serverDriverFactory that is used in other parts of your code can lead to faster performance as the caches only need to be populated once.

Parameters:
  `url` - url of configuration file.
  `serverDriverFactory` - serverDriver factory.
Throws:
  `java.io.IOException`

### RegistryLoaderIni

    public RegistryLoaderIni(java.lang.String[] urls,
                             ServerDriverFactory serverDriverFactory,
                             boolean includeDefaultGroups)
                      throws java.io.IOException

  Load driver groups defined in the _urls_.

  The configuration files are concatenated in the order they are provided and the optional default groups will be appended at the end if included.

  Providing a serverDriverFactory that is used in other parts of your code can lead to faster performance as the caches only need to be populated once and connection pooling may be possible between drivers.

  One use case for this method is to automatically load all the groups defined on a database server (based on ensembl database naming conventions). To do this:

  1. Create a configuration file such as "myconfig.ini" that defines the server parameters and any other 'default' parameters for the drivers. e.g.

                 [default]
                 host localhost
                 port 6000
                 user anonymous
                 connection_pool_size 4
                 type species

  2. Use this constructor `new RegistryLoaderIni(new String[]{"myconfig.ini"}, aServerDriverFactory, true)`

Parameters:
  `urls` - urls of (possibly partial) configuration files.
  `serverDriverFactory` - factory of ServerDrivers.
  `includeDefaultGroups` - whether to include default groups in addition to any defined in the _urls_.
Throws:
  `java.io.IOException`

### RegistryLoaderIni

    public RegistryLoaderIni(java.lang.String url)
                      throws java.io.IOException

  Loads DriverGroups for configuration at _url_.

Parameters:
  `url` - url of configuration file.
Throws:
  `java.io.IOException`

### RegistryLoaderIni

    public RegistryLoaderIni(java.net.URL url)
                      throws java.io.IOException

  Loads DriverGroups defined in the configuration file _url_.

Parameters:
  `url` - url of configuration file.

Method Detail

### load

    public void load(Registry registry)

  Adds a copy of all loaded DriverGroups keyed on name and alias to the _registry_.

  Specified by:
    `load` in interface `RegistryLoader`
  Parameters:
    `registry` - registry to load DriverGroups into.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD