|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.sqlproc.engine.SqlEngine
public abstract class SqlEngine
Common ancestor for SqlQueryEngine
, SqlCrudEngine
and SqlProcedureEngine
.
For more info please see the Tutorials.
Field Summary | |
---|---|
protected Map<String,Object> |
features
Configuration of the SQL Processor using map of features. |
protected org.slf4j.Logger |
logger
The internal slf4j logger. |
protected SqlMappingRule |
mapping
The pre-compiled mapping rule, which is an SQL execution result to Java output classes mapping prescription. |
protected SqlMonitor |
monitor
Monitor for the runtime statistics gathering. |
protected String |
name
Name of the META SQL query or statement, which uniquely identifies this instance. |
protected SqlPluginFactory |
pluginFactory
The factory for the SQL Processor plugins. |
protected Map<String,SqlProcessResult> |
processingCache
The processing cache used for SqlProcessResult instances. |
protected SqlMetaStatement |
statement
The pre-compiled META SQL query or statement. |
protected SqlTypeFactory |
typeFactory
The factory for the META types construction. |
protected SqlValidator |
validator
The injected validator. |
Constructor Summary | |
---|---|
SqlEngine(String name,
SqlMetaStatement statement,
SqlMappingRule mapping,
SqlMonitor monitor,
Map<String,Object> features,
SqlTypeFactory typeFactory,
SqlPluginFactory pluginFactory)
Creates a new instance of the SqlEngine from one META SQL statement and one SQL Mapping rule instance. |
Method Summary | |
---|---|
(package private) void |
checkDynamicInputValues(Object dynamicInputValues)
Check the input parameters. |
(package private) void |
checkStaticInputValues(Object staticInputValues)
Check the input parameters. |
Map<String,Object> |
getFeatures()
Returns the optional features, which can alter the SQL Processor runtime behavior. |
static Map<String,Object> |
getFeatures(SqlControl sqlControl)
The helper to prevent the NPE |
static int |
getFetchSize(SqlControl sqlControl)
The helper to prevent the NPE |
static int |
getFirstResult(SqlControl sqlControl)
The helper to prevent the NPE |
static int |
getMaxResults(SqlControl sqlControl)
The helper to prevent the NPE |
static int |
getMaxTimeout(SqlControl sqlControl)
The helper to prevent the NPE |
static Map<String,Class<?>> |
getMoreResultClasses(SqlControl sqlControl)
The helper to prevent the NPE |
static SqlOrder |
getOrder(SqlControl sqlControl)
The helper to prevent the NPE |
SqlPluginFactory |
getPluginFactory()
Returns the factory for the SQL Processor plugins. |
Map<String,SqlProcessResult> |
getProcessingCache()
Returns the processing cache used for SqlProcessResult instances. |
static String |
getProcessingId(SqlControl sqlControl)
The helper to prevent the NPE |
static Object |
getStaticInputValues(SqlControl sqlControl)
The helper to prevent the NPE |
SqlTypeFactory |
getTypeFactory()
Returns the factory for the META types construction. |
protected SqlProcessResult |
process(SqlMetaStatement.Type sqlStatementType,
Object dynamicInputValues,
SqlControl sqlControl)
The main contract for a dynamic ANSI SQL Query generation. |
void |
setFeature(String name,
Object value)
Sets the optional feature in the stament's or global scope. |
void |
setProcessingCache(Map<String,SqlProcessResult> processingCache)
Sets the processing cache used for SqlProcessResult instances. |
void |
setValidator(SqlValidator validator)
Injects a validator. |
void |
unsetFeatures(Set<String> names)
Clears the optional features in the stament's or global scope. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final org.slf4j.Logger logger
protected String name
protected SqlMetaStatement statement
protected SqlMappingRule mapping
protected Map<String,Object> features
protected SqlMonitor monitor
protected SqlValidator validator
protected SqlTypeFactory typeFactory
JdbcTypeFactory
.
protected SqlPluginFactory pluginFactory
protected Map<String,SqlProcessResult> processingCache
SqlProcessResult
instances.
Constructor Detail |
---|
public SqlEngine(String name, SqlMetaStatement statement, SqlMappingRule mapping, SqlMonitor monitor, Map<String,Object> features, SqlTypeFactory typeFactory, SqlPluginFactory pluginFactory)
SqlProcessorLoader
,
which is able to read all statements definitions from an external meta statements file and create the named
SqlEngine instances. Also an external SQL Monitor for the runtime statistics gathering can be engaged.
name
- the name of this SQL Engine instancestatement
- the pre-compiled META SQL statementmapping
- the pre-compiled SQL mapping rulemonitor
- the SQL Monitor for the runtime statistics gatheringfeatures
- the optional SQL Processor featurestypeFactory
- the factory for the META types constructionpluginFactory
- the factory for the SQL Processor pluginsMethod Detail |
---|
public void setValidator(SqlValidator validator)
validator
- a generir validator instancepublic void setFeature(String name, Object value)
name
- the name of the optional featurevalue
- the value of the optional featurepublic void unsetFeatures(Set<String> names)
names
- the names of the optional featurespublic static Object getStaticInputValues(SqlControl sqlControl)
sqlControl
- the compound parameters controlling the META SQL execution
public static int getMaxTimeout(SqlControl sqlControl)
sqlControl
- the compound parameters controlling the META SQL execution
public static int getFirstResult(SqlControl sqlControl)
sqlControl
- the compound parameters controlling the META SQL execution
public static int getMaxResults(SqlControl sqlControl)
sqlControl
- the compound parameters controlling the META SQL execution
public static SqlOrder getOrder(SqlControl sqlControl)
sqlControl
- the compound parameters controlling the META SQL execution
public static Map<String,Class<?>> getMoreResultClasses(SqlControl sqlControl)
sqlControl
- the compound parameters controlling the META SQL execution
public static Map<String,Object> getFeatures(SqlControl sqlControl)
sqlControl
- the compound parameters controlling the META SQL execution
public static String getProcessingId(SqlControl sqlControl)
sqlControl
- the compound parameters controlling the META SQL execution
public static int getFetchSize(SqlControl sqlControl)
sqlControl
- the compound parameters controlling the META SQL execution
void checkDynamicInputValues(Object dynamicInputValues)
dynamicInputValues
- The object used for the SQL statement dynamic input values. The class of this object is also named as
the input class or the dynamic parameters class. The exact class type isn't important, all the
parameters settled into the SQL prepared statement are picked up using the reflection API.
InvalidParameterException
- in the case the incorrect classes used for dynamic input valuesvoid checkStaticInputValues(Object staticInputValues)
staticInputValues
- The object used for the SQL statement static input values. The class of this object is also named as
the input class or the static parameters class. The exact class type isn't important, all the
parameters injected into the SQL query command are picked up using the reflection API. Compared to
dynamicInputValues input parameters, parameters in this class should't be produced by an end user to
prevent SQL injection threat!
InvalidParameterException
- in the case the incorrect classes used for static input valuespublic Map<String,Object> getFeatures()
public SqlTypeFactory getTypeFactory()
JdbcTypeFactory
public SqlPluginFactory getPluginFactory()
public Map<String,SqlProcessResult> getProcessingCache()
SqlProcessResult
instances.
SqlProcessResult
instances.public void setProcessingCache(Map<String,SqlProcessResult> processingCache)
SqlProcessResult
instances.
processingCache
- the processing cache used for SqlProcessResult
instances.protected SqlProcessResult process(SqlMetaStatement.Type sqlStatementType, Object dynamicInputValues, SqlControl sqlControl)
sqlStatementType
- the SQL command typedynamicInputValues
- the SQL statement dynamic parameters (input values)sqlControl
- The compound parameters controlling the META SQL execution
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |