use of password.pwm.config.stored.ConfigurationReader in project pwm by pwm-project.
the class LocalDBLoggerTest method setUp.
@Override
protected void setUp() throws Exception {
// To change body of overridden methods use File | Settings | File Templates.
super.setUp();
TestHelper.setupLogging();
final File localDBPath = new File(TestHelper.getParameter("localDBPath"));
final File configFile = new File(TestHelper.getParameter("configurationFile"));
final ConfigurationReader reader = new ConfigurationReader(configFile);
config = reader.getConfiguration();
localDB = LocalDBFactory.getInstance(localDBPath, false, null, config);
// localDB.truncate(LocalDB.DB.EVENTLOG_EVENTS);
// System.out.println(localDB.size(LocalDB.DB.EVENTLOG_EVENTS));
// new TimeDuration(1,TimeUnit.HOURS).pause();
{
// open localDBLogger based on configuration settings;
final int maxEvents = (int) reader.getConfiguration().readSettingAsLong(PwmSetting.EVENTS_PWMDB_MAX_EVENTS);
final long maxAgeMs = reader.getConfiguration().readSettingAsLong(PwmSetting.EVENTS_PWMDB_MAX_AGE) * (long) 1000;
final LocalDBLoggerSettings settings = new LocalDBLoggerSettings.Builder().setMaxEvents(maxEvents).setMaxAge(new TimeDuration(maxAgeMs)).setFlags(Collections.<LocalDBLoggerSettings.Flag>emptySet()).createLocalDBLoggerSettings();
localDBLogger = new LocalDBLogger(null, localDB, settings);
}
settings = new Settings();
settings.threads = 10;
settings.testDuration = new TimeDuration(3, TimeUnit.HOURS);
settings.valueLength = 5000;
settings.batchSize = 100;
}
use of password.pwm.config.stored.ConfigurationReader in project pwm by pwm-project.
the class ConfigManagerServlet method initRequestAttributes.
void initRequestAttributes(final PwmRequest pwmRequest) throws PwmUnrecoverableException {
final ConfigurationReader configurationReader = pwmRequest.getContextManager().getConfigReader();
pwmRequest.setAttribute(PwmRequestAttribute.PageTitle, LocaleHelper.getLocalizedMessage(Config.Title_ConfigManager, pwmRequest));
pwmRequest.setAttribute(PwmRequestAttribute.ApplicationPath, pwmRequest.getPwmApplication().getPwmEnvironment().getApplicationPath().getAbsolutePath());
pwmRequest.setAttribute(PwmRequestAttribute.ConfigFilename, configurationReader.getConfigFile().getAbsolutePath());
{
final Instant lastModifyTime = configurationReader.getStoredConfiguration().modifyTime();
final String output = lastModifyTime == null ? LocaleHelper.getLocalizedMessage(Display.Value_NotApplicable, pwmRequest) : JavaHelper.toIsoDate(lastModifyTime);
pwmRequest.setAttribute(PwmRequestAttribute.ConfigLastModified, output);
}
pwmRequest.setAttribute(PwmRequestAttribute.ConfigHasPassword, LocaleHelper.booleanString(configurationReader.getStoredConfiguration().hasPassword(), pwmRequest.getLocale(), pwmRequest.getConfig()));
}
use of password.pwm.config.stored.ConfigurationReader in project pwm by pwm-project.
the class ConfigManagerServlet method readCurrentConfiguration.
public static StoredConfigurationImpl readCurrentConfiguration(final PwmRequest pwmRequest) throws PwmUnrecoverableException {
final ContextManager contextManager = ContextManager.getContextManager(pwmRequest.getHttpServletRequest().getSession());
final ConfigurationReader runningConfigReader = contextManager.getConfigReader();
final StoredConfigurationImpl runningConfig = runningConfigReader.getStoredConfiguration();
return StoredConfigurationImpl.copy(runningConfig);
}
Aggregations