]> matita.cs.unibo.it Git - logicplayer.git/blobdiff - server/com/company/DirectoryWhatcer.java
Updated to new version.
[logicplayer.git] / server / com / company / DirectoryWhatcer.java
index 8b376a1a3557e5cdec54122e390834a1ac8cb760..1d219b2367c7a0bba8bd3d0afc8bcdd2ca55ba53 100644 (file)
@@ -66,6 +66,36 @@ class DirectoryWatcher implements Runnable {
                 }
             }
         }
+        dbConnect db=new dbConnect();
+        try {
+            String[] esercizi=suString.stringToVectorString(db.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 +108,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