diff --git a/Readme.md b/Readme.md index db189b1..7fe5232 100644 --- a/Readme.md +++ b/Readme.md @@ -1,6 +1,6 @@ ## Database Exporter Application -This is a Java application for exporting data from a MySQL database to various formats (e.g., HTML, XML, etc.). The application uses Swing for the graphical user interface and supports a plug-and-play architecture for adding new export formats without changing existing code. +This is a Java application for exporting data from a MySQL database to various formats (e.g., HTML, XML, etc.). The application uses Swing for the graphical user interface and supports a plug-and-play architecture with configuration-less addition of new export formats without changing existing code. ## Table of Contents @@ -20,6 +20,12 @@ This is a Java application for exporting data from a MySQL database to various f * Extensible architecture for adding new export formats without modifying existing code. * Graphical user interface using Swing. * Virtually configurationless operation. +
+### Variants +* `v0`     :`(uses an XML config file for adding new export formats)` \ +* `v1`     :`(Configurationless addition of new export formats)`\ +* `Base App` : `v1 + new export format name annotations (@ExportType) ` + ## Prerequisites @@ -68,13 +74,29 @@ exporter.export("your_table_name", "output.xml"); ## Plugin Architecture -The application employs a plugin architecture, allowing you to add new export formats without modifying existing code. To add a new export format, simply create a new class implementing the Exportable interface and place it in the org.nmpl.exporters package. +The application employs a plugin architecture, allowing you to add new export formats without modifying existing code or addintional config. To add a new export format, simply create a new class implementing the Exportable interface and place it in the org.nmpl.exporters package. Example for creating a new export format: ```java package org.nmpl.exporters; + import org.nmpl.Exportable; + +public class NewFormatExporter implements Exportable { +// Implement the export method as per your requirements +} +``` + + +You can give the name of the export format using annotaions like this: +```java +package org.nmpl.exporters; + +import org.nmpl.ExportType; +import org.nmpl.Exportable; + +@ExportType("Export_Type_Name") public class NewFormatExporter implements Exportable { // Implement the export method as per your requirements } @@ -85,7 +107,12 @@ No changes to the existing code are needed. The new class is automatically recog ## Configurationless Operation -The application is designed for configurationless operation. The config.xml file, located in the resources directory, maps export formats to their corresponding Java class names. This enables the application to dynamically recognize and utilize new exporters without explicit configuration. +The application is designed for configurationless operation due to its internal usage of Reflection and class loader libraries. +*** + +#### Note : You may choose to use the version of the program that does not uses an XML configuration file to load the new export types `Go to the V0 directory and run the App.java inside it` +The config.xml file, located in the resources directory, maps export formats to their corresponding Java class names. This enables the application to dynamically recognize and utilize new exporters without explicit configuration. + Example config.xml: diff --git a/pom.xml b/pom.xml index 11f56fc..13eddd8 100644 --- a/pom.xml +++ b/pom.xml @@ -109,7 +109,7 @@ - org.nmpl.App + org.nmpl.v0.App @@ -123,7 +123,7 @@ exec-maven-plugin 3.1.1 - org.nmpl.App + org.nmpl.v0.App diff --git a/src/main/java/org/nmpl/App.java b/src/main/java/org/nmpl/App.java index 7ad3d33..3d9cdb3 100644 --- a/src/main/java/org/nmpl/App.java +++ b/src/main/java/org/nmpl/App.java @@ -5,17 +5,12 @@ import java.sql.SQLException; public class App { public static void main(String[] args) { - final String dbName = "shortener"; - final String username = "root"; - final String pasword = "1234qwer"; - SwingUtilities.invokeLater(() -> { - DbExporter manager; try { - manager = new DbExporter(dbName,username,pasword); + manager = new DbExporter(); } - catch (Exception e) { + catch (SQLException e) { throw new RuntimeException(e); } manager.setVisible(true); diff --git a/src/main/java/org/nmpl/DbExporter.java b/src/main/java/org/nmpl/DbExporter.java index 0ca0be8..4cd1820 100644 --- a/src/main/java/org/nmpl/DbExporter.java +++ b/src/main/java/org/nmpl/DbExporter.java @@ -9,13 +9,13 @@ import java.util.List; import java.util.Objects; public class DbExporter extends JFrame { - protected final JComboBox exportFormatComboBox; - protected final JList tableList; + private final JComboBox exportFormatComboBox; + private final JList tableList; private final DefaultListModel tableListModel; private final Connection connection; - public DbExporter(String dbName,String username,String pasword) throws SQLException { - connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/"+dbName, username, pasword); + public DbExporter() throws SQLException { + connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/bankdb", "root", "1234qwer"); setTitle("Database Manager"); setSize(400, 400); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); @@ -60,7 +60,7 @@ public class DbExporter extends JFrame { exportButton.addActionListener(e -> exportTable()); } - protected void showTables() { + private void showTables() { try { DatabaseMetaData metaData = connection.getMetaData(); String catalog = connection.getCatalog(); @@ -75,13 +75,12 @@ public class DbExporter extends JFrame { tables.close(); } catch (SQLException e) { - String error = "Failed to connect to the database or fetch tables."; - JOptionPane.showMessageDialog(this, error); - throw new DbExporterException(error, e); + e.printStackTrace(); + JOptionPane.showMessageDialog(this, "Failed to connect to the database or fetch tables."); } } - protected void exportTable() { + private void exportTable() { String selectedTable = tableList.getSelectedValue(); if (selectedTable == null) { JOptionPane.showMessageDialog(this, "Please select a table to export."); @@ -107,9 +106,8 @@ public class DbExporter extends JFrame { exporter.export(selectedTable, fileName); JOptionPane.showMessageDialog(this, "Table data exported to " + fileName); } catch (Exception e) { - String error = "Failed to export table."; - JOptionPane.showMessageDialog(this, error); - throw new DbExporterException(error, e); + e.printStackTrace(); + JOptionPane.showMessageDialog(this, "Failed to export table."); } } } diff --git a/src/main/java/org/nmpl/v2/ExportType.java b/src/main/java/org/nmpl/ExportType.java similarity index 92% rename from src/main/java/org/nmpl/v2/ExportType.java rename to src/main/java/org/nmpl/ExportType.java index 18fd25a..102978c 100644 --- a/src/main/java/org/nmpl/v2/ExportType.java +++ b/src/main/java/org/nmpl/ExportType.java @@ -1,4 +1,4 @@ -package org.nmpl.v2; +package org.nmpl; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; diff --git a/src/main/java/org/nmpl/ExporterFactory.java b/src/main/java/org/nmpl/ExporterFactory.java index 5852437..d30a703 100644 --- a/src/main/java/org/nmpl/ExporterFactory.java +++ b/src/main/java/org/nmpl/ExporterFactory.java @@ -1,17 +1,9 @@ package org.nmpl; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; +import org.reflections.Reflections; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; import java.sql.Connection; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; public class ExporterFactory { private final Map exporterClassNames; @@ -22,25 +14,16 @@ public class ExporterFactory { exporterClassNames = new HashMap<>(); loadExporterConfig(); } - private void loadExporterConfig() { try { - // Parse the XML configuration file - DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); - DocumentBuilder dBuilder = dbFactory.newDocumentBuilder(); - Document doc = dBuilder.parse(getClass().getClassLoader().getResourceAsStream("config.xml")); + String exporterPackage = "org.nmpl.exporters"; + Reflections reflections = new Reflections(exporterPackage); + Set> exporterClasses = reflections.getSubTypesOf(Exportable.class); - doc.getDocumentElement().normalize(); - - // Read exporter elements from the XML - NodeList nodeList = doc.getElementsByTagName("exporter"); - for (int i = 0; i < nodeList.getLength(); i++) { - Node node = nodeList.item(i); - if (node.getNodeType() == Node.ELEMENT_NODE) { - Element element = (Element) node; - String type = element.getElementsByTagName("type").item(0).getTextContent(); - String className = element.getElementsByTagName("class").item(0).getTextContent(); - exporterClassNames.put(type, className); + for (Class exporterClass : exporterClasses) { + String format = getExportFormat(exporterClass); + if (format != null) { + exporterClassNames.put(format, exporterClass.getName()); } } } catch (Exception e) { @@ -48,16 +31,20 @@ public class ExporterFactory { } } - public Exportable getExporter(String format) { + private String getExportFormat(Class exporterClass) { + ExportType annotation = exporterClass.getAnnotation(ExportType.class); + if (annotation != null) { + return annotation.value(); + } + return null; + } + + public Exportable getExporter(String format) throws Exception { String className = exporterClassNames.get(format); if (className == null) { throw new IllegalArgumentException("Unsupported export format: " + format); } - try { - return (Exportable) Class.forName(className).getDeclaredConstructor(Connection.class).newInstance(connection); - } catch (Exception e) { - throw new RuntimeException("Failed to create exporter instance", e); - } + return (Exportable) Class.forName(className).getDeclaredConstructor(Connection.class).newInstance(connection); } public List getSupportedFormats() { diff --git a/src/main/java/org/nmpl/exporters/HTMLExporter.java b/src/main/java/org/nmpl/exporters/HTMLExporter.java index 5faada5..ca2ee0b 100644 --- a/src/main/java/org/nmpl/exporters/HTMLExporter.java +++ b/src/main/java/org/nmpl/exporters/HTMLExporter.java @@ -1,5 +1,6 @@ package org.nmpl.exporters; +import org.nmpl.ExportType; import org.nmpl.Exportable; import java.io.FileWriter; @@ -8,6 +9,7 @@ import java.sql.ResultSet; import java.sql.ResultSetMetaData; import java.sql.Statement; +@ExportType("HTML") public class HTMLExporter implements Exportable { private final Connection connection; diff --git a/src/main/java/org/nmpl/exporters/TestExporter.java b/src/main/java/org/nmpl/exporters/TestExporter.java index b263acd..2f54ccd 100644 --- a/src/main/java/org/nmpl/exporters/TestExporter.java +++ b/src/main/java/org/nmpl/exporters/TestExporter.java @@ -1,21 +1,17 @@ package org.nmpl.exporters; - -import org.nmpl.DbExporterException; +import org.nmpl.ExportType; import org.nmpl.Exportable; -import java.sql.Connection; + + +@ExportType("TEST") public class TestExporter implements Exportable { - private final Connection connection; - - public TestExporter(Connection connection) { - this.connection = connection; - } - @Override public void export(String tableName, String fileName) { try { - System.out.println("TEST EXPORTER\n DB NAME: "+connection.getCatalog()); + System.out.println("TEST EXPORTER"); } catch (Exception e) { - throw new DbExporterException("Failed to export table to HTML.",e); + e.printStackTrace(); + throw new RuntimeException("Failed to export table to HTML."); } } } \ No newline at end of file diff --git a/src/main/java/org/nmpl/exporters/XMLExporter.java b/src/main/java/org/nmpl/exporters/XMLExporter.java index 667b953..3729d82 100644 --- a/src/main/java/org/nmpl/exporters/XMLExporter.java +++ b/src/main/java/org/nmpl/exporters/XMLExporter.java @@ -1,22 +1,24 @@ package org.nmpl.exporters; +import org.nmpl.ExportType; +import org.nmpl.Exportable; +import org.w3c.dom.Document; +import org.w3c.dom.Element; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.transform.OutputKeys; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.stream.StreamResult; import java.io.FileOutputStream; import java.sql.Connection; import java.sql.ResultSet; import java.sql.ResultSetMetaData; import java.sql.Statement; -import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.dom.DOMSource; -import javax.xml.transform.stream.StreamResult; - -import org.nmpl.Exportable; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.transform.OutputKeys; +@ExportType("XML") public class XMLExporter implements Exportable { private final Connection connection; diff --git a/src/main/java/org/nmpl/v2/App.java b/src/main/java/org/nmpl/v0/App.java similarity index 55% rename from src/main/java/org/nmpl/v2/App.java rename to src/main/java/org/nmpl/v0/App.java index f2a9356..6c3044f 100644 --- a/src/main/java/org/nmpl/v2/App.java +++ b/src/main/java/org/nmpl/v0/App.java @@ -1,16 +1,20 @@ -package org.nmpl.v2; +package org.nmpl.v0; import javax.swing.*; -import java.sql.SQLException; public class App { public static void main(String[] args) { + final String dbName = "shortener"; + final String username = "root"; + final String pasword = "1234qwer"; + SwingUtilities.invokeLater(() -> { + DbExporter manager; try { - manager = new DbExporter(); + manager = new DbExporter(dbName,username,pasword); } - catch (SQLException e) { + catch (Exception e) { throw new RuntimeException(e); } manager.setVisible(true); diff --git a/src/main/java/org/nmpl/v2/DbExporter.java b/src/main/java/org/nmpl/v0/DbExporter.java similarity index 83% rename from src/main/java/org/nmpl/v2/DbExporter.java rename to src/main/java/org/nmpl/v0/DbExporter.java index 2af713d..8794a51 100644 --- a/src/main/java/org/nmpl/v2/DbExporter.java +++ b/src/main/java/org/nmpl/v0/DbExporter.java @@ -1,4 +1,4 @@ -package org.nmpl.v2; +package org.nmpl.v0; import javax.swing.*; import java.awt.*; @@ -9,13 +9,13 @@ import java.util.List; import java.util.Objects; public class DbExporter extends JFrame { - private final JComboBox exportFormatComboBox; - private final JList tableList; + protected final JComboBox exportFormatComboBox; + protected final JList tableList; private final DefaultListModel tableListModel; private final Connection connection; - public DbExporter() throws SQLException { - connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/bankdb", "root", ""); + public DbExporter(String dbName,String username,String pasword) throws SQLException { + connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/"+dbName, username, pasword); setTitle("Database Manager"); setSize(400, 400); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); @@ -60,7 +60,7 @@ public class DbExporter extends JFrame { exportButton.addActionListener(e -> exportTable()); } - private void showTables() { + protected void showTables() { try { DatabaseMetaData metaData = connection.getMetaData(); String catalog = connection.getCatalog(); @@ -75,12 +75,13 @@ public class DbExporter extends JFrame { tables.close(); } catch (SQLException e) { - e.printStackTrace(); - JOptionPane.showMessageDialog(this, "Failed to connect to the database or fetch tables."); + String error = "Failed to connect to the database or fetch tables."; + JOptionPane.showMessageDialog(this, error); + throw new DbExporterException(error, e); } } - private void exportTable() { + protected void exportTable() { String selectedTable = tableList.getSelectedValue(); if (selectedTable == null) { JOptionPane.showMessageDialog(this, "Please select a table to export."); @@ -106,8 +107,9 @@ public class DbExporter extends JFrame { exporter.export(selectedTable, fileName); JOptionPane.showMessageDialog(this, "Table data exported to " + fileName); } catch (Exception e) { - e.printStackTrace(); - JOptionPane.showMessageDialog(this, "Failed to export table."); + String error = "Failed to export table."; + JOptionPane.showMessageDialog(this, error); + throw new DbExporterException(error, e); } } } diff --git a/src/main/java/org/nmpl/DbExporterException.java b/src/main/java/org/nmpl/v0/DbExporterException.java similarity index 93% rename from src/main/java/org/nmpl/DbExporterException.java rename to src/main/java/org/nmpl/v0/DbExporterException.java index 211c12b..738a359 100644 --- a/src/main/java/org/nmpl/DbExporterException.java +++ b/src/main/java/org/nmpl/v0/DbExporterException.java @@ -1,4 +1,4 @@ -package org.nmpl; +package org.nmpl.v0; public class DbExporterException extends RuntimeException { diff --git a/src/main/java/org/nmpl/v2/Exportable.java b/src/main/java/org/nmpl/v0/Exportable.java similarity index 82% rename from src/main/java/org/nmpl/v2/Exportable.java rename to src/main/java/org/nmpl/v0/Exportable.java index c41f460..99f1f61 100644 --- a/src/main/java/org/nmpl/v2/Exportable.java +++ b/src/main/java/org/nmpl/v0/Exportable.java @@ -1,4 +1,4 @@ -package org.nmpl.v2; +package org.nmpl.v0; public interface Exportable { void export(String tableName, String fileName) throws Exception; } diff --git a/src/main/java/org/nmpl/v0/ExporterFactory.java b/src/main/java/org/nmpl/v0/ExporterFactory.java new file mode 100644 index 0000000..1047e7d --- /dev/null +++ b/src/main/java/org/nmpl/v0/ExporterFactory.java @@ -0,0 +1,66 @@ +package org.nmpl.v0; + +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import java.sql.Connection; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class ExporterFactory { + private final Map exporterClassNames; + private final Connection connection; + + public ExporterFactory(Connection connection) { + this.connection = connection; + exporterClassNames = new HashMap<>(); + loadExporterConfig(); + } + + private void loadExporterConfig() { + try { + // Parse the XML configuration file + DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); + DocumentBuilder dBuilder = dbFactory.newDocumentBuilder(); + Document doc = dBuilder.parse(getClass().getClassLoader().getResourceAsStream("config.xml")); + + doc.getDocumentElement().normalize(); + + // Read exporter elements from the XML + NodeList nodeList = doc.getElementsByTagName("exporter"); + for (int i = 0; i < nodeList.getLength(); i++) { + Node node = nodeList.item(i); + if (node.getNodeType() == Node.ELEMENT_NODE) { + Element element = (Element) node; + String type = element.getElementsByTagName("type").item(0).getTextContent(); + String className = element.getElementsByTagName("class").item(0).getTextContent(); + exporterClassNames.put(type, className); + } + } + } catch (Exception e) { + throw new RuntimeException("Failed to load exporter configuration: " + e.getMessage(), e); + } + } + + public Exportable getExporter(String format) { + String className = exporterClassNames.get(format); + if (className == null) { + throw new IllegalArgumentException("Unsupported export format: " + format); + } + try { + return (Exportable) Class.forName(className).getDeclaredConstructor(Connection.class).newInstance(connection); + } catch (Exception e) { + throw new RuntimeException("Failed to create exporter instance", e); + } + } + + public List getSupportedFormats() { + return new ArrayList<>(exporterClassNames.keySet()); + } +} \ No newline at end of file diff --git a/src/main/java/org/nmpl/v2/exporters/HTMLExporter.java b/src/main/java/org/nmpl/v0/exporters/HTMLExporter.java similarity index 95% rename from src/main/java/org/nmpl/v2/exporters/HTMLExporter.java rename to src/main/java/org/nmpl/v0/exporters/HTMLExporter.java index d6221db..fa43bee 100644 --- a/src/main/java/org/nmpl/v2/exporters/HTMLExporter.java +++ b/src/main/java/org/nmpl/v0/exporters/HTMLExporter.java @@ -1,7 +1,6 @@ -package org.nmpl.v2.exporters; +package org.nmpl.v0.exporters; -import org.nmpl.v2.ExportType; -import org.nmpl.v2.Exportable; +import org.nmpl.v0.Exportable; import java.io.FileWriter; import java.sql.Connection; @@ -9,7 +8,6 @@ import java.sql.ResultSet; import java.sql.ResultSetMetaData; import java.sql.Statement; -@ExportType("HTML") public class HTMLExporter implements Exportable { private final Connection connection; diff --git a/src/main/java/org/nmpl/v2/exporters/TestExporter.java b/src/main/java/org/nmpl/v0/exporters/TestExporter.java similarity index 56% rename from src/main/java/org/nmpl/v2/exporters/TestExporter.java rename to src/main/java/org/nmpl/v0/exporters/TestExporter.java index b4b3ff9..e29956c 100644 --- a/src/main/java/org/nmpl/v2/exporters/TestExporter.java +++ b/src/main/java/org/nmpl/v0/exporters/TestExporter.java @@ -1,12 +1,9 @@ -package org.nmpl.v2.exporters; +package org.nmpl.v0.exporters; - -import org.nmpl.v2.ExportType; -import org.nmpl.v2.Exportable; +import org.nmpl.v0.DbExporterException; +import org.nmpl.v0.Exportable; import java.sql.Connection; - -@ExportType("TEST") public class TestExporter implements Exportable { private final Connection connection; @@ -17,10 +14,9 @@ public class TestExporter implements Exportable { @Override public void export(String tableName, String fileName) { try { - System.out.println("TEST EXPORTER"); + System.out.println("TEST EXPORTER\n DB NAME: "+connection.getCatalog()); } catch (Exception e) { - e.printStackTrace(); - throw new RuntimeException("Failed to export table to HTML."); + throw new DbExporterException("Failed to export table to HTML.",e); } } } \ No newline at end of file diff --git a/src/main/java/org/nmpl/v2/exporters/XMLExporter.java b/src/main/java/org/nmpl/v0/exporters/XMLExporter.java similarity index 96% rename from src/main/java/org/nmpl/v2/exporters/XMLExporter.java rename to src/main/java/org/nmpl/v0/exporters/XMLExporter.java index 6e4f997..c935631 100644 --- a/src/main/java/org/nmpl/v2/exporters/XMLExporter.java +++ b/src/main/java/org/nmpl/v0/exporters/XMLExporter.java @@ -1,7 +1,6 @@ -package org.nmpl.v2.exporters; +package org.nmpl.v0.exporters; -import org.nmpl.v2.ExportType; -import org.nmpl.v2.Exportable; +import org.nmpl.v0.Exportable; import org.w3c.dom.Document; import org.w3c.dom.Element; @@ -18,7 +17,6 @@ import java.sql.ResultSet; import java.sql.ResultSetMetaData; import java.sql.Statement; -@ExportType("XML") public class XMLExporter implements Exportable { private final Connection connection; diff --git a/src/main/java/org/nmpl/v2/ExporterFactory.java b/src/main/java/org/nmpl/v2/ExporterFactory.java deleted file mode 100644 index 66b827f..0000000 --- a/src/main/java/org/nmpl/v2/ExporterFactory.java +++ /dev/null @@ -1,52 +0,0 @@ -package org.nmpl.v2; - -import org.reflections.Reflections; -import java.sql.Connection; -import java.util.*; - -public class ExporterFactory { - private final Map exporterClassNames; - private final Connection connection; - - public ExporterFactory(Connection connection) { - this.connection = connection; - exporterClassNames = new HashMap<>(); - loadExporterConfig(); - } - private void loadExporterConfig() { - try { - String exporterPackage = "org.nmpl.v2.exporters"; - Reflections reflections = new Reflections(exporterPackage); - Set> exporterClasses = reflections.getSubTypesOf(Exportable.class); - - for (Class exporterClass : exporterClasses) { - String format = getExportFormat(exporterClass); - if (format != null) { - exporterClassNames.put(format, exporterClass.getName()); - } - } - } catch (Exception e) { - throw new RuntimeException("Failed to load exporter configuration: " + e.getMessage(), e); - } - } - - private String getExportFormat(Class exporterClass) { - ExportType annotation = exporterClass.getAnnotation(ExportType.class); - if (annotation != null) { - return annotation.value(); - } - return null; - } - - public Exportable getExporter(String format) throws Exception { - String className = exporterClassNames.get(format); - if (className == null) { - throw new IllegalArgumentException("Unsupported export format: " + format); - } - return (Exportable) Class.forName(className).getDeclaredConstructor(Connection.class).newInstance(connection); - } - - public List getSupportedFormats() { - return new ArrayList<>(exporterClassNames.keySet()); - } -} \ No newline at end of file diff --git a/src/main/resources/META-INF/MANIFEST.MF b/src/main/resources/META-INF/MANIFEST.MF index 508d04f..9b4bf94 100644 --- a/src/main/resources/META-INF/MANIFEST.MF +++ b/src/main/resources/META-INF/MANIFEST.MF @@ -1,3 +1,3 @@ Manifest-Version: 1.0 -Main-Class: org.nmpl.App +Main-Class: org.nmpl.v0.App diff --git a/src/main/resources/config.xml b/src/main/resources/config.xml index 3a18e42..6ab95cf 100644 --- a/src/main/resources/config.xml +++ b/src/main/resources/config.xml @@ -2,15 +2,15 @@ HTML - org.nmpl.exporters.HTMLExporter + org.nmpl.v0.exporters.HTMLExporter XML - org.nmpl.exporters.XMLExporter + org.nmpl.v0.exporters.XMLExporter TEST - org.nmpl.exporters.TestExporter + org.nmpl.v0.exporters.TestExporter \ No newline at end of file diff --git a/src/test/java/org/nmpl/AppTest.java b/src/test/java/org/nmpl/AppTest.java index a8a62fb..16b0d99 100644 --- a/src/test/java/org/nmpl/AppTest.java +++ b/src/test/java/org/nmpl/AppTest.java @@ -2,6 +2,8 @@ package org.nmpl; import org.fest.swing.fixture.FrameFixture; import org.junit.jupiter.api.Test; +import org.nmpl.v0.DbExporter; + import javax.swing.*; import java.sql.SQLException; diff --git a/src/test/java/org/nmpl/ExporterFactoryTest.java b/src/test/java/org/nmpl/ExporterFactoryTest.java index 6dae40b..adbe158 100644 --- a/src/test/java/org/nmpl/ExporterFactoryTest.java +++ b/src/test/java/org/nmpl/ExporterFactoryTest.java @@ -5,6 +5,8 @@ import org.junit.jupiter.api.Test; import org.mockito.Mock; import org.mockito.MockitoAnnotations; import org.nmpl.exporters.XMLExporter; +import org.nmpl.v0.Exportable; +import org.nmpl.v0.ExporterFactory; import java.sql.Connection; import java.util.List;