// Path: src/main/java/com/dcp/sm/config/io/json/JsonSimpleReader.java
// public class JsonSimpleReader
// {
//     private JSONParser parser;
//     private FileReader json_file;
//     private JSONObject obj;
//     
//     public JsonSimpleReader(String file_name) throws IOException, ParseException
//     {
//         parser = new JSONParser();
//         json_file = new FileReader(file_name);
//         obj = (JSONObject) parser.parse(json_file);
//     }
//     
//     public JsonSimpleReader(String file_name, String root_obj) throws IOException, ParseException
//     {
//         parser = new JSONParser();
//         json_file = new FileReader(file_name);
//         obj = (JSONObject) parser.parse(json_file);
//         obj = (JSONObject) obj.get(root_obj);
//     }
//     
//     public int readInt(String name) {
//         return (Integer) obj.get(name);
//     }
//     
//     public String readString(String name) {
//         return (String) obj.get(name);
//     }
//     
//     @SuppressWarnings("unchecked")
//     public List<String> readStringList(String name) {
//         JSONArray msg = (JSONArray) obj.get(name);
//         List<String> list = new ArrayList<String>();
//         Iterator<String> iterator = msg.iterator();
//         while(iterator.hasNext()) {
//             list.add(iterator.next());
//         }
//         return list;
//     }
//     @SuppressWarnings("unchecked")
//     public String[] readStringArray(String name) {
//         JSONArray msg = (JSONArray) obj.get(name);
//         String[] arr = new String[msg.size()];
//         Iterator<String> iterator = msg.iterator();
//         for(int i=0;iterator.hasNext();i++) {
//             arr[i] = iterator.next();
//         }
//         return arr;
//     }
//     
//     public void close() throws IOException {
//         json_file.close();
//     }
//     
// 
//     @SuppressWarnings("unchecked")
//     public static void main(String[] args)
//     {
//         JSONParser parser = new JSONParser();
//         
//         try {
//      
//             Object obj = parser.parse(new FileReader("src/dcp/config/io/json/test.txt"));
//      
//             JSONObject jsonObject = (JSONObject) obj;
//      
//             String name = (String) jsonObject.get("name");
//             System.out.println(name);
//      
//             long age = (Long) jsonObject.get("age");
//             System.out.println(age);
//      
//             // loop array
//             JSONArray msg = (JSONArray) jsonObject.get("messages");
//             Iterator<String> iterator = msg.iterator();
//             while (iterator.hasNext()) {
//                 System.out.println(iterator.next());
//             }
//      
//         } catch (FileNotFoundException e) {
//             e.printStackTrace();
//         } catch (IOException e) {
//             e.printStackTrace();
//         } catch (ParseException e) {
//             e.printStackTrace();
//         }
//     }
// 
// }
// 
// Path: src/main/java/com/dcp/sm/logic/factory/TypeFactory.java
// public static enum FILE_TYPE {
//     File,
//     Folder,
//     Archive,
//     Executable,
//     Setup,
//     Document,
//     Image,
//     Web,
//     Sound,
//     Video,
//     Custom
// }


import java.io.File;
import java.io.IOException;
import org.apache.pivot.util.Filter;
import org.apache.pivot.util.concurrent.TaskExecutionException;
import org.apache.pivot.wtk.media.Image;
import org.json.simple.parser.ParseException;
import com.dcp.sm.config.io.json.JsonSimpleReader;
import com.dcp.sm.logic.factory.TypeFactory.FILE_TYPE;
package com.dcp.sm.config.io;




/**
 * Input/Output Factory
 * @author SSAIDELI
 */
public class IOFactory
{
    //ISO3 language codes
    public static String[] iso3Codes;
    //File type extensions
    public static String[] archiveExt;// = {"zip", "rar", "jar", "iso"};
    public static String[] exeExt;// = {"exe", "jar", "cmd", "sh", "bat"};
    public static String[] setupExt;// = {"msi"};
    public static String[] docExt;// = {"txt", "pdf", "doc", "docx", "xml", "rtf", "odt", "xls", "xlsx", "csv"};
    public static String[] imgExt;// = {"bmp", "jpg", "jpeg", "gif", "png", "ico"};
    public static String[] webExt;// = {"html", "htm", "php", "js", "asp", "aspx", "css"};
    public static String[] soundExt;// = {"wav", "mp3", "ogg", "wma"};
    public static String[] vidExt;// = {"mp4", "mpg", "mpeg", "wmv", "avi", "mkv"};
    public static String[] custExt;//User defined custom extensions
    
