***  This class is subject to change.  ***

com.sas.iquery.dataretrieval
Class SimpleQueryConnector

com.sas.iquery.dataretrieval.SimpleQueryConnector
All Implemented Interfaces:
com.sas.iquery.execution.OverrideLocaleInterface, com.sas.iquery.execution.OverrideMLSLookupsInterface, com.sas.iquery.execution.OverrideStpNamesInterface
Direct Known Subclasses:
QueryConnector

public class SimpleQueryConnector
implements com.sas.iquery.execution.OverrideLocaleInterface, com.sas.iquery.execution.OverrideMLSLookupsInterface, com.sas.iquery.execution.OverrideStpNamesInterface

A basic query connector without result or connection management.

Please don't instantiate this class directly! Consumers should use the QueryConnector subclass or QueryConnectorInterface.

See the package-level documentation for com.sas.iquery.dataretrieval for examples of how to use the query connector.

See Also:
QueryConnectorInterface, QueryConnector

Method Summary
 java.util.Locale getComputationalLocale()
          Returns the Locale to override all query computations submitted or null if the computation locale of the query is not to be overridden.
 java.util.Map<java.lang.String,com.sas.iquery.metadata.physical.MLSLookup> getMLSLookups()
          returns the MLSLookup definitions map, keyed by output column name (RSID) If MLS is disabled then this returns null.
 java.lang.String getPhysicalQuery(BusinessQuery businessQuery)
          Returns the generated query as a string, excluding connection information.
 java.lang.String getResultSetStructure(BusinessQuery businessQuery)
          Returns information about the structure of a result set.
 RetrievalPolicy getRetrievalPolicy()
          Returns the query connector's current retrieval policy as last set by the setRetrievalPolicy(RetrievalPolicy) method or the default if not explicitly set.
 com.sas.iquery.execution.instructions.StpNames getStpNames()
          Returns the stored process assigned names cache.
 boolean isMultipleLanguageSupportEnabled()
          Enables Multiple Language Support for output results.
protected  com.sas.iquery.dataretrieval.QueryContainer newQueryContainer(BusinessQuery businessQuery, RetrievalPolicy retrievalPolicy)
          The query container acts as a parameter object between: a.
 ResultSetInterface retrieveQueryResult(BusinessQuery query)
           
 java.util.Map<java.lang.String,ResultSetInterface> retrieveQueryResultMap(java.util.List<? extends BusinessQuery> queries)
          Creates a map of query results (ResultSetInterface), based on a list of input business queries.
 java.util.Map<java.lang.String,ResultSetInterface> retrieveQueryResultMap(java.util.List<? extends BusinessQuery> queries, RetrievalPolicy retrievalPolicy)
          Creates a map of query results, based on a list of input business queries.
 void setComputationalLocale(java.util.Locale overrideComputationalLocale)
          Sets the Locale to override all query computations submitted or if the computation locale of the query is not to be overridden then use null.
 void setMLSLookups(java.util.Map<java.lang.String,com.sas.iquery.metadata.physical.MLSLookup> mlsLookupsByColumnName)
          sets the Overriding MLSLookup definitions map, keyed by output column name (RSID) (null to use NONE, empty to auto-generate and return the lookup defs).
 void setMultipleLanguageSupportEnabled(boolean enabled)
          Enables or disables Multiple Language Support for output results.
 void setRetrievalPolicy(RetrievalPolicy policy)
          Sets a retrieval policy on the query connector.
 void setStpNames(com.sas.iquery.execution.instructions.StpNames stpNames)
          sets the stored process assigned names cache.
 

Method Detail

getRetrievalPolicy

public RetrievalPolicy getRetrievalPolicy()
Returns the query connector's current retrieval policy as last set by the setRetrievalPolicy(RetrievalPolicy) method or the default if not explicitly set.

Returns:
the QueryConnector's current retrieval policy

setRetrievalPolicy

public void setRetrievalPolicy(RetrievalPolicy policy)
Sets a retrieval policy on the query connector.

This retrieval policy will be used if the retrieveQueryResultMap(List) method is called.


retrieveQueryResultMap

@Nonnull
public java.util.Map<java.lang.String,ResultSetInterface> retrieveQueryResultMap(java.util.List<? extends BusinessQuery> queries,
                                                                                         RetrievalPolicy retrievalPolicy)
                                                                          throws DataRetrievalException
Creates a map of query results, based on a list of input business queries.

The keys of the resulting map are the ID's of the input business queries. Use the IntelligentQueryInterface.getID() method to determine the id.

The input list must fulfill the following requirements:

Parameters:
queries - a list of business queries to execute
retrievalPolicy - the policy to use for executing
Returns:
A map whose keys are ID's of the executed BusinessQueries and values are ResultSetInterface results
Throws:
DataRetrievalException
See Also:
retrieveQueryResultMap(List)

retrieveQueryResult

@Nonnull
public ResultSetInterface retrieveQueryResult(@Nonnull
                                                      BusinessQuery query)
                                       throws DataRetrievalException
Throws:
DataRetrievalException

