Class MIDataSourceFactory


  • public class MIDataSourceFactory
    extends Object
    A factory singleton to create data sources. The datasource have to be registered first and then the factory can create the proper datasource depending on the options
    Since:
    01/03/13
    Version:
    $Id$
    Author:
    Marine Dumousseau (marine@ebi.ac.uk)
    • Method Detail

      • getInstance

        public static MIDataSourceFactory getInstance()

        Getter for the field instance.

        Returns:
        the MIFactory instance
      • getMIDataSourceWith

        public MIDataSource getMIDataSourceWith​(Map<String,​Object> requiredOptions)

        getMIDataSourceWith

        Parameters:
        requiredOptions - : options needed and to initialise dataSource
        Returns:
        a new MIDatasource instance if the factory could find a registered MIDataSource matching the options. Null if the factory cannot provide any MIDataSource implementation matching the requested options
      • getInteractionSourceWith

        public <I extends InteractionInteractionStream<I> getInteractionSourceWith​(Map<String,​Object> requiredOptions)

        getInteractionSourceWith

        Type Parameters:
        I - a I object.
        Parameters:
        requiredOptions - : options needed and to initialise dataSource
        Returns:
        a new InteractionStream instance if the factory could find a registered InteractionStream matching the options. Null if the factory cannot provide any InteractionStream implementation matching the requested options
      • registerDataSource

        public void registerDataSource​(Class<? extends MIDataSource> dataSourceClass,
                                       Map<String,​Object> supportedOptions)
        Register a datasource with options in this factory
        Parameters:
        dataSourceClass - : the class of the dataSource to register. It must provide a empty constructor
        supportedOptions - : the map of options supported by this dataSource
      • removeDataSource

        public void removeDataSource​(Class<? extends MIDataSource> dataSourceClass)
        Remove the dataSource from this factory
        Parameters:
        dataSourceClass - : registered dataSource class
      • clearRegisteredDataSources

        public void clearRegisteredDataSources()
        Clear all the registered datasources from this factory