public abstract class AbstractClient extends Object implements ISClient
ISClient.
Subclasses implement specific methods to load implementations of standard {link ISQuery ISQueries},
and to execute those queries against the associated Information System.ISClient.ISMalformedQueryException, ISClient.ISMalformedResultException, ISClient.ISUnsupportedQueryException| Modifier and Type | Field and Description |
|---|---|
protected static Map<String,String> |
genericQueries
Query implementations indexed by their implementation-defined name.
|
protected static Map<Class<? extends ISQuery<?>>,Class<? extends ISQuery<?>>> |
implementationMap
Query implementations indexed by their standard interface.
|
protected GCUBELog |
logger
Object logger.
|
| Constructor and Description |
|---|
AbstractClient()
Creates a new instance and loads query implementations if not previously done.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
checkQuery(ISQuery<?> query)
Invoked internally by
execute(ISQuery, GCUBEScope) to check that a
can be handled by the implementation and is in fact well-formed. |
abstract <RESULT> List<RESULT> |
execute(ISQuery<RESULT> query,
GCUBEScope scope)
Evaluates a query in a given scope and returns its results a local list.
|
abstract <RESULT> ISInputStream<RESULT> |
executeByRef(ISQuery<RESULT> query,
GCUBEScope scope)
Implement to execute the query against the associated Information System in a given scope, and to return the locator of a resultset which contains the unparsed result serialisations.
|
<RESULT,QUERY extends ISQuery<RESULT>> |
getQuery(Class<QUERY> clazz)
Returns a query from the interface or class which defines its type.
|
protected Class<? extends AbstractQuery> |
getQueryBaseClass()
Returns the subtype of
AbstractQuery used as the base class for query implementations. |
protected abstract void |
loadGenericQueries(Map<String,String> queryMap)
Implement to load query implementations in a map which indexes by their standard interfaces.
|
protected abstract void |
loadQueries(Map<Class<? extends ISQuery<?>>,Class<? extends ISQuery<?>>> queryMap)
Implement to load query implementations in a map which indexes by their standard interfaces.
|
protected GCUBELog logger
protected static Map<Class<? extends ISQuery<?>>,Class<? extends ISQuery<?>>> implementationMap
public AbstractClient()
protected abstract void loadQueries(Map<Class<? extends ISQuery<?>>,Class<? extends ISQuery<?>>> queryMap)
queryMap - the map.protected abstract void loadGenericQueries(Map<String,String> queryMap)
queryMap - the map.public <RESULT,QUERY extends ISQuery<RESULT>> QUERY getQuery(Class<QUERY> clazz) throws ISClient.ISUnsupportedQueryException, InstantiationException, IllegalAccessException
getQuery in interface ISClientRESULT - the type of the query results.QUERY - the type of the query which produces results of type RESULT.clazz - the query interface or class.ISClient.ISUnsupportedQueryExceptionInstantiationExceptionIllegalAccessExceptionpublic abstract <RESULT> List<RESULT> execute(ISQuery<RESULT> query, GCUBEScope scope) throws ISClient.ISUnsupportedQueryException, ISException
execute in interface ISClientRESULT - The type of the query results.query - the query.scope - the scope.ISMalformedResultExceptionISClient.ISMalformedQueryException - if the query is incorrectly formulated and cannot produce results.ISException - if the evaluation could not be completed.ISClient.ISUnsupportedQueryExceptionprotected void checkQuery(ISQuery<?> query) throws ISClient.ISMalformedQueryException, ISClient.ISUnsupportedQueryException
execute(ISQuery, GCUBEScope) to check that a
can be handled by the implementation and is in fact well-formed.
By default it checks that the query is an AbstractQuery and can thus be handled by subclasses.
Subclasses may wish to override the method to enforce more specific checks.query - the query.ISMalformedQueryException - if the query is not well-formed.ISInvalidQueryException - if the query if of a type which cannot be processed by the implementatioISClient.ISMalformedQueryExceptionISClient.ISUnsupportedQueryExceptionpublic abstract <RESULT> ISInputStream<RESULT> executeByRef(ISQuery<RESULT> query, GCUBEScope scope) throws ISClient.ISMalformedQueryException, ISClient.ISUnsupportedQueryException, ISException
AbstractQuery used by the implementation, as runtime checks.
have already been performed.executeByRef in interface ISClientRESULT - The type of the query results.query - the query.scope - the scope.ISException - if the query could not be executedISClient.ISMalformedQueryException - if the query is incorrectly formulated and cannot produce results.ISClient.ISUnsupportedQueryExceptionprotected Class<? extends AbstractQuery> getQueryBaseClass()
AbstractQuery used as the base class for query implementations.
This is used by the client to check the validity of queries once and where most convenient
on behalf of its subclasses.Copyright © 2015. All Rights Reserved.