org.sqlproc.engine
Class SqlProcessorLoader

java.lang.Object
  extended by org.sqlproc.engine.SqlProcessorLoader
All Implemented Interfaces:
SqlEngineFactory

public class SqlProcessorLoader
extends Object
implements SqlEngineFactory

The helper class for the META SQL statements and mapping rules parsing. These statements and rules are taken from the file repository based on the provided ANTLR grammar.
The purpose of this class is to load and analyze (=parse) the SQL Processor artifacts:

This is rather a low level helper class. For more simple approach please see SqlSimpleFactory

All the statements with the name name(QRY) are parsed as the META SQL queries using the ANTLR based grammar.
All the statements with the name name(CRUD) are parsed as the META SQL CRUD statements using the ANTLR based grammar.
All the statements with the name name(CALL) are parsed as the META SQL CALL statements using the ANTLR based grammar. These are used to call the stored procedures.
All the statements with the name name(OUT) are parsed as the mapping rules using the ANTLR based grammar.
A pair of the META SQL statement and the (optional) mapping rule forms one named SQL Engine instance.
All the statements with the name name(OPT) are taken as the optional features used in the process of the SQL query/statement generation and execution.

In the process of ANTLR based parsing different kinds of incorrect stuff can cause the SqlEngineException to be raised.

In the process of the META SQL statements and mapping rules parsing the input/output values META types have to be established. For this purpose a factory class responsible for these META types construction has to be supplied.

To initialize the SqlProcessorLoader, Spring DI configuration can be utilized, like the next one:

 <beans ...>
   ...
     <bean id="sqlFactory" class="org.sqlproc.engine.jdbc.JdbcEngineFactory" init-method="init">
         <property name="metaFilesNames">
             <list>
                 <value>statements.qry</value>
             </list>
         </property>
     </bean>
 </beans>
 
and use the next code to obtain an instance of the SQL Query engine
 SqlEngineFactory sqlFactory = context.getBean("sqlFactory", SqlEngineFactory.class);
 SqlQueryEngine sqlEngine = sqlFactory.getQueryEngine("ALL");
 
or the next code to obtain an instance of the SQL CRUD engine
 SqlEngineFactory sqlFactory = context.getBean("sqlFactory", SqlEngineFactory.class);
 SqlCrudEngine sqlEngine = sqlFactory.getCrudEngine("ALL");
 

Another possibility is to utilize SqlFilesLoader.

 SqlFilesLoader loader = new SqlFilesLoader("statements.qry", this.getClass());
 SqlProcessorLoader sqlLoader = new SqlProcessorLoader(loader.getStatements(), JdbcTypeFactory.getInstance());
 SqlQueryEngine sqlEngine = sqlLoader.getQueryEngine("ALL");
 

For more info please see the Tutorials.

Author:
Vladimir Hudec

Nested Class Summary
(package private) static class SqlProcessorLoader.EngineType
          The SQL Engine types
 
Field Summary
private  Map<String,SqlMetaStatement> calls
          The collection of named META SQL CALLABLE statements.
private  Map<String,Map<String,SqlProcessResult>> commonProcessingCache
          The processing cache used for SqlProcessResult instances.
private  SqlTypeFactory composedTypeFactory
          The combined factory for the META types construction.
private  Map<String,SqlMetaStatement> cruds
          The collection of named META SQL CRUD statements.
private  Map<String,SqlEngine> dynamicEngines
          The collection of named dynamic SQL Engines (the primary SQL Processor class) instances.
private  Map<String,SqlEngine> engines
          The collection of named SQL Engines (the primary SQL Processor class) instances.
private  Map<String,Object> features
          The collection of the SQL Processor optional features.
private  boolean lazyInit
          This flag indicates to speed up the initialization process.
protected  org.slf4j.Logger logger
          The internal slf4j logger.
private  SqlMonitorFactory monitorFactory
          The monitor factory used in the process of the SQL Monitor instances creation
private  Map<String,SqlMappingRule> outs
          The collection of named explicitly defined mapping rules.
private  SqlPluginFactory pluginFactory
          The factory for the SQL Processor plugins.
