use of org.ff4j.property.Property in project ff4j by ff4j.
the class PropertyStoreHBase method readAllProperties.
/**
* {@inheritDoc}
*/
@Override
public Map<String, Property<?>> readAllProperties() {
Map<String, Property<?>> mapOfProperty = new HashMap<>();
try (Connection hbConn = ConnectionFactory.createConnection(conn.getConfig())) {
try (Table table = hbConn.getTable(PROPERTIES_TABLENAME)) {
Scan scan = new Scan();
scan.setCaching(100);
scan.setBatch(100);
scan.addFamily(B_FEATURES_CF_PROPERTIES);
try (ResultScanner resultScanner = table.getScanner(scan)) {
Iterator<Result> iterator = resultScanner.iterator();
while (iterator.hasNext()) {
Property<?> p = MAPPER.fromStore(iterator.next());
mapOfProperty.put(p.getName(), p);
}
}
}
} catch (IOException e) {
throw new PropertyAccessException("Cannot read all property", e);
}
return mapOfProperty;
}
use of org.ff4j.property.Property in project ff4j by ff4j.
the class PropertyStoreJCacheTest method clear.
/**
* TDD.
*/
@Test
public void clear() {
// Given
Assert.assertNotNull(testedStore);
Map<String, Property<?>> before = testedStore.readAllProperties();
Assert.assertFalse(before.isEmpty());
// When
testedStore.clear();
// Then
Assert.assertTrue(testedStore.readAllProperties().isEmpty());
// / Reinit
for (String pName : before.keySet()) {
testedStore.createProperty(before.get(pName));
}
}
use of org.ff4j.property.Property in project ff4j by ff4j.
the class PropertyStoreCassandra method readAllProperties.
/**
* {@inheritDoc}
*/
@Override
public Map<String, Property<?>> readAllProperties() {
Map<String, Property<?>> properties = new HashMap<String, Property<?>>();
ResultSet rs = cqlSession.execute(STMT_PROPERTY_READ_ALL);
for (Row row : rs.all()) {
Property<?> p = mapPropertyRow(row);
properties.put(p.getName(), p);
}
return properties;
}
use of org.ff4j.property.Property in project ff4j by ff4j.
the class PropertyStoreCouchbase method readAllProperties.
/**
* {@inheritDoc}
*/
@Override
public Map<String, Property<?>> readAllProperties() {
N1qlQuery queryFeatures = N1qlQuery.simple("SELECT * FROM " + couchBaseConnection.getFf4jPropertyBucketName());
N1qlQueryResult queryResult = getPropertyBucket().query(queryFeatures);
Map<String, Property<?>> allProperties = new HashMap<>();
for (N1qlQueryRow row : queryResult.allRows()) {
Property<?> p = PropertyJsonParser.parseProperty(row.value().get(couchBaseConnection.getFf4jPropertyBucketName()).toString());
allProperties.put(p.getName(), p);
}
return allProperties;
}
use of org.ff4j.property.Property in project ff4j by ff4j.
the class PropertyStoreCommonsConfig method readAllProperties.
/**
* {@inheritDoc}
*/
@Override
public Map<String, Property<?>> readAllProperties() {
Map<String, Property<?>> props = new HashMap<String, Property<?>>();
Iterator<String> iterKeys = conf().getKeys();
while (iterKeys.hasNext()) {
String currentKey = iterKeys.next();
props.put(currentKey, readProperty(currentKey));
}
return props;
}
Aggregations