// Path: src/main/java/ro/kuberam/oxygen/addonBuilder/utils/IOUtilities.java
// public class IOUtilities {
// 
// 	public static void storeJavaTemplateToBeDeleted(String addonPackageAbsolutePath, String javaTemplateName,
// 			String addonJavaPackageName) {
// 		String javaTemplate = null;
// 		try {
// 			javaTemplate = new String(Files.readAllBytes(Paths
// 					.get(AddonBuilderPluginExtension.class.getResource("templates/java/" + javaTemplateName).toURI())),
// 					StandardCharsets.UTF_8);
// 		} catch (IOException | URISyntaxException e) {
// 			e.printStackTrace();
// 		}
// 
// 		javaTemplate = javaTemplate.replaceAll("addon-javapackage-name", addonJavaPackageName);
// 
// 		try {
// 			Files.write(Paths.get(addonPackageAbsolutePath, javaTemplateName), javaTemplate.getBytes());
// 		} catch (IOException e) {
// 			e.printStackTrace();
// 		}
// 	}
// 
// 	public static void storeJavaTemplates(File javaTemplatesDir, String addonJavaPackageName, File targetDir) {
// 		File[] javaTemplateFiles = javaTemplatesDir.listFiles();
// 
// 		for (File javaTemplateFile : javaTemplateFiles) {
// 			String javaTemplate = null;
// 			try {
// 				javaTemplate = new String(Files.readAllBytes(javaTemplateFile.toPath()), StandardCharsets.UTF_8);
// 
// 			} catch (IOException e2) {
// 				e2.printStackTrace();
// 			}
// 			javaTemplate = javaTemplate.replaceAll("addon-javapackage-name", addonJavaPackageName);
// 
// 			try {
// 				Files.write(targetDir.toPath().resolve(javaTemplateFile.getName()), javaTemplate.getBytes());
// 			} catch (IOException e) {
// 				e.printStackTrace();
// 			}
// 		}
// 	}
// 
// 	public static String serializeObjectToFile(File folderPath, Object object, String objectName)
// 			throws FileNotFoundException, IOException {
// 		String filePath = folderPath + File.separator + objectName + ".ser";
// 		ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(filePath));
// 		oos.writeObject(object);
// 		oos.flush();
// 		oos.close();
// 
// 		return filePath;
// 	}
// 
// 	public static Object deserializeObjectFromFile(String filePath)
// 			throws FileNotFoundException, IOException, ClassNotFoundException {
// 		Object result = null;
// 		ObjectInputStream ois = new ObjectInputStream(IOUtilities.class.getResourceAsStream(filePath));
// 		result = ois.readObject();
// 		ois.close();
// 
// 		return result;
// 	}
// 
// 	public static Object deserializeObjectFromFile(File file)
// 			throws FileNotFoundException, IOException, ClassNotFoundException {
// 		Object result = null;
// 		ObjectInputStream ois = new ObjectInputStream(new FileInputStream(file));
// 		result = ois.readObject();
// 		ois.close();
// 
// 		return result;
// 	}
// 
// 	public static void saveXmlToFile(Element documentElement, File outputFile) {
// 		Transformer transformer;
// 		try {
// 			transformer = TransformerFactory.newInstance().newTransformer();
// 			Result output = new StreamResult(outputFile);
// 			Source input = new DOMSource(documentElement);
// 			transformer.transform(input, output);
// 		} catch (TransformerConfigurationException | TransformerFactoryConfigurationError e1) {
// 			e1.printStackTrace();
// 		} catch (TransformerException e1) {
// 			e1.printStackTrace();
// 		}
// 
// 	}
// 
// }


import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import ro.kuberam.oxygen.addonBuilder.utils.IOUtilities;
package ro.kuberam.oxygen.addonBuilder;



public class SerialisedObjects {

	public static String variablesModule = "";
	public static Map<String, String> templates = new HashMap<String, String>();

