001package test;
002
003//tes
004import java.nio.file.Path;
005import java.nio.file.Files;
006import java.nio.charset.StandardCharsets;
007import java.io.InputStream;
008import java.io.IOException;
009import java.io.StringReader;
010import com.killcoding.log.Logger;
011import com.killcoding.tool.ConfigProperties;
012import com.killcoding.log.LoggerFactory;
013import java.util.Map;
014import java.util.HashMap;
015import java.util.regex.Pattern;
016import java.util.regex.Matcher;
017import java.util.ArrayList;
018import java.util.List;
019import java.util.Date;
020import java.util.Collection;
021import java.util.Arrays;
022import java.net.URL;
023import java.io.File;
024import java.net.URI;
025import java.net.URISyntaxException;
026import java.util.stream.Stream;
027import java.util.Collections;
028import java.util.Set;
029import java.util.Comparator;
030import java.util.LinkedHashMap;
031import com.killcoding.cache.Cache;
032import com.killcoding.tool.FileTools;
033import com.killcoding.cache.CacheArray;
034import java.util.function.Function;
035import com.killcoding.tool.EscapeTools;
036import com.killcoding.tool.CodeEscapeLevel;
037import com.killcoding.cache.DiskCache;
038import com.killcoding.cache.AbsCacheApi;
039import com.killcoding.tool.CipherTools;
040import com.killcoding.tool.Base64Tools;
041import javax.script.ScriptEngine;
042import javax.script.ScriptEngineManager;
043import javax.script.ScriptEngineFactory;
044import com.killcoding.tool.CommonTools;
045import java.net.URLClassLoader;
046import java.lang.reflect.Method;
047import java.lang.reflect.InvocationTargetException;
048import java.lang.reflect.Constructor;
049import javax.script.ScriptContext;
050import javax.script.SimpleScriptContext;
051import javax.script.Bindings;
052import javax.script.Invocable;
053import java.time.LocalDate;
054import java.util.Properties;
055import java.text.MessageFormat;
056import java.text.SimpleDateFormat;
057import com.killcoding.cache.DataObject;
058import java.nio.file.Paths;
059import java.util.stream.Collectors;
060import java.text.ParseException;
061import java.nio.file.attribute.FileTime;
062import com.killcoding.datasource.Clock;
063import java.nio.file.LinkOption;
064import com.killcoding.file.DiskFile;
065import com.killcoding.file.FilePart;
066import java.nio.file.attribute.FileAttribute;
067import java.util.Calendar;
068import java.util.concurrent.ConcurrentHashMap;
069import com.killcoding.datasource.DriverDataSource;
070import java.util.concurrent.ThreadLocalRandom;
071import java.nio.charset.Charset;
072import java.security.MessageDigest;
073import java.time.format.DateTimeFormatter;
074
075
076public class Test {
077    
078    private static final Map<String, ConfigProperties> DATA_MAPPING = new ConcurrentHashMap<String, ConfigProperties>();
079    
080    private static final Map<String, List<String>> DATA_MAPPING_LIST = new ConcurrentHashMap<String, List<String>>();    
081
082        public Test() {
083                super();
084        }
085
086    public static boolean isHidden(String path) throws Exception{
087        Path checkPath = Paths.get(path);
088
089        if(!Files.exists(checkPath)) return false;
090        
091        while(checkPath != null){
092
093            boolean hide = Files.isHidden(checkPath);
094            
095            if(hide) return true;
096            
097            checkPath = checkPath.getParent();
098            
099            
100        }
101                return false;
102    }  
103    
104        public static void main (String[] args) {
105            try{
106                LoggerFactory.defaultConfig();
107                
108                String[] s = "abc:efg;123".split(":|;");
109                System.out.println(s[0]);
110                System.out.println(s[1]);
111                System.out.println(s[2]);
112            // Cache.setApi(new DiskCache());
113            // Cache.set("testkey","testvalue",5);
114            // Thread.sleep(2000);
115            // System.out.println("VALUE 1:" +Cache.get("testkey"));
116            
117            // Thread.sleep(6000);
118            // System.out.println("VALUE 2:" +Cache.get("testkey"));
119            
120            // Thread.sleep(5000);
121            // Path fullPath = Paths.get("/src/data/test_hide/.a/b/c/d/e/");
122            // boolean ishide = Files.isHidden(fullPath);
123            // System.out.println("ishide:"  + isHidden(fullPath.toString()));
124            
125            // System.out.println(Files.createTempDirectory(String.format("TMP_BaseFile_%s_",ProcessHandle.current().pid())));
126            try{
127                String srcDate = "0000-01-01 00:00:00.000";
128                String pattern = "yyyy-MM-dd HH:mm:ss.SSS";
129                        SimpleDateFormat fullFormat = new SimpleDateFormat(pattern);
130        //              DateTimeFormatter format = DateTimeFormatter.ofPattern(pattern);        
131                        Date date = fullFormat.parse(srcDate);            
132                System.out.println(date);
133            }catch(Exception e){
134                e.printStackTrace();
135            }
136            System.exit(1);
137               // MessageDigest digest = MessageDigest.getInstance("SHA-256");
138        //     byte[] hash = digest.digest(CommonTools.generateId(128).getBytes("UTF-8"));
139        //     byte[] result = Arrays.copyOf(hash, 16);
140        //     System.out.println("hash size=" + hash.length);
141        //     for(int i = 0;i <hash.length;i++){
142        //         System.out.print(hash[i]);
143        //         System.out.print(",");
144        //     }   
145        //     System.out.println();
146        //     System.out.println("result size=" + result.length);
147        //     for(int i = 0;i <result.length;i++){
148        //         System.out.print(result[i]);
149        //         System.out.print(",");
150        //     }
151         
152               // String text = "Hello World! 哈老世界!";
153               // byte[] encryptText = CipherTools.AESEncrypt("testtestjjhnbggcvvffdcxs",text.getBytes("UTF-8"));
154               //// System.out.println(new String(encryptText,"UTF-8"));
155               // byte[] decryptText = CipherTools.AESDecrypt("testtestjjhnbggcvvffdcxs", encryptText);
156               // System.out.println(new String(decryptText,"UTF-8"));
157           // DiskFile df = new DiskFile("/src/app/charset_gb2312.txt");
158           //// String originalString = new String(df.readAllBytes(),"GBK");
159           // byte[] originalBytes = df.readAllBytes(); /* throws IOException */
160           //// System.out.println("originalString: " + originalString);
161
162           //// String ds = new String(originalString.getBytes(), Charset.forName("GBK") );
163           //// System.out.println("ds: " + ds);
164            
165        //     Map<String, Charset> charsets = Charset.availableCharsets();
166        //     for (String charsetName : charsets.keySet()) {
167        //         try{
168        //             // String ds = new String(originalString.getBytes(), Charset.forName(charsetName) );
169        //             boolean garbled = isGarbled(charsetName,originalBytes);
170        //             // boolean grabledUFFD = false;//isGarbledForUFFD(ds);
171        //             // boolean matched = !(garbled || grabledUFFD);
172        //             if(!garbled){
173        //                 System.out.println("Matched (" + charsetName + ")" + new String(originalBytes,charsetName));
174        //             }
175        //         }catch(Exception ee){
176        //             System.out.println("Error Charset:" + charsetName);
177        //         }
178        //     }            
179            }catch(Exception e){
180                e.printStackTrace();
181            }
182        }
183        
184   public static boolean isGarbledForUFFD(String str) throws Exception {
185        // 示例:检测是否存在Unicode替换字符(常见乱码显示�)
186        Pattern garbledPattern = Pattern.compile(".*\\uFFFD.*");
187        return garbledPattern.matcher(str).find();
188    }   
189        
190    public static boolean isGarbled(String charset,byte[] bytes) throws Exception {
191        StringBuffer all = new StringBuffer();
192        String hasAscii = "\\x00-\\x7F";
193        String hasChinese =  "\\u4e00-\\u9fa5";
194        String hasJapanese = "\\u4e00-\\u9fa5\\u3040-\\u309F\\u30A0-\\u30FF";
195        String hasKorean =  "\\uAC00-\\uD7A3";
196        String hasSanskrit = "\\u0900-\\u097F\\u1CD0-\\u1CFF";
197        all.append(hasAscii);
198        // all.append(hasChinese);
199        // all.append(hasJapanese);
200        // all.append(hasKorean);
201        String regexFormat = ".*[^%s\\u3000-\\u303F\\uFF00-\\uFFEF].*";
202        String regex = String.format(regexFormat,all.toString());
203        return new String(bytes,charset).matches(regex);
204    }   
205
206        public static void main_test(String[] args) throws Exception {
207            LoggerFactory.defaultConfig();
208            try{
209            ConfigProperties cp = new ConfigProperties();
210            cp.load(new File("/src/app/test.properties"), new Runnable(){
211                @Override
212                public void run(){
213                    System.out.println("Loaded...");
214                }
215            });
216            String dsKey = "afasdfasldalgjdgdsafsf";
217            List<String> dmArray = cp.getArray("DataMapping",new String[]{});
218            int size = dmArray.size();
219            List<String> dmList = DATA_MAPPING_LIST.get(dsKey);
220            
221            if(dmList == null) dmList = new ArrayList<String>();
222            
223        for(int i = 0;i < size;i++) {
224            String dm = dmArray.get(i);
225            String originKey = String.format("DataMapping[%s]",i);
226            Map<String,Object> dmMap = cp.getMap(originKey);
227            String shortKey = String.format("%s.%s",dsKey,dm);
228            if(dmMap != null){
229                String dmKey = String.format("%s.%s",dsKey,originKey);
230                
231                if(!DATA_MAPPING.containsKey(shortKey)){
232                    ConfigProperties dmCp = new ConfigProperties();
233                    dmCp.putAllAndReturnSlef(dmMap);
234                    String dataSourceFileOriginValue = dmCp.getString(String.format("%s.DataSource",originKey));
235                    String tableRangOriginValue = dmCp.getString(String.format("%s.TableRange",originKey),"0");
236                    ConfigProperties shortCp = new ConfigProperties();
237                    List<Integer> tableRange = new ArrayList<Integer>();
238                    if(tableRangOriginValue.contains("-")){
239                        String[] ranges = tableRangOriginValue.split("-");
240                        Integer begin = Integer.parseInt(ranges[0].trim());
241                        Integer end = Integer.parseInt(ranges[1].trim());
242                        for(int j = begin;j <= end;j++){
243                            tableRange.add(begin + j);
244                        }
245                    }else if(tableRangOriginValue.contains(",")){
246                        String[] ranges = tableRangOriginValue.split(",");
247                        int rangesLen = ranges.length;
248                        for(int j = 0;j < rangesLen;j++){
249                            tableRange.add(Integer.parseInt(ranges[j].trim()));
250                        }
251                    }else{
252                        tableRange.add(Integer.parseInt(tableRangOriginValue.trim()));
253                    }                  
254                    shortCp.putAndReturnSlef("TableRange",tableRange);
255                    shortCp.putAndReturnSlef("Priority",dmCp.getInteger(String.format("%s.Priority",originKey),0) +"");
256                    // shortCp.put("DataSource",new DriverDataSource(new File(dataSourceFileOriginValue)));
257                    shortCp.putAndReturnSlef("UsingCount",99);
258                    shortCp.putAndReturnSlef("Name",dm);
259                    int randomIndex = ThreadLocalRandom.current().nextInt(0,tableRange.size());
260                    shortCp.put("Table",String.format("%s_data_%s","remote_file",tableRange.get(randomIndex)));   
261                    DATA_MAPPING.put(shortKey,shortCp);
262                    dmList.add(dm);
263                    DATA_MAPPING_LIST.put(dsKey,dmList);
264                }
265            }
266        }
267        System.out.println("DATA_MAPPING = " + DATA_MAPPING);
268        System.out.println("DATA_MAPPING_LIST = " + DATA_MAPPING_LIST);
269            }catch(Exception e){
270                e.printStackTrace();
271            }
272
273           // System.out.println(cp.getArray("DataMapping"));
274           // System.out.println(cp.getMap("DataMapping[0]"));
275           // System.out.println(cp.getMap("DataMapping[1]"));
276           // System.out.println(cp.getMap("DataMapping[2]"));
277           // System.out.println(cp.getMap("DataMapping[3]"));
278           // URL classPathFileUrl = Test.class.getResource(String.format("/config/%s", "app.properties"));
279           // System.out.println(classPathFileUrl);
280           // System.out.println(String.format("MaxUsage: %.2f%%\tCurrentUsage: %.2f%%%s", 0.987D*100,0.876D*100, System.lineSeparator()));
281           // List<Double> aveUsageList = new ArrayList<Double>();
282           // aveUsageList.add(0,1.0D);
283           // aveUsageList.add(0,2.0D);
284           // aveUsageList.add(0,3.0D);
285           // aveUsageList.add(0,4.0D);
286           // aveUsageList.add(0,5.0D);
287           // aveUsageList.add(0,6.0D);
288           // System.out.println(aveUsageList);
289           //Map<String,Object> map = new HashMap<String,Object>();
290           //map.put("name","ddd");
291           //map.put("id","afa");
292           //String _cacheName = String.format("%s%s%s%s", "select from ", map, 0,1);
293           //System.out.println(_cacheName);
294           //// String TMP_MATCHES_FILE = "^.*\\.(create|modify|delete)\\.tmp~$";
295            
296           // String s = "/src/data/jdk8u332-b09/src22.zip.create.tmp~";
297          
298           // System.out.println(s.matches(TMP_MATCHES_FILE));
299//          Path path = Paths.get("/src/app/README.md");
300                        
301//              Files.setLastModifiedTime(path, FileTime.fromMillis(new Date().getTime()));
302//          System.out.println("done");
303           // String s = "/src/data/jre/src/data/jre";
304           // System.out.println(s.replaceFirst("/src/data/jre[/]*","/src/new/path/"));
305            
306           // byte[] allBytes = new byte[]{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};
307           // byte[] part = new byte[5];
308           // System.arraycopy(allBytes, 15, part, 0, part.length);
309           //// System.out.println(Arrays.asList(part));
310           // System.out.println(part[0] + " - " + part[part.length - 1]);
311           // byte[] part = Arrays..copyOfRange(allBytes,0,5);
312           // List partList = Arrays.asList(allBytes);
313           // System.out.println(partList.subList(1, 5));
314           // System.out.println(partList.get(0) + " - " + partList.get(partList.size() - 1));
315           // System.out.println("c:\\abc\\12\\ooo.txt".replaceAll("\\\\","/"));
316           // Path link = Paths.get(new File("/src/app/readmd").toURI());
317           // Files.readSymbolicLink(Path arg0);
318           //Files.createSymbolicLink(Paths.get("/src/app/readmd"), Paths.get("/src/app/README.md"));
319           // System.out.println(Files.readSymbolicLink(link).toString());
320            
321           // Files.delete(link);
322           // DataObject dob = new DataObject("","","/src/app/test");
323           // dob.setObject(Files.readAllBytes(Paths.get(new File("/src/app/20241212_200001.gz").toURI())));
324           // DiskFile df = new DiskFile("/src/data/tables_FLIGHT_INFO/FLIGHT_INFO.AODB_FLIGHTS.csv");
325           // df.split(1024*1024*10, new FilePart(){
326           //     @Override
327    //         protected void process(int partIndex,byte[] buffer){
328    //             System.out.println(partIndex + " -- " + buffer.length);
329    //         }
330    //         @Override
331    //         protected void completed(int lastPartIndex,long fileSize){
332    //             System.out.println("completed " + lastPartIndex + " -- " + fileSize);
333    //         }
334           // });
335           // SplitLargeFile slf = new SplitLargeFile();//FLIGHT_INFO.AIRLINES.csv
336            //slf.splitByFileSize(new File("/src/data/tables_FLIGHT_INFO/FLIGHT_INFO.AODB_FLIGHTS.csv"),1024*1024*10); 
337            
338           // slf.splitByFileSize(new File("/src/data/tables_FLIGHT_INFO/FLIGHT_INFO.AIRLINES.csv"),1024*1024*10); 
339            
340           //  String fileIndexStr = String.format("%0"+ (9 - "5".length() )+"d%s",0 ,"5");
341             
342           // System.out.println(fileIndexStr);
343           // String hostname = ConfigProperties.getEnv("${HOSTNAME}");
344           // System.out.println(hostname);
345           // File binLogFolder = new File("/src/data/root");
346           // Path directoryPath = Paths.get(binLogFolder.toURI());
347    //     List<Path> sortedFiles = Files.list(directoryPath)
348    //     .filter(Files::isDirectory)
349    //     .filter(file -> file.toFile().getName().matches("^[0-9]{4}$")) 
350    //     .sorted()
351    //     .collect(Collectors.toList());  
352    //     System.out.println(sortedFiles);        
353           // DataObject dob = new DataObject(null,null,"/src/app/release/dsc/BinLog/20241206144701178_000000000");
354           ////DataObject dob = new DataObject(null,null,"/src/app/20241206140021809_000000023");
355           // Object[] data = (Object[])dob.getData(); 
356            
357           // System.out.println("data size -> " + data.length);
358           // System.out.println("data  -> " + Arrays.asList(data));
359           // System.out.println("data_0 -> " + data[0]);
360           // System.out.println("data_1 -> " + data[1]);
361            
362            /*
363            
364           // SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm");
365           // Date d1 = df.parse("2024-12-26 00:00");
366           // Date d2 = df.parse("2024-12-29 00:00");
367           // long rang = (d2.getTime() - d1.getTime()) / 86400000 + 1;
368           // System.out.println(rang);
369           // byte[] bb = new byte[]{1,2,3};
370           // System.out.println(Integer.MAX_VALUE);
371           // System.out.println((Integer.MAX_VALUE +"").length());
372           // String s = String.format("%0"+ (9 - "Apple".length() )+"d%s",0 ,"Apple"); ;
373           // System.out.println(s);
374           
375           //FileTime ft = Files.getLastModifiedTime(Paths.get("/src/data/BinLog/BinLog/000000299"));
376           // System.out.println(ft);
377        // Path directoryPath = Paths.get("/src/data/BinLog/BinLog");
378        // List<Path> sortedFiles = Files.list(directoryPath)
379        //         .filter(Files::isRegularFile)
380        //         .filter(file -> file.toFile().getName().matches("^[0-9]{9}$"))
381        //         .sorted()
382        //         .collect(Collectors.toList());  
383        // Path lastOnePath = sortedFiles.get(sortedFiles.size() - 1); 
384        // String filename = lastOnePath.toFile().getName();
385        
386        // System.out.println(filename);
387            
388           // DataObject d = new DataObject("12345678","123456781234567812345678","/src/data/data/test");
389           // d.setObject(new byte[]{1,2});
390           
391           //String s = FileTools.text("/src/data/AA.txt");
392           //String b64 =new String(Base64Tools.encode(s.getBytes()));
393           //System.out.println(b64);
394           
395           //System.out.println(new String(Base64Tools.decode(b64)));
396            
397           // String s = EscapeTools.escape(FileTools.text("/src/data/AA.txt"), CodeEscapeLevel.LEVEL_4_ALL_CHARACTERS);
398           // String s = FileTools.text("/src/data/AA.txt").replaceAll(",","\\\\u002C").replaceAll("\n", "\\\\n").replaceAll("\r", "\\\\r");
399            
400            
401           // FileTools.write("/src/data/aaa.txt",s,false);
402           // System.out.println(s);
403            
404            // , -> \u002C
405//          Pattern pattern = Pattern.compile("^([-\\+]{0,1}[0-9]+)(((?i)ms|s|m|h|d|w){1})$");
406//              Matcher matcher = pattern.matcher("+100s");
407//              boolean m = matcher.find();
408//              if(m) System.out.println(Long.parseLong(matcher.group(1)));
409           // String s = "[cursorStart=0,maxRows=1] SEL\"ECT `appdb`.`user`.* FROM `appdb`.`user` WHERE `appdb`.`user`.`id` = ? AND `appdb`.`user`.`deleted` = ? AND `appdb`.`user`.`active` = ? AND `appdb`.`user`.`last_login_at` = ?";
410           // FileTools.write("/src/app/test.txt", s.replaceAll("\"","\\\\\""),false); /* throws IOException */
411           // System.out.println(s);
412           // String s = "01234567890123456789";
413           // for(int i = 0;i <100;i++){
414           //     System.out.println(i + " = " + (i % 2));
415           // }
416           // System.out.println(Arrays.asList("        WARN       ,          ERROR,             MARK".trim().split("[^\\S]*,[^\\S]*")));
417            
418           // String s = String.format("TESTing %s",1);
419           // System.out.println(s.matches("^((?i)testing).*$"));
420            
421        // Pattern pattern = Pattern.compile("(.*);[^\\S]*$", Pattern.MULTILINE);
422        // Matcher matcher = pattern.matcher("select 1;\nselect 2;  \n    selet 3;");
423
424        // while(matcher.find()){
425        //     System.out.println("group = " + matcher.group());
426        // }
427            
428            
429//          String FileNameFormat = "server-`yyyyMMdd_HHmmssSSS`.log";
430//          int startIndex = FileNameFormat.indexOf("`");
431//          int endIndex = FileNameFormat.lastIndexOf("`");
432//          String FileNameFormatStr = FileNameFormat.substring(startIndex + 1,endIndex);
433//          SimpleDateFormat ldf = new SimpleDateFormat(FileNameFormatStr);
434//         String ff = ldf.format(new java.util.Date());
435//              String ffv = FileNameFormat.replaceFirst("`.*`", ff);
436//              File logFileNameFile = new File(ffv);
437//              System.out.println("logFileNameFile = " + logFileNameFile);
438                
439           // String js = FileTools.text("/src/data/define.js");
440           // String s = EscapeTools.escape(js, CodeEscapeLevel.LEVEL_3_ALL_NON_ALPHANUMERIC);
441           // System.out.println("print\u0028\"completedFun\u0020\u002D\u003E\u0020\"\u0020");
442           // FileTools.write("/src/data/define2.js",s,true);
443           // File f = new File("20240822.log.json");
444           // String extName = f.getName().substring(f.getName().lastIndexOf(".") + 1);
445           // System.out.println(f.getName().lastIndexOf("."));
446           // System.out.println(f.getName().substring(0,f.getName().lastIndexOf("."))  + " - " + extName);
447           //Object[]  objectArray = new Object[]{1,2,true,"AAA"};
448           //// String[] stringArray = Arrays.copyOf(objectArray, objectArray.length, String[].class);
449           //String[] stringArray = new String[objectArray.length];
450           // for (int i=0;i<objectArray.length;i++){
451           //     stringArray[i]= objectArray[i] + "";
452           // } 
453           // System.out.println(Arrays.asList(stringArray));
454           // String message = MessageFormat.format("name={0}, age={1}", 25, "huhx"); 
455           // System.out.println(message);
456            
457           // System.out.println("System.getProperties = " + System.getProperties());
458           // System.out.println("System.getenv = " + System.getenv());
459           // String value = "${JAVA_HOME:/src/lib/java/default}";
460            
461           // String regex = "^\\$\\{?([\\w-]+)(:{1}([^\\}]+)){0,1}\\}$";
462           // System.out.println(regex);
463           // Pattern p = Pattern.compile(regex);//. represents single character  
464    //     Matcher m = p.matcher(value);
465    //     boolean b = m.find();
466    //     System.out.println("find: " + b);
467    //     if(b){
468    //         System.out.println("group 1 = " + m.group(1));
469    //         System.out.println("group 3 = " + m.group(3));
470    //     }
471        // System.out.println(m.quoteReplacement(String arg0))
472            
473           // FileTools.write(new File("/src/data/test123.txt"),"testing\n",false);
474           // FileTools.write(new File("/src/data/test123.txt"),"testing-1\n",false);
475           // FileTools.write(new File("/src/data/test123.txt"),"testing-2\n",true);
476            
477           // long fileOutArchiveDaysMs = new Date().getTime() - (30 * 24 * 3600000L);
478           // System.out.println(new Date(fileOutArchiveDaysMs));
479           // File file = new File("/src/data/env.yml");
480           // long lastModified = file.lastModified();
481           // System.out.println(new Date(lastModified));
482            
483           // System.setProperty("APP_LOGGER","Logger.properties");
484           // System.out.println("APP_LOGGER: " + System.getProperty("APP_LOGGER"));
485          
486        // final String regex = "\"([^\"]+)\":[\"]*([^,^\\}^\"]+)";
487        // final String string = "[{\"name\":\"Піксель ТВ\",\"url\":\"http://st.it-tv.org:4575/?224.1.16.33\",\"type\":81,\"tsOn\":false}]";
488        
489        // final Pattern pattern = Pattern.compile(regex, Pattern.CASE_INSENSITIVE);
490        // final Matcher matcher = pattern.matcher(string);
491        
492        // while (matcher.find()) {
493        //     System.out.println("Full match: " + matcher.group(0));
494            
495        //     for (int i = 1; i <= matcher.groupCount(); i++) {
496        //         System.out.println("Group " + i + ": " + matcher.group(i));
497        //     }
498        // }
499
500                // CommonTools.loadJar("/src/data/jdbc/org.mozilla.javascript-1.7.5.v201504281450.jar");
501//              URLClassLoader classLoader = CommonTools.loadJars("/src/app/script_lib");
502//              ScriptEngineManager sem = new ScriptEngineManager(classLoader);
503                
504//              String JS = "function doit(p) { list.add(p); return true; }";
505//              List<String> list = new ArrayList<>();
506
507
508//     ScriptEngineManager scriptManager = new ScriptEngineManager();
509//     ScriptEngine engine = scriptManager.getEngineByName("javascript");
510
511//     ScriptContext context = new SimpleScriptContext();
512//     context.setBindings(engine.createBindings(), ScriptContext.ENGINE_SCOPE);
513//     Bindings scope = context.getBindings(ScriptContext.ENGINE_SCOPE);
514
515//     scope.put("list", list);
516//     engine.eval(JS, context);
517//      engine.eval("print('val = ' + 123)", context);
518//     engine.setContext(context);
519//     Invocable invocable = (Invocable) engine;
520//     invocable.invokeFunction("doit", "Hello!!!");
521
522    // System.out.println(list.size());
523//              List<ScriptEngineFactory> factories = sem.getEngineFactories();
524//              for (ScriptEngineFactory factory : factories)
525//                      System.out.println(factory.getEngineName() + " " + factory.getEngineVersion() + " " + factory.getNames());
526//              if (factories.isEmpty())
527//                      System.out.println("No Script Engines found");
528
529// //           ScriptEngineManager sem = new ScriptEngineManager(classLoader);
530//              System.out.println(sem);
531//              ScriptEngine engine = sem.getEngineByName("js");
532//              System.out.println(engine);
533//              Object result = engine.eval("var greeting='hello world';" + "print(greeting);" + "greeting");
534//              System.out.println("result = " + result);
535                // byte[] bytes = CipherTools._3DESEncrypt("012345678901234567890123","01234567",new String("testvalue").getBytes());
536                // String s = EscapeTools.escape(new String(Base64Tools.encode(bytes)), CodeEscapeLevel.LEVEL_4_ALL_CHARACTERS);
537                // System.out.println(s);
538                // String base64Str = EscapeTools.unescape(s);
539                // byte[] data = Base64Tools.decode(base64Str);
540                // byte[] strData = CipherTools._3DESDecrypt("012345678901234567890123","01234567",data); /* throws Exception */
541                // System.out.println(new String(strData));boolean isId = name.toLowerCase().endsWith("id");
542                //              boolean isId = "id".toLowerCase().matches("^.*[\\_]{0,1}id$");
543                //              System.out.println(isId);
544                Thread.sleep(2000L);
545                System.exit(0);
546
547        }
548
549}