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 |
audit()
Enable auditing of features when not found.
|
FF4j |
audit(boolean val)
Enable auditing of features when not found.
|
FF4j |
autoCreate()
Enable autocreation of features when not found.
|
FF4j |
autoCreate(boolean flag)
Enable autocreation of features when not found.
|
FF4j |
cache(FF4JCacheManager cm)
Enable a cache proxy.
|
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 |
createFeature(Feature fp)
Create new Feature.
|
FF4j |
createFeature(String featureName)
Create new Feature.
|
FF4j |
createFeature(String featureName,
boolean enable)
Create new Feature.
|
FF4j |
createFeature(String featureName,
boolean enable,
String description)
Create new Feature.
|
FF4j |
createProperty(Property<?> prop)
Create new Property.
|
void |
createSchema()
Create tables/collections/columns in DB (if required).
|
FF4j |
delete(String fpId)
Delete feature name.
|
FF4j |
deleteProperty(String propertyName)
Delete new Property.
|
FF4j |
disable(String featureID)
Disable Feature.
|
void |
disableAlterBeanThrowInvocationTargetException()
Disable Alter bean Throw InvocationTargetException, when disabled
the alter bean method always throw the exception cause.
|
FF4j |
disableGroup(String groupName)
Disable group.
|
FF4j |
enable(String featureID)
Enable Feature.
|
void |
enableAlterBeanThrowInvocationTargetException()
Enable Alter bean Throw InvocationTargetException, when enabled
the alter bean method always throw
InvocationTargetException |
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'.
|
FF4jCacheProxy |
getCacheProxy()
try to fetch CacheProxy (cannot handled proxy CGLIB, ASM or any bytecode manipulation).
|
FeatureStore |
getConcreteFeatureStore()
Reach concrete implementation of the featureStore.
|
PropertyStore |
getConcretePropertyStore()
Reach concrete implementation of the propertyStore.
|
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,Property<?>> |
getProperties()
Return all properties from store.
|
PropertyStore |
getPropertiesStore()
Getter accessor for attribute 'pStore'.
|
Property<?> |
getProperty(String propertyName)
Read property in Store
|
String |
getPropertyAsString(String propertyName)
Read property in Store
|
String |
getSource()
Getter accessor for attribute 'source'.
|
long |
getStartTime()
Getter accessor for attribute 'startTime'.
|
String |
getVersion()
Getter accessor for attribute 'version'.
|
FF4j |
importFeatures(Collection<Feature> features)
Help to import features.
|
FF4j |
importProperties(Collection<Property<?>> properties)
Help to import propertiess.
|
boolean |
isAllowed(Feature featureName)
Load SecurityProvider roles (e.g : SpringSecurity GrantedAuthorities)
|
boolean |
isAlterBeanThrowInvocationTargetException()
Getter accessor for attribute 'alterBeanThrowInvocationTargetException'.
|
boolean |
isAutocreate()
Getter accessor for attribute 'autocreate'.
|
boolean |
isEnableAudit()
Getter accessor for attribute 'enableAudit'.
|
XmlConfig |
parseXmlConfig(String fileName)
Parse configuration file.
|
void |
removeCurrentContext()
Clear context.
|
void |
setAuthManager(String mnger) |
void |
setAuthorizationsManager(AuthorizationsManager authorizationsManager)
Setter accessor for attribute 'authorizationsManager'.
|
void |
setAutocreate(boolean autocreate)
Setter accessor for attribute 'autocreate'.
|
void |
setCurrentContext(FlippingExecutionContext executionContext)
Override flipping execution context.
|
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 |
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)
Asset
public 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,Property<?>> 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 createFeature(Feature fp)
featureID
- unique feature identifier.public FF4j createProperty(Property<?> prop)
featureID
- unique feature identifier.public FF4j createFeature(String featureName, boolean enable, String description)
featureID
- unique feature identifier.public FF4j createFeature(String featureName, boolean enable)
featureID
- unique feature identifier.public FF4j createFeature(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 Property<?> getProperty(String propertyName)
featureID
- target feature IDpublic String getPropertyAsString(String propertyName)
featureID
- target feature IDpublic FF4j importFeatures(Collection<Feature> features)
features
- set of features.public FF4j importProperties(Collection<Property<?>> properties)
features
- set of features.public InputStream exportFeatures() throws IOException
IOException
public FF4j autoCreate(boolean flag)
flag
- target value for autocreate flagpublic FF4j autoCreate()
flag
- target value for autocreate flagpublic FF4j audit()
flag
- target value for autocreate flagpublic FF4j audit(boolean val)
flag
- target value for autocreate flagpublic FF4j deleteProperty(String propertyName)
featureID
- unique feature identifier.public FF4j cache(FF4JCacheManager cm)
cm
- current cache managerpublic XmlConfig parseXmlConfig(String fileName)
fileName
- target filepublic 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 void createSchema()
public FeatureStore getFeatureStore()
public EventPublisher getEventPublisher()
public PropertyStore getPropertiesStore()
public FlippingExecutionContext getCurrentContext()
public void setCurrentContext(FlippingExecutionContext executionContext)
executionContext
- The new current contextpublic boolean isAutocreate()
public long getStartTime()
public String getVersion()
public void setPropertiesStore(PropertyStore pStore)
pStore
- new value for 'pStore '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 setAuthManager(String mnger)
public void stop()
public String getSource()
public FeatureStore getConcreteFeatureStore()
public PropertyStore getConcretePropertyStore()
public FF4jCacheProxy getCacheProxy()
public void enableAlterBeanThrowInvocationTargetException()
InvocationTargetException
public void disableAlterBeanThrowInvocationTargetException()
public boolean isAlterBeanThrowInvocationTargetException()
Copyright © 2013–2020 FF4J. All rights reserved.