primer commit
This commit is contained in:
commit
850580e835
41
.classpath
Normal file
41
.classpath
Normal file
@ -0,0 +1,41 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" output="target/classes" path="src/main/java">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
<attribute name="optional" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
|
||||
<attributes>
|
||||
<attribute name="test" value="true"/>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
|
||||
<attributes>
|
||||
<attribute name="test" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
<attribute name="optional" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk-25">
|
||||
<attributes>
|
||||
<attribute name="module" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
</classpath>
|
||||
23
.project
Normal file
23
.project
Normal file
@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>aadd_act2_3</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.m2e.core.maven2Builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
2
.settings/org.eclipse.core.resources.prefs
Normal file
2
.settings/org.eclipse.core.resources.prefs
Normal file
@ -0,0 +1,2 @@
|
||||
eclipse.preferences.version=1
|
||||
encoding/<project>=UTF-8
|
||||
13
.settings/org.eclipse.jdt.core.prefs
Normal file
13
.settings/org.eclipse.jdt.core.prefs
Normal file
@ -0,0 +1,13 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
||||
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
|
||||
org.eclipse.jdt.core.compiler.release=disabled
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
||||
4
.settings/org.eclipse.m2e.core.prefs
Normal file
4
.settings/org.eclipse.m2e.core.prefs
Normal file
@ -0,0 +1,4 @@
|
||||
activeProfiles=
|
||||
eclipse.preferences.version=1
|
||||
resolveWorkspaceProjects=true
|
||||
version=1
|
||||
5
config/conf.properties
Normal file
5
config/conf.properties
Normal file
@ -0,0 +1,5 @@
|
||||
# Parámetros de conexión a la base de datos MapaMundi en SGDB MySQL
|
||||
jdbc.driver = com.mysql.cj.jdbc.Driver
|
||||
jdbc.url = jdbc:mysql://192.168.1.35:3306/Mapamundi
|
||||
jdbc.usuario = root
|
||||
jdbc.password = mysql_123
|
||||
6
pom.xml
Normal file
6
pom.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>aadd_act2_3</groupId>
|
||||
<artifactId>aadd_act2_3</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
</project>
|
||||
46
src/main/java/es/palomafp/aadd/inm/GestorMapaMundi.java
Normal file
46
src/main/java/es/palomafp/aadd/inm/GestorMapaMundi.java
Normal file
@ -0,0 +1,46 @@
|
||||
package es.palomafp.aadd.inm;
|
||||
|
||||
import java.util.Scanner;
|
||||
|
||||
import es.palomafp.aadd.inm.gestor.GestorFicheroConfiguracion;
|
||||
|
||||
/**
|
||||
*
|
||||
* GestorMapaMundi: Clase que accede a información de la BBDD MapaMundi.
|
||||
*
|
||||
* @author Isidoro Nevares Martín - IES Virgen de la Paloma
|
||||
* @date 26 sept 2025
|
||||
*/
|
||||
|
||||
public class GestorMapaMundi {
|
||||
|
||||
public static void main(String[] args) {
|
||||
String urlJDBC= GestorFicheroConfiguracion.getValorDeConfiguracion("jdbc.url");
|
||||
System.out.println(urlJDBC);
|
||||
Scanner scanner = new Scanner(System.in); // Crear el scanner
|
||||
|
||||
System.out.println("Introduce una opción de procesamiento sobre Mapa Mundi.");
|
||||
System.out.println("Opción 1: Consultar países del continente americao que empiezan por Sa");
|
||||
System.out.println("Opción 2: Añadir nuevo continente.");
|
||||
System.out.println("Opción 3: Actualizar el país con código 107. capital -> Capital City.");
|
||||
System.out.println("Opción 4: Eliminar el continente con código 02.");
|
||||
String opcion = scanner.nextLine(); // Leer una opción introducida.
|
||||
|
||||
switch (opcion) {
|
||||
case "1":
|
||||
System.out.println("Opción 1: Consultar países del continente americao que empiezan por Sa");
|
||||
break;
|
||||
case "2":
|
||||
System.out.println("Opción 2: Añadir nuevo continente.");
|
||||
break;
|
||||
case "3":
|
||||
System.out.println("Opción 3: Actualizar el país con código 107. capital -> Capital City.");
|
||||
break;
|
||||
case "4":
|
||||
System.out.println("Opción 4: Eliminar el continente con código 02.");
|
||||
break;
|
||||
}
|
||||
|
||||
scanner.close();
|
||||
}
|
||||
}
|
||||
11
src/main/java/es/palomafp/aadd/inm/dao/IContinenteDAO.java
Normal file
11
src/main/java/es/palomafp/aadd/inm/dao/IContinenteDAO.java
Normal file
@ -0,0 +1,11 @@
|
||||
package es.palomafp.aadd.inm.dao;
|
||||
|
||||
/**
|
||||
*
|
||||
* IContinenteDAO: Interfaz que define las operaciones de acceso a datos para Continente.
|
||||
*
|
||||
* @author Isidoro Nevares Martín - IES Virgen de la Paloma
|
||||
* @date 31 oct 2025
|
||||
*/
|
||||
public interface IContinenteDAO {
|
||||
}
|
||||
16
src/main/java/es/palomafp/aadd/inm/dao/IPaisDAO.java
Normal file
16
src/main/java/es/palomafp/aadd/inm/dao/IPaisDAO.java
Normal file
@ -0,0 +1,16 @@
|
||||
package es.palomafp.aadd.inm.dao;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import es.palomafp.aadd.inm.vo.Pais;
|
||||
|
||||
/**
|
||||
*
|
||||
* IPaisDAO: Interfaz que define las operaciones de acceso a datos para País.
|
||||
*
|
||||
* @author Isidoro Nevares Martín - IES Virgen de la Paloma
|
||||
* @date 31 oct 2025
|
||||
*/
|
||||
public interface IPaisDAO {
|
||||
List<Pais> obtenerListaPaises(String codigoContinente);
|
||||
}
|
||||
@ -0,0 +1,13 @@
|
||||
package es.palomafp.aadd.inm.dao.impl;
|
||||
|
||||
import es.palomafp.aadd.inm.dao.IContinenteDAO;
|
||||
|
||||
/**
|
||||
*
|
||||
* ContinenteDaoJDBC: Clase que implementa el interfaz IContinenteDAO
|
||||
*
|
||||
* @author Isidoro Nevares Martín - IES Virgen de la Paloma
|
||||
* @date 31 oct 2025
|
||||
*/
|
||||
public class ContinenteDaoJDBC implements IContinenteDAO {
|
||||
}
|
||||
25
src/main/java/es/palomafp/aadd/inm/dao/impl/PaisDaoJDBC.java
Normal file
25
src/main/java/es/palomafp/aadd/inm/dao/impl/PaisDaoJDBC.java
Normal file
@ -0,0 +1,25 @@
|
||||
package es.palomafp.aadd.inm.dao.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import es.palomafp.aadd.inm.dao.IPaisDAO;
|
||||
import es.palomafp.aadd.inm.gestor.GestorFicheroConfiguracion;
|
||||
import es.palomafp.aadd.inm.vo.Pais;
|
||||
|
||||
/**
|
||||
*
|
||||
* PaisDaoJDBC: Clase que implementa el interfaz IPaisDAO
|
||||
*
|
||||
* @author Isidoro Nevares Martín - IES Virgen de la Paloma
|
||||
* @date 31 oct 2025
|
||||
*/
|
||||
public class PaisDaoJDBC implements IPaisDAO{
|
||||
|
||||
@Override
|
||||
public List<Pais> obtenerListaPaises(String codigoContinente) {
|
||||
// TODO Auto-generated method stub
|
||||
String urlJDBC= GestorFicheroConfiguracion.getValorDeConfiguracion("jdbc.url");
|
||||
System.out.println("urlJDBC: "+urlJDBC);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,38 @@
|
||||
package es.palomafp.aadd.inm.gestor;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.util.Properties;
|
||||
|
||||
/**
|
||||
*
|
||||
* GestorFicheroConfiguracion: Clase que se encarga de gestionar el fichero de configuración.
|
||||
*
|
||||
*
|
||||
* @author Isidoro Nevares Martín - IES Virgen de la Paloma
|
||||
* @date 31 oct 2025
|
||||
*/
|
||||
public class GestorFicheroConfiguracion {
|
||||
private static final String RUTA_FICHERO_CONFIGURACION = "config/conf.properties";
|
||||
private static Properties propiedades;
|
||||
|
||||
private GestorFicheroConfiguracion() {
|
||||
// Constructor privado para evitar instanciación
|
||||
}
|
||||
static {
|
||||
propiedades= new Properties();
|
||||
try {
|
||||
// Fichero que está en el classpath
|
||||
// propiedades.load(GestorFicheroConfiguracion.class.getClassLoader().getResourceAsStream(RUTA_FICHERO_CONFIGURACION));
|
||||
|
||||
// Fichero con ruta relativa al proyecto
|
||||
propiedades.load(new FileInputStream(RUTA_FICHERO_CONFIGURACION));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
public static String getValorDeConfiguracion(String clave) {
|
||||
String valor = null;
|
||||
valor = propiedades.getProperty(clave);
|
||||
return valor;
|
||||
}
|
||||
}
|
||||
35
src/main/java/es/palomafp/aadd/inm/vo/Continente.java
Normal file
35
src/main/java/es/palomafp/aadd/inm/vo/Continente.java
Normal file
@ -0,0 +1,35 @@
|
||||
package es.palomafp.aadd.inm.vo;
|
||||
|
||||
/**
|
||||
* Continente: Clase que se encarga de almacenar información de un Continente.
|
||||
*
|
||||
* @author: Isidoro Nevares Martín (IES Virgen de la Paloma)
|
||||
* @date: 2 oct 2025
|
||||
*/
|
||||
public class Continente {
|
||||
|
||||
private String codigo;
|
||||
private String nombre;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Continente [codigo=" + codigo + ", nombre=" + nombre + "]";
|
||||
}
|
||||
|
||||
public String getCodigo() {
|
||||
return codigo;
|
||||
}
|
||||
|
||||
public void setCodigo(String codigo) {
|
||||
this.codigo = codigo;
|
||||
}
|
||||
|
||||
public String getNombre() {
|
||||
return nombre;
|
||||
}
|
||||
|
||||
public void setNombre(String nombre) {
|
||||
this.nombre = nombre;
|
||||
}
|
||||
|
||||
}
|
||||
52
src/main/java/es/palomafp/aadd/inm/vo/Pais.java
Normal file
52
src/main/java/es/palomafp/aadd/inm/vo/Pais.java
Normal file
@ -0,0 +1,52 @@
|
||||
package es.palomafp.aadd.inm.vo;
|
||||
|
||||
/**
|
||||
* Pais: Clase que se encarga de almacenar información de un País.
|
||||
*
|
||||
* @author: Isidoro Nevares Martín (IES Virgen de la Paloma)
|
||||
* @date: 2 oct 2025
|
||||
*/
|
||||
public class Pais {
|
||||
private int identificador;
|
||||
private String nombre;
|
||||
private String capital;
|
||||
private Continente continente;
|
||||
|
||||
public int getIdentificador() {
|
||||
return identificador;
|
||||
}
|
||||
|
||||
public void setIdentificador(int identificador) {
|
||||
this.identificador = identificador;
|
||||
}
|
||||
|
||||
public String getNombre() {
|
||||
return nombre;
|
||||
}
|
||||
|
||||
public void setNombre(String nombre) {
|
||||
this.nombre = nombre;
|
||||
}
|
||||
|
||||
public String getCapital() {
|
||||
return capital;
|
||||
}
|
||||
|
||||
public void setCapital(String capital) {
|
||||
this.capital = capital;
|
||||
}
|
||||
|
||||
public Continente getContinente() {
|
||||
return continente;
|
||||
}
|
||||
|
||||
public void setContinente(Continente continente) {
|
||||
this.continente = continente;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Pais [identificador=" + identificador + ", nombre=" + nombre + ", capital=" + capital + ", continente="
|
||||
+ continente + "]\n";
|
||||
}
|
||||
}
|
||||
5
src/main/resources/config/conf.properties
Normal file
5
src/main/resources/config/conf.properties
Normal file
@ -0,0 +1,5 @@
|
||||
# Parámetros de conexión a la base de datos MapaMundi en SGDB MySQL
|
||||
jdbc.driver = com.mysql.cj.jdbc.Driver
|
||||
jdbc.url = jdbc:mysql://192.168.1.35:3306/Mapamundi
|
||||
jdbc.usuario = root
|
||||
jdbc.password = mysql_123
|
||||
4
target/classes/META-INF/MANIFEST.MF
Normal file
4
target/classes/META-INF/MANIFEST.MF
Normal file
@ -0,0 +1,4 @@
|
||||
Manifest-Version: 1.0
|
||||
Build-Jdk-Spec: 25
|
||||
Created-By: Maven Integration for Eclipse
|
||||
|
||||
@ -0,0 +1,7 @@
|
||||
#Generated by Maven Integration for Eclipse
|
||||
#Mon Nov 03 10:44:08 CET 2025
|
||||
artifactId=aadd_act2_3
|
||||
groupId=aadd_act2_3
|
||||
m2e.projectLocation=C\:\\Users\\ineva\\INM\\Personal\\Trabajo\\00-Educaci\u00F3n - CM\\10-Curso 2025-2026\\02-Acceso de datos -DAM2\\workspace\\aadd_act2_3
|
||||
m2e.projectName=aadd_act2_3
|
||||
version=0.0.1-SNAPSHOT
|
||||
@ -0,0 +1,6 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>aadd_act2_3</groupId>
|
||||
<artifactId>aadd_act2_3</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
</project>
|
||||
5
target/classes/config/conf.properties
Normal file
5
target/classes/config/conf.properties
Normal file
@ -0,0 +1,5 @@
|
||||
# Parámetros de conexión a la base de datos MapaMundi en SGDB MySQL
|
||||
jdbc.driver = com.mysql.cj.jdbc.Driver
|
||||
jdbc.url = jdbc:mysql://192.168.1.35:3306/Mapamundi
|
||||
jdbc.usuario = root
|
||||
jdbc.password = mysql_123
|
||||
BIN
target/classes/es/palomafp/aadd/inm/GestorMapaMundi.class
Normal file
BIN
target/classes/es/palomafp/aadd/inm/GestorMapaMundi.class
Normal file
Binary file not shown.
BIN
target/classes/es/palomafp/aadd/inm/dao/IContinenteDAO.class
Normal file
BIN
target/classes/es/palomafp/aadd/inm/dao/IContinenteDAO.class
Normal file
Binary file not shown.
BIN
target/classes/es/palomafp/aadd/inm/dao/IPaisDAO.class
Normal file
BIN
target/classes/es/palomafp/aadd/inm/dao/IPaisDAO.class
Normal file
Binary file not shown.
Binary file not shown.
BIN
target/classes/es/palomafp/aadd/inm/dao/impl/PaisDaoJDBC.class
Normal file
BIN
target/classes/es/palomafp/aadd/inm/dao/impl/PaisDaoJDBC.class
Normal file
Binary file not shown.
Binary file not shown.
BIN
target/classes/es/palomafp/aadd/inm/vo/Continente.class
Normal file
BIN
target/classes/es/palomafp/aadd/inm/vo/Continente.class
Normal file
Binary file not shown.
BIN
target/classes/es/palomafp/aadd/inm/vo/Pais.class
Normal file
BIN
target/classes/es/palomafp/aadd/inm/vo/Pais.class
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user