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);
}
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;
}
Aggregations