public class FF4jCacheProxy extends Object implements FeatureStore, PropertyStore
FeatureStore could generate some overhead and decrease performances. This is the reason why cache is provided
though proxies.
As applications are distributed, the cache itself could be distributed. The default implement is
InMemoryFeatureStoreCacheProxy but other are provided to use distributed cache system as redis or memcached.| Constructor and Description |
|---|
FF4jCacheProxy()
Allow Ioc and defeine default constructor.
|
FF4jCacheProxy(FeatureStore fStore,
PropertyStore pStore,
FF4JCacheManager cache)
Initialization through constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addToGroup(String featureId,
String groupName)
Add target
Feature to target group. |
void |
clear()
Empty features set.
|
void |
create(Feature fp)
Create flipPoint in storage (with roles).
|
<T> void |
createProperty(Property<T> property)
Create new property within store.
|
void |
createSchema()
Initialize the target database schema by creating expected structures.
|
void |
delete(String featureId)
Remove fliPoint from store.
|
void |
deleteProperty(String name)
Delete current property.
|
void |
disable(String featureId)
Create Feature is does not exist and enable it.
|
void |
disableGroup(String groupName)
Disable all features contained in the following group.
|
void |
enable(String featureId)
Enable/UP/switch on a FlipPoint.
|
void |
enableGroup(String groupName)
Enable all features contained in the following group.
|
boolean |
exist(String featureId)
Check if Feature Exist.
|
boolean |
existGroup(String groupName)
Check if current group exist or not.
|
boolean |
existProperty(String propertyName)
Check existence of target property.
|
String |
getCachedTargetStore() |
FF4JCacheManager |
getCacheManager()
Getter accessor for attribute 'cacheManager'.
|
String |
getCacheProvider() |
Store2CachePollingScheduler |
getStore2CachePoller()
Getter accessor for attribute 'store2CachePoller'.
|
FeatureStore |
getTargetFeatureStore()
Getter accessor for attribute 'target'.
|
PropertyStore |
getTargetPropertyStore()
Getter accessor for attribute 'target'.
|
void |
grantRoleOnFeature(String featureId,
String roleName)
Add a role to a flipPOINT.
|
void |
importFeatures(Collection<Feature> features)
Import features.
|
void |
importProperties(Collection<Property<?>> properties)
Import a set of properties.
|
boolean |
isCached() |
boolean |
isEmpty()
Tell if a store is empty
|
Set<String> |
listPropertyNames()
List all property names.
|
Feature |
read(String featureUid)
Create Feature is does not exist and enable it.
|
Map<String,Feature> |
readAll()
Access to all features to get information.
|
Set<String> |
readAllGroups()
Return a set of existing groups.
|
Map<String,Property<?>> |
readAllProperties()
Retrieve all properties from store.
|
Map<String,Feature> |
readGroup(String groupName)
Read all features within target group.
|
Property<?> |
readProperty(String name)
Read property value.
|
Property<?> |
readProperty(String name,
Property<?> defaultValue)
Read property value and if not found return the default value
|
void |
removeFromGroup(String featureId,
String groupName)
Remove target
Feature from group. |
void |
removeRoleFromFeature(String featureId,
String roleName)
Remove role to acess flip point
|
void |
setCacheManager(FF4JCacheManager cacheManager)
Setter accessor for attribute 'cacheManager'.
|
void |
setStore2CachePoller(Store2CachePollingScheduler store2CachePoller)
Setter accessor for attribute 'store2CachePoller'.
|
void |
setTargetFeatureStore(FeatureStore targetFeatureStore)
Setter accessor for attribute 'targetFeatureStore'.
|
void |
setTargetPropertyStore(PropertyStore targetPropertyStore)
Setter accessor for attribute 'targetPropertyStore'.
|
void |
startPolling(long delay)
Start the polling of target store is required.
|
void |
stopPolling()
Stop the polling of target store is required.
|
void |
update(Feature fp)
Update FlipPoint within store.
|
<T> void |
updateProperty(Property<T> propertyValue)
Update existing property.
|
void |
updateProperty(String name,
String newValue)
Update existing property.
|
public FF4jCacheProxy()
public FF4jCacheProxy(FeatureStore fStore, PropertyStore pStore, FF4JCacheManager cache)
store - target store to retrieve featurescache - cache manager to limit overhead of storepublic void startPolling(long delay)
public void stopPolling()
public void enable(String featureId)
enable in interface FeatureStorefeatureId - unique feature identifierpublic void disable(String featureId)
disable in interface FeatureStorepublic boolean exist(String featureId)
exist in interface FeatureStorepublic void createSchema()
createSchema in interface FeatureStorecreateSchema in interface PropertyStorepublic void create(Feature fp)
create in interface FeatureStorefp - create rolespublic Feature read(String featureUid)
read in interface FeatureStorepublic Map<String,Feature> readAll()
readAll in interface FeatureStorepublic Set<String> readAllGroups()
readAllGroups in interface FeatureStorepublic void delete(String featureId)
delete in interface FeatureStorepublic void update(Feature fp)
update in interface FeatureStorefp - flipPoint new elementpublic void grantRoleOnFeature(String featureId, String roleName)
grantRoleOnFeature in interface FeatureStorepublic void removeRoleFromFeature(String featureId, String roleName)
removeRoleFromFeature in interface FeatureStorepublic void enableGroup(String groupName)
enableGroup in interface FeatureStoregroupName - target group namepublic void disableGroup(String groupName)
disableGroup in interface FeatureStoregroupName - target group namepublic boolean existGroup(String groupName)
existGroup in interface FeatureStoregroupName - target group namepublic Map<String,Feature> readGroup(String groupName)
readGroup in interface FeatureStoregroupName - target group namepublic void addToGroup(String featureId, String groupName)
Feature to target group.addToGroup in interface FeatureStorefeatureId - target feature identifiergroupName - target groupNamepublic void removeFromGroup(String featureId, String groupName)
Feature from group.removeFromGroup in interface FeatureStorefeatureId - target feature identifiergroupName - target groupNamepublic FeatureStore getTargetFeatureStore()
public PropertyStore getTargetPropertyStore()
public FF4JCacheManager getCacheManager()
public void setCacheManager(FF4JCacheManager cacheManager)
cacheManager - new value for 'cacheManager 'public boolean isCached()
public String getCacheProvider()
public String getCachedTargetStore()
public Map<String,Property<?>> readAllProperties()
readAllProperties in interface PropertyStorepublic boolean existProperty(String propertyName)
existProperty in interface PropertyStorepropertyName - target namepublic <T> void createProperty(Property<T> property)
createProperty in interface PropertyStoreproperty - target valuepublic Property<?> readProperty(String name)
readProperty in interface PropertyStorename - target property namepublic Property<?> readProperty(String name, Property<?> defaultValue)
readProperty in interface PropertyStorename - target property namepublic void updateProperty(String name, String newValue)
updateProperty in interface PropertyStorename - target namenewValue - new valuepublic <T> void updateProperty(Property<T> propertyValue)
updateProperty in interface PropertyStorepublic void deleteProperty(String name)
deleteProperty in interface PropertyStorename - target namepublic boolean isEmpty()
isEmpty in interface PropertyStorepublic Set<String> listPropertyNames()
listPropertyNames in interface PropertyStorepublic void clear()
clear in interface FeatureStoreclear in interface PropertyStorepublic void importProperties(Collection<Property<?>> properties)
importProperties in interface PropertyStoreproperties - a set of propertiespublic void importFeatures(Collection<Feature> features)
importFeatures in interface FeatureStorefeatures - list of features.spublic void setTargetFeatureStore(FeatureStore targetFeatureStore)
targetFeatureStore - new value for 'targetFeatureStore 'public void setTargetPropertyStore(PropertyStore targetPropertyStore)
targetPropertyStore - new value for 'targetPropertyStore 'public Store2CachePollingScheduler getStore2CachePoller()
public void setStore2CachePoller(Store2CachePollingScheduler store2CachePoller)
store2CachePoller - new value for 'store2CachePoller 'Copyright © 2013–2017 FF4J. All rights reserved.