Search in sources :

Example 1 with CouchbaseOperationServiceImpl

use of io.jans.orm.couchbase.operation.impl.CouchbaseOperationServiceImpl in project jans by JanssenProject.

the class CouchbaseEntryManagerFactory method createEntryManager.

@Override
public CouchbaseEntryManager createEntryManager(Properties conf) {
    Properties entryManagerConf = PropertiesHelper.filterProperties(conf, "#");
    // Allow proper initialization
    if (this.couchbaseConnectionProperties == null) {
        this.couchbaseConnectionProperties = entryManagerConf;
    }
    init();
    if (!isInitialized()) {
        throw new ConfigurationException("Failed to create Couchbase environment!");
    }
    CouchbaseConnectionProvider connectionProvider = new CouchbaseConnectionProvider(entryManagerConf, couchbaseEnvironment);
    connectionProvider.create();
    if (!connectionProvider.isCreated()) {
        throw new ConfigurationException(String.format("Failed to create Couchbase connection pool! Result code: '%s'", connectionProvider.getCreationResultCode()));
    }
    LOG.debug("Created connectionProvider '{}' with code '{}'", connectionProvider, connectionProvider.getCreationResultCode());
    CouchbaseEntryManager couchbaseEntryManager = new CouchbaseEntryManager(new CouchbaseOperationServiceImpl(entryManagerConf, connectionProvider));
    LOG.info("Created CouchbaseEntryManager: {}", couchbaseEntryManager.getOperationService());
    return couchbaseEntryManager;
}
Also used : ConfigurationException(io.jans.orm.exception.operation.ConfigurationException) CouchbaseConnectionProvider(io.jans.orm.couchbase.operation.impl.CouchbaseConnectionProvider) Properties(java.util.Properties) CouchbaseOperationServiceImpl(io.jans.orm.couchbase.operation.impl.CouchbaseOperationServiceImpl)

Aggregations

CouchbaseConnectionProvider (io.jans.orm.couchbase.operation.impl.CouchbaseConnectionProvider)1 CouchbaseOperationServiceImpl (io.jans.orm.couchbase.operation.impl.CouchbaseOperationServiceImpl)1 ConfigurationException (io.jans.orm.exception.operation.ConfigurationException)1 Properties (java.util.Properties)1