Search in sources :

Example 1 with PropertyStoreAuditProxy

use of org.ff4j.audit.proxy.PropertyStoreAuditProxy in project ff4j by ff4j.

the class FF4jTest method getConcreteFeatureStore.

@Test
public void getConcreteFeatureStore() {
    FF4j ff4j = new FF4j();
    ff4j.cache(new InMemoryCacheManager());
    Assert.assertNotNull(ff4j.getCacheProxy());
    Assert.assertNotNull(ff4j.getConcreteFeatureStore());
    Assert.assertNotNull(ff4j.getConcretePropertyStore());
    ff4j.setPropertiesStore(new PropertyStoreAuditProxy(ff4j, ff4j.getPropertiesStore()));
    Assert.assertNotNull(ff4j.getConcretePropertyStore());
}
Also used : PropertyStoreAuditProxy(org.ff4j.audit.proxy.PropertyStoreAuditProxy) InMemoryCacheManager(org.ff4j.cache.InMemoryCacheManager) FF4j(org.ff4j.FF4j) Test(org.junit.Test)

Example 2 with PropertyStoreAuditProxy

use of org.ff4j.audit.proxy.PropertyStoreAuditProxy in project ff4j by ff4j.

the class PropertyStoreAuditProxyTest method initPropertyStore.

/**
 * {@inheritDoc}
 */
@Override
protected PropertyStore initPropertyStore() {
    FF4j ff4j = new FF4j();
    PropertyStore ps = new InMemoryPropertyStore("ff4j.xml");
    ff4j.setPropertiesStore(ps);
    return new PropertyStoreAuditProxy(ff4j, ps);
}
Also used : PropertyStoreAuditProxy(org.ff4j.audit.proxy.PropertyStoreAuditProxy) InMemoryPropertyStore(org.ff4j.property.store.InMemoryPropertyStore) FF4j(org.ff4j.FF4j) InMemoryPropertyStore(org.ff4j.property.store.InMemoryPropertyStore) PropertyStore(org.ff4j.property.store.PropertyStore)

Example 3 with PropertyStoreAuditProxy

use of org.ff4j.audit.proxy.PropertyStoreAuditProxy in project ff4j by ff4j.

the class FF4j method init.

/**
 * Initialization of background components.
 */
private synchronized void init() {
    // Execution Context
    FlippingExecutionContext context = new FlippingExecutionContext();
    this.currentExecutionContext.set(context);
    // Event Publisher
    if (eventPublisher == null) {
        eventPublisher = new EventPublisher(eventRepository);
        this.shutdownEventPublisher = true;
    }
    // Audit is enabled, proxified stores for auditing
    if (isEnableAudit()) {
        if (fstore != null && !(fstore instanceof FeatureStoreAuditProxy)) {
            this.fstore = new FeatureStoreAuditProxy(this, fstore);
        }
        if (pStore != null && !(pStore instanceof PropertyStoreAuditProxy)) {
            this.pStore = new PropertyStoreAuditProxy(this, pStore);
        }
    } else {
        // Audit is disabled but could have been enabled before... removing PROXY if relevant
        if (fstore != null && fstore instanceof FeatureStoreAuditProxy) {
            this.fstore = ((FeatureStoreAuditProxy) fstore).getTarget();
        }
        if (pStore != null && pStore instanceof PropertyStoreAuditProxy) {
            this.pStore = ((PropertyStoreAuditProxy) pStore).getTarget();
        }
    }
    // Flag as OK
    this.initialized = true;
}
Also used : PropertyStoreAuditProxy(org.ff4j.audit.proxy.PropertyStoreAuditProxy) EventPublisher(org.ff4j.audit.EventPublisher) FeatureStoreAuditProxy(org.ff4j.audit.proxy.FeatureStoreAuditProxy) FlippingExecutionContext(org.ff4j.core.FlippingExecutionContext)

Aggregations

PropertyStoreAuditProxy (org.ff4j.audit.proxy.PropertyStoreAuditProxy)3 FF4j (org.ff4j.FF4j)2 EventPublisher (org.ff4j.audit.EventPublisher)1 FeatureStoreAuditProxy (org.ff4j.audit.proxy.FeatureStoreAuditProxy)1 InMemoryCacheManager (org.ff4j.cache.InMemoryCacheManager)1 FlippingExecutionContext (org.ff4j.core.FlippingExecutionContext)1 InMemoryPropertyStore (org.ff4j.property.store.InMemoryPropertyStore)1 PropertyStore (org.ff4j.property.store.PropertyStore)1 Test (org.junit.Test)1