|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.sqlproc.engine.impl.SqlProcessor
public class SqlProcessor
Pre-compiled META SQL statements, output mappings and optional features (also known as the SQL Processor artifacts). Instance of this class is created by the ANTLR parser. The grammar is defined in SqlProcessor.g.
Nested Class Summary | |
---|---|
static class |
SqlProcessor.FeatureType
The mapping rule type. |
(package private) static class |
SqlProcessor.FilterStatus
This status is the result of the filters processing, based on the next rules: in the case there are no filters - there are activeFilters, the artifact is dead - NOK - otherwise the artifact is ok - OK in the case there are filters - there are no activeFilters, the artifact is ok, but lower priority - OK_LOWER - there are activeFilters, and the intersection is not empty, the artifact is ok - OK - there are activeFilters, and the intersection is empty, the artifact is dead - NOK |
static class |
SqlProcessor.MappingType
The mapping rule type. |
static class |
SqlProcessor.StatementType
The META SQL statement type. |
Field Summary | |
---|---|
private Set<String> |
allArtifactsNames
The collection of all artifacts to enable duplicity control. |
private Map<String,Object> |
defaultFeatures
The collection of the SQL Processor default optional features. |
private List<ErrorMsg> |
errors
The list of all errors. |
private Map<String,Object> |
features
The collection of the SQL Processor optional features. |
protected static org.slf4j.Logger |
logger
The internal slf4j logger. |
private Pattern |
mapPattern
Pattern for MOPT |
(package private) Map<String,Map<String,SqlMappingRule>> |
mappingRules
The collection of the output value mappings. |
(package private) Map<String,Map<String,SqlMetaStatement>> |
metaStatements
The collection of the META SQL statements. |
private Set<String> |
onlyStatements
Only statements and rules with the names in this set are picked up from the statements' repository. |
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 List<String> |
warnings
The list of all warnings. |
Constructor Summary | |
---|---|
SqlProcessor(Map<String,Object> defaultFeatures,
Set<String> onlyStatements)
Creates a new instance. |
Method Summary | |
---|---|
boolean |
addFeature(String type,
String name,
String feature,
List<ErrorMsg> errors,
List<String> activeFilters,
String... filters)
Adds a new optional feature. |
boolean |
addMappingRule(String type,
String name,
String raw,
SqlMappingRule mapping,
List<ErrorMsg> errors,
List<String> activeFilters,
String... filters)
Adds a new output value mapping. |
(package private) boolean |
addMetaStatement(String type,
String name,
String raw,
SqlMetaStatement statement,
List<ErrorMsg> errors,
List<String> activeFilters,
String... filters)
Adds a new META SQL statement. |
protected void |
addWarnings(List<ErrorMsg> errors)
Adds all parsing errors as warnings. |
protected boolean |
duplicityControl(String type,
String name,
List<String> activeFilters)
Controls if the name of the artifact isn't already used. |
private List<String> |
filterActiveFilters(List<String> activeFilters)
Filter the active filters removing all values, which contain the character '=' |
protected SqlProcessor.FilterStatus |
filtersControl(String[] filters,
List<String> activeFilters)
Runs the business logic for the filters related to the artifact usability. |
List<ErrorMsg> |
getErrors()
Returns the list of error, which can happen in the process of this instance creation and ALTLR parsing |
protected Object |
getFeature(String type,
String feature)
Builds the correct class instance for the optional feature |
Map<String,Object> |
getFeatures()
Returns the collection of the SQL Processor optional features. |
static SqlProcessor |
getInstance(StringBuilder sbStatements,
SqlTypeFactory typeFactory,
Map<String,Object> defaultFeatures,
Set<String> onlyStatements,
String... filters)
Simple factory method (design pattern). |
static SqlProcessor |
getLazyInstance(StringBuilder sbStatements,
SqlTypeFactory typeFactory,
Map<String,Object> defaultFeatures,
Set<String> onlyStatements,
String... filters)
Simple factory method (design pattern). |
Map<String,SqlMappingRule> |
getMappingRules(SqlProcessor.MappingType type)
Returns the collection of the output value mappings. |
Map<String,SqlMappingRule> |
getMappingRules(String type)
Returns the collection of the output value mappings. |
Map<String,SqlMetaStatement> |
getMetaStatements(SqlProcessor.StatementType type)
Returns the collection of the META SQL statements. |
Map<String,SqlMetaStatement> |
getMetaStatements(String type)
Returns the collection of the META SQL statements. |
Map<String,Map<String,Object>> |
getStatementsFeatures()
Returns the collection of the SQL Processor optional features in the statement context. |
Map<String,Set<String>> |
getStatementsFeaturesUnset()
Returns the collection of the SQL Processor optional features to be cleared in the statement context. |
List<String> |
getWarnings()
Returns the list of warnings, which can happen in the process of this instance creation and ALTLR parsing |
private void |
loadStatementFeatures(String name,
List<String> activeFilters)
Some filters can be the optional features in the statement context. |
protected boolean |
nameControl(Set<String> onlyStatements,
String name)
Controls, if the artifact name is listed in the provided container |
protected String |
uniqueArtifactName(String type,
String name,
List<String> activeFilters)
Builds the unique artifact name. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static org.slf4j.Logger logger
private Pattern mapPattern
Map<String,Map<String,SqlMetaStatement>> metaStatements
Map<String,Map<String,SqlMappingRule>> mappingRules
private Map<String,Object> features
private Map<String,Map<String,Object>> statementsFeatures
private Map<String,Set<String>> statementsFeaturesUnset
private Map<String,Object> defaultFeatures
private Set<String> onlyStatements
private Set<String> allArtifactsNames
private List<String> warnings
private List<ErrorMsg> errors
Constructor Detail |
---|
SqlProcessor(Map<String,Object> defaultFeatures, Set<String> onlyStatements)
Method Detail |
---|
public static SqlProcessor getInstance(StringBuilder sbStatements, SqlTypeFactory typeFactory, Map<String,Object> defaultFeatures, Set<String> onlyStatements, String... filters) throws SqlEngineException
sbStatements
- String representation of the META SQL queries/statements/output mappingstypeFactory
- the factory for the META types constructiondefaultFeatures
- the default features based on SqlFeature
onlyStatements
- only the statements and rules with the names in this set are picked up from the statements' repositoryfilters
- only the artifacts without active filters and the artifacts with the active filter from this
collections are picked up from the statements' repository
SqlEngineException
- in the case of ANTLR parsing exceptionpublic static SqlProcessor getLazyInstance(StringBuilder sbStatements, SqlTypeFactory typeFactory, Map<String,Object> defaultFeatures, Set<String> onlyStatements, String... filters) throws SqlEngineException
sbStatements
- String representation of the META SQL queries/statements/output mappingstypeFactory
- the factory for the META types constructiondefaultFeatures
- the default features based on SqlFeature
onlyStatements
- only the statements and rules with the names in this set are picked up from the statements' repositoryfilters
- only the artifacts without active filters and the artifacts with the active filter from this
collections are picked up from the statements' repository
SqlEngineException
- in the case of ANTLR parsing exceptionpublic Map<String,SqlMetaStatement> getMetaStatements(SqlProcessor.StatementType type)
type
- the META SQL statement type
public Map<String,SqlMetaStatement> getMetaStatements(String type)
type
- the String representation of the META SQL statement type
boolean addMetaStatement(String type, String name, String raw, SqlMetaStatement statement, List<ErrorMsg> errors, List<String> activeFilters, String... filters)
type
- the String representation of the META SQL statement typename
- the name of the META SQL statementraw
- the raw (not pre-compiled) representation of the META SQL statementstatement
- the META SQL statementerrors
- the list of potential errors created during the ANTLR based parsingactiveFilters
- the active filters from the META SQL statement definitionfilters
- only the artifacts without active filters and the artifacts with the active filter from this
collections are taken into this instance of the SQL Processor
public Map<String,SqlMappingRule> getMappingRules(SqlProcessor.MappingType type)
type
- the input/output mapping rule type
public Map<String,SqlMappingRule> getMappingRules(String type)
type
- the String representation of the input/output mapping rule type
public boolean addMappingRule(String type, String name, String raw, SqlMappingRule mapping, List<ErrorMsg> errors, List<String> activeFilters, String... filters)
type
- the String representation of the output value mapping typename
- the name of the output value mappingraw
- the raw (not pre-compiled) representation of the output value mappingmapping
- the output value mappingerrors
- the list of potential errors created during the ANTLR based parsingactiveFilters
- the active filters from the output value mapping definitionfilters
- only the artifacts without active filters and the artifacts with the active filter from this
collections are taken into this instance of the SQL Processor
public Map<String,Object> getFeatures()
public Map<String,Map<String,Object>> getStatementsFeatures()
public Map<String,Set<String>> getStatementsFeaturesUnset()
protected Object getFeature(String type, String feature)
type
- the type of the optional feature based on enumaration SqlProcessor.FeatureType
feature
- the String representation of the optional feature
public boolean addFeature(String type, String name, String feature, List<ErrorMsg> errors, List<String> activeFilters, String... filters)
type
- the String representation of the optional feature typename
- the name of the optional featurefeature
- the optional featureerrors
- the list of potential errors created during the ANTLR based parsingactiveFilters
- the active filters from the optional feature definitionfilters
- only the artifacts without active filters and the artifacts with the active filter from this
collections are taken into this instance of the SQL Processor
protected boolean duplicityControl(String type, String name, List<String> activeFilters)
type
- the String representation of the artifact typename
- the name of the artifactactiveFilters
- the active filters from the artifact definition
protected String uniqueArtifactName(String type, String name, List<String> activeFilters)
type
- the String representation of the artifact typename
- the name of the artifactactiveFilters
- the active filters from the artifact definition
protected void addWarnings(List<ErrorMsg> errors)
errors
- the list of potential errors created during the ANTLR based parsingpublic List<String> getWarnings()
public List<ErrorMsg> getErrors()
protected SqlProcessor.FilterStatus filtersControl(String[] filters, List<String> activeFilters)
activeFilters
- the active filters from the artifact definitionfilters
- only the artifacts without active filters and the artifacts with the active filter from this
collections are taken into this instance of the SQL Processor
protected boolean nameControl(Set<String> onlyStatements, String name)
onlyStatements
- only the statements and rules with the names in this set are picked up from the statements' repositoryname
- the artifact name
private List<String> filterActiveFilters(List<String> activeFilters)
activeFilters
- the active filters from the artifact definition
private void loadStatementFeatures(String name, List<String> activeFilters)
name
- the name of the META SQL statementactiveFilters
- the active filters from the META SQL statement definition
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |