src/main/java/de/uapcore/lightpit/AbstractLightPITServlet.java

changeset 159
86b5d8a1662f
parent 158
4f912cd42876
child 160
e2d09cf3fb96
--- a/src/main/java/de/uapcore/lightpit/AbstractLightPITServlet.java	Fri Nov 06 10:50:32 2020 +0100
+++ b/src/main/java/de/uapcore/lightpit/AbstractLightPITServlet.java	Thu Nov 19 13:58:54 2020 +0100
@@ -28,8 +28,8 @@
  */
 package de.uapcore.lightpit;
 
-import de.uapcore.lightpit.dao.DataAccessObjects;
-import de.uapcore.lightpit.dao.postgres.PGDataAccessObjects;
+import de.uapcore.lightpit.dao.DaoProvider;
+import de.uapcore.lightpit.dao.postgres.PGDaoProvider;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -100,15 +100,15 @@
      * @param connection the SQL connection
      * @return a set of data access objects
      */
-    private DataAccessObjects createDataAccessObjects(Connection connection) throws SQLException {
+    private DaoProvider createDataAccessObjects(Connection connection) throws SQLException {
         final var df = (DataSourceProvider) getServletContext().getAttribute(DataSourceProvider.Companion.getSC_ATTR_NAME());
         if (df.getDialect() == DataSourceProvider.Dialect.Postgres) {
-            return new PGDataAccessObjects(connection);
+            return new PGDaoProvider(connection);
         }
         throw new UnsupportedOperationException("Non-exhaustive if-else - this is a bug.");
     }
 
-    private void invokeMapping(Map.Entry<PathPattern, Method> mapping, HttpServletRequest req, HttpServletResponse resp, DataAccessObjects dao) throws IOException {
+    private void invokeMapping(Map.Entry<PathPattern, Method> mapping, HttpServletRequest req, HttpServletResponse resp, DaoProvider dao) throws IOException {
         final var pathPattern = mapping.getKey();
         final var method = mapping.getValue();
         try {
@@ -121,7 +121,7 @@
                 } else if (paramTypes[i].isAssignableFrom(HttpServletResponse.class)) {
                     paramValues[i] = resp;
                 }
-                if (paramTypes[i].isAssignableFrom(DataAccessObjects.class)) {
+                if (paramTypes[i].isAssignableFrom(DaoProvider.class)) {
                     paramValues[i] = dao;
                 }
                 if (paramTypes[i].isAssignableFrom(PathParameters.class)) {
@@ -180,7 +180,7 @@
                         paramsInjectible &= HttpServletRequest.class.isAssignableFrom(param)
                                 || HttpServletResponse.class.isAssignableFrom(param)
                                 || PathParameters.class.isAssignableFrom(param)
-                                || DataAccessObjects.class.isAssignableFrom(param);
+                                || DaoProvider.class.isAssignableFrom(param);
                     }
                     if (paramsInjectible) {
                         try {

mercurial