IoT CAS Frameworks/IOT_Server/Report_Generator_Framework/source/DashBoard-JSONgenerator-ArbitraryDate/src/com/merit/dashboard/Controller.java
public void generateDirectoryStructureByCustomerID(String customerName, String tomcat_home) {

        String szProjectName = DBUtilHelper.getMetrics_mapping_properties().getProperty("projectName");
        String[] types;
        String resTypes = DBUtilHelper.getMetrics_mapping_properties().getProperty("ResourceName");
        if (resTypes.contains(",")) {
            types = resTypes.split(",");
        } else {
            types = new String[1];
            types[0] = resTypes;
        }

        Object[] cCustomers = custServiceMap.get(customerName).keySet().toArray();

        //System.out.println("\n ProjectName:" + szProjectName + ";\n Customer Name:" + customerName + "\n Resource Type List::" + types.length);
        log.debug("\n ProjectName:" + szProjectName + ";\n Customer Name:" + customerName + "\n Resource Type List::" + types.length);
        cal = DateGenerator.getCurrentTime();
        String szDate = sdf.format(cal.getTime());
        System.out.println("cal = " + cal.toString());
        System.out.println("szDate = " + szDate);
        File f1 = new File(
                tomcat_home + File.separator
                + //"webapps" + File.separator +
                szProjectName + File.separator
                + customerName + File.separator
                + szDate + File.separator + ServiceThreadListener.gPeriod);
        System.out.println("check directory " + tomcat_home + File.separator
                + //"webapps" + File.separator +
                szProjectName + File.separator
                + customerName + File.separator
                + szDate + File.separator + ServiceThreadListener.gPeriod);
        if (!f1.exists()) {
            //System.out.println(" Customer directory not found:" + tomcat_home + File.separator +   "webapps" + File.separator +   szProjectName + File.separator + customerName);
            System.out.println(" Customer directory not found:" + tomcat_home + File.separator + /*"webapps" + File.separator +*/ szProjectName
                    + File.separator + customerName);
            //String[] timedFOLDR = {"Hour", "Day", "Week", "Month", "Year"};
            List<String> arrMetricList = new ArrayList();
            try {
                System.out.println("generating folder structure....");
                ArrayList services;//
                //for (int t = 0; t < timedFOLDR.length; t++) {
                    for (int i = 0; i < types.length; i++) {
                        arrMetricList.clear();
                        arrMetricList.addAll(ServiceThreadListener.getJSONLocationSet(types[i].trim()));
                        System.out.println("cCustomers length=" + cCustomers.length);
                        for (int c = 0; c < cCustomers.length; c++) {
                            System.out.println("generate for cCustomer " + cCustomers[c].toString());
                            folderstructure = new File(
                                    tomcat_home + File.separator
                                    //+ "webapps" + File.separator
                                    + szProjectName + File.separator
                                    + customerName + File.separator
                                    + szDate + File.separator
                                    + ServiceThreadListener.gPeriod + File.separator
                                    + cCustomers[c].toString());
                            folderstructure.mkdirs();
                            services = custServiceMap.get(customerName).get(cCustomers[c].toString());
                            for (int s = 0; s < services.size(); s++) {
                                folderstructure = new File(
                                        tomcat_home + File.separator
                                        //+ "webapps" + File.separator
                                        + szProjectName + File.separator
                                        + customerName + File.separator
                                        + szDate + File.separator
                                        + ServiceThreadListener.gPeriod + File.separator
                                        + cCustomers[c].toString() + File.separator
                                        + services.get(s).toString());
                                folderstructure.mkdirs();
                                //getArray of JSON Folders remoove space from names { }
                                //create one more for loop add the named folder except TIME LINE
                                //System.out.println("types[i].trim() = " + types[i].trim());
                                //Set<String> arrMetricGroup =
                                for (String mtricgroup : arrMetricList) {
                                    if (mtricgroup != null) {
                                        folderstructure = new File(
                                                tomcat_home + File.separator
                                                //+ "webapps" + File.separator
                                                + szProjectName + File.separator
                                                + customerName + File.separator
                                                + szDate + File.separator
                                                + ServiceThreadListener.gPeriod + File.separator
                                                + cCustomers[c].toString() + File.separator
                                                + services.get(s).toString() + File.separator
                                                + types[i].trim() + File.separator
                                                + mtricgroup);
                                        folderstructure.mkdirs();
                                        System.out.println("Created directory:" + tomcat_home + File.separator
                                                //+ "webapps" + File.separator
                                                + szProjectName + File.separator
                                                + customerName + File.separator
                                                + szDate + File.separator
                                                + ServiceThreadListener.gPeriod + File.separator
                                                + cCustomers[c].toString() + File.separator
                                                + services.get(s).toString() + File.separator
                                                + types[i].trim() + File.separator
                                                + mtricgroup);
                                    }
                                }
                            }
                        }
                    }
                //}
                folderstructure = null;
            } catch (Exception e) {
                e.printStackTrace();
                log.error("Error in generateDirectoryStructureByCustomerID" + e.toString());//
            } finally {
                cCustomers = null;// modified
                arrMetricList = null;//modified 
            }
        } else {
            //System.out.println(" Ok! Customer directory found: webapps" + File.separator + szProjectName + File.separator + customerName);
            System.out.println(" Ok! Customer directory found: " + szProjectName + File.separator + customerName);
        }
        f1 = null;
    }
