use of org.gluu.persist.model.PersistenceConfiguration in project oxTrust by GluuFederation.
the class ConfigurationFactory method reloadConfiguration.
private void reloadConfiguration() {
// Reload LDAP configuration if needed
PersistenceConfiguration newPersistenceConfiguration = persistanceFactoryService.loadPersistenceConfiguration(getApplicationPropertiesFileName());
if (newPersistenceConfiguration != null) {
if (!StringHelper.equalsIgnoreCase(this.persistenceConfiguration.getFileName(), newPersistenceConfiguration.getFileName()) || (newPersistenceConfiguration.getLastModifiedTime() > this.persistenceConfiguration.getLastModifiedTime())) {
// Reload configuration only if it was modified
this.persistenceConfiguration = newPersistenceConfiguration;
event.select(LdapConfigurationReload.Literal.INSTANCE).fire(PERSISTENCE_CONFIGUARION_RELOAD_EVENT_TYPE);
}
}
// Reload Base configuration if needed
File baseConfiguration = new File(BASE_PROPERTIES_FILE);
if (baseConfiguration.exists()) {
final long lastModified = baseConfiguration.lastModified();
if (lastModified > baseConfigurationFileLastModifiedTime) {
// Reload configuration only if it was modified
loadBaseConfiguration();
event.select(BaseConfigurationReload.Literal.INSTANCE).fire(BASE_CONFIGUARION_RELOAD_EVENT_TYPE);
}
}
if (!loadedFromLdap) {
return;
}
final C conf = loadConfigurationFromDb("oxRevision");
if (conf == null) {
return;
}
if (!isNewRevision(conf)) {
return;
}
createFromDb();
}
use of org.gluu.persist.model.PersistenceConfiguration in project oxTrust by GluuFederation.
the class AppInitializer method preparePersistanceProperties.
protected Properties preparePersistanceProperties() {
PersistenceConfiguration persistenceConfiguration = this.configurationFactory.getPersistenceConfiguration();
FileConfiguration persistenceConfig = persistenceConfiguration.getConfiguration();
Properties connectionProperties = (Properties) persistenceConfig.getProperties();
EncryptionService securityService = encryptionServiceInstance.get();
Properties decryptedConnectionProperties = securityService.decryptAllProperties(connectionProperties);
return decryptedConnectionProperties;
}
use of org.gluu.persist.model.PersistenceConfiguration in project oxAuth by GluuFederation.
the class ConfigurationFactory method reloadConfiguration.
private void reloadConfiguration() {
// Reload LDAP configuration if needed
PersistenceConfiguration newPersistenceConfiguration = persistanceFactoryService.loadPersistenceConfiguration(LDAP_PROPERTIES_FILE);
if (newPersistenceConfiguration != null) {
if (!StringHelper.equalsIgnoreCase(this.persistenceConfiguration.getFileName(), newPersistenceConfiguration.getFileName()) || (newPersistenceConfiguration.getLastModifiedTime() > this.persistenceConfiguration.getLastModifiedTime())) {
// Reload configuration only if it was modified
this.persistenceConfiguration = newPersistenceConfiguration;
event.select(LdapConfigurationReload.Literal.INSTANCE).fire(PERSISTENCE_CONFIGUARION_RELOAD_EVENT_TYPE);
}
}
// Reload Base configuration if needed
File baseConfiguration = new File(BASE_PROPERTIES_FILE);
if (baseConfiguration.exists()) {
final long lastModified = baseConfiguration.lastModified();
if (lastModified > baseConfigurationFileLastModifiedTime) {
// Reload configuration only if it was modified
loadBaseConfiguration();
event.select(BaseConfigurationReload.Literal.INSTANCE).fire(BASE_CONFIGUARION_RELOAD_EVENT_TYPE);
}
}
if (!loadedFromLdap) {
return;
}
if (!isRevisionIncreased()) {
return;
}
createFromLdap(false);
}
use of org.gluu.persist.model.PersistenceConfiguration in project oxAuth by GluuFederation.
the class AppInitializer method preparePersistanceProperties.
protected Properties preparePersistanceProperties() {
PersistenceConfiguration persistenceConfiguration = this.configurationFactory.getPersistenceConfiguration();
FileConfiguration persistenceConfig = persistenceConfiguration.getConfiguration();
Properties connectionProperties = (Properties) persistenceConfig.getProperties();
EncryptionService securityService = encryptionServiceInstance.get();
Properties decryptedConnectionProperties = securityService.decryptAllProperties(connectionProperties);
return decryptedConnectionProperties;
}
Aggregations