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 Details

    • sqlEngineFactory

      private SqlEngineFactory sqlEngineFactory
      The SQL Engine factory instance
  • Constructor Details

    • SqlDefaultFactoryMXBean

      public SqlDefaultFactoryMXBean()
  • Method Details

    • 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 instance
      sqlStatement - 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 instance
      sqlStatement - 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 instance
      sqlStatement - 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 Engine
      names - 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 Engine
      names - 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 Engine
      names - 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