Java Code Examples for play.libs.Files#deleteDirectory()
The following examples show how to use
play.libs.Files#deleteDirectory() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FilesystemStore.java From restcommander with Apache License 2.0 | 6 votes |
public void rebuildAllIndexes() throws Exception { stop(); File fl = new File(DATA_PATH); Files.deleteDirectory(fl); fl.mkdirs(); List<ApplicationClass> classes = Play.classes.getAnnotatedClasses(Indexed.class); for (ApplicationClass applicationClass : classes) { List<JPABase> objects = JPA.em().createQuery( "select e from " + applicationClass.javaClass.getCanonicalName() + " as e") .getResultList(); for (JPABase jpaBase : objects) { index(jpaBase, applicationClass.javaClass.getName()); } } Logger.info("Rebuild index finished"); }
Example 2
Source File: FilesystemStore.java From restcommander with Apache License 2.0 | 6 votes |
public void delete(String name) { synchronized (this) { try { if (indexSearchers.containsKey(name)) { IndexReader rd = indexSearchers.get(name).getIndexReader(); indexSearchers.get(name).close(); indexSearchers.remove(name); } if (indexWriters.containsKey(name)) { indexWriters.get(name).close(); indexWriters.remove(name); } File target = new File(DATA_PATH, name); if (target.exists() && target.isDirectory()) Files.deleteDirectory(target); } catch (Exception e) { throw new UnexpectedException("Can't reopen reader", e); } } }