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 Registry

    java.lang.Object
      org.ensembl.registry.Registry

public class Registry
extends java.lang.Object

A Registry provide convenient programatic access to multiple ensembl databases through DriverGroups.

Accessing ensembldb.ensembl.org.

A default registry providing access to the latest databases on ensembldb.ensembl.org can be created by `Registry.createDefaultDriver()`. This example shows how to access the latest human and compara databases on that database:

     Registry r = Registry.createDefaultDriver();

     DriverGroup human = r.getGroupDriver("human");

       CoreDriver humanCore = human.getCoreDriver();
       Iterator genesIter = humanCore.getGeneAdaptor().fetchIterator(new Location("chromosome:10"));

       VariationDriver humanVar = human.getVariationDriver();
       Iterator vfIter = humanVar.getVariationFeatureAdaptor().fetchIterator(new Location("chromosome:10"));

       ComparaDriver compara = r.getDriverGroup("compara").getComparaDriver();
       List dnaDnaAlignFeatures = compara.getDnaDnaAlignFeatureAdaptor().fetch(
       "Homo sapiens", new Location("chromosome:1:1000000-1200000:0"),
       "Mus musculus", "BLASTZ_NET");

Default user registry

Databases added to the default user registry file are automatically available via the default user registry. For example `Registry.createDefaultUserRegistry().getGroup("some_group")` retrieves the "some_group" DriverGroup defined in the config file. See createDefaultUserRegistry(), getDefaultUserRegistryURL() and isDefaultUserRegistryAvailable() for more information.

Adding registries

Users can create additional Registry instances by using registry loaders. For example `new Registry(new RegistryLoaderIni("my_config.ini"))`.

Author:
  Craig Melsopp
See Also:
  `DriverGroup`, `RegistryLoaderIni`

Constructor Summary
`Registry()` Create an empty registry.
`Registry(RegistryLoader loader)` Create a registry with DriverGroups loaded from loader.

Method Summary
`void` | `add(RegistryLoader loader)` Add the DriverGroups from the loader.
`DriverGroup` | `add(java.lang.String name, DriverGroup group)` Adds the named group to the registry.
`void` | `clear()` Removes all name to DriverGroup mappings.
`void` | `closeAllConnections()` Close all the connections on all driver groups.
`static Registry` | `createDefaultRegistry()` Create a registry pointing at the latest databases on ensembldb.ensembl.org.
`static Registry` | `createDefaultUserRegistry()` Create a registry from the default user registry file returned by getDefaultUserRegistryFile().
`static java.lang.String[]` | `getDefaultRegistryURLs()` Returns the URLs of the configuration files used to initialise the default registry.
`static java.lang.String` | `getDefaultUserRegistryURL()` Returns the URL of the default user registry file.
`DriverGroup` | `getGroup(java.lang.String name)` Returns the specified DriverGroup.
`java.lang.String[]` | `getGroupNames()` Returns the names for all MetaDrivers.
`java.util.List` | `getGroups()` Returns all GroupDrivers.
`static boolean` | `isDefaultUserRegistryAvailable()` Convenience method that checks whether the default user registry is available.
`DriverGroup` | `remove(java.lang.String name)` Removes the mapping from _name_ to it's associated DriverGroup.
`java.lang.String` | `toString()`

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

Constructor Detail

### Registry

    public Registry()

  Create an empty registry.

### Registry

    public Registry(RegistryLoader loader)

  Create a registry with DriverGroups loaded from loader.

Method Detail

### createDefaultRegistry

    public static Registry createDefaultRegistry()
                                          throws AdaptorException

  Create a registry pointing at the latest databases on ensembldb.ensembl.org. It is possible to disable/override the configuration. See getDefaultRegistry() for more information.

  Returns:
    registry pointing at the latest databases on ensembldb.ensembl.org.
  Throws:
    `java.io.IOException`
    `AdaptorException`
  See Also:
    `getDefaultRegistryURLs()`

