use of org.olat.core.logging.StartupException in project OpenOLAT by OpenOLAT.
the class AbstractHierarchicalIndexer method setIndexerList.
/**
* Bean setter method used by spring.
* @param indexerList
*/
public void setIndexerList(List<Indexer> indexerList) {
if (indexerList == null) {
throw new AssertException("null value for indexerList not allowed.");
}
try {
for (Indexer indexer : indexerList) {
childIndexers.add(indexer);
logDebug("Adding indexer from configuraton. TypeName=" + indexer.getSupportedTypeName());
}
} catch (ClassCastException cce) {
throw new StartupException("Configured indexer is not of type Indexer", cce);
}
}
use of org.olat.core.logging.StartupException in project OpenOLAT by OpenOLAT.
the class UserModule method checkMandatoryUserProperty.
private void checkMandatoryUserProperty(String userPropertyIdentifyer) {
List<UserPropertyHandler> propertyHandlers = userPropertiesConfig.getAllUserPropertyHandlers();
boolean propertyDefined = false;
for (UserPropertyHandler propertyHandler : propertyHandlers) {
if (propertyHandler.getName().equals(userPropertyIdentifyer)) {
propertyDefined = true;
break;
}
}
if (!propertyDefined) {
throw new StartupException("The user property handler for the mandatory user property " + userPropertyIdentifyer + " is not defined. Check your olat_userconfig.xml file!");
}
}
use of org.olat.core.logging.StartupException in project OpenOLAT by OpenOLAT.
the class LoginModule method init.
@Override
public void init() {
// configure timed cache default params: refresh 1 minute, timeout according to configuration
failedLoginCache = coordinatorManager.getCoordinator().getCacher().getCache(LoginModule.class.getSimpleName(), "blockafterfailedattempts");
updateProperties();
boolean defaultProviderFound = false;
for (Iterator<AuthenticationProvider> iterator = authenticationProviders.iterator(); iterator.hasNext(); ) {
AuthenticationProvider provider = iterator.next();
if (provider.isDefault()) {
defaultProviderFound = true;
defaultProviderName = provider.getName();
log.info("Using default authentication provider '" + defaultProviderName + "'.");
}
}
if (!defaultProviderFound) {
throw new StartupException("Defined DefaultAuthProvider::" + defaultProviderName + " not existent or not enabled. Please fix.");
}
}
use of org.olat.core.logging.StartupException in project OpenOLAT by OpenOLAT.
the class DatabaseUpgradeManager method runAlterDbStatements.
/**
* @see org.olat.upgrade.UpgradeManager#runAlterDbStatements()
*/
public void runAlterDbStatements() {
Dialect dialect;
// only run upgrades on mysql or postgresql
if (getDbVendor().contains("mysql"))
dialect = Dialect.mysql;
else if (getDbVendor().contains("postgresql"))
dialect = Dialect.postgresql;
else
return;
Statement statement = null;
try {
logAudit("+--------------------------------------------------------------+");
logAudit("+... Pure database upgrade: starting alter DB statements ...+");
logAudit("+ If it fails, do it manually by applying the content of the alter_X_to_Y.sql files.+");
logAudit("+ For each file you upgraded to add an entry like this to the [pathToOlat]/olatdata/system/installed_database_upgrades.xml: +");
logAudit("+ <entry><string>Database update</string><boolean>true</boolean></entry>+");
logAudit("+--------------------------------------------------------------+");
statement = getDataSource().getConnection().createStatement();
Iterator<OLATUpgrade> iter = upgrades.iterator();
OLATUpgrade upgrade = null;
while (iter.hasNext()) {
upgrade = iter.next();
String alterDbStatementsFilename = upgrade.getAlterDbStatements();
if (alterDbStatementsFilename != null) {
UpgradeHistoryData uhd = getUpgradesHistory(upgrade.getVersion());
if (uhd == null) {
// has never been called, initialize
uhd = new UpgradeHistoryData();
}
if (!uhd.getBooleanDataValue(OLATUpgrade.TASK_DP_UPGRADE)) {
loadAndExecuteSqlStatements(statement, alterDbStatementsFilename, dialect);
uhd.setBooleanDataValue(OLATUpgrade.TASK_DP_UPGRADE, true);
setUpgradesHistory(uhd, upgrade.getVersion());
logAudit("Successfully executed alter DB statements for Version::" + upgrade.getVersion());
}
}
}
} catch (SQLException e) {
logError("Could not upgrade your database! Please do it manually and add ", e);
throw new StartupException("Could not execute alter db statements. Please do it manually.", e);
} catch (Throwable e) {
logWarn("Error executing alter DB statements::", e);
abort(e);
} finally {
try {
if (statement != null) {
statement.close();
}
} catch (SQLException e2) {
logWarn("Could not close sql statement", e2);
throw new StartupException("Could not close sql statements.", e2);
}
}
}
use of org.olat.core.logging.StartupException in project openolat by klemens.
the class AbstractHierarchicalIndexer method setIndexerList.
/**
* Bean setter method used by spring.
* @param indexerList
*/
public void setIndexerList(List<Indexer> indexerList) {
if (indexerList == null) {
throw new AssertException("null value for indexerList not allowed.");
}
try {
for (Indexer indexer : indexerList) {
childIndexers.add(indexer);
logDebug("Adding indexer from configuraton. TypeName=" + indexer.getSupportedTypeName());
}
} catch (ClassCastException cce) {
throw new StartupException("Configured indexer is not of type Indexer", cce);
}
}
Aggregations