    /**
     * Returns file type of a file
     * @param f: file
     * @return FILE_TYPE
     */
// Path: src/main/java/com/dcp/sm/config/io/json/JsonSimpleReader.java
// public class JsonSimpleReader
// {
//     private JSONParser parser;
//     private FileReader json_file;
//     private JSONObject obj;
//     
//     public JsonSimpleReader(String file_name) throws IOException, ParseException
//     {
//         parser = new JSONParser();
//         json_file = new FileReader(file_name);
//         obj = (JSONObject) parser.parse(json_file);
//     }
//     
//     public JsonSimpleReader(String file_name, String root_obj) throws IOException, ParseException
//     {
//         parser = new JSONParser();
//         json_file = new FileReader(file_name);
//         obj = (JSONObject) parser.parse(json_file);
//         obj = (JSONObject) obj.get(root_obj);
//     }
//     
//     public int readInt(String name) {
//         return (Integer) obj.get(name);
//     }
//     
//     public String readString(String name) {
//         return (String) obj.get(name);
//     }
//     
//     @SuppressWarnings("unchecked")
//     public List<String> readStringList(String name) {
//         JSONArray msg = (JSONArray) obj.get(name);
//         List<String> list = new ArrayList<String>();
//         Iterator<String> iterator = msg.iterator();
//         while(iterator.hasNext()) {
//             list.add(iterator.next());
//         }
//         return list;
//     }
//     @SuppressWarnings("unchecked")
//     public String[] readStringArray(String name) {
//         JSONArray msg = (JSONArray) obj.get(name);
//         String[] arr = new String[msg.size()];
//         Iterator<String> iterator = msg.iterator();
//         for(int i=0;iterator.hasNext();i++) {
//             arr[i] = iterator.next();
//         }
//         return arr;
//     }
//     
//     public void close() throws IOException {
//         json_file.close();
//     }
//     
// 
//     @SuppressWarnings("unchecked")
//     public static void main(String[] args)
//     {
//         JSONParser parser = new JSONParser();
//         
//         try {
//      
//             Object obj = parser.parse(new FileReader("src/dcp/config/io/json/test.txt"));
//      
//             JSONObject jsonObject = (JSONObject) obj;
//      
//             String name = (String) jsonObject.get("name");
//             System.out.println(name);
//      
//             long age = (Long) jsonObject.get("age");
//             System.out.println(age);
//      
//             // loop array
//             JSONArray msg = (JSONArray) jsonObject.get("messages");
//             Iterator<String> iterator = msg.iterator();
//             while (iterator.hasNext()) {
//                 System.out.println(iterator.next());
//             }
//      
//         } catch (FileNotFoundException e) {
//             e.printStackTrace();
//         } catch (IOException e) {
//             e.printStackTrace();
//         } catch (ParseException e) {
//             e.printStackTrace();
//         }
//     }
// 
// }
// 
// Path: src/main/java/com/dcp/sm/logic/factory/TypeFactory.java
// public static enum FILE_TYPE {
//     File,
//     Folder,
//     Archive,
//     Executable,
//     Setup,
//     Document,
//     Image,
//     Web,
//     Sound,
//     Video,
//     Custom
// }


// Path: src/main/java/com/dcp/sm/config/io/IOFactory.java
import java.io.File;
import java.io.IOException;
import org.apache.pivot.util.Filter;
import org.apache.pivot.util.concurrent.TaskExecutionException;
import org.apache.pivot.wtk.media.Image;
import org.json.simple.parser.ParseException;
import com.dcp.sm.config.io.json.JsonSimpleReader;
import com.dcp.sm.logic.factory.TypeFactory.FILE_TYPE;

package com.dcp.sm.config.io;




/**
 * Input/Output Factory
 * @author SSAIDELI
 */
public class IOFactory
{
    //ISO3 language codes
    public static String[] iso3Codes;
    //File type extensions
    public static String[] archiveExt;// = {"zip", "rar", "jar", "iso"};
    public static String[] exeExt;// = {"exe", "jar", "cmd", "sh", "bat"};
    public static String[] setupExt;// = {"msi"};
    public static String[] docExt;// = {"txt", "pdf", "doc", "docx", "xml", "rtf", "odt", "xls", "xlsx", "csv"};
    public static String[] imgExt;// = {"bmp", "jpg", "jpeg", "gif", "png", "ico"};
    public static String[] webExt;// = {"html", "htm", "php", "js", "asp", "aspx", "css"};
    public static String[] soundExt;// = {"wav", "mp3", "ogg", "wma"};
    public static String[] vidExt;// = {"mp4", "mpg", "mpeg", "wmv", "avi", "mkv"};
    public static String[] custExt;//User defined custom extensions
    
    /**
     * Returns file type of a file
     * @param f: file
     * @return FILE_TYPE
     */
    public static FILE_TYPE getFileType(File f) {