### createDefaultUserRegistry

    public static Registry createDefaultUserRegistry()
                                              throws AdaptorException

  Create a registry from the default user registry file returned by getDefaultUserRegistryFile(). See RegistryLoaderIni for information on the file format.

  Returns:
    registry pointing at the latest databases on ensembldb.ensembl.org.
  Throws:
    `AdaptorException`
    `java.io.IOException`
  See Also:
    `RegistryLoaderIni`, `getDefaultUserRegistryURL()`

### getDefaultRegistryURLs

    public static java.lang.String[] getDefaultRegistryURLs()
                                                     throws java.net.MalformedURLException

  Returns the URLs of the configuration files used to initialise the default registry. The normal registry config files are "resources/data/default_registry_server.ini" and "resources/data/default_registry_groups.ini" which are found on the classpath (usually in ensj.jar). These can be overridden by a user created file USER_HOME_DIRECTORY/.ensembl/user_registry.ini. Although this is generally not necessary (you should use the default user registry to configure access to your own databases) one case where it is useful is if you have trouble connecting to ensembldb.ensembl.org (e.g.due to access/firewall restrictions) and your program does so automatically. In this case you can 'disable' access by creating an empty USER_HOME_DIRECTORY/.ensembl/user_registry.ini file or one that defines groups on another database server.

  Returns:
    urls of the configuration files that will be used initialise the default registry.
  Throws:
    `java.net.MalformedURLException`

### getDefaultUserRegistryURL

    public static java.lang.String getDefaultUserRegistryURL()
                                                      throws java.net.MalformedURLException

  Returns the URL of the default user registry file. By default this is "file:USER_HOME_DIRECTORY_PATH/.ensembl/user_registry.ini" but this can be overridden by specifying an alternative URL via the JVM parameter USER_REGISTRY_URL. e.g. `java -DUSER_REGISTRY_URL=file:/tmp/my_registry.ini MyProgram`.

  Returns:
    URL of the default user registry file.
  Throws:
    `java.net.MalformedURLException`

### isDefaultUserRegistryAvailable

    public static boolean isDefaultUserRegistryAvailable()

  Convenience method that checks whether the default user registry is available.

  Returns:
    true if the URL returned by getDefaultUserRegistryURL() can be opened, otherwise false.
  See Also:
    `getDefaultUserRegistryURL()`

### getGroup

    public DriverGroup getGroup(java.lang.String name)
                         throws ConfigurationException

  Returns the specified DriverGroup.

  Parameters:
    `name` - group name or alias for a DriverGroup.
  Returns:
    specified DriverGroup, or null if none available.
  Throws:
    `ConfigurationException`

### getGroups

    public java.util.List getGroups()
                             throws ConfigurationException

  Returns all GroupDrivers. Note that it is possible to have more groupNames than groups (getGroups().size()
  Returns:
    all (zero or more) GroupDrivers.
  Throws:
    `ConfigurationException`

### toString

    public java.lang.String toString()

### getGroupNames

    public java.lang.String[] getGroupNames()

  Returns the names for all MetaDrivers.

  Returns:
    zero or more MetaDriverNames.

### closeAllConnections

    public void closeAllConnections()
                             throws AdaptorException

  Close all the connections on all driver groups.

  Throws:
    `AdaptorException`

### add

    public DriverGroup add(java.lang.String name,
                           DriverGroup group)

  Adds the named group to the registry.

  Parameters:
    `name` - name of group.
    `group` - group.
  Returns:
    previous DriverGroup associatted with _name_, can be null.

### add

    public void add(RegistryLoader loader)

  Add the DriverGroups from the loader.

  Parameters:
    `loader` - RegistryLoader providing zero or more DriverGroups.

### remove

    public DriverGroup remove(java.lang.String name)

  Removes the mapping from _name_ to it's associated DriverGroup.

  Parameters:
    `name` - name of the DriverGroup.
  Returns:
    DriverGroup removed, or null if nothing was associated with the name.

### clear

    public void clear()

  Removes all name to DriverGroup mappings.

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