Search in sources :

Example 1 with FeatureStoreAuditProxy

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

the class FeatureStoreAuditProxyTest method initStore.

/**
 * {@inheritDoc}
 */
@Override
public FeatureStore initStore() {
    FF4j ff4j = new FF4j();
    InMemoryFeatureStore imfs = new InMemoryFeatureStore();
    imfs.setLocation("ff4j.xml");
    ff4j.setFeatureStore(imfs);
    return new FeatureStoreAuditProxy(ff4j, imfs);
}
Also used : FF4j(org.ff4j.FF4j) InMemoryFeatureStore(org.ff4j.store.InMemoryFeatureStore) FeatureStoreAuditProxy(org.ff4j.audit.proxy.FeatureStoreAuditProxy)

Example 2 with FeatureStoreAuditProxy

use of org.ff4j.audit.proxy.FeatureStoreAuditProxy 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

FeatureStoreAuditProxy (org.ff4j.audit.proxy.FeatureStoreAuditProxy)2 FF4j (org.ff4j.FF4j)1 EventPublisher (org.ff4j.audit.EventPublisher)1 PropertyStoreAuditProxy (org.ff4j.audit.proxy.PropertyStoreAuditProxy)1 FlippingExecutionContext (org.ff4j.core.FlippingExecutionContext)1 InMemoryFeatureStore (org.ff4j.store.InMemoryFeatureStore)1