public class FF4j extends Object
FeatureStore to record features statused. By default, features are stored into memory but you would like
to persist them in an external storage (as database) and choose among implementations available in different modules (jdbc,
mongo, http...).
AuthorizationsManager to add permissions and limit usage of features to granted people. FF4J does not
created roles, it's rely on external security provider as SpringSecurity Apache Chiro.
EventRepository to monitoring actions performed on features.
| Constructor and Description |
|---|
FF4j()
Default constructor to allows instantiation through IoC.
|
FF4j(InputStream xmlFileResourceAsStream)
Constructor initializing ff4j with an InMemoryStore using an InputStream.
|
FF4j(String xmlFile)
Constructor initializing ff4j with an InMemoryStore
|
| Modifier and Type | Method and Description |
|---|---|
FF4j |
autoCreate(boolean flag)
Enable autocreation of features when not found.
|
boolean |
check(String featureID)
Ask if flipped.
|
boolean |
check(String featureID,
FlippingExecutionContext executionContext)
Elegant way to ask for flipping.
|
boolean |
checkOveridingStrategy(String featureID,
FlippingStrategy strats)
Overriding strategy on feature.
|
boolean |
checkOveridingStrategy(String featureID,
FlippingStrategy strats,
FlippingExecutionContext executionContext)
Overriding strategy on feature.
|
FF4j |
create(Feature fp)
Create new Feature.
|
FF4j |
create(String featureName)
Create new Feature.
|
FF4j |
create(String featureName,
boolean enable)
Create new Feature.
|
FF4j |
create(String featureName,
boolean enable,
String description)
Create new Feature.
|
FF4j |
delete(String fpId)
Delete feature name.
|
FF4j |
disable(String featureID)
Disable Feature.
|
FF4j |
disableGroup(String groupName)
Disable group.
|
FF4j |
enable(String featureID)
Enable Feature.
|
FF4j |
enableGroup(String groupName)
Enable group.
|
boolean |
exist(String featureId)
Check if target feature exist.
|
InputStream |
exportFeatures()
Export Feature through FF4J.
|
AuthorizationsManager |
getAuthorizationsManager()
Getter accessor for attribute 'authorizationsManager'.
|
FlippingExecutionContext |
getCurrentContext()
Initialize flipping execution context.
|
EventPublisher |
getEventPublisher()
Getter accessor for attribute 'eventPublisher'.
|
EventRepository |
getEventRepository()
Getter accessor for attribute 'eventRepository'.
|
Feature |
getFeature(String featureID)
The feature will be create automatically if the boolea, autocreate is enabled.
|
Map<String,Feature> |
getFeatures()
Read Features from store.
|
FeatureStore |
getFeatureStore()
Access store as static way (single store).
|
Map<String,AbstractProperty<?>> |
getProperties()
Return all properties from store.
|
PropertyStore |
getPropertiesStore()
Getter accessor for attribute 'pStore'.
|
long |
getStartTime()
Getter accessor for attribute 'startTime'.
|
FeatureStore |
getStore()
Deprecated.
use
getFeatureStore() instead as since 1.4 there are both Features and properties stores |
String |
getVersion()
Getter accessor for attribute 'version'.
|
boolean |
isAllowed(Feature featureName)
Load SecurityProvider roles (e.g : SpringSecurity GrantedAuthorities)
|
boolean |
isAutocreate()
Getter accessor for attribute 'autocreate'.
|
boolean |
isEnableAudit()
Getter accessor for attribute 'enableAudit'.
|
void |
removeCurrentContext()
Clear context.
|
void |
setAuthorizationsManager(AuthorizationsManager authorizationsManager)
Setter accessor for attribute 'authorizationsManager'.
|
void |
setAutocreate(boolean autocreate)
Setter accessor for attribute 'autocreate'.
|
void |
setEnableAudit(boolean enableAudit)
Setter accessor for attribute 'enableAudit'.
|
void |
setEventPublisher(EventPublisher eventPublisher)
Setter accessor for attribute 'eventPublisher'.
|
void |
setEventRepository(EventRepository eventRepository)
Setter accessor for attribute 'eventRepository'.
|
void |
setFeatureStore(FeatureStore fbs)
NON Static to be use by Injection of Control.
|
void |
setFileName(String fname)
Required for spring namespace and 'fileName' attribut on ff4j tag.
|
void |
setPropertiesStore(PropertyStore pStore)
Setter accessor for attribute 'pStore'.
|
void |
setStore(FeatureStore fbs)
Deprecated.
|
void |
stop()
Shuts down the event publisher if we actually started it (As opposed to
having it dependency-injected).
|
String |
toString() |
public FF4j()
InMemoryFeatureStore.public FF4j(String xmlFile)
public FF4j(InputStream xmlFileResourceAsStream)
Assetpublic boolean check(String featureID)
featureID - feature unique identifier.executionContext - current execution contextpublic boolean check(String featureID, FlippingExecutionContext executionContext)
featureID - feature unique identifier.executionContext - current execution contextpublic boolean checkOveridingStrategy(String featureID, FlippingStrategy strats)
featureID - feature unique identifier.executionContext - current execution contextpublic boolean checkOveridingStrategy(String featureID, FlippingStrategy strats, FlippingExecutionContext executionContext)
featureID - feature unique identifier.executionContext - current execution contextpublic boolean isAllowed(Feature featureName)
featureName - target name of the featurepublic Map<String,Feature> getFeatures()
public Map<String,AbstractProperty<?>> getProperties()
public FF4j enable(String featureID)
featureID - unique feature identifier.public FF4j enableGroup(String groupName)
groupName - target groupeNamepublic FF4j disableGroup(String groupName)
groupName - target groupeNamepublic FF4j create(Feature fp)
featureID - unique feature identifier.public FF4j create(String featureName, boolean enable, String description)
featureID - unique feature identifier.public FF4j create(String featureName, boolean enable)
featureID - unique feature identifier.public FF4j create(String featureName)
featureID - unique feature identifier.public FF4j disable(String featureID)
featureID - unique feature identifier.public boolean exist(String featureId)
featureId - unique feature identifier.public Feature getFeature(String featureID)
featureID - target feature IDpublic InputStream exportFeatures() throws IOException
IOExceptionpublic FF4j autoCreate(boolean flag)
flag - target value for autocreate flag@Deprecated public FeatureStore getStore()
getFeatureStore() instead as since 1.4 there are both Features and properties storespublic FeatureStore getFeatureStore()
@Deprecated public void setStore(FeatureStore fbs)
fbs - target store.public void setFeatureStore(FeatureStore fbs)
fbs - target store.public void setAutocreate(boolean autocreate)
autocreate - new value for 'autocreate 'public AuthorizationsManager getAuthorizationsManager()
public void setAuthorizationsManager(AuthorizationsManager authorizationsManager)
authorizationsManager - new value for 'authorizationsManager 'public EventRepository getEventRepository()
public void setEventRepository(EventRepository eventRepository)
eventRepository - new value for 'eventRepository 'public void setEventPublisher(EventPublisher eventPublisher)
eventPublisher - new value for 'eventPublisher 'public EventPublisher getEventPublisher()
public boolean isAutocreate()
public long getStartTime()
public String getVersion()
public PropertyStore getPropertiesStore()
public void setPropertiesStore(PropertyStore pStore)
pStore - new value for 'pStore 'public FlippingExecutionContext getCurrentContext()
public void removeCurrentContext()
public boolean isEnableAudit()
public void setEnableAudit(boolean enableAudit)
enableAudit - new value for 'enableAudit 'public void setFileName(String fname)
fname - target namepublic void stop()
Copyright © 2013–2015 FF4J. All rights reserved.