public class SqlEngineConfiguration extends Object
The primary goal of this configuration is the eager initialization of the selected SQL Engines. The overall
configuration can be also persisted using the sql-processor-spring.
The configuration can be dynamically changed using the JMX interface
SqlDefaultFactoryMXBean
.
For more info please see the Tutorials.
Modifier and Type | Class and Description |
---|---|
class |
SqlEngineConfiguration.NameValue
The simple container.
|
Modifier and Type | Field and Description |
---|---|
private Integer |
asyncInitThreads
The number of threads used for asynchronous initialization.
|
private ConcurrentHashMap<String,AtomicInteger> |
crudEngines
The container of initialized CRUD Engines' names (static or dynamic ones) together with the number of their
usage.
|
private Set<String> |
dontProcessingCacheEngines
Negative list of engines, for which the processing cache can be used.
|
private Set<String> |
doProcessingCacheEngines
Positive list of engines, for which the processing cache can be used.
|
private ConcurrentHashMap<String,String> |
dynamicCrudEngines
The container of initialized dynamic CRUD Engines' names together with their SQL statement.
|
private ConcurrentHashMap<String,String> |
dynamicProcedureEngines
The container of initialized dynamic Procedure Engines' names together with their SQL statement.
|
private ConcurrentHashMap<String,String> |
dynamicQueryEngines
The container of initialized dynamic Query Engines' names together with their SQL statement.
|
private Boolean |
initClearUsage
After the engines instantiations the users should be cleared.
|
private Boolean |
initInUsageOrder
The most frequently used engines should be initialized preferentially.
|
private Integer |
initTreshold
The engines, which usage is at least this number should be initialized directly.
|
private Boolean |
lazyInit
This flag indicates to speed up the initialization process.
|
(package private) org.slf4j.Logger |
logger
The internal slf4j logger.
|
private ConcurrentHashMap<String,AtomicInteger> |
procedureEngines
The container of initialized Procedure Engines' names (static or dynamic ones) together with the number of their
usage.
|
private ConcurrentHashMap<String,AtomicInteger> |
queryEngines
The container of initialized Query Engines' names (static or dynamic ones) together with the number of their
usage.
|
private SqlEngineConfigurationStore |
store
The store to persist this configuration;
|
private Boolean |
useDynamicProcessingCache
The processing cache can be used for
SqlProcessResult instances dynamically. |
private Boolean |
useProcessingCache
The processing cache can be used for
SqlProcessResult instances. |
Constructor and Description |
---|
SqlEngineConfiguration()
The default constructor.
|
SqlEngineConfiguration(SqlEngineConfigurationStore store)
The constructor takes data from the persisted state in external file.
|
SqlEngineConfiguration(String directory,
String fileName)
The constructor takes data from the persisted state in external file.
|
Modifier and Type | Method and Description |
---|---|
int |
addCrudEngine(String name)
Adds the CRUD Engine to the container of initialized engines.
|
int |
addDynamicCrudEngine(String name,
String sqlStatement)
Adds the dynamic CRUD Engine to the container of initialized engines.
|
int |
addDynamicProcedureEngine(String name,
String sqlStatement)
Adds the dynamic Procedure Engine to the container of initialized engines.
|
int |
addDynamicQueryEngine(String name,
String sqlStatement)
Adds the dynamic Query Engine to the container of initialized engines.
|
protected int |
addEngine(String name,
ConcurrentHashMap<String,AtomicInteger> engines)
Adds the SQL Engine to the container of initialized engines.
|
int |
addProcedureEngine(String name)
Adds the Procedure Engine to the container of initialized engines.
|
int |
addQueryEngine(String name)
Adds the Query Engine to the container of initialized engines.
|
void |
clear()
Reset the state of the dynamic configuration instance.
|
void |
clearUsage()
Reset the engines' usage counters.
|
Integer |
getAsyncInitThreads()
Returns the number of threads used for asynchronous initialization
|
ConcurrentHashMap<String,AtomicInteger> |
getCrudEngines()
Returns the container of initialized CRUD Engines' names (static or dynamic ones) together with the number of
their usage
|
Map<String,Integer> |
getCrudEnginesToInit(Integer treshold)
Returns the container of the CRUD Engines' names, which has to be initialized.
|
Set<String> |
getDontProcessingCacheEngines()
Returns the list of engines, for which the processing cache can't be used
|
Set<String> |
getDoProcessingCacheEngines()
Returns the list of engines, for which the processing cache can be used
|
ConcurrentHashMap<String,String> |
getDynamicCrudEngines()
Returns the container of initialized dynamic CRUD Engines' names together with their SQL statement
|
ConcurrentHashMap<String,String> |
getDynamicProcedureEngines()
Returns the container of initialized dynamic Procedure Engines' names together with their SQL statement
|
ConcurrentHashMap<String,String> |
getDynamicQueryEngines()
Returns the container of initialized dynamic Query Engines' names together with their SQL statement
|
protected Map<String,Integer> |
getEnginesToInit(ConcurrentHashMap<String,AtomicInteger> engines,
Integer treshold)
Returns the container of the SQL Engines' names, which has to be initialized.
|
Boolean |
getInitClearUsage()
Returns the indicator that after the engines instantiations the users should be cleared
|
Boolean |
getInitInUsageOrder()
Returns the indicator that the most frequently used engines should be initialized preferentially
|
Integer |
getInitTreshold()
Returns the initialization threshold.
|
Boolean |
getLazyInit()
Returns the indicator to speed up the initialization process
|
ConcurrentHashMap<String,AtomicInteger> |
getProcedureEngines()
Returns the container of initialized Procedure Engines' names (static or dynamic ones) together with the number
of their usage
|
Map<String,Integer> |
getProcedureEnginesToInit(Integer treshold)
Returns the container of the Procedure Engines' names, which has to be initialized.
|
ConcurrentHashMap<String,AtomicInteger> |
getQueryEngines()
Returns the container of initialized Query Engines' names (static or dynamic ones) together with the number of
their usage
|
Map<String,Integer> |
getQueryEnginesToInit(Integer treshold)
Returns the container of the Query Engines' names, which has to be initialized.
|
Boolean |
getUseDynamicProcessingCache()
Returns the indicator that the processing cache can be used dynamically
|
Boolean |
getUseProcessingCache()
Returns the indicator that the processing cache can be used
|
void |
load()
Loads the persisted configuration.
|
int |
removeCrudEngine(String name)
Removes the CRUD Engine from the container of initialized engines.
|
int |
removeDynamicCrudEngine(String name)
Removes the dynamic CRUD Engine from the container of initialized engines.
|
int |
removeDynamicProcedureEngine(String name)
Removes the dynamic Procedure Engine from the container of initialized engines.
|
int |
removeDynamicQueryEngine(String name)
Removes the dynamic Query Engine from the container of initialized engines.
|
protected int |
removeEngine(String name,
ConcurrentHashMap<String,AtomicInteger> engines)
Removes the SQL Engine from the container of initialized engines.
|
int |
removeProcedureEngine(String name)
Removes the Procedure Engine from the container of initialized engines.
|
int |
removeQueryEngine(String name)
Removes the Query Engine from the container of initialized engines.
|
void |
setAsyncInitThreads(Integer asyncInitThreads)
Sets the number of threads used for asynchronous initialization
|
void |
setCrudEngines(ConcurrentHashMap<String,AtomicInteger> crudEngines)
Sets the container of initialized CRUD Engines' names (static or dynamic ones) together with the number of their
usage
|
void |
setDontProcessingCacheEngines(Set<String> dontProcessingCacheEngines)
Sets the list of engines, for which the processing cache can't be used
|
void |
setDoProcessingCacheEngines(Set<String> doProcessingCacheEngines)
Sets the list of engines, for which the processing cache can be used
|
void |
setDynamicCrudEngines(ConcurrentHashMap<String,String> dynamicCrudEngines)
Sets the container of initialized dynamic CRUD Engines' names together with their SQL statement
|
void |
setDynamicProcedureEngines(ConcurrentHashMap<String,String> dynamicProcedureEngines)
Sets the container of initialized dynamic Procedure Engines' names together with their SQL statement
|
void |
setDynamicQueryEngines(ConcurrentHashMap<String,String> dynamicQueryEngines)
Sets the container of initialized dynamic Query Engines' names together with their SQL statement
|
void |
setInitClearUsage(Boolean initClearUsage)
Sets the indicator that after the engines instantiations the users should be cleared
|
void |
setInitInUsageOrder(Boolean initInUsageOrder)
Sets the indicator that the most frequently used engines should be initialized preferentially
|
void |
setInitTreshold(Integer initTreshold)
Sets the initialization threshold.
|
void |
setLazyInit(Boolean lazyInit)
Sets the indicator to speed up the initialization process
|
void |
setProcedureEngines(ConcurrentHashMap<String,AtomicInteger> procedureEngines)
Sets the container of initialized Procedure Engines' names (static or dynamic ones) together with the number of
their usage
|
void |
setQueryEngines(ConcurrentHashMap<String,AtomicInteger> queryEngines)
Sets the container of initialized Query Engines' names (static or dynamic ones) together with the number of their
usage
|
void |
setUseDynamicProcessingCache(Boolean useDynamicProcessingCache)
Sets the indicator that the processing cache can be used for dynamically
|
void |
setUseProcessingCache(Boolean useProcessingCache)
Sets the indicator that the processing cache can be used
|
void |
store()
Persist the configuration into the external file.
|
String |
toString() |
final org.slf4j.Logger logger
private ConcurrentHashMap<String,AtomicInteger> queryEngines
private ConcurrentHashMap<String,AtomicInteger> crudEngines
private ConcurrentHashMap<String,AtomicInteger> procedureEngines
private ConcurrentHashMap<String,String> dynamicQueryEngines
private ConcurrentHashMap<String,String> dynamicCrudEngines
private ConcurrentHashMap<String,String> dynamicProcedureEngines
private Boolean lazyInit
private Integer asyncInitThreads
private Integer initTreshold
private Boolean initInUsageOrder
private Boolean initClearUsage
private Boolean useProcessingCache
SqlProcessResult
instances.private Boolean useDynamicProcessingCache
SqlProcessResult
instances dynamically.private Set<String> doProcessingCacheEngines
private Set<String> dontProcessingCacheEngines
private SqlEngineConfigurationStore store
public SqlEngineConfiguration()
public SqlEngineConfiguration(String directory, String fileName) throws IOException, JAXBException
directory
- the directory, where the persisted file is placedfileName
- the name of the persisted fileIOException
- in the case there's a I/O problem with the persisted fileJAXBException
- in the case there's a problem with JAXB deserializationpublic SqlEngineConfiguration(SqlEngineConfigurationStore store)
store
- the store to persist this configurationIOException
- in the case there's a I/O problem with the persisted fileJAXBException
- in the case there's a problem with JAXB deserializationpublic void load() throws JAXBException
JAXBException
public void store()
public void clear()
public void clearUsage()
protected int addEngine(String name, ConcurrentHashMap<String,AtomicInteger> engines)
name
- the name of the SQL Engineengines
- the container of initialized enginesprotected int removeEngine(String name, ConcurrentHashMap<String,AtomicInteger> engines)
name
- the name of the SQL Engineengines
- the container of initialized enginespublic int addQueryEngine(String name)
name
- the name of the Query Enginepublic int addCrudEngine(String name)
name
- the name of the CRUD Enginepublic int addProcedureEngine(String name)
name
- the name of the Procedure Enginepublic int removeQueryEngine(String name)
name
- the name of the Query Enginepublic int removeCrudEngine(String name)
name
- the name of the CRUD Enginepublic int removeProcedureEngine(String name)
name
- the name of the Procedure Enginepublic int addDynamicQueryEngine(String name, String sqlStatement)
name
- the name of the dynamic Query Enginepublic int addDynamicCrudEngine(String name, String sqlStatement)
name
- the name of the dynamic CRUD Enginepublic int addDynamicProcedureEngine(String name, String sqlStatement)
name
- the name of the dynamic Procedure Enginepublic int removeDynamicQueryEngine(String name)
name
- the name of the dynamic Query Enginepublic int removeDynamicCrudEngine(String name)
name
- the name of the dynamic CRUD Enginepublic int removeDynamicProcedureEngine(String name)
name
- the name of the dynamic Procedure Enginepublic ConcurrentHashMap<String,AtomicInteger> getQueryEngines()
public ConcurrentHashMap<String,AtomicInteger> getCrudEngines()
public ConcurrentHashMap<String,AtomicInteger> getProcedureEngines()
public ConcurrentHashMap<String,String> getDynamicQueryEngines()
public ConcurrentHashMap<String,String> getDynamicCrudEngines()
public ConcurrentHashMap<String,String> getDynamicProcedureEngines()
public void setQueryEngines(ConcurrentHashMap<String,AtomicInteger> queryEngines)
queryEngines
- the container of initialized Query Engines' names (static or dynamic ones) together with the number of
their usagepublic void setCrudEngines(ConcurrentHashMap<String,AtomicInteger> crudEngines)
crudEngines
- the container of initialized CRUD Engines' names (static or dynamic ones) together with the number of
their usagepublic void setProcedureEngines(ConcurrentHashMap<String,AtomicInteger> procedureEngines)
procedureEngines
- the container of initialized Procedure Engines' names (static or dynamic ones) together with the
number of their usagepublic void setDynamicQueryEngines(ConcurrentHashMap<String,String> dynamicQueryEngines)
dynamicQueryEngines
- the container of initialized dynamic Query Engines' names together with their SQL statementpublic void setDynamicCrudEngines(ConcurrentHashMap<String,String> dynamicCrudEngines)
dynamicCrudEngines
- the container of initialized dynamic CRUD Engines' names together with their SQL statementpublic void setDynamicProcedureEngines(ConcurrentHashMap<String,String> dynamicProcedureEngines)
dynamicProcedureEngines
- the container of initialized dynamic Procedure Engines' names together with their SQL statementpublic Boolean getLazyInit()
public void setLazyInit(Boolean lazyInit)
lazyInit
- the indicator to speed up the initialization processpublic Integer getAsyncInitThreads()
public void setAsyncInitThreads(Integer asyncInitThreads)
asyncInitThreads
- the number of threads used for asynchronous initializationpublic Integer getInitTreshold()
public void setInitTreshold(Integer initTreshold)
initTreshold
- the initialization threshold. The engines, which usage is at least this number should be initialized
directlypublic Boolean getInitInUsageOrder()
public void setInitInUsageOrder(Boolean initInUsageOrder)
initInUsageOrder
- the indicator that the most frequently used engines should be initialized preferentiallypublic Boolean getInitClearUsage()
public void setInitClearUsage(Boolean initClearUsage)
initClearUsage
- the indicator that after the engines instantiations the users should be clearedpublic Boolean getUseProcessingCache()
public void setUseProcessingCache(Boolean useProcessingCache)
useProcessingCache
- the indicator that the processing cache can be usedpublic Boolean getUseDynamicProcessingCache()
public void setUseDynamicProcessingCache(Boolean useDynamicProcessingCache)
useDynamicProcessingCache
- the indicator that the processing cache can be used dynamicallypublic Set<String> getDoProcessingCacheEngines()
public void setDoProcessingCacheEngines(Set<String> doProcessingCacheEngines)
doProcessingCacheEngines
- the list of engines, for which the processing cache can be usedpublic Set<String> getDontProcessingCacheEngines()
public void setDontProcessingCacheEngines(Set<String> dontProcessingCacheEngines)
dontProcessingCacheEngines
- the list of engines, for which the processing cache can't be usedprotected Map<String,Integer> getEnginesToInit(ConcurrentHashMap<String,AtomicInteger> engines, Integer treshold)
engines
- the container of initialized enginestreshold
- the engines, which usage is at least this number should be initialized directlypublic Map<String,Integer> getQueryEnginesToInit(Integer treshold)
treshold
- the engines, which usage is at least this number should be initialized directlypublic Map<String,Integer> getCrudEnginesToInit(Integer treshold)
treshold
- the engines, which usage is at least this number should be initialized directlypublic Map<String,Integer> getProcedureEnginesToInit(Integer treshold)
treshold
- the engines, which usage is at least this number should be initialized directlyCopyright © 2017. All rights reserved.