/**
     * This method is creating Directory like merit inside
     * hour,day,week,month,year then inside hour:
     * server,Desktop,DataBase,Network,JVM etc
     *
     * @param customerName customerId
     * @param timestampselection means (hour, days, week, month, year)
     * @param tomcat_home where you want to create a directory
     *
     */
This method is creating Directory like merit inside
hour,day,week,month,year then inside hour:
server,Desktop,DataBase,Network,JVM etc

@param customerName customerId
@param timestampselection means (hour, days, week, month, year)
@param tomcat_home where you want to create a directory
This method is creating Directory like merit inside hour day week month year then inside hour : server Desktop DataBase Network JVM etc @param customerName customerId @param timestampselection means ( hour days week month year ) @param tomcat_home where you want to create a directory
public void generateDirectoryStructureByCustomerID(String customerName, String tomcat_home) {
        String szProjectName = DBUtilHelper.getMetrics_mapping_properties().getProperty("projectName");
        String[] types;
        String resTypes = DBUtilHelper.getMetrics_mapping_properties().getProperty("ResourceName");
        if (resTypes.contains(",")) {
            types = resTypes.split(",");
        } else {
            types = new String[1];
            types[0] = resTypes;
        }
        Object[] cCustomers = custServiceMap.get(customerName).keySet().toArray();
        log.debug("\n ProjectName:" + szProjectName + ";\n Customer Name:" + customerName + "\n Resource Type List::" + types.length);
        cal = DateGenerator.getCurrentTime();
        String szDate = sdf.format(cal.getTime());
        System.out.println("cal = " + cal.toString());
        System.out.println("szDate = " + szDate);
        File f1 = new File(
                tomcat_home + File.separator
                + 
                szProjectName + File.separator
                + customerName + File.separator
                + szDate + File.separator + ServiceThreadListener.gPeriod);
        System.out.println("check directory " + tomcat_home + File.separator
                + 
                szProjectName + File.separator
                + customerName + File.separator
                + szDate + File.separator + ServiceThreadListener.gPeriod);
        if (!f1.exists()) {
            System.out.println(" Customer directory not found:" + tomcat_home + File.separator + /*"webapps" + File.separator +*/ szProjectName
                    + File.separator + customerName);
            List<String> arrMetricList = new ArrayList();
            try {
                System.out.println("generating folder structure....");
                ArrayList services;
                for (int t = 0; t < timedFOLDR.length; t++) {
                    for (int i = 0; i < types.length; i++) {
                        arrMetricList.clear();
                        arrMetricList.addAll(ServiceThreadListener.getJSONLocationSet(types[i].trim()));
                        System.out.println("cCustomers length=" + cCustomers.length);
                        for (int c = 0; c < cCustomers.length; c++) {
                            System.out.println("generate for cCustomer " + cCustomers[c].toString());
                            folderstructure = new File(
                                    tomcat_home + File.separator
                                    + "webapps" + File.separator
                                    + szProjectName + File.separator
                                    + customerName + File.separator
                                    + szDate + File.separator
                                    + ServiceThreadListener.gPeriod + File.separator
                                    + cCustomers[c].toString());
                            folderstructure.mkdirs();
                            services = custServiceMap.get(customerName).get(cCustomers[c].toString());
                            for (int s = 0; s < services.size(); s++) {
                                folderstructure = new File(
                                        tomcat_home + File.separator
                                        + "webapps" + File.separator
                                        + szProjectName + File.separator
                                        + customerName + File.separator
                                        + szDate + File.separator
                                        + ServiceThreadListener.gPeriod + File.separator
                                        + cCustomers[c].toString() + File.separator
                                        + services.get(s).toString());
                                folderstructure.mkdirs();
                                getArray of JSON Folders remoove space from names { }
                                create one more for loop add the named folder except TIME LINE
                                System.out.println("types[i].trim() = " + types[i].trim());
                                Set<String> arrMetricGroup =
                                for (String mtricgroup : arrMetricList) {
                                    if (mtricgroup != null) {
                                        folderstructure = new File(
                                                tomcat_home + File.separator
                                                + "webapps" + File.separator
                                                + szProjectName + File.separator
                                                + customerName + File.separator
                                                + szDate + File.separator
                                                + ServiceThreadListener.gPeriod + File.separator
                                                + cCustomers[c].toString() + File.separator
                                                + services.get(s).toString() + File.separator
                                                + types[i].trim() + File.separator
                                                + mtricgroup);
                                        folderstructure.mkdirs();
                                        System.out.println("Created directory:" + tomcat_home + File.separator
                                                + "webapps" + File.separator
                                                + szProjectName + File.separator
                                                + customerName + File.separator
                                                + szDate + File.separator
                                                + ServiceThreadListener.gPeriod + File.separator
                                                + cCustomers[c].toString() + File.separator
                                                + services.get(s).toString() + File.separator
                                                + types[i].trim() + File.separator
                                                + mtricgroup);
                                    }
                                }
                            }
                        }
                    }
                }
                folderstructure = null;
            } catch (Exception e) {
                e.printStackTrace();
                log.error("Error in generateDirectoryStructureByCustomerID" + e.toString());
            } finally {
                cCustomers = null; modified
                arrMetricList = null;modified 
            }
        } else {
            System.out.println(" Ok! Customer directory found: webapps" + File.separator + szProjectName + File.separator + customerName);
            System.out.println(" Ok! Customer directory found: " + szProjectName + File.separator + customerName);
        }
        f1 = null;
    }
