Package psidev.psi.mi.jami.commons
Class MIDataSourceOptionFactory
- java.lang.Object
-
- psidev.psi.mi.jami.commons.MIDataSourceOptionFactory
-
public class MIDataSourceOptionFactory extends Object
The factory to populate the map of options for the DataSourceFactory- Since:
03/07/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 Map<String,Object>
getDefaultFileOptions(MIFileType sourceType, Object inputData)
Create a map of default options depending on the provided sourceType.Map<String,Object>
getDefaultMitabOptions(Object inputData)
Create the default options for the MITAB datasource.Map<String,Object>
getDefaultOptions(File file)
Create a map with the default options to retrieve the default MI datasource that will read the file content.Map<String,Object>
getDefaultOptions(InputStream streamToAnalyse)
Create a map with the default options to retrieve the default MI datasource that will read the inputstream content.Map<String,Object>
getDefaultOptions(Reader readerToAnalyze)
Create a map with the default options to retrieve the default MI datasource that will read the reader content.Map<String,Object>
getDefaultOptions(URL url)
Creates a map with the default options to retrieve MI datasource that will read the URL contentMap<String,Object>
getDefaultXmlOptions(Object inputData)
Create the default options for the Psi-XML 2.5 datasource.static MIDataSourceOptionFactory
getInstance()
Getter for the fieldinstance
.Map<String,Object>
getMitabOptions(boolean streaming, Object inputData)
Create the options for the MITAB datasource and specify if we want a Streaming MIFileDatasource.Map<String,Object>
getMitabOptions(MIFileParserListener listener, Object inputData)
Create the options for the MITAB datasource using the provided MIFileParserListener.Map<String,Object>
getMitabOptions(InteractionCategory objectCategory, ComplexType complexType, boolean streaming, MIFileParserListener listener, Object input)
Create the options for the MITAB datasource.Map<String,Object>
getMitabOptions(InteractionCategory objectCategory, ComplexType complexType, Object inputData)
Create the options for the MITAB datasource using the provided objectCategory.Map<String,Object>
getOptions(MIFileType type, InteractionCategory objectCategory, ComplexType complexType, boolean streaming, MIFileParserListener listener, Object input)
Create a map of optionsMap<String,Object>
getXmlOptions(boolean streaming, Object inputData)
Create the options for the PSI-XML datasource and specify if we want a Streaming MIFileDatasource.Map<String,Object>
getXmlOptions(MIFileParserListener listener, Object inputData)
Create the options for the Psi-XML datasource using the provided MIFileParserListener.Map<String,Object>
getXmlOptions(InteractionCategory objectCategory, ComplexType complexType, boolean streaming, MIFileParserListener listener, Object input, ComplexExpansionMethod expansionMethod, PsiXmlIdCache objectCache)
Create the options for the PSI-XML datasource.Map<String,Object>
getXmlOptions(InteractionCategory objectCategory, ComplexType complexType, Object inputData)
Create the options for the Psi-XML datasource using the provided objectCategory.
-
-
-
Method Detail
-
getInstance
public static MIDataSourceOptionFactory getInstance()
Getter for the field
instance
.- Returns:
- a
MIDataSourceOptionFactory
object.
-
getDefaultOptions
public Map<String,Object> getDefaultOptions(File file) throws IOException
Create a map with the default options to retrieve the default MI datasource that will read the file content.- Parameters:
file
- aFile
object.- Returns:
- the default options for the MI datasource corresponding to this file
- Throws:
IOException
- if any.
-
getDefaultOptions
public Map<String,Object> getDefaultOptions(URL url) throws IOException
Creates a map with the default options to retrieve MI datasource that will read the URL content- Parameters:
url
- aURL
object.- Returns:
- the default options for the MI datasource corresponding to this url
- Throws:
IOException
- if any.
-
getDefaultOptions
public Map<String,Object> getDefaultOptions(InputStream streamToAnalyse) throws IOException
Create a map with the default options to retrieve the default MI datasource that will read the inputstream content.- Parameters:
streamToAnalyse
- : stream to be used to analyze the MIFileType- Returns:
- the default options for the MI datasource corresponding to this source inputstream
- Throws:
IOException
- if any.
-
getDefaultOptions
public Map<String,Object> getDefaultOptions(Reader readerToAnalyze) throws IOException
Create a map with the default options to retrieve the default MI datasource that will read the reader content.- Parameters:
readerToAnalyze
- : reader to be used to analyze the MIFileType- Returns:
- the default options for the MI datasource corresponding to this source reader
- Throws:
IOException
- if any.
-
getDefaultFileOptions
public Map<String,Object> getDefaultFileOptions(MIFileType sourceType, Object inputData)
Create a map of default options depending on the provided sourceType. It can recognize mitab, psi-xml and other- Parameters:
sourceType
- aMIFileType
object.inputData
- aObject
object.- Returns:
- the map of default options for this sourceType
-
getDefaultMitabOptions
public Map<String,Object> getDefaultMitabOptions(Object inputData)
Create the default options for the MITAB datasource. It will read InteractionEvidence elements in a streaming way. It will use the MitabParserLogger to listen to the MITAB parsing events- Parameters:
inputData
- aObject
object.- Returns:
- the default options for the MITAB datasource
-
getMitabOptions
public Map<String,Object> getMitabOptions(InteractionCategory objectCategory, ComplexType complexType, Object inputData)
Create the options for the MITAB datasource using the provided objectCategory. It will read elements from this objectCategory in a streaming way. It will use the MitabParserLogger to listen to the MITAB parsing events- Parameters:
objectCategory
- aInteractionCategory
object.complexType
- : the kind of complex : n-ary or binaryinputData
- aObject
object.- Returns:
- the options for the MITAB datasource using the provided objectCategory
-
getMitabOptions
public Map<String,Object> getMitabOptions(boolean streaming, Object inputData)
Create the options for the MITAB datasource and specify if we want a Streaming MIFileDatasource. It will read InteractionEvidence elements. It will use the MitabParserLogger to listen to the MITAB parsing events- Parameters:
streaming
- : tru if we want to read the interactions in a streaming wayinputData
- aObject
object.- Returns:
- the options for the MITAB datasource and specify if we want a Streaming MIFileDatasource
-
getMitabOptions
public Map<String,Object> getMitabOptions(MIFileParserListener listener, Object inputData)
Create the options for the MITAB datasource using the provided MIFileParserListener. It will read InteractionEvidence elements in a streaming way.- Parameters:
listener
- aMIFileParserListener
object.inputData
- is the mitab data to read- Returns:
- the options for the MITAB datasource with the provided listener
-
getMitabOptions
public Map<String,Object> getMitabOptions(InteractionCategory objectCategory, ComplexType complexType, boolean streaming, MIFileParserListener listener, Object input)
Create the options for the MITAB datasource.- Parameters:
objectCategory
- : interaction object type to loadcomplexType
- : the kind of complex : n-ary or binarystreaming
- : true if we want to load interactions in a streaming waylistener
- : the listener to use for listening MITAB parsing eventsinput
- aObject
object.- Returns:
- the MITAB datasource options
-
getDefaultXmlOptions
public Map<String,Object> getDefaultXmlOptions(Object inputData)
Create the default options for the Psi-XML 2.5 datasource. It will read InteractionEvidence elements in a streaming way. It will use the PsiXmlParserLogger to listen to the Psi-XML parsing events It will keep the parsed objects having an id in memory.- Parameters:
inputData
- aObject
object.- Returns:
- the default options for the PSI-xml 2.5 datasource
-
getXmlOptions
public Map<String,Object> getXmlOptions(InteractionCategory objectCategory, ComplexType complexType, Object inputData)
Create the options for the Psi-XML datasource using the provided objectCategory. It will read elements from this objectCategory in a streaming way. It will use the PsiXmlParserLogger to listen to the Psi=XML parsing events It will keep the parsed objects having an id in memory.- Parameters:
objectCategory
- aInteractionCategory
object.complexType
- : the kind of complex : n-ary or binaryinputData
- aObject
object.- Returns:
- the options for the Psi Xml datasource using the provided objectCategory
-
getXmlOptions
public Map<String,Object> getXmlOptions(boolean streaming, Object inputData)
Create the options for the PSI-XML datasource and specify if we want a Streaming MIFileDatasource. It will read InteractionEvidence elements. It will use the PsiXmlParserLogger to listen to the PSI-XML parsing events It will keep the parsed objects having an id in memory.- Parameters:
streaming
- : tru if we want to read the interactions in a streaming wayinputData
- aObject
object.- Returns:
- the options for the PSI-XML datasource and specify if we want a Streaming MIFileDatasource
-
getXmlOptions
public Map<String,Object> getXmlOptions(MIFileParserListener listener, Object inputData)
Create the options for the Psi-XML datasource using the provided MIFileParserListener. It will read InteractionEvidence elements in a streaming way. It will keep the parsed objects having an id in memory.- Parameters:
listener
- aMIFileParserListener
object.inputData
- is the mitab data to read- Returns:
- the options for the PSI-XML datasource with the provided listener
-
getXmlOptions
public Map<String,Object> getXmlOptions(InteractionCategory objectCategory, ComplexType complexType, boolean streaming, MIFileParserListener listener, Object input, ComplexExpansionMethod expansionMethod, PsiXmlIdCache objectCache)
Create the options for the PSI-XML datasource.- Parameters:
objectCategory
- : interaction object type to loadcomplexType
- : the kind of complex : n-ary or binarystreaming
- : true if we want to load interactions in a streaming waylistener
- : the listener to use for listening XML parsing eventsinput
- : the MI source containing dataexpansionMethod
- : the complex expansion methodobjectCache
- : cache for parsed objects having an id- Returns:
- the Xml 2.5 datasource options
-
getOptions
public Map<String,Object> getOptions(MIFileType type, InteractionCategory objectCategory, ComplexType complexType, boolean streaming, MIFileParserListener listener, Object input)
Create a map of options- Parameters:
type
- : MI source type (mitab, xml25, etc.)objectCategory
- : the kind of interactions to be returned by the datasource (interaction evidence, binary, modelled interaction, ...)complexType
- : the kind of complex : n-ary or binarystreaming
- : boolean value to know if we want to stream the interactions or load the full interaction datasetlistener
- : parser listenerinput
- : the MI source containing data- Returns:
- the map of options
-
-