use of io.jans.orm.exception.operation.ConfigurationException 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;
}
use of io.jans.orm.exception.operation.ConfigurationException in project jans by JanssenProject.
the class StandalonePersistanceFactoryService method createPersistenceEntryManagerFactoryImpl.
private PersistenceEntryManagerFactory createPersistenceEntryManagerFactoryImpl(Class<? extends PersistenceEntryManagerFactory> persistenceEntryManagerFactoryClass) {
PersistenceEntryManagerFactory persistenceEntryManagerFactory;
try {
persistenceEntryManagerFactory = ReflectHelper.createObjectByDefaultConstructor(persistenceEntryManagerFactoryClass);
persistenceEntryManagerFactory.initStandalone(this);
} catch (PropertyNotFoundException | IllegalArgumentException | InstantiationException | IllegalAccessException | InvocationTargetException e) {
throw new ConfigurationException(String.format("Failed to create PersistenceEntryManagerFactory by type '%s'!", persistenceEntryManagerFactoryClass));
}
return persistenceEntryManagerFactory;
}
use of io.jans.orm.exception.operation.ConfigurationException in project jans by JanssenProject.
the class SqlEntryManagerFactory method createEntryManager.
@Override
public SqlEntryManager createEntryManager(Properties conf) {
Properties entryManagerConf = PropertiesHelper.filterProperties(conf, "#");
SqlConnectionProvider connectionProvider = new SqlConnectionProvider(entryManagerConf);
connectionProvider.create();
if (!connectionProvider.isCreated()) {
throw new ConfigurationException(String.format("Failed to create SQL connection pool! Result code: '%s'", connectionProvider.getCreationResultCode()));
}
LOG.debug("Created connectionProvider '{}' with code '{}'", connectionProvider, connectionProvider.getCreationResultCode());
SqlEntryManager sqlEntryManager = new SqlEntryManager(new SqlOperationServiceImpl(entryManagerConf, connectionProvider));
LOG.info("Created SqlEntryManager: {}", sqlEntryManager.getOperationService());
return sqlEntryManager;
}
use of io.jans.orm.exception.operation.ConfigurationException in project jans by JanssenProject.
the class LdapEntryManagerFactory method createEntryManager.
@Override
public LdapEntryManager createEntryManager(Properties conf) {
Properties entryManagerConf = PropertiesHelper.filterProperties(conf, "#");
LdapConnectionProvider connectionProvider = new LdapConnectionProvider(entryManagerConf);
connectionProvider.create();
if (!connectionProvider.isCreated()) {
throw new ConfigurationException(String.format("Failed to create LDAP connection pool! Result code: '%s'", connectionProvider.getCreationResultCode()));
}
LOG.debug("Created connectionProvider '{}' with code '{}'", connectionProvider, connectionProvider.getCreationResultCode());
LdapConnectionProvider bindConnectionProvider = new LdapAuthConnectionProvider(entryManagerConf);
connectionProvider.create();
if (!bindConnectionProvider.isCreated()) {
throw new ConfigurationException(String.format("Failed to create LDAP bind connection pool! Result code: '%s'", bindConnectionProvider.getCreationResultCode()));
}
LOG.debug("Created bindConnectionProvider '{}' with code '{}'", bindConnectionProvider, bindConnectionProvider.getCreationResultCode());
LdapEntryManager ldapEntryManager = new LdapEntryManager(new LdapOperationServiceImpl(connectionProvider, bindConnectionProvider));
LOG.info("Created LdapEntryManager: {}", ldapEntryManager.getOperationService());
return ldapEntryManager;
}
use of io.jans.orm.exception.operation.ConfigurationException in project jans by JanssenProject.
the class HybridEntryManagerFactory method createEntryManager.
@Override
public HybridEntryManager createEntryManager(Properties conf) {
HashMap<String, PersistenceEntryManager> persistenceEntryManagers = new HashMap<String, PersistenceEntryManager>();
List<PersistenceOperationService> operationServices = new ArrayList<PersistenceOperationService>();
if (persistenceTypes == null) {
Properties hybridProperties = PropertiesHelper.findProperties(conf, PERSISTENCE_TYPE, "#");
hybridProperties = PropertiesHelper.filterProperties(hybridProperties, "#");
String storagesList = hybridProperties.getProperty("storages", null);
if (StringHelper.isEmpty(storagesList)) {
throw new ConfigurationException("'storages' key not exists or value is empty!");
}
this.persistenceTypes = StringHelper.split(storagesList, ",");
}
for (String persistenceType : persistenceTypes) {
PersistenceEntryManagerFactory persistenceEntryManagerFactory = persistanceFactoryService.getPersistenceEntryManagerFactory(persistenceType);
if (persistenceEntryManagerFactory == null) {
throw new ConfigurationException(String.format("Unable to get Persistence Entry Manager Factory by type '%s'", persistenceType));
}
Properties entryManagerConf = PropertiesHelper.findProperties(conf, persistenceType, "#");
PersistenceEntryManager persistenceEntryManager = persistenceEntryManagerFactory.createEntryManager(entryManagerConf);
persistenceEntryManagers.put(persistenceType, persistenceEntryManager);
operationServices.add(persistenceEntryManager.getOperationService());
}
this.hybridMappingProperties = PropertiesHelper.filterProperties(conf, "#");
HybridPersistenceOperationService hybridOperationService = new HybridPersistenceOperationService(operationServices);
HybridEntryManager hybridEntryManager = new HybridEntryManager(hybridMappingProperties, persistenceEntryManagers, hybridOperationService);
LOG.info("Created HybridEntryManager: {}", hybridOperationService);
return hybridEntryManager;
}
Aggregations