retrieveQueryResultMap

@Nonnull
public java.util.Map<java.lang.String,ResultSetInterface> retrieveQueryResultMap(java.util.List<? extends BusinessQuery> queries)
                                                                          throws DataRetrievalException
Creates a map of query results (ResultSetInterface), based on a list of input business queries.

Uses the retrieval policy returned by getRetrievalPolicy(). BusinessQuery

Parameters:
queries - a list of business queries to execute
Returns:
a map whose keys are ID's of the executed BusinessQueries and values are ResultSetInterface results
Throws:
DataRetrievalException
See Also:
retrieveQueryResultMap(List,RetrievalPolicy)

getPhysicalQuery

public java.lang.String getPhysicalQuery(BusinessQuery businessQuery)
                                  throws com.sas.iquery.intelligentquery.IntelligentQueryException
Returns the generated query as a string, excluding connection information.

Parameters:
businessQuery - The business query to generate code for
Returns:
A string containing the server-specific query generated
Throws:
com.sas.iquery.intelligentquery.IntelligentQueryException

getResultSetStructure

public java.lang.String getResultSetStructure(BusinessQuery businessQuery)
                                       throws com.sas.iquery.intelligentquery.IntelligentQueryException
Returns information about the structure of a result set. The returned values can be one of

Parameters:
businessQuery - The query to examine
Returns:
The type of result set
Throws:
com.sas.iquery.intelligentquery.IntelligentQueryException - If the structure cannot be determined

newQueryContainer

protected com.sas.iquery.dataretrieval.QueryContainer newQueryContainer(BusinessQuery businessQuery,
                                                                        RetrievalPolicy retrievalPolicy)
                                                                 throws DataRetrievalException
The query container acts as a parameter object between: a. this Query Connector b. strategySelector.getStrategy(...) c. queryExecutor.execute(...). The query's result form queryExecutor.execute will be returned in it as well.

Parameters:
query -
retrievalPolicy -
Returns:
Throws:
MetadataException
DataRetrievalException

getComputationalLocale

public java.util.Locale getComputationalLocale()
Returns the Locale to override all query computations submitted or null if the computation locale of the query is not to be overridden.

Specified by:
getComputationalLocale in interface com.sas.iquery.execution.OverrideLocaleInterface
Returns:
Overriding Locale (or null)
See Also:
QueryConnectorInterface.getComputationalLocale(), BusinessModel.getComputationalLocale()

setComputationalLocale

public void setComputationalLocale(java.util.Locale overrideComputationalLocale)
Sets the Locale to override all query computations submitted or if the computation locale of the query is not to be overridden then use null.

Specified by:
setComputationalLocale in interface com.sas.iquery.execution.OverrideLocaleInterface
Parameters:
computationLocale - Locale to override query computation locale or null to not override.
See Also:
QueryConnectorInterface.setComputationalLocale(Locale), BusinessModel.setComputationalLocale(Locale)

getStpNames

public com.sas.iquery.execution.instructions.StpNames getStpNames()
Description copied from interface: OverrideStpNamesInterface
Returns the stored process assigned names cache.

Specified by:
getStpNames in interface com.sas.iquery.execution.OverrideStpNamesInterface
Returns:
StpNames
See Also:
OverrideStpNamesInterface.getStpNames()

setStpNames

public void setStpNames(com.sas.iquery.execution.instructions.StpNames stpNames)
Description copied from interface: OverrideStpNamesInterface
sets the stored process assigned names cache.

Specified by:
setStpNames in interface com.sas.iquery.execution.OverrideStpNamesInterface
See Also:
OverrideStpNamesInterface.setStpNames(com.sas.iquery.execution.instructions.StpNames)

getMLSLookups

public java.util.Map<java.lang.String,com.sas.iquery.metadata.physical.MLSLookup> getMLSLookups()
returns the MLSLookup definitions map, keyed by output column name (RSID) If MLS is disabled then this returns null.

Specified by:
getMLSLookups in interface com.sas.iquery.execution.OverrideMLSLookupsInterface
See Also:
OverrideMLSLookupsInterface.getMLSLookups()

setMLSLookups

public void setMLSLookups(java.util.Map<java.lang.String,com.sas.iquery.metadata.physical.MLSLookup> mlsLookupsByColumnName)
sets the Overriding MLSLookup definitions map, keyed by output column name (RSID) (null to use NONE, empty to auto-generate and return the lookup defs).

Specified by:
setMLSLookups in interface com.sas.iquery.execution.OverrideMLSLookupsInterface
See Also:
OverrideMLSLookupsInterface.setMLSLookups(java.util.Map)

setMultipleLanguageSupportEnabled

public void setMultipleLanguageSupportEnabled(boolean enabled)
Enables or disables Multiple Language Support for output results.

Parameters:
enabled -

isMultipleLanguageSupportEnabled

public boolean isMultipleLanguageSupportEnabled()
Enables Multiple Language Support for output results.

Parameters:
enabled -

***  This class is subject to change.  ***




Copyright © 2009 SAS Institute Inc. All Rights Reserved.