Search in sources :

Example 1 with NoSqlAdapter

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

the class AbstractNoSqlResourceProviderFactory method getResourceProvider.

public final ResourceProvider getResourceProvider(Map<String, Object> authenticationInfo) throws LoginException {
    NoSqlAdapter adapter = getNoSqlAdapter();
    adapter.checkConnection();
    adapter.createIndexDefinitions();
    return new NoSqlResourceProvider(adapter, getEventAdmin());
}
Also used : NoSqlAdapter(org.apache.sling.nosql.generic.adapter.NoSqlAdapter) NoSqlResourceProvider(org.apache.sling.nosql.generic.resource.impl.NoSqlResourceProvider)

Example 2 with NoSqlAdapter

use of org.apache.sling.nosql.generic.adapter.NoSqlAdapter 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 3 with NoSqlAdapter

use of org.apache.sling.nosql.generic.adapter.NoSqlAdapter 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

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