Search in sources :

Example 1 with MetricsNoSqlAdapterWrapper

use of org.apache.sling.nosql.generic.adapter.MetricsNoSqlAdapterWrapper in project sling by apache.

the class CouchbaseNoSqlResourceProviderFactory method activate.

@Activate
private void activate(ComponentContext componentContext, Map<String, Object> config) {
    String cacheKeyPrefix = PropertiesUtil.toString(config.get(CACHE_KEY_PREFIX_PROPERTY), CACHE_KEY_PREFIX_DEFAULT);
    NoSqlAdapter couchbaseAdapter = new CouchbaseNoSqlAdapter(couchbaseClient, cacheKeyPrefix);
    // enable call logging and metrics for {@link CouchbaseNoSqlAdapter}
    noSqlAdapter = new MetricsNoSqlAdapterWrapper(couchbaseAdapter, LoggerFactory.getLogger(CouchbaseNoSqlAdapter.class));
}
Also used : NoSqlAdapter(org.apache.sling.nosql.generic.adapter.NoSqlAdapter) MetricsNoSqlAdapterWrapper(org.apache.sling.nosql.generic.adapter.MetricsNoSqlAdapterWrapper) Activate(org.apache.felix.scr.annotations.Activate)

Example 2 with MetricsNoSqlAdapterWrapper

use of org.apache.sling.nosql.generic.adapter.MetricsNoSqlAdapterWrapper in project sling by apache.

the class MongoDBNoSqlResourceProviderFactory method activate.

@Activate
private void activate(ComponentContext componentContext, Map<String, Object> config) {
    String connectionString = PropertiesUtil.toString(config.get(CONNECTION_STRING_PROPERTY), CONNECTION_STRING_DEFAULT);
    String database = PropertiesUtil.toString(config.get(DATABASE_PROPERTY), DATABASE_DEFAULT);
    String collection = PropertiesUtil.toString(config.get(COLLECTION_PROPERTY), COLLECTION_DEFAULT);
    mongoClient = new MongoClient(connectionString);
    NoSqlAdapter mongodbAdapter = new MongoDBNoSqlAdapter(mongoClient, database, collection);
    // enable call logging and metrics for {@link MongoDBNoSqlAdapter}
    noSqlAdapter = new MetricsNoSqlAdapterWrapper(mongodbAdapter, LoggerFactory.getLogger(MongoDBNoSqlAdapter.class));
}
Also used : NoSqlAdapter(org.apache.sling.nosql.generic.adapter.NoSqlAdapter) MongoClient(com.mongodb.MongoClient) MetricsNoSqlAdapterWrapper(org.apache.sling.nosql.generic.adapter.MetricsNoSqlAdapterWrapper) Activate(org.apache.felix.scr.annotations.Activate)

Aggregations

Activate (org.apache.felix.scr.annotations.Activate)2 MetricsNoSqlAdapterWrapper (org.apache.sling.nosql.generic.adapter.MetricsNoSqlAdapterWrapper)2 NoSqlAdapter (org.apache.sling.nosql.generic.adapter.NoSqlAdapter)2 MongoClient (com.mongodb.MongoClient)1