Package pl.decerto.hyperon.runtime.core
Class HyperonEngineImpl
java.lang.Object
pl.decerto.hyperon.runtime.core.HyperonEngineImpl
- All Implemented Interfaces:
HyperonEngine
Default engine implementation for accessing crucial aspects of the system.
- Author:
- przemek hertel
-
Constructor Summary
ConstructorsConstructorDescriptionHyperonEngineImpl(ParamEngine engine, DomainCache domainCache, VersionInterceptor versionInterceptor, boolean valueNeverNull) Creates a HyperonEngineImpl instance with required arguments. -
Method Summary
Modifier and TypeMethodDescriptioncall(String functionName, ParamContext ctx, Object... args) This method calls function defined within higson, with context and optional arguments.voidRemoves effective date, that was once set.voidRemoves both effective date and effective versions for all regions.voidclearEffectiveVersion(String region) Removes effective version for given region, if there was any.voidclearEffectiveVersion(String profileCode, String regionCode) Removes effective version for given region, if there was any.voidRemoves all effective versions that were once set, even for multiple regions.get(String parameterName, ParamContext ctx) This method tries to fetch parameter's value for givenparameterNameand contextctx.get0(String uid, ParamContext ctx) Deprecated.should not be exposed.Return digest of one of given Parameter/Funcion/Literal valueGet domain object based on given profile andobjectPath.Deprecated.Shouldn't expose cache.Returns codes of profiles with at least one domain element.Returns codes of profiles with at least one domain element.booleanDeprecated.Shouldn't be exposed.Return runtime configuration of this instance of parameter/function engine.voidsetEffectiveDate(Date date) Enables to change effective date that will alter work of a schedule (if there is any).voidsetEffectiveVersion(String region, String version) Enables to change version for given region, so it will acts as effective version.voidsetEffectiveVersion(String profileCode, String regionCode, String version) Enables to change version for given region in given profile, so it will acts as effective version.
-
Constructor Details
-
HyperonEngineImpl
public HyperonEngineImpl(ParamEngine engine, DomainCache domainCache, VersionInterceptor versionInterceptor, boolean valueNeverNull) Creates a HyperonEngineImpl instance with required arguments.- Parameters:
engine- engine for parameters and functionsdomainCache- domain cacheversionInterceptor- version interceptorvalueNeverNull- flag, if fetched value can't be null for parameters results
-
-
Method Details
-
get
Description copied from interface:HyperonEngineThis method tries to fetch parameter's value for givenparameterNameand contextctx. If parameter requires context for proper working(context is defined parameter's metadata), then it must be provided, so values could be fetched for matched context.Example:
HyperonEngine engine = .. // might be injected or created from HyperonEngineFactory ParamValue paramValue = engine.get("parameter.code", new HyperonContext());- Specified by:
getin interfaceHyperonEngine- Parameters:
parameterName- parameter namectx- context that is required for proper parameter fetching- Returns:
- parameter value if found, or might be null
- See Also:
-
get0
Deprecated.should not be exposed. It will be hidden in the future.- Parameters:
uid- uidctx- ctx- Returns:
- PramValue object
-
call
Description copied from interface:HyperonEngineThis method calls function defined within higson, with context and optional arguments. Function might return value asObject.Example:
HyperonEngine engine = .. // might be injected or created from HyperonEngineFactory Object result = engine.call("function.name", new HyperonContext(), 1, 2, 3);- Specified by:
callin interfaceHyperonEngine- Parameters:
functionName- function namectx- context used by functionargs- optional argument, if function requires them- Returns:
- possible result of function call
- See Also:
-
runtimeConfiguration
Description copied from interface:HyperonEngineReturn runtime configuration of this instance of parameter/function engine.- Specified by:
runtimeConfigurationin interfaceHyperonEngine- Returns:
- runtime config
-
setEffectiveVersion
Description copied from interface:HyperonEngineEnables to change version for given region, so it will acts as effective version. System version based on schedule will not be altered. If given region is attached to more than one profile,AmbiguousProfileExceptionis thrown. UseHyperonEngine.setEffectiveVersion(String, String, String)in such situation.- Specified by:
setEffectiveVersionin interfaceHyperonEngine- Parameters:
region- region codeversion- effective version- See Also:
-
setEffectiveVersion
Description copied from interface:HyperonEngineEnables to change version for given region in given profile, so it will acts as effective version. System version based on schedule will not be altered.- Specified by:
setEffectiveVersionin interfaceHyperonEngine- Parameters:
profileCode- profile coderegionCode- region codeversion- effective version- See Also:
-
setEffectiveDate
Description copied from interface:HyperonEngineEnables to change effective date that will alter work of a schedule (if there is any). After proper schedule was fetched, then version of parameters and functions is changed according to new schedule(based on given date).
Warning Current implementation doesn't affect fetching domain objects from engine. It might be changed in the future.- Specified by:
setEffectiveDatein interfaceHyperonEngine- Parameters:
date- effective date to be used for schedule- See Also:
-
clearEffectiveVersion
Description copied from interface:HyperonEngineRemoves effective version for given region, if there was any. If given region is attached to more than one profile,AmbiguousProfileExceptionis thrown. UseHyperonEngine.clearEffectiveVersion(String, String)in such situation.- Specified by:
clearEffectiveVersionin interfaceHyperonEngine- Parameters:
region- region code to reset- See Also:
-
clearEffectiveVersion
Description copied from interface:HyperonEngineRemoves effective version for given region, if there was any.- Specified by:
clearEffectiveVersionin interfaceHyperonEngine- Parameters:
profileCode- profile coderegionCode- region code to reset- See Also:
-
clearEffectiveVersions
public void clearEffectiveVersions()Description copied from interface:HyperonEngineRemoves all effective versions that were once set, even for multiple regions.- Specified by:
clearEffectiveVersionsin interfaceHyperonEngine- See Also:
-
clearEffectiveDate
public void clearEffectiveDate()Description copied from interface:HyperonEngineRemoves effective date, that was once set. If there was no date, nothing happens.- Specified by:
clearEffectiveDatein interfaceHyperonEngine- See Also:
-
clearEffectiveSetup
public void clearEffectiveSetup()Description copied from interface:HyperonEngineRemoves both effective date and effective versions for all regions.- Specified by:
clearEffectiveSetupin interfaceHyperonEngine- See Also:
-
getProfiles
Description copied from interface:HyperonEngineReturns codes of profiles with at least one domain element.- Specified by:
getProfilesin interfaceHyperonEngine- Returns:
Listof profile codes for all profiles with at least one domain element, or empty list if there are no such profiles.
-
getExistingProfiles
Description copied from interface:HyperonEngineReturns codes of profiles with at least one domain element.- Specified by:
getExistingProfilesin interfaceHyperonEngine- Returns:
Setof profile codes for all profiles with at least one domain element, or empty list if there are no such profiles.
-
getDomain
Description copied from interface:HyperonEngineGet domain object based on given profile andobjectPath. It will be either head object or from user's session.
How objectPath is defined: "/PLANS[LIAB]/OPTIONS[OPT1]" - where- /PLANS[LIAB] - LIAB code element within PLANS collection
- / - acts as separator between child and parent
- /OPTIONS[OPT1] - OPT1 code element within OPTIONS collection, that is child of PLANS[LIAB]
Example:
HyperonEngine engine = .. // might be injected or created from HyperonEngineFactory HyperonDomainObject root = engine.getDomain("PROFILE1", "/"); // root domain object for PROFILE1 HyperonDomainObject adminElement = engine.getDomain("PROFILE1", "/USERS[ADMIN]"); // domain object with code "ADMIN" within collection "USERS"- Specified by:
getDomainin interfaceHyperonEngine- Parameters:
profile- profile codeobjectPath- full path to domain object- Returns:
- domain object if found, or null
- See Also:
-
getDigest
Description copied from interface:HyperonEngineReturn digest of one of given Parameter/Funcion/Literal value- Specified by:
getDigestin interfaceHyperonEngine- Parameters:
type- of Higson element to calculate its digestelementCode- code of parameter/function or literal value- Returns:
- digest as string of given element or null, if digest is not available.
-
isValueNeverNull
Deprecated.Shouldn't be exposed. Will be removed in the future.- Returns:
- valueNeverNull
-
getDomainCache
Deprecated.Shouldn't expose cache. Will be removed in the future.- Returns:
- DomainCache instance
-