Class DelegateClient<R>
- java.lang.Object
-
- org.gcube.resources.discovery.client.impl.DelegateClient<R>
-
- Type Parameters:
R- the type of query results
- All Implemented Interfaces:
DiscoveryClient<R>
public class DelegateClient<R> extends Object implements DiscoveryClient<R>
ADiscoveryClientthat delegates the execution of queries to anotherDiscoveryClientthat does not perform result parsing and the parsing itself to a dedicatedResultParser.- Author:
- Fabio Simeoni
-
-
Constructor Summary
Constructors Constructor Description DelegateClient(ResultParser<R> parser, DiscoveryClient<String> inner)Creates an instance with a givenResultParserand aDiscoveryClientthat produces untyped results
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<R>submit(Query query)Submits aQueryfor remote execution and returns a list of typed results.
-
-
-
Constructor Detail
-
DelegateClient
public DelegateClient(ResultParser<R> parser, DiscoveryClient<String> inner)
Creates an instance with a givenResultParserand aDiscoveryClientthat produces untyped results- Parameters:
parser- the parserinner- the client
-
-
Method Detail
-
submit
public List<R> submit(Query query) throws DiscoveryException, InvalidResultException
Submits aQueryfor remote execution and returns a list of typed results.Result parsing errors are only logged as long as some results are successfully parsed. Otherwise, the client flags the parsing errors as likely due to the parser itself.
- Specified by:
submitin interfaceDiscoveryClient<R>- Parameters:
query- the query- Returns:
- the results
- Throws:
DiscoveryException- if the query cannot be submittedInvalidResultException- if the results cannot be parsed. Implementations may adopt different degrees of tolerance to parsing errors before raising this exception.
-
-