1 19 20 package org.netbeans.modules.db.test; 21 22 import java.io.IOException ; 23 import org.netbeans.modules.db.explorer.DatabaseConnectionConvertor; 24 import org.netbeans.modules.db.explorer.driver.JDBCDriverConvertor; 25 import org.openide.filesystems.FileObject; 26 import org.openide.filesystems.Repository; 27 28 32 public class Util { 33 34 private Util() { 35 } 36 37 public static void deleteConnectionFiles() throws IOException { 38 deleteFileObjects(getConnectionsFolder().getChildren()); 39 } 40 41 public static void deleteDriverFiles() throws IOException { 42 deleteFileObjects(getDriversFolder().getChildren()); 43 } 44 45 public static FileObject getConnectionsFolder() { 46 return Repository.getDefault().getDefaultFileSystem().findResource(DatabaseConnectionConvertor.CONNECTIONS_PATH); 47 } 48 49 public static FileObject getDriversFolder() { 50 return Repository.getDefault().getDefaultFileSystem().findResource(JDBCDriverConvertor.DRIVERS_PATH); 51 } 52 53 private static void deleteFileObjects(FileObject[] fos) throws IOException { 54 for (int i = 0; i < fos.length; i++) { 55 fos[i].delete(); 56 } 57 } 58 } 59 | Popular Tags |