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 FeatureStore
featureId
- unique feature identifierpublic void disable(String featureId)
disable
in interface FeatureStore
public boolean exist(String featureId)
exist
in interface FeatureStore
public void createSchema()
createSchema
in interface FeatureStore
createSchema
in interface PropertyStore
public void create(Feature fp)
create
in interface FeatureStore
fp
- create rolespublic Feature read(String featureUid)
read
in interface FeatureStore
public Map<String,Feature> readAll()
readAll
in interface FeatureStore
public Set<String> readAllGroups()
readAllGroups
in interface FeatureStore
public void delete(String featureId)
delete
in interface FeatureStore
public void update(Feature fp)
update
in interface FeatureStore
fp
- flipPoint new elementpublic void grantRoleOnFeature(String featureId, String roleName)
grantRoleOnFeature
in interface FeatureStore
public void removeRoleFromFeature(String featureId, String roleName)
removeRoleFromFeature
in interface FeatureStore
public void enableGroup(String groupName)
enableGroup
in interface FeatureStore
groupName
- target group namepublic void disableGroup(String groupName)
disableGroup
in interface FeatureStore
groupName
- target group namepublic boolean existGroup(String groupName)
existGroup
in interface FeatureStore
groupName
- target group namepublic Map<String,Feature> readGroup(String groupName)
readGroup
in interface FeatureStore
groupName
- target group namepublic void addToGroup(String featureId, String groupName)
Feature
to target group.addToGroup
in interface FeatureStore
featureId
- target feature identifiergroupName
- target groupNamepublic void removeFromGroup(String featureId, String groupName)
Feature
from group.removeFromGroup
in interface FeatureStore
featureId
- 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 PropertyStore
public boolean existProperty(String propertyName)
existProperty
in interface PropertyStore
propertyName
- target namepublic <T> void createProperty(Property<T> property)
createProperty
in interface PropertyStore
property
- target valuepublic Property<?> readProperty(String name)
readProperty
in interface PropertyStore
name
- target property namepublic Property<?> readProperty(String name, Property<?> defaultValue)
readProperty
in interface PropertyStore
name
- target property namepublic void updateProperty(String name, String newValue)
updateProperty
in interface PropertyStore
name
- target namenewValue
- new valuepublic <T> void updateProperty(Property<T> propertyValue)
updateProperty
in interface PropertyStore
public void deleteProperty(String name)
deleteProperty
in interface PropertyStore
name
- target namepublic boolean isEmpty()
isEmpty
in interface PropertyStore
public Set<String> listPropertyNames()
listPropertyNames
in interface PropertyStore
public void clear()
clear
in interface FeatureStore
clear
in interface PropertyStore
public void importProperties(Collection<Property<?>> properties)
importProperties
in interface PropertyStore
properties
- a set of propertiespublic void importFeatures(Collection<Feature> features)
importFeatures
in interface FeatureStore
features
- 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–2020 FF4J. All rights reserved.