	// loading the serialized objects
	static {
		try {
			variablesModule = (String) IOUtilities.deserializeObjectFromFile("/prolog.ser");
// Path: src/main/java/ro/kuberam/oxygen/addonBuilder/utils/IOUtilities.java
// public class IOUtilities {
// 
// 	public static void storeJavaTemplateToBeDeleted(String addonPackageAbsolutePath, String javaTemplateName,
// 			String addonJavaPackageName) {
// 		String javaTemplate = null;
// 		try {
// 			javaTemplate = new String(Files.readAllBytes(Paths
// 					.get(AddonBuilderPluginExtension.class.getResource("templates/java/" + javaTemplateName).toURI())),
// 					StandardCharsets.UTF_8);
// 		} catch (IOException | URISyntaxException e) {
// 			e.printStackTrace();
// 		}
// 
// 		javaTemplate = javaTemplate.replaceAll("addon-javapackage-name", addonJavaPackageName);
// 
// 		try {
// 			Files.write(Paths.get(addonPackageAbsolutePath, javaTemplateName), javaTemplate.getBytes());
// 		} catch (IOException e) {
// 			e.printStackTrace();
// 		}
// 	}
// 
// 	public static void storeJavaTemplates(File javaTemplatesDir, String addonJavaPackageName, File targetDir) {
// 		File[] javaTemplateFiles = javaTemplatesDir.listFiles();
// 
// 		for (File javaTemplateFile : javaTemplateFiles) {
// 			String javaTemplate = null;
// 			try {
// 				javaTemplate = new String(Files.readAllBytes(javaTemplateFile.toPath()), StandardCharsets.UTF_8);
// 
// 			} catch (IOException e2) {
// 				e2.printStackTrace();
// 			}
// 			javaTemplate = javaTemplate.replaceAll("addon-javapackage-name", addonJavaPackageName);
// 
// 			try {
// 				Files.write(targetDir.toPath().resolve(javaTemplateFile.getName()), javaTemplate.getBytes());
// 			} catch (IOException e) {
// 				e.printStackTrace();
// 			}
// 		}
// 	}
// 
// 	public static String serializeObjectToFile(File folderPath, Object object, String objectName)
// 			throws FileNotFoundException, IOException {
// 		String filePath = folderPath + File.separator + objectName + ".ser";
// 		ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(filePath));
// 		oos.writeObject(object);
// 		oos.flush();
// 		oos.close();
// 
// 		return filePath;
// 	}
// 
// 	public static Object deserializeObjectFromFile(String filePath)
// 			throws FileNotFoundException, IOException, ClassNotFoundException {
// 		Object result = null;
// 		ObjectInputStream ois = new ObjectInputStream(IOUtilities.class.getResourceAsStream(filePath));
// 		result = ois.readObject();
// 		ois.close();
// 
// 		return result;
// 	}
// 
// 	public static Object deserializeObjectFromFile(File file)
// 			throws FileNotFoundException, IOException, ClassNotFoundException {
// 		Object result = null;
// 		ObjectInputStream ois = new ObjectInputStream(new FileInputStream(file));
// 		result = ois.readObject();
// 		ois.close();
// 
// 		return result;
// 	}
// 
// 	public static void saveXmlToFile(Element documentElement, File outputFile) {
// 		Transformer transformer;
// 		try {
// 			transformer = TransformerFactory.newInstance().newTransformer();
// 			Result output = new StreamResult(outputFile);
// 			Source input = new DOMSource(documentElement);
// 			transformer.transform(input, output);
// 		} catch (TransformerConfigurationException | TransformerFactoryConfigurationError e1) {
// 			e1.printStackTrace();
// 		} catch (TransformerException e1) {
// 			e1.printStackTrace();
// 		}
// 
// 	}
// 
// }


// Path: src/main/java/ro/kuberam/oxygen/addonBuilder/SerialisedObjects.java
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import ro.kuberam.oxygen.addonBuilder.utils.IOUtilities;

package ro.kuberam.oxygen.addonBuilder;



public class SerialisedObjects {

	public static String variablesModule = "";
	public static Map<String, String> templates = new HashMap<String, String>();

	// loading the serialized objects
	static {
		try {
			variablesModule = (String) IOUtilities.deserializeObjectFromFile("/prolog.ser");
			templates = (Map<String, String>) IOUtilities.deserializeObjectFromFile("/templates.ser");