Package org.chenile.stm.impl
Class ConfigBasedEnablementStrategy
java.lang.Object
org.chenile.stm.impl.ConfigBasedEnablementStrategy
- All Implemented Interfaces:
EnablementStrategy
Provides an enablement strategy based on configuration. This requires a configuration provider.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionConfigBasedEnablementStrategy(ConfigProvider configProvider) ConfigBasedEnablementStrategy(ConfigProvider configProvider, String prefix) -
Method Summary
Modifier and TypeMethodDescriptionaddDynamicStates(FlowDescriptor flowInfo) private voidaddEventInformationToTransition(Transition transition, StateDescriptor sd) voidvoidgetStateInfo(State state, FlowDescriptor flowDescriptor) booleanisEventEnabled(StateDescriptor sd, EventInformation eventInformation) booleanprivate booleanpropEnabled(String prop) voidsetAddTransitionProperty(String addTransitionProperty) voidsetEnabledProperty(String enabledProperty)
-
Field Details
-
ENABLED_PROPERTY
- See Also:
-
ADD_PROPERTY
- See Also:
-
enabledProperty
String enabledProperty -
addTransitionProperty
String addTransitionProperty -
ENABLEMENT
- See Also:
-
prefix
String prefix -
configProvider
ConfigProvider configProvider
-
-
Constructor Details
-
ConfigBasedEnablementStrategy
-
ConfigBasedEnablementStrategy
-
-
Method Details
-
setEnabledProperty
-
setAddTransitionProperty
-
isStateEnabled
- Specified by:
isStateEnabledin interfaceEnablementStrategy
-
isEventEnabled
- Specified by:
isEventEnabledin interfaceEnablementStrategy- Parameters:
sd- state descriptoreventInformation- - event information- Returns:
- For every state or event it looks for a property in the configuration which is named after the
* state or event. For example to enable state State1 on entity Entity1, we will need Entity1.State1.enabled = true
* If this config is missing or set to true then the State is enabled. If it is explicitly set to false
* then it is disabled.
*
Similarly, for an event Event1 that belongs to state State1 of entity Entity1 the property * Entity1.State1.Event1.enabled must be explicitly set to false. Else if it is missing or set to true, * then the event is considered enabled.
-
addDynamicTransitions
- Specified by:
addDynamicTransitionsin interfaceEnablementStrategy- Parameters:
sd-- Returns:
- Allows for the addition of transitions in the property files.
-
addEventInformationToTransition
- Parameters:
transition-sd-
-
addMetadataToTransition
- Specified by:
addMetadataToTransitionin interfaceEnablementStrategy- Parameters:
t-sd- Allows for metadata to be added to a transition in property file.
-
getStateInfo
- Specified by:
getStateInfoin interfaceEnablementStrategy
-
addDynamicStates
- Specified by:
addDynamicStatesin interfaceEnablementStrategy
-
addMetadataToState
- Specified by:
addMetadataToStatein interfaceEnablementStrategy
-
propEnabled
-