public void generateDirectoryStructureByCustomerID ( String customerName , String tomcat_home ) { String szProjectName = DBUtilHelper . getMetrics_mapping_properties ( ) . getProperty ( "projectName" ) ; String [ ] types ; String resTypes = DBUtilHelper . getMetrics_mapping_properties ( ) . getProperty ( "ResourceName" ) ; if ( resTypes . contains ( "," ) ) { types = resTypes . split ( "," ) ; } else { types = new String [ 1 ] ; types [ 0 ] = resTypes ; } Object [ ] cCustomers = custServiceMap . get ( customerName ) . keySet ( ) . toArray ( ) ; log . debug ( "\n ProjectName:" + szProjectName + ";\n Customer Name:" + customerName + "\n Resource Type List::" + types . length ) ; cal = DateGenerator . getCurrentTime ( ) ; String szDate = sdf . format ( cal . getTime ( ) ) ; System . out . println ( "cal = " + cal . toString ( ) ) ; System . out . println ( "szDate = " + szDate ) ; File f1 = new File ( tomcat_home + File . separator + szProjectName + File . separator + customerName + File . separator + szDate + File . separator + ServiceThreadListener . gPeriod ) ; System . out . println ( "check directory " + tomcat_home + File . separator + szProjectName + File . separator + customerName + File . separator + szDate + File . separator + ServiceThreadListener . gPeriod ) ; if ( ! f1 . exists ( ) ) { System . out . println ( " Customer directory not found:" + tomcat_home + File . separator + /*"webapps" + File.separator +*/ szProjectName + File . separator + customerName ) ; List < String > arrMetricList = new ArrayList ( ) ; try { System . out . println ( "generating folder structure...." ) ; ArrayList services ; for ( int i = 0 ; i < types . length ; i ++ ) { arrMetricList . clear ( ) ; arrMetricList . addAll ( ServiceThreadListener . getJSONLocationSet ( types [ i ] . trim ( ) ) ) ; System . out . println ( "cCustomers length=" + cCustomers . length ) ; for ( int c = 0 ; c < cCustomers . length ; c ++ ) { System . out . println ( "generate for cCustomer " + cCustomers [ c ] . toString ( ) ) ; folderstructure = new File ( tomcat_home + File . separator + szProjectName + File . separator + customerName + File . separator + szDate + File . separator + ServiceThreadListener . gPeriod + File . separator + cCustomers [ c ] . toString ( ) ) ; folderstructure . mkdirs ( ) ; services = custServiceMap . get ( customerName ) . get ( cCustomers [ c ] . toString ( ) ) ; for ( int s = 0 ; s < services . size ( ) ; s ++ ) { folderstructure = new File ( tomcat_home + File . separator + szProjectName + File . separator + customerName + File . separator + szDate + File . separator + ServiceThreadListener . gPeriod + File . separator + cCustomers [ c ] . toString ( ) + File . separator + services . get ( s ) . toString ( ) ) ; folderstructure . mkdirs ( ) ; for ( String mtricgroup : arrMetricList ) { if ( mtricgroup != null ) { folderstructure = new File ( tomcat_home + File . separator + szProjectName + File . separator + customerName + File . separator + szDate + File . separator + ServiceThreadListener . gPeriod + File . separator + cCustomers [ c ] . toString ( ) + File . separator + services . get ( s ) . toString ( ) + File . separator + types [ i ] . trim ( ) + File . separator + mtricgroup ) ; folderstructure . mkdirs ( ) ; System . out . println ( "Created directory:" + tomcat_home + File . separator + szProjectName + File . separator + customerName + File . separator + szDate + File . separator + ServiceThreadListener . gPeriod + File . separator + cCustomers [ c ] . toString ( ) + File . separator + services . get ( s ) . toString ( ) + File . separator + types [ i ] . trim ( ) + File . separator + mtricgroup ) ; } } } } } folderstructure = null ; } catch ( Exception e ) { e . printStackTrace ( ) ; log . error ( "Error in generateDirectoryStructureByCustomerID" + e . toString ( ) ) ; } finally { cCustomers = null ; arrMetricList = null ; } } else { System . out . println ( " Ok! Customer directory found: " + szProjectName + File . separator + customerName ) ; } f1 = null ; }
This method is creating Directory like merit inside
 hour,day,week,month,year then inside hour:
 server,Desktop,DataBase,Network,JVM etc
This method is creating Directory like merit inside hour day week month year then inside hour : server Desktop DataBase Network JVM etc
//System.out.println("\n ProjectName:" + szProjectName + ";\n Customer Name:" + customerName + "\n Resource Type List::" + types.length); //"webapps" + File.separator + //"webapps" + File.separator + //System.out.println(" Customer directory not found:" + tomcat_home + File.separator +   "webapps" + File.separator +   szProjectName + File.separator + customerName); //String[] timedFOLDR = {"Hour", "Day", "Week", "Month", "Year"}; // //for (int t = 0; t < timedFOLDR.length; t++) { //+ "webapps" + File.separator //+ "webapps" + File.separator //getArray of JSON Folders remoove space from names { } //create one more for loop add the named folder except TIME LINE //System.out.println("types[i].trim() = " + types[i].trim()); //Set<String> arrMetricGroup = //+ "webapps" + File.separator //+ "webapps" + File.separator //} // // modified //modified  //System.out.println(" Ok! Customer directory found: webapps" + File.separator + szProjectName + File.separator + customerName);