Package psidev.psi.mi.jami.factory
Class MIDataSourceFactory
- java.lang.Object
-
- psidev.psi.mi.jami.factory.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 Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clearRegisteredDataSources()
Clear all the registered datasources from this factorystatic MIDataSourceFactory
getInstance()
Getter for the fieldinstance
.<I extends Interaction>
InteractionStream<I>getInteractionSourceWith(Map<String,Object> requiredOptions)
getInteractionSourceWithMIDataSource
getMIDataSourceWith(Map<String,Object> requiredOptions)
getMIDataSourceWithvoid
registerDataSource(Class<? extends MIDataSource> dataSourceClass, Map<String,Object> supportedOptions)
Register a datasource with options in this factoryvoid
removeDataSource(Class<? extends MIDataSource> dataSourceClass)
Remove the dataSource from this factory
-
-
-
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 Interaction> InteractionStream<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 constructorsupportedOptions
- : 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
-
-