/** * Creates credential reader using default configurations for credential store database. * @return The credential reader. * @throws ClassNotFoundException If an error occurred while instantiating jdbc driver * @throws ApplicationSettingsException If an error occurred while reading database configurations. * @throws InstantiationException If an error occurred while instantiating jdbc driver * @throws IllegalAccessException A security exception accessing jdbc driver. */ public static CredentialReader createCredentialStoreReader() throws ClassNotFoundException, ApplicationSettingsException, InstantiationException, IllegalAccessException { return new CredentialReaderImpl(DBUtil.getCredentialStoreDBUtil()); } }
public void init() throws ServletException { DBUtil dbUtil; try { dbUtil = DBUtil.getCredentialStoreDBUtil(); } catch (Exception e) { throw new ServletException("Error initializing database operations.", e); } try { configurationReader = new ConfigurationReader(); super.init(); certificateCredentialWriter = new CertificateCredentialWriter(dbUtil); } catch (Exception e) { throw new ServletException("Error initializing configuration reader.", e); } // initialize notifier try { boolean enabled = Boolean.parseBoolean(ApplicationSettings.getCredentialStoreNotifierEnabled()); if (enabled) { EmailNotifierConfiguration notifierConfiguration = EmailNotifierConfiguration.getEmailNotifierConfigurations(); long duration = Long.parseLong(ApplicationSettings.getCredentialStoreNotifierDuration()); notifierBootstrap = new NotifierBootstrap(duration, dbUtil, notifierConfiguration); } } catch (ApplicationSettingsException e) { throw new ServletException("Error initializing notifier.", e); } info("Credential store callback initialized successfully."); }