package fr.loicdelorme.followUpYourGarden.core.database;

import java.io.FileNotFoundException;
import java.io.IOException;

import fr.loicdelorme.followUpYourGarden.core.manipulators.sources.ISourceManipulator;
import fr.loicdelorme.followUpYourGarden.core.manipulators.sources.database.DatabaseSourceManipulator;
import fr.loicdelorme.followUpYourGarden.core.properties.IDatabaseConfigurationReader;
import fr.loicdelorme.followUpYourGarden.core.properties.database.DatabaseConfigurationPropertiesReader;

/**
 * This class allow you to handle your database.
 * 
 * @author DELORME Loïc
 * @version 1.0.0
 */
public class MyDatabase
{
	/**
	 * A data source manipulator.
	 */
	private static ISourceManipulator sourceManipulator;

	/**
	 * A database configuration data reader.
	 */
	private static IDatabaseConfigurationReader databaseConfigurationReader;

	/**
	 * Get an instance of my database.
	 * 
	 * @return An instance of my database.
	 * @throws ClassNotFoundException
	 *             If the class is not found.
	 * @throws FileNotFoundException
	 *             If the file is not found.
	 * @throws IOException
	 *             If the file can't be opened.
	 */
	public static ISourceManipulator getInstance() throws ClassNotFoundException, FileNotFoundException, IOException
	{
		if (databaseConfigurationReader == null)
			databaseConfigurationReader = new DatabaseConfigurationPropertiesReader();

		if (sourceManipulator == null)
			sourceManipulator = new DatabaseSourceManipulator(databaseConfigurationReader.getDriver(), databaseConfigurationReader.getUrl(), databaseConfigurationReader.getUsername(), databaseConfigurationReader.getPassword());

		return sourceManipulator;
	}
}

@@ -1369,16 +1369,21 @@
  null)%0D%0A
+%09%09%7B%0D%0A
 %09%09%09datab
@@ -1452,16 +1452,21 @@
 ader();%0D
+%0A%09%09%7D%0D
 %0A%0D%0A%09%09if 
@@ -1494,16 +1494,21 @@
  null)%0D%0A
+%09%09%7B%0D%0A
 %09%09%09sourc
@@ -1719,16 +1719,23 @@
 rd());%0D%0A
+%09%09%7D%0D%0A%09%09
 %0D%0A%09%09retu

format code.