// 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;
        else if (IOFactory.isFileType(NAME, FILE_TYPE.Executable))//Executable
            return FILE_TYPE.Executable;
        else if (IOFactory.isFileType(NAME, FILE_TYPE.Setup))//Setup file
            return FILE_TYPE.Setup;
        else if (IOFactory.isFileType(NAME, FILE_TYPE.Document))//Text Document file
            return FILE_TYPE.Document;
        else if (IOFactory.isFileType(NAME, FILE_TYPE.Image))//Image file
            return FILE_TYPE.Image;
        else if (IOFactory.isFileType(NAME, FILE_TYPE.Web))//Web file
            return FILE_TYPE.Web;
        else if (IOFactory.isFileType(NAME, FILE_TYPE.Sound))//Sound file
            return FILE_TYPE.Sound;
        else if (IOFactory.isFileType(NAME, FILE_TYPE.Video))//Video file
            return FILE_TYPE.Video;
        else if (IOFactory.isFileType(NAME, FILE_TYPE.Custom))//Custom extension
            return FILE_TYPE.Custom;
        else//Simple File
            return FILE_TYPE.File;
    }
    
    /**
     * Tests if a file's extension is of a type
     * (folders and files without extension are automatically valid)
     * @param file_name
     * @param file_type
     * @return boolean: success
     */
    public static boolean isFileType(String file_name, FILE_TYPE file_type) {
        // Accept all (unix) files without extensions
        if (!file_name.contains("."))
// 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;

        else if (IOFactory.isFileType(NAME, FILE_TYPE.Executable))//Executable
            return FILE_TYPE.Executable;
        else if (IOFactory.isFileType(NAME, FILE_TYPE.Setup))//Setup file
            return FILE_TYPE.Setup;
        else if (IOFactory.isFileType(NAME, FILE_TYPE.Document))//Text Document file
            return FILE_TYPE.Document;
        else if (IOFactory.isFileType(NAME, FILE_TYPE.Image))//Image file
            return FILE_TYPE.Image;
        else if (IOFactory.isFileType(NAME, FILE_TYPE.Web))//Web file
            return FILE_TYPE.Web;
        else if (IOFactory.isFileType(NAME, FILE_TYPE.Sound))//Sound file
            return FILE_TYPE.Sound;
        else if (IOFactory.isFileType(NAME, FILE_TYPE.Video))//Video file
            return FILE_TYPE.Video;
        else if (IOFactory.isFileType(NAME, FILE_TYPE.Custom))//Custom extension
            return FILE_TYPE.Custom;
        else//Simple File
            return FILE_TYPE.File;
    }
    
    /**
     * Tests if a file's extension is of a type
     * (folders and files without extension are automatically valid)
     * @param file_name
     * @param file_type
     * @return boolean: success
     */
    public static boolean isFileType(String file_name, FILE_TYPE file_type) {
        // Accept all (unix) files without extensions
        if (!file_name.contains("."))
            return true;