Class HyperonEngineFactory
HyperonEngineImpl using create(), that is used in many places during application runtime. Using this factory,
developers might have impact on some behaviour of the runtime. It will be described below.
The most important aspect of configuration is to setup dataSource, so this is main action for developer to take.
More configuration options are available via flags and setter's. During engine creation, multiple things happens:
1. Watchers are created by default, since autoStartWatchers is set to true
2. Database access points (DAO's) and providers for core elements like functions, parameters, domain are created.
3. Interceptors/listeners might be injected to the engine.
4. Functions invokers supported by higson are created.
There is also possibility for using higson engine in developer mode. By enabling developer mode setDeveloperMode(boolean) to true,
and setting userName setUsername(String), runtime will be aware of user perspective(higson session) automatically. For example, if user is
making some changes in parameters/function/domain via Higson Studio connected to the same dataSource as runtime, but doesn't want to public the session
(so other
users can't see it) and his runtime environment will be aware of this change. If developer mode is set to [@code false}, then user in Higson Studio has
to manually publish his session, so any changes done to parameters, functions or domain will be available via higson runtime.
Sample basic configuration:
DataSource ds = ... //
HyperonEngineFactory factory = new HyperonEngineFactory(ds);
factory.create();
Sample configuration with developer mode ON for username "jason":
DataSource ds = ... //
HyperonEngineFactory factory = new HyperonEngineFactory(ds);
factory.setDeveloperMode(true);
factory.setUsername("jason");
factory.create();
- Author:
- przemek hertel
-
Constructor Summary
ConstructorsConstructorDescriptionHyperonEngineFactory(DataSource dataSource) Deprecated.HyperonEngineFactory(DataSource dataSource, ConnectionInterceptor connectionInterceptor) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddExternalDataSource(String code, DataSource dataSource) Deprecated.Add external dataSource under given code, so higson will recognize it, when fetching for parameters that have defined this external source.voidaddExternalDataSources(Map<String, DataSource> dataSourceMap) Deprecated.Same assetExternalDataSources(Map)and it will iterate over given map and calladdExternalDataSource(String, DataSource)voidaddFunctionInvocationInterceptor(FunctionInvocationInterceptor functionInvocationInterceptor) Deprecated.Add user defined function invocation interceptor.voidaddRegionForParametersPrefetch(String profileCode, String regionCode) Deprecated.Allows specifying region code within profile, which is used to fetch parameters early on system startup.voidattachLogListener(LogListener logListener) Deprecated.create()Deprecated.Creates HyperonEngine instance based on given configuration.Deprecated.createVersionWatcher(WatcherConfig config) Deprecated.voiddestroy()Deprecated.This method stops all threads created by higson-runtime.Deprecated.booleanDeprecated.Checks if developerMode is ON or OFF.booleanDeprecated.voidredefineDomainCache(DomainCache newMpDomainCache, MpDomainCacheProvider newDomainCacheProvider, DomainCacheManager newDomainCacheManager) Deprecated.Setup custom domain cache, provider and manager for it.voidsetAttributeInterceptor(AttributeInterceptor attributeInterceptor) Deprecated.Setup attribute interceptor for attribute value provider.voidsetAutoStartWatchers(boolean autoStartWatchers) Deprecated.Control flag for starting watchers during engine build.voidsetCustomPlugins(Map<String, Object> customPlugins) Deprecated.This method allows developers to inject custom plugins or even override behaviour of higson plugins.final voidsetDataSource(DataSource dataSource) Deprecated.This method setup dataSource used by higson-runtime with all required elements, like: main access points to parameters, functions, external sources, domain, etc.voidsetDbSchema(String dbSchema) Deprecated.Setup database schema if required.voidsetDeveloperMode(boolean developerMode) Deprecated.Setup higson engine with developer mode.voidsetDialect(String dialect) Deprecated.Set database dialect, if not used then default dialect supported by higson will be used.voidsetDomainWatcherInvalidateCacheTime(int domainWatcherInvalidateCacheTime, TemporalUnit unit) Deprecated.Setup lifespan of domain trees in cache, if there are not used.voidsetEnableDomainCache(boolean enableDomainCache) Deprecated.Control flag, that enables domain caching managed by higson-runtime mechanism.voidDeprecated.Same asaddExternalDataSources(Map)and it will iterate over given map and calladdExternalDataSource(String, DataSource)voidsetExternalModulesForPython(List<String> modules) Deprecated.voidDeprecated.Set time-to-live (TTL) for function log level cached entries.voidsetFunctionsToPrefetch(List<String> functionsToPrefetch) Deprecated.Allows to setup a list of functions codes to be fetched early on system startup.voidsetIdleChecker(IdleChecker idleChecker) Deprecated.voidsetLevelCreatorInterceptor(FunctionInvokerInterceptor levelCreatorInterceptor) Deprecated.Setup level creator interceptor.voidsetMaxConcurrentLoads(int maxConcurrentLoads) Deprecated.Sets limited access to concurrent loads of parameters.voidsetMaxIdleTime(Duration maxIdleTime) Deprecated.voidsetParamsToPrefetch(List<String> paramsToPrefetch) Deprecated.Allows to setup a list of parameters codes to be fetched early on system startup.voidsetRefreshOnlyViaWatcher(boolean refreshOnlyViaWatcher) Deprecated.voidDeprecated.Sets the refresh watcher configuration (delay, pause, error pause)voidsetReloadPolicy(ReloadPolicy reloadPolicy) Deprecated.voidsetRhinoPlugins(Map<String, Object> rhinoPlugins) Deprecated.- This method will be removed in the future.voidsetScheduleWatcherPauseSeconds(int scheduleWatcherPauseSeconds) Deprecated.Setup pause in seconds of global schedule watcher.voidsetSessionProvider(MpUserSessionProvider sessionProvider) Deprecated.Sets session provider, which holds information about a user like userName.voidsetThrowOnNormalizeInputValueException(boolean throwOnNormalizeInputValueException) Deprecated.voidsetUsername(String username) Deprecated.Setup username for developer mode.voidsetValidateFunctionArgumentsDataTypes(boolean validateFunctionArgumentsDataTypes) Deprecated.Setup built-in argument data types validator for function invocation.voidsetValueNeverNull(boolean valueNeverNull) Deprecated.Flag responsible for managing global support of nullable parameters results by engine.voidsetWatcherErrorPauseSeconds(int watcherErrorPauseSeconds) Deprecated.Setup pause during some error of watchers in seconds.voidsetWatcherEventListener(WatcherEventListener watcherEventListener) Deprecated.Setup watcher event listener for function and parameters runtime watchers.voidsetWatcherForceSyncSeconds(int seconds) Deprecated.Set the time after which the watcher will force a full cache synchronization.voidsetWatcherPauseSeconds(int watcherPauseSeconds) Deprecated.Setup pause of watchers in seconds.voidsetWatcherStartDelaySeconds(int watcherStartDelaySeconds) Deprecated.Setup delay of watchers in seconds.startDomainWatcher(WatcherConfig watcherConf) Deprecated.Creates and starts domain runtime watcher, if flagenableDomainCacheistrue.startFunctionWatcher(WatcherConfig config) Deprecated.Creates, inject watcher event listener and starts functions runtime watcher.startParamWatcher(WatcherConfig config) Deprecated.Creates, inject watcher event listener and starts parameters runtime watcher.startRefreshWatcher(WatcherConfig config) Deprecated.Creates and starts refresh runtime watcher, that is responsible for evicting parameters from cache.Deprecated.Creates and starts schedule runtime watcher.startVersionWatcher(WatcherConfig config) Deprecated.Creates and starts version runtime watcher.
-
Constructor Details
-
HyperonEngineFactory
Deprecated. -
HyperonEngineFactory
Deprecated.
-
-
Method Details
-
setDataSource
Deprecated.This method setup dataSource used by higson-runtime with all required elements, like: main access points to parameters, functions, external sources, domain, etc. If developer didn't provided any connection interceptor, thenStdConnectionInterceptorwill be used.- Parameters:
dataSource- that will be used during runtime
-
setDialect
Deprecated.Set database dialect, if not used then default dialect supported by higson will be used. But if dialect will not be recognized, then during creation of an engine,UnrecognizedDialectExceptionwill be thrown. Supported dialects are defined withinDialectRegistry.- Parameters:
dialect- code to be set during startup
-
setValueNeverNull
public void setValueNeverNull(boolean valueNeverNull) Deprecated.Flag responsible for managing global support of nullable parameters results by engine. If it is set to true (by default), then parameters will never returnnull, but instead they will return instance ofEmptyParamValue.- Parameters:
valueNeverNull- true of false to be set
-
setMaxConcurrentLoads
public void setMaxConcurrentLoads(int maxConcurrentLoads) Deprecated.Sets limited access to concurrent loads of parameters. Default value is 3. This helps to control usage of resources, since fetching parameters might be very stressful for the application.- Parameters:
maxConcurrentLoads- currentLoads maximal number of concurrent loads
-
setSessionProvider
Deprecated.Sets session provider, which holds information about a user like userName.- Parameters:
sessionProvider- instance ofMpUserSessionProvider
-
setAutoStartWatchers
public void setAutoStartWatchers(boolean autoStartWatchers) Deprecated.Control flag for starting watchers during engine build.trueby default.- Parameters:
autoStartWatchers- if true, during engine creation watchers will be created. If false, then nothing will happen.
-
setWatcherStartDelaySeconds
public void setWatcherStartDelaySeconds(int watcherStartDelaySeconds) Deprecated.Setup delay of watchers in seconds. Default value is set toWATCHER_DEFAULT_START_DELAYseconds. Parameter and function watchers will have the same delay.- Parameters:
watcherStartDelaySeconds- delay in seconds
-
setWatcherPauseSeconds
public void setWatcherPauseSeconds(int watcherPauseSeconds) Deprecated.Setup pause of watchers in seconds. Default value is set toWATCHER_DEFAULT_PAUSEseconds. Parameter and function watchers will have the same pause.- Parameters:
watcherPauseSeconds- pause in seconds
-
setRefreshWatcherConfig
Deprecated.Sets the refresh watcher configuration (delay, pause, error pause) -
setDomainWatcherInvalidateCacheTime
public void setDomainWatcherInvalidateCacheTime(int domainWatcherInvalidateCacheTime, TemporalUnit unit) Deprecated.Setup lifespan of domain trees in cache, if there are not used. By default domain tree will be removed from cache, if it's last build exceedsWATCHER_DOMAIN_DEFAULT_CACHE_LIFESPAN_VALUEWATCHER_DOMAIN_DEFAULT_CACHE_LIFESPAN_UNIT(or any time defined by this method).- Parameters:
domainWatcherInvalidateCacheTime- value of lifespan. By default it will beWATCHER_DOMAIN_DEFAULT_CACHE_LIFESPAN_VALUEunit- used with value from lifespan. By default it will beWATCHER_DOMAIN_DEFAULT_CACHE_LIFESPAN_UNIT
-
setWatcherErrorPauseSeconds
public void setWatcherErrorPauseSeconds(int watcherErrorPauseSeconds) Deprecated.Setup pause during some error of watchers in seconds. Default value is set toWATCHER_DEFAULT_RECOVERYseconds. Parameter and function watchers will have the same pause.- Parameters:
watcherErrorPauseSeconds- error pause in seconds
-
setWatcherForceSyncSeconds
public void setWatcherForceSyncSeconds(int seconds) Deprecated.Set the time after which the watcher will force a full cache synchronization. Currently only the param watcher supports this setting.- Parameters:
seconds- force sync pause in seconds
-
setScheduleWatcherPauseSeconds
public void setScheduleWatcherPauseSeconds(int scheduleWatcherPauseSeconds) Deprecated.Setup pause in seconds of global schedule watcher. Default value is set toSCHEDULE_WATCHER_PAUSEseconds.- Parameters:
scheduleWatcherPauseSeconds- value of pause seconds
-
setRhinoPlugins
Deprecated.- This method will be removed in the future. Please use accordingsetCustomPlugins(Map).- Parameters:
rhinoPlugins- Custom plugins, that will be added to the base of higson supported plugins.
-
setCustomPlugins
Deprecated.This method allows developers to inject custom plugins or even override behaviour of higson plugins. Plugins will be added, when methodcreate()is called. Higson supported plugins codes:- log
- date
- ctx
- domain
- util
- Parameters:
customPlugins- map, where key is plugin code, value is instance of the plugin
-
setParamsToPrefetch
Deprecated.Allows to setup a list of parameters codes to be fetched early on system startup.- Parameters:
paramsToPrefetch- list of parameters codes
-
setFunctionsToPrefetch
Deprecated.Allows to setup a list of functions codes to be fetched early on system startup.- Parameters:
functionsToPrefetch- list of functions codes
-
addRegionForParametersPrefetch
Deprecated.Allows specifying region code within profile, which is used to fetch parameters early on system startup. Bear in mind that adding too many profileCodes or regionCodes for given profileCode puts a lot of pressure on the database on system startup.- Parameters:
profileCode- profile coderegionCode- region code
-
create
Deprecated.Creates HyperonEngine instance based on given configuration. Here multiple whole structure of an engine is created. First the dialect for database is registered. After that, all providers and invokers for parameters, functions, etc. All supported types for HyperonContext are created here as well.ParamEngineConfigBuilderis used as well to buildParamEngineConfig.autoStartWatchersif it is set totrue(by default it is), then all watchers for higson main functionalities will be enabled.enableDomainCacheif it is set totrue(by default it is), then domain will be cached and maintained by higson-runtime.paramsToPrefetchandfunctionsToPrefetchgives a possibility to early fetch on startup list of given parameters or functions codes.- Returns:
- new higson engine
- Throws:
HyperonRuntimeException- if dataSource isnull
-
startParamWatcher
Deprecated.Creates, inject watcher event listener and starts parameters runtime watcher.- Parameters:
config- for watcher- Returns:
- instance of started runtime watcher
- See Also:
-
startFunctionWatcher
Deprecated.Creates, inject watcher event listener and starts functions runtime watcher.- Parameters:
config- for watcher- Returns:
- instance of started runtime watcher
- See Also:
-
startVersionWatcher
Deprecated.Creates and starts version runtime watcher.- Parameters:
config- for watcher- Returns:
- instance of started runtime watcher
- See Also:
-
createVersionWatcher
Deprecated. -
createUserRegionVersionWatcher
Deprecated. -
startScheduleWatcher
Deprecated.Creates and starts schedule runtime watcher. WatcherConfig is using property set via#scheduleWatcherPauseSeconds.- Returns:
- instance of started runtime watcher
- See Also:
-
startRefreshWatcher
Deprecated.Creates and starts refresh runtime watcher, that is responsible for evicting parameters from cache.- Parameters:
config- for watcher- Returns:
- instance of started runtime watcher
- See Also:
-
startDomainWatcher
Deprecated.Creates and starts domain runtime watcher, if flagenableDomainCacheistrue.- Parameters:
watcherConf- for watcher- Returns:
- instance of started runtime watcher
- See Also:
-
destroy
public void destroy()Deprecated.This method stops all threads created by higson-runtime. All threads have to be stopped so that the JVM process can exit. This is very important to call this method from client application, otherwise the JVM will not stop. Below is the recommended way to free resources:HyperonEngineFactory factory; HyperonEngine engine; [PostConstruct] public void init() { factory = new HyperonEngineFactory(dataSource); engine = factory.create(); } [PreDestroy] public void destroy() { factory.destroy(); } -
setLevelCreatorInterceptor
Deprecated.Setup level creator interceptor. Higson provides default implementation if not specified.- Parameters:
levelCreatorInterceptor- acts as function invoker interceptor
-
setEnableDomainCache
public void setEnableDomainCache(boolean enableDomainCache) Deprecated.Control flag, that enables domain caching managed by higson-runtime mechanism. By default it istrue.- Parameters:
enableDomainCache- control flag
-
setRefreshOnlyViaWatcher
Deprecated. -
setAttributeInterceptor
Deprecated.Setup attribute interceptor for attribute value provider.- Parameters:
attributeInterceptor- custom interceptor for domain attributes- See Also:
-
setWatcherEventListener
Deprecated.Setup watcher event listener for function and parameters runtime watchers.- Parameters:
watcherEventListener- custom event listener
-
isDeveloperMode
public boolean isDeveloperMode()Deprecated.Checks if developerMode is ON or OFF.- Returns:
- true if ON, false otherwise
-
setDeveloperMode
public void setDeveloperMode(boolean developerMode) Deprecated.Setup higson engine with developer mode. It will change default behaviour of an engine. Default value is false.- Parameters:
developerMode- control flag
-
setUsername
Deprecated.Setup username for developer mode.- Parameters:
username- to be used
-
setValidateFunctionArgumentsDataTypes
public void setValidateFunctionArgumentsDataTypes(boolean validateFunctionArgumentsDataTypes) Deprecated.Setup built-in argument data types validator for function invocation. Default value is false.- Parameters:
validateFunctionArgumentsDataTypes- control flag
-
isRefreshOnlyViaWatcher
Deprecated. -
getPythonFunctionInvoker
Deprecated. -
addExternalDataSources
Deprecated.Same assetExternalDataSources(Map)and it will iterate over given map and calladdExternalDataSource(String, DataSource)- Parameters:
dataSourceMap- of datasource and theirs codes
-
addExternalDataSource
Deprecated.Add external dataSource under given code, so higson will recognize it, when fetching for parameters that have defined this external source.- Parameters:
code- under which dataSource will be availabledataSource- external dataSource
-
setExternalDataSources
Deprecated.Same asaddExternalDataSources(Map)and it will iterate over given map and calladdExternalDataSource(String, DataSource)- Parameters:
map- of datasource and theirs codes
-
redefineDomainCache
public void redefineDomainCache(DomainCache newMpDomainCache, MpDomainCacheProvider newDomainCacheProvider, DomainCacheManager newDomainCacheManager) Deprecated.Setup custom domain cache, provider and manager for it. If developer provider custom implementations, then duringcreate()higson will skip building them on its own.- Parameters:
newMpDomainCache- custom domain cachenewDomainCacheProvider- custom domain cache providernewDomainCacheManager- custom domain cache manager
-
setDbSchema
Deprecated.Setup database schema if required. Then all queries within engine will use this schema with queries.- Parameters:
dbSchema- to be used in engine queries
-
setExternalModulesForPython
Deprecated. -
setThrowOnNormalizeInputValueException
public void setThrowOnNormalizeInputValueException(boolean throwOnNormalizeInputValueException) Deprecated. -
addFunctionInvocationInterceptor
public void addFunctionInvocationInterceptor(FunctionInvocationInterceptor functionInvocationInterceptor) Deprecated.Add user defined function invocation interceptor. Higson triggers added interceptor before every function invocation.- Parameters:
functionInvocationInterceptor- User defined function invocation interceptor- See Also:
-
setFunctionLogLevelCacheTTL
Deprecated.Set time-to-live (TTL) for function log level cached entries. -
attachLogListener
Deprecated. -
setIdleChecker
Deprecated. -
setMaxIdleTime
Deprecated. -
setReloadPolicy
Deprecated.
-
HigsonEngineFactory