|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.sqlproc.engine.SqlEngineLoader
@Deprecated public class SqlEngineLoader
The helper class for the META SQL statements and mapping rules parsing. These statements and rules are taken from the
Properties
.
The purpose of this class is to load and analyze (=parse) the META SQL statements and mapping rules located in the
properties repository. The standard properties repository is the external properties file with the name
queries.properties
.
This is rather a low level helper class. For more simple approach please see SqlSimpleFactory
All the properties with the key QRY_...
are parsed as the META SQL queries using the ANTLR based
grammar.
All the properties with the key CRUD_...
are parsed as the META SQL CRUD statements using the ANTLR
based grammar.
All the properties with the key CALL_...
are parsed as the META SQL CALL statements using the ANTLR
based grammar. These are used to call the stored procedures.
All the properties with the key 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 properties with the key SET_...
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 SqlEngineLoader, Spring DI configuration can be utilized, like the next one:
<beans ...> ... <bean id="typeFactory" class="org.sqlproc.engine.jdbc.type.JdbcTypeFactory" factory-method="getInstance" /> <bean id="sqlQueries" class="org.springframework.beans.factory.config.PropertiesFactoryBean"> <property name="location"> <value>classpath:queries.properties</value> </property> </bean> <bean id="sqlLoader" class="org.sqlproc.engine.SqlEngineLoader"> <constructor-arg ref="sqlQueries" /> <constructor-arg ref="typeFactory" /> </bean> </beans>and use the next code to obtain an instance of the SQL Query engine
SqlQueryEngine sqlEngine = sqlLoader.getQueryEngine("ALL");or the next code to obtain an instance of the SQL CRUD engine
SqlCrudEngine sqlEngine = sqlLoader.getCrudEngine("ALL");
Another possibility is to utilize SqlPropertiesLoader
.
SqlPropertiesLoader loader = new SqlPropertiesLoader("queries.properties", this.getClass()); SqlEngineLoader sqlLoader = new SqlEngineLoader(loader.getProperties(), JdbcTypeFactory.getInstance()); SqlEngine sqlEngine = sqlLoader.getQueryEngine("ALL");
For more info please see the Tutorials.
Field Summary | |
---|---|
private static String |
CALL_PREFIX
Deprecated. |
private Map<String,String> |
calls
Deprecated. The collection of named META SQL CALLABLE statements. |
private SqlTypeFactory |
composedTypeFactory
Deprecated. |
private static String |
CRUD_PREFIX
Deprecated. |
private Map<String,String> |
cruds
Deprecated. The collection of named META SQL CRUD statements. |
private Map<String,SqlEngine> |
engines
Deprecated. The collection of named SQL Engines (the primary SQL Processor class) instances. |
private Map<String,Object> |
features
Deprecated. The collection of the SQL Processor optional features. |
private static String |
FIELDS_REFERENCE
Deprecated. |
private static String |
INPUT_MAPPING_PREFIX
Deprecated. |
private static int |
lCALL_PREFIX
Deprecated. |
private static int |
lCRUD_PREFIX
Deprecated. |
private static int |
lFIELDS_REFERENCE
Deprecated. |
protected org.slf4j.Logger |
logger
Deprecated. The internal slf4j logger. |
private static int |
lOUTPUT_MAPPING_PREFIX
Deprecated. |
private static int |
lQUERY_PREFIX
Deprecated. |
private static int |
lSET_PREFIX
Deprecated. |
private static String |
OUTPUT_MAPPING_PREFIX
Deprecated. |
private Map<String,String> |
outs
Deprecated. The collection of named explicitly defined mapping rules. |
private static String |
QUERY_PREFIX
Deprecated. |
private static String |
SET_PREFIX
Deprecated. |
private Map<String,String> |
sqls
Deprecated. The collection of named META SQL queries. |
Constructor Summary | |
---|---|
SqlEngineLoader(Properties props,
SqlTypeFactory typeFactory)
Deprecated. Creates a new instance of the SqlEngineLoader from the properties repository (which is in fact a collection of the META SQL statements, mapping rules and optional features. |
|
SqlEngineLoader(Properties props,
SqlTypeFactory typeFactory,
String filter)
Deprecated. Creates a new instance of the SqlEngineLoader from the properties repository (which is in fact a collection of the META SQL statements, mapping rules and optional features. |
|
SqlEngineLoader(Properties props,
SqlTypeFactory typeFactory,
String filter,
SqlMonitorFactory monitorFactory)
Deprecated. Creates a new instance of the SqlEngineLoader from the properties repository (which is in fact a collection of the META SQL statements, mapping rules and optional features. |
|
SqlEngineLoader(Properties props,
SqlTypeFactory typeFactory,
String filter,
SqlMonitorFactory monitorFactory,
List<SqlInternalType> customTypes,
String... onlyStatements)
Deprecated. Creates a new instance of the SqlEngineLoader from the properties repository (which is in fact a collection of the META SQL statements, mapping rules and optional features. |
|
SqlEngineLoader(Properties props,
SqlTypeFactory typeFactory,
String filter,
SqlMonitorFactory monitorFactory,
String... onlyStatements)
Deprecated. Creates a new instance of the SqlEngineLoader from the properties repository (which is in fact a collection of the META SQL statements, mapping rules and optional features. |
Method Summary | |
---|---|
SqlCrudEngine |
getCrudEngine(String name)
Deprecated. Returns the named SQL CRUD Engine instance (the primary SQL Processor class). |
String |
getMappingRule(String name)
Deprecated. Returns the named mapping rule. |
String |
getMetaSql(String name)
Deprecated. Returns the named META SQL query/statement. |
Collection<String> |
getNames()
Deprecated. Returns the collection of names of all initialized/constructed SQL Engine instances. |
SqlProcedureEngine |
getProcedureEngine(String name)
Deprecated. Returns the named SQL Procedure Engine instance (the primary SQL Processor class). |
SqlQueryEngine |
getQueryEngine(String name)
Deprecated. Returns the named SQL Query Engine instance (the primary SQL Processor class). |
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
private static final String SET_PREFIX
private static final int lSET_PREFIX
private static final String FIELDS_REFERENCE
private static final int lFIELDS_REFERENCE
private static final String QUERY_PREFIX
private static final int lQUERY_PREFIX
private static final String INPUT_MAPPING_PREFIX
private static final String OUTPUT_MAPPING_PREFIX
private static final int lOUTPUT_MAPPING_PREFIX
private static final String CRUD_PREFIX
private static final int lCRUD_PREFIX
private static final String CALL_PREFIX
private static final int lCALL_PREFIX
private SqlTypeFactory composedTypeFactory
private Map<String,SqlEngine> engines
private Map<String,String> sqls
private Map<String,String> cruds
private Map<String,String> calls
private Map<String,String> outs
private Map<String,Object> features
Constructor Detail |
---|
public SqlEngineLoader(Properties props, SqlTypeFactory typeFactory) throws SqlEngineException
props
- the collection of META SQL statements, mapping rules and optional features located in the properties
repositorytypeFactory
- the factory for the META types construction
SqlEngineException
- mainly in the case the provided statements or rules are not compliant with the ANTLR based grammarpublic SqlEngineLoader(Properties props, SqlTypeFactory typeFactory, String filter) throws SqlEngineException
props
- the collection of META SQL statements, mapping rules and optional featurestypeFactory
- the factory for the META types constructionfilter
- the properties name prefix to filter the META SQL statements, mapping rules and optional features
SqlEngineException
- mainly in the case the provided statements or rules are not compliant with the ANTLR based grammarpublic SqlEngineLoader(Properties props, SqlTypeFactory typeFactory, String filter, SqlMonitorFactory monitorFactory) throws SqlEngineException
props
- the collection of META SQL statements, mapping rules and optional featurestypeFactory
- the factory for the META types constructionfilter
- the properties name prefix to filter the META SQL statements, mapping rules and optional featuresmonitorFactory
- the monitor factory used in the process of the SQL Monitor instances creation
SqlEngineException
- mainly in the case the provided statements or rules are not compliant with the ANTLR based grammarpublic SqlEngineLoader(Properties props, SqlTypeFactory typeFactory, String filter, SqlMonitorFactory monitorFactory, String... onlyStatements)
props
- the collection of META SQL statements, mapping rules and optional featurestypeFactory
- the factory for the META types constructionfilter
- the properties name prefix to filter the META SQL statements, mapping rules and optional featuresmonitorFactory
- the monitor factory used in the process of the SQL Monitor instances creationonlyStatements
- only statements and rules with the names in this set are picked up from the properties repository
SqlEngineException
- mainly in the case the provided statements or rules are not compliant with the ANTLR based grammarpublic SqlEngineLoader(Properties props, SqlTypeFactory typeFactory, String filter, SqlMonitorFactory monitorFactory, List<SqlInternalType> customTypes, String... onlyStatements) throws SqlEngineException
props
- the collection of META SQL statements, mapping rules and optional featurestypeFactory
- the factory for the META types constructionfilter
- the properties name prefix to filter the META SQL statements, mapping rules and optional featuresmonitorFactory
- the monitor factory used in the process of the SQL Monitor instances creationcustomTypes
- the custom META typesonlyStatements
- only statements and rules with the names in this set are picked up from the properties repository
SqlEngineException
- mainly in the case the provided statements or rules are not compliant with the ANTLR based grammarMethod Detail |
---|
public Collection<String> getNames()
public String getMetaSql(String name)
name
- the name of the required META SQL query/statement
public String getMappingRule(String name)
name
- the name of the required mapping rule
public SqlQueryEngine getQueryEngine(String name)
getQueryEngine
in interface SqlEngineFactory
name
- the name of the required SQL Query Engine instance
public SqlCrudEngine getCrudEngine(String name)
getCrudEngine
in interface SqlEngineFactory
name
- the name of the required SQL CRUD Engine instance
public SqlProcedureEngine getProcedureEngine(String name)
getProcedureEngine
in interface SqlEngineFactory
name
- the name of the required SQL Procedure Engine instance
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |