Package org.togglz.core.manager
Class DefaultFeatureManager
- java.lang.Object
-
- org.togglz.core.manager.DefaultFeatureManager
-
- All Implemented Interfaces:
FeatureManager
public class DefaultFeatureManager extends Object implements FeatureManager
Default implementation ofFeatureManager- Author:
- Christian Kaltepoth
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<ActivationStrategy>getActivationStrategies()Provides access to theActivationStrategylist known by the managerFeatureUsergetCurrentFeatureUser()Get the current feature user.Set<Feature>getFeatures()Provides access to all features the manager is responsible for.FeatureStategetFeatureState(Feature feature)Returns theFeatureStatefor the specified feature.FeatureMetaDatagetMetaData(Feature feature)Returns theFeatureMetaDatadescribing the supplied feature.StringgetName()A unique name for this feature manager.booleanisActive(Feature feature)Checks whether the supplied feature is active or not.voidsetFeatureState(FeatureState state)Updates the state of a feature.StringtoString()
-
-
-
Method Detail
-
getName
public String getName()
Description copied from interface:FeatureManagerA unique name for this feature manager.- Specified by:
getNamein interfaceFeatureManager
-
getFeatures
public Set<Feature> getFeatures()
Description copied from interface:FeatureManagerProvides access to all features the manager is responsible for.- Specified by:
getFeaturesin interfaceFeatureManager- Returns:
- Set of features, never
null
-
getMetaData
public FeatureMetaData getMetaData(Feature feature)
Description copied from interface:FeatureManagerReturns theFeatureMetaDatadescribing the supplied feature.- Specified by:
getMetaDatain interfaceFeatureManager- Parameters:
feature- The feature to get the metadata for- Returns:
- the metadata for the feature
-
isActive
public boolean isActive(Feature feature)
Description copied from interface:FeatureManagerChecks whether the supplied feature is active or not. Please note that this method will internally use theUserProviderto obtain the currently acting user as it may be relevant if the feature is enabled only for specific set of users.- Specified by:
isActivein interfaceFeatureManager- Parameters:
feature- The feature to check- Returns:
trueif the feature is active,falseotherwise
-
getFeatureState
public FeatureState getFeatureState(Feature feature)
Description copied from interface:FeatureManagerReturns theFeatureStatefor the specified feature. This state represents the current configuration of the feature and is typically persisted by aStateRepositoryacross JVM restarts. The state includes whether the feature is enabled or disabled and the use list.- Specified by:
getFeatureStatein interfaceFeatureManager- Parameters:
feature- The feature to get the state for- Returns:
- The current state of the feature, never
null.
-
setFeatureState
public void setFeatureState(FeatureState state)
Description copied from interface:FeatureManagerUpdates the state of a feature. THis allows to enable or disable a feature and to modify the user list associated with the feature.- Specified by:
setFeatureStatein interfaceFeatureManager- Parameters:
state- The new feature state.
-
getActivationStrategies
public List<ActivationStrategy> getActivationStrategies()
Description copied from interface:FeatureManagerProvides access to theActivationStrategylist known by the manager- Specified by:
getActivationStrategiesin interfaceFeatureManager- Returns:
- list of
ActivationStrategy
-
getCurrentFeatureUser
public FeatureUser getCurrentFeatureUser()
Description copied from interface:FeatureManagerGet the current feature user. This method will internally use the configuredUserProviderto obtain the user.- Specified by:
getCurrentFeatureUserin interfaceFeatureManager- Returns:
- The current
FeatureUseror null if theUserProviderdidn't return any result.
-
-