X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=server%2Fcom%2Fcompany%2FDirectoryWhatcer.java;h=630c9083f2dc77dbd9d54d43fa669951c90083d3;hb=0e669c56166061993453baecf536bf7dee1f11da;hp=8b376a1a3557e5cdec54122e390834a1ac8cb760;hpb=bd7a266f1a37cb373614b8fa3d0c1e832c4b82e3;p=logicplayer.git diff --git a/server/com/company/DirectoryWhatcer.java b/server/com/company/DirectoryWhatcer.java index 8b376a1..630c908 100644 --- a/server/com/company/DirectoryWhatcer.java +++ b/server/com/company/DirectoryWhatcer.java @@ -39,9 +39,8 @@ class DirectoryWatcher implements Runnable { xmlOperation es=new xmlOperation(); File car=new File(global.listaEsercizi); if (car.exists()) { - dbConnect db=new dbConnect(); try { - ArrayList esercizi=suString.stringToArrayList(db.dbQuery("4")); + ArrayList esercizi=suString.stringToArrayList(global.request.dbQuery("4")); boolean add=true; for(String esercizio : esercizi) { @@ -66,6 +65,35 @@ class DirectoryWatcher implements Runnable { } } } + try { + String[] esercizi=suString.stringToVectorString(global.request.dbQuery("4")); + boolean delete=true; + for(String esercizio : esercizi) + { + for(String elemento : lista) + { + if(esercizio.contentEquals(elemento)) + delete=false; + } + if(delete) { + xmlOperation es = new xmlOperation(); + es.remove(esercizio); + } + + } + } catch (SQLException e) { + e.printStackTrace(); + } catch (ClassNotFoundException e) { + e.printStackTrace(); + } catch (IllegalAccessException e) { + e.printStackTrace(); + } catch (InstantiationException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } catch (NoSuchAlgorithmException e) { + e.printStackTrace(); + } } // print the events and the affected file @@ -78,7 +106,7 @@ class DirectoryWatcher implements Runnable { boolean check = EsNameParser.check(pathCreated.getFileName().toString()); if(!check) { - File file = new File(global.locationEsercizi+pathCreated.getFileName().toString()); + File file = new File("/var/www/html/esercizi/"+pathCreated.getFileName().toString()); if(file.delete()) System.out.println("eliminato"); else