From dbd7497d8e7f32635d81fbcad72c75730786ba47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isidoro=20Nevares=20Mart=C3=ADn?= Date: Mon, 9 Nov 2026 13:06:49 +0100 Subject: [PATCH] comentarios service --- ...orConexionesBBDD.java => GestorConexionesJDBC.java} | 4 ++-- .../redmetro/eva1/gestores/GestorConfiguracion.java | 4 ---- .../madrid/redmetro/eva1/service/CocheraService.java | 10 +++++----- src/es/madrid/redmetro/eva1/service/LineaService.java | 4 ++-- src/es/madrid/redmetro/eva1/service/TrenService.java | 6 +++--- 5 files changed, 12 insertions(+), 16 deletions(-) rename src/es/madrid/redmetro/eva1/gestores/{GestorConexionesBBDD.java => GestorConexionesJDBC.java} (92%) diff --git a/src/es/madrid/redmetro/eva1/gestores/GestorConexionesBBDD.java b/src/es/madrid/redmetro/eva1/gestores/GestorConexionesJDBC.java similarity index 92% rename from src/es/madrid/redmetro/eva1/gestores/GestorConexionesBBDD.java rename to src/es/madrid/redmetro/eva1/gestores/GestorConexionesJDBC.java index 4c79b5d..bf2bbed 100644 --- a/src/es/madrid/redmetro/eva1/gestores/GestorConexionesBBDD.java +++ b/src/es/madrid/redmetro/eva1/gestores/GestorConexionesJDBC.java @@ -15,11 +15,11 @@ import java.sql.SQLException; * */ -public class GestorConexionesBBDD { +public class GestorConexionesJDBC { // Constructor privado: de esta manera conseguimos que esta clase no se puede // instanciar. - private GestorConexionesBBDD() { + private GestorConexionesJDBC() { } public static Connection obtenerConexion() throws SQLException { diff --git a/src/es/madrid/redmetro/eva1/gestores/GestorConfiguracion.java b/src/es/madrid/redmetro/eva1/gestores/GestorConfiguracion.java index 9ce7a4a..5033536 100644 --- a/src/es/madrid/redmetro/eva1/gestores/GestorConfiguracion.java +++ b/src/es/madrid/redmetro/eva1/gestores/GestorConfiguracion.java @@ -41,10 +41,6 @@ public class GestorConfiguracion { } } - public static String getClaseDriver() { - return PROPIEDADES_CONFIGURACION.getProperty("sgdb.clase.driver"); - } - public static String getConexionURL() { return PROPIEDADES_CONFIGURACION.getProperty("sgdb.conexion.url"); } diff --git a/src/es/madrid/redmetro/eva1/service/CocheraService.java b/src/es/madrid/redmetro/eva1/service/CocheraService.java index 78c0f45..47c4f82 100644 --- a/src/es/madrid/redmetro/eva1/service/CocheraService.java +++ b/src/es/madrid/redmetro/eva1/service/CocheraService.java @@ -6,7 +6,7 @@ import java.sql.SQLException; import es.madrid.redmetro.eva1.dao.ICocheraDAO; import es.madrid.redmetro.eva1.dao.impl.CocheraDaoJDBC; import es.madrid.redmetro.eva1.excepcion.RedMetroException; -import es.madrid.redmetro.eva1.gestores.GestorConexionesBBDD; +import es.madrid.redmetro.eva1.gestores.GestorConexionesJDBC; import es.madrid.redmetro.eva1.model.Cochera; /** @@ -23,7 +23,7 @@ public class CocheraService { public boolean existeCocheraPorClave(int idCochera) throws RedMetroException { boolean existeFP = false; - try (Connection conexion = GestorConexionesBBDD.obtenerConexion();) { + try (Connection conexion = GestorConexionesJDBC.obtenerConexion();) { ICocheraDAO iCocheraDAO = new CocheraDaoJDBC(conexion); existeFP = iCocheraDAO.existeCochera(idCochera); } catch (SQLException e) { @@ -34,7 +34,7 @@ public class CocheraService { public void insertarCochera(Cochera cochera) throws RedMetroException { - try (Connection conexion = GestorConexionesBBDD.obtenerConexion();) { + try (Connection conexion = GestorConexionesJDBC.obtenerConexion();) { ICocheraDAO iCocheraDAO = new CocheraDaoJDBC(conexion); iCocheraDAO.insertarCochera(cochera); } catch (SQLException e) { @@ -44,7 +44,7 @@ public class CocheraService { public void actualizarCochera(Cochera cochera) throws RedMetroException { - try (Connection conexion = GestorConexionesBBDD.obtenerConexion();) { + try (Connection conexion = GestorConexionesJDBC.obtenerConexion();) { ICocheraDAO iCocheraDAO = new CocheraDaoJDBC(conexion); iCocheraDAO.actualizarCochera(cochera); } catch (SQLException e) { @@ -54,7 +54,7 @@ public class CocheraService { public void borrarCochera(int idCochera) throws RedMetroException { - try (Connection conexion = GestorConexionesBBDD.obtenerConexion();) { + try (Connection conexion = GestorConexionesJDBC.obtenerConexion();) { ICocheraDAO iCocheraDAO = new CocheraDaoJDBC(conexion); iCocheraDAO.borrarCochera(idCochera); } catch (SQLException e) { diff --git a/src/es/madrid/redmetro/eva1/service/LineaService.java b/src/es/madrid/redmetro/eva1/service/LineaService.java index fe61837..40c39a1 100644 --- a/src/es/madrid/redmetro/eva1/service/LineaService.java +++ b/src/es/madrid/redmetro/eva1/service/LineaService.java @@ -6,7 +6,7 @@ import java.sql.SQLException; import es.madrid.redmetro.eva1.dao.ILineaDAO; import es.madrid.redmetro.eva1.dao.impl.LineaDaoJDBC; import es.madrid.redmetro.eva1.excepcion.RedMetroException; -import es.madrid.redmetro.eva1.gestores.GestorConexionesBBDD; +import es.madrid.redmetro.eva1.gestores.GestorConexionesJDBC; import es.madrid.redmetro.eva1.model.Linea; /** @@ -22,7 +22,7 @@ public class LineaService { public Linea obtenerLineaPorClave(int idLinea) throws RedMetroException { Linea linea = null; - try (Connection conexion = GestorConexionesBBDD.obtenerConexion();) { + try (Connection conexion = GestorConexionesJDBC.obtenerConexion();) { ILineaDAO iLineaDAO = new LineaDaoJDBC(conexion); linea = iLineaDAO.obtenerInformacionLinea(idLinea); } catch (SQLException e) { diff --git a/src/es/madrid/redmetro/eva1/service/TrenService.java b/src/es/madrid/redmetro/eva1/service/TrenService.java index 9a15a31..6ce74c9 100644 --- a/src/es/madrid/redmetro/eva1/service/TrenService.java +++ b/src/es/madrid/redmetro/eva1/service/TrenService.java @@ -7,7 +7,7 @@ import java.util.List; import es.madrid.redmetro.eva1.dao.ITrenDAO; import es.madrid.redmetro.eva1.dao.impl.TrenDaoJDBC; import es.madrid.redmetro.eva1.excepcion.RedMetroException; -import es.madrid.redmetro.eva1.gestores.GestorConexionesBBDD; +import es.madrid.redmetro.eva1.gestores.GestorConexionesJDBC; import es.madrid.redmetro.eva1.model.Tren; /** @@ -23,7 +23,7 @@ public class TrenService { public List obtenerListaTrenes() throws RedMetroException { List listaTrenes = null; - try (Connection conexion = GestorConexionesBBDD.obtenerConexion();) { + try (Connection conexion = GestorConexionesJDBC.obtenerConexion();) { ITrenDAO iTrenDAO = new TrenDaoJDBC(conexion); listaTrenes = iTrenDAO.obtenerListaTrenes(); } catch (SQLException e) { @@ -34,7 +34,7 @@ public class TrenService { public void insertarTren(Tren tren) throws RedMetroException { - try (Connection conexion = GestorConexionesBBDD.obtenerConexion();) { + try (Connection conexion = GestorConexionesJDBC.obtenerConexion();) { ITrenDAO iTrenDAO = new TrenDaoJDBC(conexion); iTrenDAO.insertarTren(tren); } catch (SQLException e) {