private  Map<String,SqlMetaStatement> sqls
          The collection of named META SQL queries.
private  Map<String,Map<String,Object>> statementsFeatures
          The collection of the SQL Processor optional features in the statement context.
private  Map<String,Set<String>> statementsFeaturesUnset
          The collection of the SQL Processor optional features to be cleared in the statement context.
private  SqlValidatorFactory validatorFactory
          The validator factory used in the process of the SQL Monitor instances creation
 
Constructor Summary
SqlProcessorLoader(StringBuilder sbStatements, SqlTypeFactory typeFactory, SqlPluginFactory pluginFactory)
          Creates a new instance of the SqlProcessorLoader from the String content repository (which is in fact a collection of the META SQL statements, mapping rules and optional features.
SqlProcessorLoader(StringBuilder sbStatements, SqlTypeFactory typeFactory, SqlPluginFactory pluginFactory, String filter)
          Creates a new instance of the SqlProcessorLoader from the String content repository (which is in fact a collection of the META SQL statements, mapping rules and optional features.
SqlProcessorLoader(StringBuilder sbStatements, SqlTypeFactory typeFactory, SqlPluginFactory pluginFactory, String filter, SqlMonitorFactory monitorFactory)
          Creates a new instance of the SqlProcessorLoader from the String content repository (which is in fact a collection of the META SQL statements, mapping rules and optional features.
SqlProcessorLoader(StringBuilder sbStatements, SqlTypeFactory typeFactory, SqlPluginFactory pluginFactory, String filter, SqlMonitorFactory monitorFactory, List<SqlInternalType> customTypes, String... onlyStatements)
          Creates a new instance of the SqlProcessorLoader from the String content repository (which is in fact a collection of the META SQL statements, mapping rules and optional features.
SqlProcessorLoader(StringBuilder sbStatements, SqlTypeFactory typeFactory, SqlPluginFactory pluginFactory, String filter, SqlMonitorFactory monitorFactory, SqlValidatorFactory validatorFactory, List<SqlInternalType> customTypes, boolean lazyInit, String... onlyStatements)
          Creates a new instance of the SqlProcessorLoader from the String content repository (which is in fact a collection of the META SQL statements, mapping rules and optional features.
SqlProcessorLoader(StringBuilder sbStatements, SqlTypeFactory typeFactory, SqlPluginFactory pluginFactory, String filter, SqlMonitorFactory monitorFactory, SqlValidatorFactory validatorFactory, List<SqlInternalType> customTypes, String... onlyStatements)
          Creates a new instance of the SqlProcessorLoader from the String content repository (which is in fact a collection of the META SQL statements, mapping rules and optional features.
SqlProcessorLoader(StringBuilder sbStatements, SqlTypeFactory typeFactory, SqlPluginFactory pluginFactory, String filter, SqlMonitorFactory monitorFactory, String... onlyStatements)
          Creates a new instance of the SqlProcessorLoader from the String content repository (which is in fact a collection of the META SQL statements, mapping rules and optional features.
 
Method Summary
private  void check(String name, SqlEngine sqlEngine)
          Check the SQL Engine instance is not null
private  SqlEngine createEngine(String name, SqlProcessorLoader.EngineType engineType, SqlMetaStatement stmt, String sqlStatement)
          Creates a new instance of the SQL Engine instance (the primary SQL Processor class).
 SqlCrudEngine getCheckedCrudEngine(String name)
          Returns the named static or dynamic SQL CRUD Engine instance (the primary SQL Processor class).
 SqlProcedureEngine getCheckedProcedureEngine(String name)
          Returns the named static or dynamic SQL Procedure Engine instance (the primary SQL Processor class).
 SqlQueryEngine getCheckedQueryEngine(String name)
          Returns the named static or dynamic SQL Query Engine instance (the primary SQL Processor class).
 SqlCrudEngine getCheckedStaticCrudEngine(String name)
          Returns the named static SQL CRUD Engine instance (the primary SQL Processor class).
 SqlProcedureEngine getCheckedStaticProcedureEngine(String name)
          Returns the named static SQL Procedure Engine instance (the primary SQL Processor class).
 SqlQueryEngine getCheckedStaticQueryEngine(String name)
          Returns the named static SQL Query Engine instance (the primary SQL Processor class).
 SqlCrudEngine getCrudEngine(String name)
          Returns the named static or dynamic SQL CRUD Engine instance (the primary SQL Processor class).
 SqlCrudEngine getDynamicCrudEngine(String name, String sqlStatement)
          Returns the named dynamic SQL CRUD Engine instance (the primary SQL Processor class).
private  SqlEngine getDynamicEngine(String name, SqlProcessorLoader.EngineType engineType, String sqlStatement)
          Returns the named dynamic SQL Engine instance (the primary SQL Processor class).
 Map<String,SqlEngine> getDynamicEngines()
          Returns the collection of names of all initialized/constructed dynamic SQL Engine instances.
 Collection<String> getDynamicNames()
          Returns the collection of names of all initialized/constructed dynamic SQL Engine instances.
 SqlProcedureEngine getDynamicProcedureEngine(String name, String sqlStatement)
          Returns the named dynamic SQL Procedure Engine instance (the primary SQL Processor class).
 SqlQueryEngine getDynamicQueryEngine(String name, String sqlStatement)
          Returns the named dynamic SQL Query Engine instance (the primary SQL Processor class).
private  SqlEngine getEngine(String name, SqlProcessorLoader.EngineType engineType)
          Returns the named static or dynamic SQL Engine instance (the primary SQL Processor class).
 Map<String,SqlEngine> getEngines()
          Returns the collection of named dynamic SQL Engines (the primary SQL Processor class) instances.
 Collection<String> getNames()
          Returns the collection of names of all initialized/constructed static SQL Engine instances.
 SqlProcedureEngine getProcedureEngine(String name)
          Returns the named static or dynamic SQL Procedure Engine instance (the primary SQL Processor class).
 SqlQueryEngine getQueryEngine(String name)
          Returns the named static or dynamic SQL Query Engine instance (the primary SQL Processor class).
private  Map<String,SqlMetaStatement> getStatements(SqlProcessorLoader.EngineType engineType)
          Returns the static statements container based on required SQL Engine type
 SqlCrudEngine getStaticCrudEngine(String name)
          Returns the named static SQL CRUD Engine instance (the primary SQL Processor class).
private  SqlEngine getStaticEngine(String name, SqlProcessorLoader.EngineType engineType)
          Returns the named static SQL Engine instance (the primary SQL Processor class).
 SqlProcedureEngine getStaticProcedureEngine(String name)
          Returns the named static SQL Procedure Engine instance (the primary SQL Processor class).
 SqlQueryEngine getStaticQueryEngine(String name)
          Returns the named static SQL Query Engine instance (the primary SQL Processor class).
 boolean isLazyInit()
          Returns a flag which indicates the lazy initialization mode.
private  void loadStatementFeatures(String name, SqlEngine sqlEngine)
          Some filters can be the optional features in the statement context.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected final org.slf4j.Logger logger
The internal slf4j logger.


composedTypeFactory

private SqlTypeFactory composedTypeFactory
The combined factory for the META types construction.


pluginFactory

private SqlPluginFactory pluginFactory
The factory for the SQL Processor plugins. This is the basic facility to alter the SQL Processor processing.


monitorFactory

private SqlMonitorFactory monitorFactory
The monitor factory used in the process of the SQL Monitor instances creation


validatorFactory

private SqlValidatorFactory validatorFactory
The validator factory used in the process of the SQL Monitor instances creation


engines

private Map<String,SqlEngine> engines
The collection of named SQL Engines (the primary SQL Processor class) instances.


dynamicEngines

private Map<String,SqlEngine> dynamicEngines
The collection of named dynamic SQL Engines (the primary SQL Processor class) instances.


sqls

private Map<String,SqlMetaStatement> sqls
The collection of named META SQL queries.


cruds

private Map<String,SqlMetaStatement> cruds
The collection of named META SQL CRUD statements.


calls

private Map<String,SqlMetaStatement> calls
The collection of named META SQL CALLABLE statements.


outs

private Map<String,SqlMappingRule> outs
The collection of named explicitly defined mapping rules.


features

private Map<String,Object> features
The collection of the SQL Processor optional features.


statementsFeatures

private Map<String,Map<String,Object>> statementsFeatures
The collection of the SQL Processor optional features in the statement context.


statementsFeaturesUnset

private Map<String,Set<String>> statementsFeaturesUnset
The collection of the SQL Processor optional features to be cleared in the statement context.


lazyInit

private boolean lazyInit
This flag indicates to speed up the initialization process.


commonProcessingCache

private Map<String,Map<String,SqlProcessResult>> commonProcessingCache
The processing cache used for SqlProcessResult instances.

Constructor Detail

SqlProcessorLoader

public SqlProcessorLoader(StringBuilder sbStatements,
                          SqlTypeFactory typeFactory,
                          SqlPluginFactory pluginFactory)
                   throws SqlEngineException
Creates a new instance of the SqlProcessorLoader from the String content repository (which is in fact a collection of the META SQL statements, mapping rules and optional features. During the instance construction all the statements are parsed and the collection of named SQL Engine instances is established. Later these instances are used for the SQL queries/statements execution. For the purpose of the META types construction (located inside the META SQL statements and mapping rules) a factory instance has to be supplied.

Parameters:
sbStatements - the String representation of the META SQL queries/statements/output mappings
typeFactory - the factory for the META types construction
pluginFactory - the factory for the SQL Processor plugins
Throws:
SqlEngineException - mainly in the case the provided statements or rules are not compliant with the ANTLR based grammar

SqlProcessorLoader

public SqlProcessorLoader(StringBuilder sbStatements,
                          SqlTypeFactory typeFactory,
                          SqlPluginFactory pluginFactory,
                          String filter)
                   throws SqlEngineException
Creates a new instance of the SqlProcessorLoader from the String content repository (which is in fact a collection of the META SQL statements, mapping rules and optional features. During the instance construction all the statements are parsed and the collection of named SQL Engine instances is established. Later these instances are used for the SQL queries/statements execution. For the purpose of the META types construction (located inside the META SQL statements and mapping rules) a factory instance has to be supplied.

Parameters:
sbStatements - the String representation of the META SQL queries/statements/output mappings
typeFactory - the factory for the META types construction
pluginFactory - the factory for the SQL Processor plugins
filter - the properties name prefix to filter the META SQL statements, mapping rules and optional features
Throws:
SqlEngineException - mainly in the case the provided statements or rules are not compliant with the ANTLR based grammar

SqlProcessorLoader

public SqlProcessorLoader(StringBuilder sbStatements,
                          SqlTypeFactory typeFactory,
                          SqlPluginFactory pluginFactory,
                          String filter,
                          SqlMonitorFactory monitorFactory)
                   throws SqlEngineException
Creates a new instance of the SqlProcessorLoader from the String content repository (which is in fact a collection of the META SQL statements, mapping rules and optional features. During the instance construction all the statements are parsed and the collection of named SQL Engine instances is established. Later these instances are used for the SQL queries/statements execution. For the purpose of the META types construction (located inside the META SQL statements and mapping rules) a factory instance has to be supplied. Every instance of the SQL Engine is accompanied with the SQL Monitor for the runtime statistics gathering. For the creation of these monitors the SQL Monitor Factory can be used.

Parameters:
sbStatements - the String representation of the META SQL queries/statements/output mappings
typeFactory - the factory for the META types construction
pluginFactory - the factory for the SQL Processor plugins
filter - the properties name prefix to filter the META SQL statements, mapping rules and optional features
monitorFactory - the monitor factory used in the process of the SQL Monitor instances creation
Throws:
SqlEngineException - mainly in the case the provided statements or rules are not compliant with the ANTLR based grammar

SqlProcessorLoader

public SqlProcessorLoader(StringBuilder sbStatements,
                          SqlTypeFactory typeFactory,
                          SqlPluginFactory pluginFactory,
                          String filter,
                          SqlMonitorFactory monitorFactory,
                          String... onlyStatements)
Creates a new instance of the SqlProcessorLoader from the String content repository (which is in fact a collection of the META SQL statements, mapping rules and optional features. During the instance construction all the statements are parsed and the collection of named SQL Engine instances is established. Later these instances are used for the SQL queries/statements execution. For the purpose of the META types construction (located inside the META SQL statements and mapping rules) a factory instance has to be supplied. Every instance of the SQL Engine is accompanied with the SQL Monitor for the runtime statistics gathering. For the creation of these monitors the SQL Monitor Factory can be used.

Parameters:
sbStatements - the String representation of the META SQL queries/statements/output mappings
typeFactory - the factory for the META types construction
pluginFactory - the factory for the SQL Processor plugins
filter - the properties name prefix to filter the META SQL statements, mapping rules and optional features
monitorFactory - the monitor factory used in the process of the SQL Monitor instances creation
onlyStatements - only statements and rules with the names in this container are picked up from the properties repository
Throws:
SqlEngineException - mainly in the case the provided statements or rules are not compliant with the ANTLR based grammar

SqlProcessorLoader

public SqlProcessorLoader(StringBuilder sbStatements,
                          SqlTypeFactory typeFactory,
                          SqlPluginFactory pluginFactory,
                          String filter,
                          SqlMonitorFactory monitorFactory,
                          List<SqlInternalType> customTypes,
                          String... onlyStatements)
                   throws SqlEngineException
Creates a new instance of the SqlProcessorLoader from the String content repository (which is in fact a collection of the META SQL statements, mapping rules and optional features. During the instance construction all the statements are parsed and the collection of named SQL Engine instances is established. Later these instances are used for the SQL queries/statements execution. For the purpose of the META types construction (located inside the META SQL statements and mapping rules) a factory instance has to be supplied. Every instance of the SQL Engine is accompanied with the SQL Monitor for the runtime statistics gathering. For the creation of these monitors the SQL Monitor Factory can be used.

Parameters:
sbStatements - the String representation of the META SQL queries/statements/output mappings
typeFactory - the factory for the META types construction
pluginFactory - the factory for the SQL Processor plugins
filter - the properties name prefix to filter the META SQL statements, mapping rules and optional features
monitorFactory - the monitor factory used in the process of the SQL Monitor instances creation
customTypes - the custom META types
onlyStatements - only statements and rules with the names in this container are picked up from the properties repository
Throws:
SqlEngineException - mainly in the case the provided statements or rules are not compliant with the ANTLR based grammar

SqlProcessorLoader

public SqlProcessorLoader(StringBuilder sbStatements,
                          SqlTypeFactory typeFactory,
                          SqlPluginFactory pluginFactory,
                          String filter,
                          SqlMonitorFactory monitorFactory,
                          SqlValidatorFactory validatorFactory,
                          List<SqlInternalType> customTypes,
                          String... onlyStatements)
                   throws SqlEngineException
Creates a new instance of the SqlProcessorLoader from the String content repository (which is in fact a collection of the META SQL statements, mapping rules and optional features. During the instance construction all the statements are parsed and the collection of named SQL Engine instances is established. Later these instances are used for the SQL queries/statements execution. For the purpose of the META types construction (located inside the META SQL statements and mapping rules) a factory instance has to be supplied. Every instance of the SQL Engine is accompanied with the SQL Monitor for the runtime statistics gathering. For the creation of these monitors the SQL Monitor Factory can be used.

Parameters:
sbStatements - the String representation of the META SQL queries/statements/output mappings
typeFactory - the factory for the META types construction
pluginFactory - the factory for the SQL Processor plugins
filter - the properties name prefix to filter the META SQL statements, mapping rules and optional features
monitorFactory - the monitor factory used in the process of the SQL Monitor instances creation
validatorFactory - the validator factory used in the process of the SQL Monitor instances creation
customTypes - the custom META types
onlyStatements - only statements and rules with the names in this container are picked up from the properties repository
Throws:
SqlEngineException - mainly in the case the provided statements or rules are not compliant with the ANTLR based grammar

SqlProcessorLoader

public SqlProcessorLoader(StringBuilder sbStatements,
                          SqlTypeFactory typeFactory,
                          SqlPluginFactory pluginFactory,
                          String filter,
                          SqlMonitorFactory monitorFactory,
                          SqlValidatorFactory validatorFactory,
                          List<SqlInternalType> customTypes,
                          boolean lazyInit,
                          String... onlyStatements)
                   throws SqlEngineException
Creates a new instance of the SqlProcessorLoader from the String content repository (which is in fact a collection of the META SQL statements, mapping rules and optional features. During the instance construction all the statements are parsed and the collection of named SQL Engine instances is established. Later these instances are used for the SQL queries/statements execution. For the purpose of the META types construction (located inside the META SQL statements and mapping rules) a factory instance has to be supplied. Every instance of the SQL Engine is accompanied with the SQL Monitor for the runtime statistics gathering. For the creation of these monitors the SQL Monitor Factory can be used.

Parameters:
sbStatements - the String representation of the META SQL queries/statements/output mappings
typeFactory - the factory for the META types construction
pluginFactory - the factory for the SQL Processor plugins
filter - the properties name prefix to filter the META SQL statements, mapping rules and optional features
monitorFactory - the monitor factory used in the process of the SQL Monitor instances creation
validatorFactory - the validator factory used in the process of the SQL Monitor instances creation
customTypes - the custom META types
lazyInit - this flag indicates to speed up the initialization process.
onlyStatements - only statements and rules with the names in this container are picked up from the properties repository
Throws:
SqlEngineException - mainly in the case the provided statements or rules are not compliant with the ANTLR based grammar
Method Detail

loadStatementFeatures

private void loadStatementFeatures(String name,
                                   SqlEngine sqlEngine)
Some filters can be the optional features in the statement context.

Parameters:
name - the name of the META SQL statement

getNames

public Collection<String> getNames()
Returns the collection of names of all initialized/constructed static SQL Engine instances.

Specified by:
getNames in interface SqlEngineFactory
Returns:
The collection of all initialized static SQL Engine instances' names

getDynamicNames

public Collection<String> getDynamicNames()
Returns the collection of names of all initialized/constructed dynamic SQL Engine instances.

Specified by:
getDynamicNames in interface SqlEngineFactory
Returns:
The collection of all initialized dynamic SQL Engine instances' names

getEngines

public Map<String,SqlEngine> getEngines()
Returns the collection of named dynamic SQL Engines (the primary SQL Processor class) instances.

Specified by:
getEngines in interface SqlEngineFactory
Returns:
The collection of named dynamic SQL Engines (the primary SQL Processor class) instances

getDynamicEngines

public Map<String,SqlEngine> getDynamicEngines()
Returns the collection of names of all initialized/constructed dynamic SQL Engine instances.

Specified by:
getDynamicEngines in interface SqlEngineFactory
Returns:
The collection of all initialized dynamic SQL Engine instances' names

createEngine

private SqlEngine createEngine(String name,
                               SqlProcessorLoader.EngineType engineType,
                               SqlMetaStatement stmt,
                               String sqlStatement)
Creates a new instance of the SQL Engine instance (the primary SQL Processor class).

Parameters:
name - the name of the required SQL Procedure Engine instance
engineType - the required SQL Engine type
stmt - the new SQL META statement instance for the case of static SQL Engine instance
sqlStatement - the new SQL statement for the case of dynamic SQL Engine instance
Returns:
the new SQL Engine instance
Throws:
SqlEngineException - in the case the instance can't be created

getStaticEngine

private SqlEngine getStaticEngine(String name,
                                  SqlProcessorLoader.EngineType engineType)
Returns the named static SQL Engine instance (the primary SQL Processor class).

Parameters:
name - the name of the required SQL Procedure Engine instance
engineType - the required SQL Engine type
Returns:
the SQL Engine instance
Throws:
SqlEngineException - in the case the instance can't be created

getStaticQueryEngine

public SqlQueryEngine getStaticQueryEngine(String name)
Returns the named static SQL Query Engine instance (the primary SQL Processor class).

Specified by:
getStaticQueryEngine in interface SqlEngineFactory
Parameters:
name - the name of the required SQL Query Engine instance
Returns:
the SQL Engine instance or null value in the case the related statement is missing

getStaticCrudEngine

public SqlCrudEngine getStaticCrudEngine(String name)
Returns the named static SQL CRUD Engine instance (the primary SQL Processor class).

Specified by:
getStaticCrudEngine in interface SqlEngineFactory
Parameters:
name - the name of the required SQL CRUD Engine instance
Returns:
the SQL Engine instance or null value in the case the related statement is missing

getStaticProcedureEngine

public SqlProcedureEngine getStaticProcedureEngine(String name)
Returns the named static SQL Procedure Engine instance (the primary SQL Processor class).

Specified by:
getStaticProcedureEngine in interface SqlEngineFactory
Parameters:
name - the name of the required SQL Procedure Engine instance
Returns:
the SQL Engine instance or null value in the case the related statement is missing

getEngine

private SqlEngine getEngine(String name,
                            SqlProcessorLoader.EngineType engineType)
Returns the named static or dynamic SQL Engine instance (the primary SQL Processor class).

Parameters:
name - the name of the required SQL Procedure Engine instance
engineType - the required SQL Engine type
Returns:
the SQL Engine instance
Throws:
SqlEngineException - in the case the instance can't be created

getQueryEngine

public SqlQueryEngine getQueryEngine(String name)
Returns the named static or dynamic SQL Query Engine instance (the primary SQL Processor class). In fact it returns the cached instance in the case it exists (it can be a static or dynamic one). Otherwise it instantiate a new static instance.

Specified by:
getQueryEngine in interface SqlEngineFactory
Parameters:
name - the name of the required SQL Query Engine instance
Returns:
the SQL Engine instance or null value in the case the related statement is missing

getCrudEngine

public SqlCrudEngine getCrudEngine(String name)
Returns the named static or dynamic SQL CRUD Engine instance (the primary SQL Processor class). In fact it returns the cached instance in the case it exists (it can be a static or dynamic one). Otherwise it instantiate a new static instance.

Specified by:
getCrudEngine in interface SqlEngineFactory
Parameters:
name - the name of the required SQL CRUD Engine instance
Returns:
the SQL Engine instance or null value in the case the related statement is missing

getProcedureEngine

public SqlProcedureEngine getProcedureEngine(String name)
Returns the named static or dynamic SQL Procedure Engine instance (the primary SQL Processor class). In fact it returns the cached instance in the case it exists (it can be a static or dynamic one). Otherwise it instantiate a new static instance.

Specified by:
getProcedureEngine in interface SqlEngineFactory
Parameters:
name - the name of the required SQL Procedure Engine instance
Returns:
the SQL Engine instance or null value in the case the related statement is missing

getDynamicEngine

private SqlEngine getDynamicEngine(String name,
                                   SqlProcessorLoader.EngineType engineType,
                                   String sqlStatement)
Returns the named dynamic SQL Engine instance (the primary SQL Processor class).

Parameters:
name - the name of the required SQL Procedure Engine instance
engineType - the required SQL Engine type
sqlStatement - the new SQL statement
Returns:
the SQL Engine instance
Throws:
SqlEngineException - in the case the instance can't be created

getDynamicQueryEngine

public SqlQueryEngine getDynamicQueryEngine(String name,
                                            String sqlStatement)
Returns the named dynamic SQL Query Engine instance (the primary SQL Processor class).

Specified by:
getDynamicQueryEngine in interface SqlEngineFactory
Parameters:
name - the name of the required SQL Query Engine instance
sqlStatement - the new SQL statement, which is going to replace the original one
Returns:
the SQL Engine instance

getDynamicCrudEngine

public SqlCrudEngine getDynamicCrudEngine(String name,
                                          String sqlStatement)
Returns the named dynamic SQL CRUD Engine instance (the primary SQL Processor class).

Specified by:
getDynamicCrudEngine in interface SqlEngineFactory
Parameters:
name - the name of the required SQL CRUD Engine instance
sqlStatement - the new SQL statement, which is going to replace the original one
Returns:
the SQL Engine instance

getDynamicProcedureEngine

public SqlProcedureEngine getDynamicProcedureEngine(String name,
                                                    String sqlStatement)
Returns the named dynamic SQL Procedure Engine instance (the primary SQL Processor class).

Specified by:
getDynamicProcedureEngine in interface SqlEngineFactory
Parameters:
name - the name of the required SQL Procedure Engine instance
sqlStatement - the new SQL statement, which is going to replace the original one
Returns:
the SQL Engine instance

getStatements

private Map<String,SqlMetaStatement> getStatements(SqlProcessorLoader.EngineType engineType)
Returns the static statements container based on required SQL Engine type

Parameters:
engineType - the required SQL Engine type
Returns:
the static statements container

getCheckedQueryEngine

public SqlQueryEngine getCheckedQueryEngine(String name)
                                     throws SqlEngineException
Returns the named static or dynamic SQL Query Engine instance (the primary SQL Processor class). In fact it returns the cached instance in the case it exists (it can be a static or dynamic one). Otherwise it instantiate a new static instance.

Specified by:
getCheckedQueryEngine in interface SqlEngineFactory
Parameters:
name - the name of the required SQL Query Engine instance
Returns:
the SQL Engine instance
Throws:
SqlEngineException - in the case the related statement is missing

getCheckedCrudEngine

public SqlCrudEngine getCheckedCrudEngine(String name)
Returns the named static or dynamic SQL CRUD Engine instance (the primary SQL Processor class). In fact it returns the cached instance in the case it exists (it can be a static or dynamic one). Otherwise it instantiate a new static instance.

Specified by:
getCheckedCrudEngine in interface SqlEngineFactory
Parameters:
name - the name of the required SQL CRUD Engine instance
Returns:
the SQL Engine instance

getCheckedProcedureEngine

public SqlProcedureEngine getCheckedProcedureEngine(String name)
Returns the named static or dynamic SQL Procedure Engine instance (the primary SQL Processor class). In fact it returns the cached instance in the case it exists (it can be a static or dynamic one). Otherwise it instantiate a new static instance.

Specified by:
getCheckedProcedureEngine in interface SqlEngineFactory
Parameters:
name - the name of the required SQL Procedure Engine instance
Returns:
the SQL Engine instance

getCheckedStaticQueryEngine

public SqlQueryEngine getCheckedStaticQueryEngine(String name)
                                           throws SqlEngineException
Returns the named static SQL Query Engine instance (the primary SQL Processor class).

Specified by:
getCheckedStaticQueryEngine in interface SqlEngineFactory
Parameters:
name - the name of the required SQL Query Engine instance
Returns:
the SQL Engine instance
Throws:
SqlEngineException - in the case the related statement is missing

getCheckedStaticCrudEngine

public SqlCrudEngine getCheckedStaticCrudEngine(String name)
Returns the named static SQL CRUD Engine instance (the primary SQL Processor class).

Specified by:
getCheckedStaticCrudEngine in interface SqlEngineFactory
Parameters:
name - the name of the required SQL CRUD Engine instance
Returns:
the SQL Engine instance

getCheckedStaticProcedureEngine

public SqlProcedureEngine getCheckedStaticProcedureEngine(String name)
Returns the named static SQL Procedure Engine instance (the primary SQL Processor class).

Specified by:
getCheckedStaticProcedureEngine in interface SqlEngineFactory
Parameters:
name - the name of the required SQL Procedure Engine instance
Returns:
the SQL Engine instance

check

private void check(String name,
                   SqlEngine sqlEngine)
Check the SQL Engine instance is not null

Parameters:
name - the name of the required SQL Engine instance
sqlEngine - the checked SQL Engine instance
Throws:
SqlEngineException - in the case the the SQL Engine instance is null

isLazyInit

public boolean isLazyInit()
Returns a flag which indicates the lazy initialization mode.

Specified by:
isLazyInit in interface SqlEngineFactory
Returns:
a flag which indicates the lazy initialization mode.


Copyright © 2014. All rights reserved.