Class 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 Detail

      • 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 - a File 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 - a URL 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 - a MIFileType object.
        inputData - a Object 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 - a Object 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 - a InteractionCategory object.
        complexType - : the kind of complex : n-ary or binary
        inputData - a Object 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 way
        inputData - a Object 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 - a MIFileParserListener 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 load
        complexType - : the kind of complex : n-ary or binary
        streaming - : true if we want to load interactions in a streaming way
        listener - : the listener to use for listening MITAB parsing events
        input - a Object 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 - a Object 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 - a InteractionCategory object.
        complexType - : the kind of complex : n-ary or binary
        inputData - a Object 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 way
        inputData - a Object 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 - a MIFileParserListener 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 load
        complexType - : the kind of complex : n-ary or binary
        streaming - : true if we want to load interactions in a streaming way
        listener - : the listener to use for listening XML parsing events
        input - : the MI source containing data
        expansionMethod - : the complex expansion method
        objectCache - : 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 binary
        streaming - : boolean value to know if we want to stream the interactions or load the full interaction dataset
        listener - : parser listener
        input - : the MI source containing data
        Returns:
        the map of options