Class FailingGeneFetcher
- java.lang.Object
-
- psidev.psi.mi.jami.bridges.fetcher.mock.AbstractMockFetcher<T>
-
- psidev.psi.mi.jami.bridges.fetcher.mock.AbstractFailingFetcher<Collection<Gene>>
-
- psidev.psi.mi.jami.bridges.fetcher.mock.FailingGeneFetcher
-
- All Implemented Interfaces:
GeneFetcher
,InteractorFetcher<Gene>
,MockFetcher<Collection<Gene>>
public class FailingGeneFetcher extends AbstractFailingFetcher<Collection<Gene>> implements GeneFetcher
A mock fetcher for testing exceptions. It extends the functionality of the mock fetcher but can also throw exceptions. Upon initialisation, an integer is given which sets how many times a query is made before returning the result. If the current query matches the last query and the counter of the number of times is less than the maxQuery set at initialisation, then an exception will be thrown. Additionally, if the maxQuery is set to -1, the fetcher will always throw an exception.- Since:
23/05/13
- Version:
- $Id$
- Author:
- Marine Dumousseau (marine@ebi.ac.uk)
-
-
Field Summary
-
Fields inherited from class psidev.psi.mi.jami.bridges.fetcher.mock.AbstractMockFetcher
localMap
-
-
Constructor Summary
Constructors Constructor Description FailingGeneFetcher(int maxQuery)
Constructor for FailingProteinFetcher.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addEntry(String identifier, Gene gene)
addEntry.Collection<Gene>
fetchByIdentifier(String identifier)
Takes a string identifier and returns the interactors which match.Collection<Gene>
fetchByIdentifier(String identifier, int taxID)
fetchByIdentifier.Collection<Gene>
fetchByIdentifiers(Collection<String> identifiers)
Takes a collection of string identifiers and returns the interactors which match.Collection<Gene>
fetchByIdentifiers(Collection<String> identifiers, int taxID)
fetchByIdentifiers.protected Collection<Gene>
getEntry(String identifier)
getEntry.-
Methods inherited from class psidev.psi.mi.jami.bridges.fetcher.mock.AbstractFailingFetcher
getEntries
-
Methods inherited from class psidev.psi.mi.jami.bridges.fetcher.mock.AbstractMockFetcher
addEntry, clearEntries, removeEntry
-
-
-
-
Method Detail
-
getEntry
protected Collection<Gene> getEntry(String identifier) throws BridgeFailedException
getEntry.
Used to retrieve an entry from the internal list. will throw exceptions if the required number of queries has not been made.- Overrides:
getEntry
in classAbstractFailingFetcher<Collection<Gene>>
- Parameters:
identifier
- aString
object.- Returns:
- a T object.
- Throws:
BridgeFailedException
- if any.
-
fetchByIdentifier
public Collection<Gene> fetchByIdentifier(String identifier) throws BridgeFailedException
Takes a string identifier and returns the interactors which match. Returns an empty collection of no entries are returned- Specified by:
fetchByIdentifier
in interfaceInteractorFetcher<Gene>
- Parameters:
identifier
- The identifier to search for.- Returns:
- The proteins which match the search term. Empty if no matches.
- Throws:
BridgeFailedException
- A problem has been encountered when contacting the service
-
fetchByIdentifiers
public Collection<Gene> fetchByIdentifiers(Collection<String> identifiers) throws BridgeFailedException
Takes a collection of string identifiers and returns the interactors which match. Returns an empty collection of no entries are returned.- Specified by:
fetchByIdentifiers
in interfaceInteractorFetcher<Gene>
- Parameters:
identifiers
- The identifiers to search for.- Returns:
- The proteins which match the search term. Empty if no matches.
- Throws:
BridgeFailedException
- if any.
-
fetchByIdentifier
public Collection<Gene> fetchByIdentifier(String identifier, int taxID) throws BridgeFailedException
Description copied from interface:GeneFetcher
fetchByIdentifier.
- Specified by:
fetchByIdentifier
in interfaceGeneFetcher
- Parameters:
identifier
- The identifier of the genetaxID
- The organism the gene is from.- Returns:
- The genes matching the search terms.
- Throws:
BridgeFailedException
- if any.
-
fetchByIdentifiers
public Collection<Gene> fetchByIdentifiers(Collection<String> identifiers, int taxID) throws BridgeFailedException
Description copied from interface:GeneFetcher
fetchByIdentifiers.
- Specified by:
fetchByIdentifiers
in interfaceGeneFetcher
- Parameters:
identifiers
- The identifiers of the genetaxID
- The organism the gene is from.- Returns:
- The genes matching the search terms.
- Throws:
BridgeFailedException
- if any.
-
-