/** {@inheritDoc} */ @Override public Map<String, Property<?>> readAllProperties() { return getTargetPropertyStore().readAllProperties(); }
/** * Parameterized constructor. * * @param fcp * cache proxy */ public Store2CachePollingWorker(FF4jCacheProxy fcp) { this(fcp.getTargetFeatureStore(),fcp.getTargetPropertyStore(),null); this.ff4JCacheProxy = fcp; }
/** {@inheritDoc} */ @Override public Set<String> listPropertyNames() { return getTargetPropertyStore().listPropertyNames(); }
/** {@inheritDoc} */ @Override public void createSchema() { // Create table for features but not only getTargetFeatureStore().createSchema(); // Also create tables for properties getTargetPropertyStore().createSchema(); }
/** {@inheritDoc} */ @Override public boolean existProperty(String propertyName) { // not in cache but maybe created from last access if (getCacheManager().getProperty(propertyName) == null) { return getTargetPropertyStore().existProperty(propertyName); } return true; }
/** {@inheritDoc} */ @Override public void deleteProperty(String name) { // Access target store getTargetPropertyStore().deleteProperty(name); // even is not present, evict name failed getCacheManager().evictProperty(name); }
/** {@inheritDoc} */ @Override public <T> void createProperty(Property<T> property) { getTargetPropertyStore().createProperty(property); getCacheManager().putProperty(property); }
/** {@inheritDoc} */ public void importProperties(Collection<Property<?>> properties) { getCacheManager().clearProperties(); getTargetPropertyStore().importProperties(properties); }
/** * Return concrete implementation. * * @param fs * current propertyStoyre * @return * target propertyStoyre */ private PropertyStore getConcretePropertyStore(PropertyStore ps) { if (ps instanceof PropertyStoreAuditProxy) { return getConcretePropertyStore(((PropertyStoreAuditProxy) ps).getTarget()); } else if (ps instanceof FF4jCacheProxy) { return getConcretePropertyStore(((FF4jCacheProxy) ps).getTargetPropertyStore()); } return ps; }
/** {@inheritDoc} */ @Override public void updateProperty(String name, String newValue) { // Retrieve the full object from its name Property<?> fp = getTargetPropertyStore().readProperty(name); fp.setValueFromString(newValue); // Update value in target store getTargetPropertyStore().updateProperty(fp); // Remove from cache old value getCacheManager().evictProperty(fp.getName()); // Add new value in the cache getCacheManager().putProperty(fp); }
/** {@inheritDoc} */ @Override public Property<?> readProperty(String name) { Property<?> fp = getCacheManager().getProperty(name); // not in cache but may has been created from now if (null == fp) { fp = getTargetPropertyStore().readProperty(name); getCacheManager().putProperty(fp); } return fp; }
/** {@inheritDoc} */ @Override public Property<?> readProperty(String name, Property<?> defaultValue) { Property<?> fp = getCacheManager().getProperty(name); // Not in cache but may has been created from now // Or in cache but with different value that default if (null == fp) { fp = getTargetPropertyStore().readProperty(name, defaultValue); getCacheManager().putProperty(fp); } return fp; }
/** {@inheritDoc} */ @Override public <T> void updateProperty(Property<T> propertyValue) { // Update the property getTargetPropertyStore().updateProperty(propertyValue); // Update the cache accordirly getCacheManager().evictProperty(propertyValue.getName()); // Update the property in cache getCacheManager().putProperty(propertyValue); }
/** {@inheritDoc} */ @Override public void clear() { // Cache Operations : As modification, flush cache for this getCacheManager().clearProperties(); getTargetPropertyStore().clear(); // Cache Operations : As modification, flush cache for this getCacheManager().clearFeatures(); getTargetFeatureStore().clear(); }