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
-
Constructor Summary
ConstructorDescriptionConfigBasedEnablementStrategy
(ConfigProvider configProvider) ConfigBasedEnablementStrategy
(ConfigProvider configProvider, String prefix) -
Method Summary
Modifier and TypeMethodDescriptionaddDynamicStates
(FlowDescriptor flowInfo) private void
addEventInformationToTransition
(Transition transition, StateDescriptor sd) void
void
getStateInfo
(State state, FlowDescriptor flowDescriptor) boolean
isEventEnabled
(StateDescriptor sd, EventInformation eventInformation) boolean
private boolean
propEnabled
(String prop) void
setAddTransitionProperty
(String addTransitionProperty) void
setEnabledProperty
(String enabledProperty)
-
Field Details
-
ENABLED_PROPERTY
- See Also:
-
ADD_PROPERTY
- See Also:
-
enabledProperty
String enabledProperty -
addTransitionProperty
String addTransitionProperty -
prefix
String prefix -
configProvider
ConfigProvider configProvider
-
-
Constructor Details
-
ConfigBasedEnablementStrategy
-
ConfigBasedEnablementStrategy
-
-
Method Details
-
setEnabledProperty
-
setAddTransitionProperty
-
isStateEnabled
- Specified by:
isStateEnabled
in interfaceEnablementStrategy
-
isEventEnabled
- Specified by:
isEventEnabled
in interfaceEnablementStrategy
- Parameters:
sd
-eventInformation
-- 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:
addDynamicTransitions
in interfaceEnablementStrategy
- Parameters:
sd
-- Returns:
- Allows for the addition of transitions in the property files.
-
addEventInformationToTransition
- Parameters:
transition
-sd
-
-
addMetadataToTransition
- Specified by:
addMetadataToTransition
in interfaceEnablementStrategy
- Parameters:
t
-sd
- Allows for metadata to be added to a transition in property file.
-
getStateInfo
- Specified by:
getStateInfo
in interfaceEnablementStrategy
-
addDynamicStates
- Specified by:
addDynamicStates
in interfaceEnablementStrategy
-
addMetadataToState
- Specified by:
addMetadataToState
in interfaceEnablementStrategy
-
propEnabled
-