Package org.sqlproc.engine.jmx
Class SqlDefaultFactoryMXBean
- java.lang.Object
-
- org.sqlproc.engine.jmx.SqlDefaultFactoryMXBean
-
public class SqlDefaultFactoryMXBean extends Object
The simplified JMX interface for the SQL Engine factory.The factory can be based on Spring DI framework for example.
For more info please see the Tutorials.
- Author:
- Vladimir Hudec
-
-
Field Summary
Fields Modifier and Type Field Description private SqlEngineFactorysqlEngineFactoryThe SQL Engine factory instance
-
Constructor Summary
Constructors Constructor Description SqlDefaultFactoryMXBean()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclearConfiguration()Resets the state of the dynamic configuration instance.voidclearConfigurationUsage()Reset the engines' usage counters.IntegergetAsyncInitThreads()Returns the number of threads used for asynchronous initializationprivate SqlEngineConfigurationgetConfiguration()Returns the dynamic SQL Processor configuration ant checks it's not nullList<String>getCrudDynamicNames()Returns the collection of names of all initialized/constructed dynamic SQL CRUD Engine instances.List<String>getCrudEngineProcessingCache(String name)Returns the processing cache used for the selected SQL CRUD EngineList<String>getCrudEngineProcessingCacheStatistics(String name)Returns the processing cache statistics used for the selected SQL CRUD EngineList<String>getCrudEnginesToInit()Returns the container of the CRUD Engines' names, which has to be initialized.intgetCrudEngineUsage(String name)Returns the CRUD Engine usage number.List<String>getCrudNames()Returns the collection of names of all initialized/constructed static SQL CRUD Engine instances.List<String>getDontProcessingCacheEngines()Returns the list of engines, for which the processing cache can't be usedList<String>getDoProcessingCacheEngines()Returns the list of engines, for which the processing cache can be usedStringgetEnginesInitErrors()Returns the result of engines initialization process.BooleangetInitInUsageOrder()Returns the indicator that the most frequently used engines should be initialized preferentiallyIntegergetInitTreshold()Returns the initialization threshold.List<String>getProcedureDynamicNames()Returns the collection of names of all initialized/constructed dynamic SQL ProcedureEngine instances.List<String>getProcedureEngineProcessingCache(String name)Returns the processing cache used for the selected SQL Procedure EngineList<String>getProcedureEngineProcessingCacheStatistics(String name)Returns the processing cache statistics used for the selected SQL Procedure EngineList<String>getProcedureEnginesToInit()Returns the container of the Procedure Engines' names, which has to be initialized.intgetProcedureEngineUsage(String name)Returns the Procedure Engine usage number.List<String>getProcedureNames()Returns the collection of names of all initialized/constructed static SQL ProcedureEngine instances.List<String>getQueryDynamicNames()Returns the collection of names of all initialized/constructed dynamic SQL Query Engine instances.List<String>getQueryEngineProcessingCache(String name)Returns the processing cache used for the selected SQL Query EngineList<String>getQueryEngineProcessingCacheStatistics(String name)Returns the processing cache statistics used for the selected SQL Query EngineList<String>getQueryEnginesToInit()Returns the container of the Query Engines' names, which has to be initialized.intgetQueryEngineUsage(String name)Returns the Query Engine usage number.List<String>getQueryNames()Returns the collection of names of all initialized/constructed static SQL Query Engine instances.BooleangetUseDynamicProcessingCache()Returns the indicator that the processing cache can be used dynamicallyBooleangetUseProcessingCache()Returns the indicator that the processing cache can be usedintinitCrudEngines(String names)In the case the SQL CRUD Engines are not initialized, a new static instances are established in the cache.intinitDontProcessingCache(String names)Updates the negative processing cache.intinitDoProcessingCache(String names)Updates the positive processing cache.intinitProcedureEngines(String names)In the case the SQL Procedure Engines are not initialized, a new static instances are established in the cache.intinitQueryEngines(String names)In the case the SQL Query Engines are not initialized, a new static instances are established in the cache.BooleanisAsyncInitFinished()Returns the flag indicating the asynchronous SQL Processor engines initialization has been finished.booleanisLazyInit()Returns the indicator to speed up the initialization processvoidloadConfiguration()Loads the persisted configuration.voidnewCrudEngine(String name, String sqlStatement)A new dynamic SQL CRUD Engine instance is established in the cache.voidnewProcedureEngine(String name, String sqlStatement)A new dynamic SQL Procedure Engine instance is established in the cache.voidnewQueryEngine(String name, String sqlStatement)A new dynamic SQL Query Engine instance is established in the cache.intresetCrudEngineProcessingCache(String name, String names)Clears the processing cache used for the selected SQL CRUD EngineintresetCrudEngines(String names)In the case any dynamic SQL CRUD Engine is in the cache, the static one is re-established.intresetCrudEngineUsage(String name)Resets the CRUD Engine usage number.intresetDontProcessingCache(String names)Updates the negative processing cache.intresetDoProcessingCache(String names)Updates the positive processing cache.intresetProcedureEngineProcessingCache(String name, String names)Clears the processing cache used for the selected SQL Procedure EngineintresetProcedureEngines(String names)In the case a dynamic SQL Procedure Engine is in the cache, the static one is re-established.intresetProcedureEngineUsage(String name)Resets the Procedure Engine usage number.intresetQueryEngineProcessingCache(String name, String names)Clears the processing cache used for the selected SQL Query EngineintresetQueryEngines(String names)In the case any dynamic SQL Query Engine is in the cache, the static one is re-established.intresetQueryEngineUsage(String name)Resets the Query Engine usage number.voidsetAsyncInitThreads(Integer asyncInitThreads)Sets the number of threads used for asynchronous initializationvoidsetInitInUsageOrder(Boolean initInUsageOrder)Sets the indicator that the most frequently used engines should be initialized preferentiallyvoidsetInitTreshold(Integer initTreshold)Sets the initialization threshold.voidsetLazyInit(boolean lazyInit)Sets the indicator to speed up the initialization processvoidsetSqlEngineFactory(SqlEngineFactory sqlEngineFactory)Sets the SQL Engine factory instancevoidsetUseDynamicProcessingCache(Boolean useDynamicProcessingCache)Sets the indicator that the processing cache can be used dynamicallyvoidsetUseProcessingCache(Boolean useProcessingCache)Sets the indicator that the processing cache can be usedvoidstoreConfiguration()Persists the configuration into the external file.private List<String>toList(Map<String,Integer> map)Converts list
-
-
-
Field Detail
-
sqlEngineFactory
private SqlEngineFactory sqlEngineFactory
The SQL Engine factory instance
-
-
Method Detail
-
initQueryEngines
public int initQueryEngines(String names)
In the case the SQL Query Engines are not initialized, a new static instances are established in the cache.- Parameters:
names- the names of the required SQL Query Engines instances- Returns:
- the number of successfully initialized engines
-
initCrudEngines
public int initCrudEngines(String names)
In the case the SQL CRUD Engines are not initialized, a new static instances are established in the cache.- Parameters:
names- the names of the required SQL CRUD Engines instances- Returns:
- the number of successfully initialized engines
-
initProcedureEngines
public int initProcedureEngines(String names)
In the case the SQL Procedure Engines are not initialized, a new static instances are established in the cache.- Parameters:
names- the names of the required SQL Procedure Engines instances- Returns:
- the number of successfully initialized engines
-
resetQueryEngines
public int resetQueryEngines(String names)
In the case any dynamic SQL Query Engine is in the cache, the static one is re-established.- Parameters:
names- the names of the required SQL Query Engines instances- Returns:
- the number of successfully reset engines
-
resetCrudEngines
public int resetCrudEngines(String names)
In the case any dynamic SQL CRUD Engine is in the cache, the static one is re-established.- Parameters:
names- the names of the required SQL CRUD Engines instances- Returns:
- the number of successfully reset engines
-
resetProcedureEngines
public int resetProcedureEngines(String names)
In the case a dynamic SQL Procedure Engine is in the cache, the static one is re-established.- Parameters:
names- the names of the required SQL Procedure Engines instances- Returns:
- the number of successfully reset engines
-
newQueryEngine
public void newQueryEngine(String name, String sqlStatement) throws SqlEngineException
A new dynamic SQL Query Engine instance is established in the cache. The static one is suppressed.- Parameters:
name- the name of the required SQL Query Engine instancesqlStatement- the new SQL statement, which is going to replace the original one- Throws:
SqlEngineException
-
newCrudEngine
public void newCrudEngine(String name, String sqlStatement)
A new dynamic SQL CRUD Engine instance is established in the cache. The static one is suppressed.- Parameters:
name- the name of the required SQL CRUD Engine instancesqlStatement- the new SQL statement, which is going to replace the original one
-
newProcedureEngine
public void newProcedureEngine(String name, String sqlStatement)
A new dynamic SQL Procedure Engine instance is established in the cache. The static one is suppressed.- Parameters:
name- the name of the required SQL Procedure Engine instancesqlStatement- the new SQL statement, which is going to replace the original one
-
getQueryNames
public List<String> getQueryNames()
Returns the collection of names of all initialized/constructed static SQL Query Engine instances.- Returns:
- The collection of all initialized static SQL Query Engine instances' names
-
getQueryDynamicNames
public List<String> getQueryDynamicNames()
Returns the collection of names of all initialized/constructed dynamic SQL Query Engine instances.- Returns:
- The collection of all initialized dynamic SQL Query Engine instances' names
-
getCrudNames
public List<String> getCrudNames()
Returns the collection of names of all initialized/constructed static SQL CRUD Engine instances.- Returns:
- The collection of all initialized static SQL CRUD Engine instances' names
-
getCrudDynamicNames
public List<String> getCrudDynamicNames()
Returns the collection of names of all initialized/constructed dynamic SQL CRUD Engine instances.- Returns:
- The collection of all initialized dynamic SQL CRUD Engine instances' names
-
getProcedureNames
public List<String> getProcedureNames()
Returns the collection of names of all initialized/constructed static SQL ProcedureEngine instances.- Returns:
- The collection of all initialized static SQL ProcedureEngine instances' names
-
getProcedureDynamicNames
public List<String> getProcedureDynamicNames()
Returns the collection of names of all initialized/constructed dynamic SQL ProcedureEngine instances.- Returns:
- The collection of all initialized dynamic SQL ProcedureEngine instances' names
-
getQueryEngineProcessingCache
public List<String> getQueryEngineProcessingCache(String name)
Returns the processing cache used for the selected SQL Query Engine- Parameters:
name- the name of the required SQL Query Engine- Returns:
- the processing cache used for the selected SQL Query Engine or the error message
-
getCrudEngineProcessingCache
public List<String> getCrudEngineProcessingCache(String name)
Returns the processing cache used for the selected SQL CRUD Engine- Parameters:
name- the name of the required SQL CRUD Engine- Returns:
- the processing cache used for the selected SQL CRUD Engine or the error message
-
getProcedureEngineProcessingCache
public List<String> getProcedureEngineProcessingCache(String name)
Returns the processing cache used for the selected SQL Procedure Engine- Parameters:
name- the name of the required SQL Procedure Engine- Returns:
- the processing cache used for the selected SQL Procedure Engine or the error message
-
getQueryEngineProcessingCacheStatistics
public List<String> getQueryEngineProcessingCacheStatistics(String name)
Returns the processing cache statistics used for the selected SQL Query Engine- Parameters:
name- the name of the required SQL Query Engine- Returns:
- the processing cache statistics used for the selected SQL Query Engine or the error message
-
getCrudEngineProcessingCacheStatistics
public List<String> getCrudEngineProcessingCacheStatistics(String name)
Returns the processing cache statistics used for the selected SQL CRUD Engine- Parameters:
name- the name of the required SQL CRUD Engine- Returns:
- the processing cache statistics used for the selected SQL CRUD Engine or the error message
-
getProcedureEngineProcessingCacheStatistics
public List<String> getProcedureEngineProcessingCacheStatistics(String name)
Returns the processing cache statistics used for the selected SQL Procedure Engine- Parameters:
name- the name of the required SQL Procedure Engine- Returns:
- the processing cache statistics used for the selected SQL Procedure Engine or the error message
-
resetQueryEngineProcessingCache
public int resetQueryEngineProcessingCache(String name, String names)
Clears the processing cache used for the selected SQL Query Engine- Parameters:
name- the name of the required SQL Query Enginenames- the names of the processing cache entries to be cleared- Returns:
- the number of successfully reset engine cache entries
-
resetCrudEngineProcessingCache
public int resetCrudEngineProcessingCache(String name, String names)
Clears the processing cache used for the selected SQL CRUD Engine- Parameters:
name- the name of the required SQL CRUD Enginenames- the names of the processing cache entries to be cleared- Returns:
- the number of successfully reset engine cache entries
-
resetProcedureEngineProcessingCache
public int resetProcedureEngineProcessingCache(String name, String names)
Clears the processing cache used for the selected SQL Procedure Engine- Parameters:
name- the name of the required SQL Procedure Enginenames- the names of the processing cache entries to be cleared- Returns:
- the number of successfully reset engine cache entries
-
getConfiguration
private SqlEngineConfiguration getConfiguration()
Returns the dynamic SQL Processor configuration ant checks it's not null- Returns:
- the dynamic SQL Processor configuration
-
isLazyInit
public boolean isLazyInit()
Returns the indicator to speed up the initialization process- Returns:
- the indicator to speed up the initialization process
-
setLazyInit
public void setLazyInit(boolean lazyInit)
Sets the indicator to speed up the initialization process- Parameters:
lazyInit- the indicator to speed up the initialization process
-
getAsyncInitThreads
public Integer getAsyncInitThreads()
Returns the number of threads used for asynchronous initialization- Returns:
- the number of threads used for asynchronous initialization
-
setAsyncInitThreads
public void setAsyncInitThreads(Integer asyncInitThreads)
Sets the number of threads used for asynchronous initialization- Parameters:
asyncInitThreads- the number of threads used for asynchronous initialization
-
getInitTreshold
public Integer getInitTreshold()
Returns the initialization threshold. The engines, which usage is at least this number should be initialized directly- Returns:
- the initialization threshold. The engines, which usage is at least this number should be initialized directly
-
setInitTreshold
public void setInitTreshold(Integer initTreshold)
Sets the initialization threshold. The engines, which usage is at least this number should be initialized directly- Parameters:
initTreshold- the initialization threshold. The engines, which usage is at least this number should be initialized directly
-
getInitInUsageOrder
public Boolean getInitInUsageOrder()
Returns the indicator that the most frequently used engines should be initialized preferentially- Returns:
- the indicator that the most frequently used engines should be initialized preferentially
-
setInitInUsageOrder
public void setInitInUsageOrder(Boolean initInUsageOrder)
Sets the indicator that the most frequently used engines should be initialized preferentially- Parameters:
initInUsageOrder- the indicator that the most frequently used engines should be initialized preferentially
-
isAsyncInitFinished
public Boolean isAsyncInitFinished()
Returns the flag indicating the asynchronous SQL Processor engines initialization has been finished.- Returns:
- the flag indicating the asynchronous SQL Processor engines initialization has been finished
-
getEnginesInitErrors
public String getEnginesInitErrors()
Returns the result of engines initialization process. For every engine, for which there's error in the initialization process there a error message. In the case there's no error, the result message is null.- Returns:
- the result of engines initialization process
-
loadConfiguration
public void loadConfiguration()
Loads the persisted configuration.
-
storeConfiguration
public void storeConfiguration()
Persists the configuration into the external file.
-
clearConfiguration
public void clearConfiguration()
Resets the state of the dynamic configuration instance.
-
clearConfigurationUsage
public void clearConfigurationUsage()
Reset the engines' usage counters.
-
toList
private List<String> toList(Map<String,Integer> map)
Converts list- Parameters:
map- the input list- Returns:
- the output list
-
getQueryEnginesToInit
public List<String> getQueryEnginesToInit()
Returns the container of the Query Engines' names, which has to be initialized. This is called during The SQL Processor initialization, so there's no need to handle concurrent changes.- Returns:
- the container of the Query Engines' names, which has to be initialized
-
getCrudEnginesToInit
public List<String> getCrudEnginesToInit()
Returns the container of the CRUD Engines' names, which has to be initialized. This is called during The SQL Processor initialization, so there's no need to handle concurrent changes.- Returns:
- the container of the CRUD Engines' names, which has to be initialized
-
getProcedureEnginesToInit
public List<String> getProcedureEnginesToInit()
Returns the container of the Procedure Engines' names, which has to be initialized. This is called during The SQL Processor initialization, so there's no need to handle concurrent changes.- Returns:
- the container of the Procedure Engines' names, which has to be initialized
-
getQueryEngineUsage
public int getQueryEngineUsage(String name)
Returns the Query Engine usage number.- Parameters:
name- the name of the SQL Query Engine- Returns:
- the Query Engine usage number
-
getCrudEngineUsage
public int getCrudEngineUsage(String name)
Returns the CRUD Engine usage number.- Parameters:
name- the name of the SQL CRUD Engine- Returns:
- the CRUD Engine usage number
-
getProcedureEngineUsage
public int getProcedureEngineUsage(String name)
Returns the Procedure Engine usage number.- Parameters:
name- the name of the SQL Procedure Engine- Returns:
- the Procedure Engine usage number
-
resetQueryEngineUsage
public int resetQueryEngineUsage(String name)
Resets the Query Engine usage number.- Parameters:
name- the name of the SQL Query Engine- Returns:
- the Query Engine usage number
-
resetCrudEngineUsage
public int resetCrudEngineUsage(String name)
Resets the CRUD Engine usage number.- Parameters:
name- the name of the SQL CRUD Engine- Returns:
- the CRUD Engine usage number
-
resetProcedureEngineUsage
public int resetProcedureEngineUsage(String name)
Resets the Procedure Engine usage number.- Parameters:
name- the name of the SQL Procedure Engine- Returns:
- the Procedure Engine usage number
-
getUseProcessingCache
public Boolean getUseProcessingCache()
Returns the indicator that the processing cache can be used- Returns:
- the indicator that the processing cache can be used
-
setUseProcessingCache
public void setUseProcessingCache(Boolean useProcessingCache)
Sets the indicator that the processing cache can be used- Parameters:
useProcessingCache- the indicator that the processing cache can be used
-
getUseDynamicProcessingCache
public Boolean getUseDynamicProcessingCache()
Returns the indicator that the processing cache can be used dynamically- Returns:
- the indicator that the processing cache can be used dynamically
-
setUseDynamicProcessingCache
public void setUseDynamicProcessingCache(Boolean useDynamicProcessingCache)
Sets the indicator that the processing cache can be used dynamically- Parameters:
useDynamicProcessingCache- the indicator that the processing cache can be used dynamically
-
getDoProcessingCacheEngines
public List<String> getDoProcessingCacheEngines()
Returns the list of engines, for which the processing cache can be used- Returns:
- the list of engines, for which the processing cache can be used
-
initDoProcessingCache
public int initDoProcessingCache(String names)
Updates the positive processing cache.- Parameters:
names- the names of the required SQL Query Engines instances- Returns:
- the number of successfully engines added to positive processing cache
-
resetDoProcessingCache
public int resetDoProcessingCache(String names)
Updates the positive processing cache.- Parameters:
names- the names of the required SQL Query Engines instances to be removed- Returns:
- the number of successfully engines removed from positive processing cache
-
getDontProcessingCacheEngines
public List<String> getDontProcessingCacheEngines()
Returns the list of engines, for which the processing cache can't be used- Returns:
- the list of engines, for which the processing cache can't be used
-
initDontProcessingCache
public int initDontProcessingCache(String names)
Updates the negative processing cache.- Parameters:
names- the names of the required SQL Query Engines instances to be excluded- Returns:
- the number of successfully engines added to negative processing cache
-
resetDontProcessingCache
public int resetDontProcessingCache(String names)
Updates the negative processing cache.- Parameters:
names- the names of the required SQL Query Engines instances to be reset- Returns:
- the number of successfully engines removed from negative processing cache
-
setSqlEngineFactory
public void setSqlEngineFactory(SqlEngineFactory sqlEngineFactory)
Sets the SQL Engine factory instance- Parameters:
sqlEngineFactory- the SQL Engine factory instance
-
-