1.1 --- a/src/main/java/de/uapcore/lightpit/DatabaseFacade.java Sun May 10 10:58:31 2020 +0200 1.2 +++ b/src/main/java/de/uapcore/lightpit/DatabaseFacade.java Mon May 11 19:09:06 2020 +0200 1.3 @@ -28,8 +28,6 @@ 1.4 */ 1.5 package de.uapcore.lightpit; 1.6 1.7 -import de.uapcore.lightpit.dao.DataAccessObjects; 1.8 -import de.uapcore.lightpit.dao.postgres.PGDataAccessObjects; 1.9 import org.slf4j.Logger; 1.10 import org.slf4j.LoggerFactory; 1.11 1.12 @@ -91,29 +89,14 @@ 1.13 1.14 private static final String DS_JNDI_NAME = "jdbc/lightpit/app"; 1.15 private DataSource dataSource; 1.16 - private DataAccessObjects dataAccessObjects; 1.17 1.18 /** 1.19 * Returns the data source. 1.20 - * <p> 1.21 - * The Optional returned should never be empty. However, if something goes 1.22 - * wrong during initialization, the data source might be absent. 1.23 - * Hence, users of this data source are forced to check the existence. 1.24 * 1.25 * @return a data source 1.26 */ 1.27 - public Optional<DataSource> getDataSource() { 1.28 - // TODO: this should not be an optional, if an empty optional is actually an exception 1.29 - return Optional.ofNullable(dataSource); 1.30 - } 1.31 - 1.32 - /** 1.33 - * Returns the data access objects. 1.34 - * 1.35 - * @return an interface to obtain the data access objects 1.36 - */ 1.37 - public DataAccessObjects getDataAccessObjects() { 1.38 - return dataAccessObjects; 1.39 + public DataSource getDataSource() { 1.40 + return dataSource; 1.41 } 1.42 1.43 public Dialect getSQLDialect() { 1.44 @@ -171,8 +154,6 @@ 1.45 } 1.46 } 1.47 1.48 - dataAccessObjects = createDataAccessObjects(dialect); 1.49 - 1.50 try { 1.51 LOG.debug("Trying to access JNDI context {}...", contextName); 1.52 Context initialCtx = new InitialContext(); 1.53 @@ -191,15 +172,6 @@ 1.54 LOG.info("Database facade injected into ServletContext."); 1.55 } 1.56 1.57 - private static DataAccessObjects createDataAccessObjects(Dialect dialect) { 1.58 - switch (dialect) { 1.59 - case Postgres: 1.60 - return new PGDataAccessObjects(); 1.61 - default: 1.62 - throw new AssertionError("Non-exhaustive switch - this is a bug."); 1.63 - } 1.64 - } 1.65 - 1.66 @Override 1.67 public void contextDestroyed(ServletContextEvent sce) { 1.68 dataSource = null;