Revision: 17468
http://sourceforge.net/p/gate/code/17468
Author: valyt
Date: 2014-02-27 12:55:47 +0000 (Thu, 27 Feb 2014)
Log Message:
-----------
Now we also remove old (emtpy) dirs.
Modified Paths:
--------------
mimir/branches/5.0/mimir-core/src/gate/mimir/util/IndexUpgrader.java
Modified: mimir/branches/5.0/mimir-core/src/gate/mimir/util/IndexUpgrader.java
===================================================================
--- mimir/branches/5.0/mimir-core/src/gate/mimir/util/IndexUpgrader.java
2014-02-27 12:54:45 UTC (rev 17467)
+++ mimir/branches/5.0/mimir-core/src/gate/mimir/util/IndexUpgrader.java
2014-02-27 12:55:47 UTC (rev 17468)
@@ -24,15 +24,10 @@
import gate.mimir.index.IndexException;
import it.unimi.di.big.mg4j.index.DiskBasedIndex;
import it.unimi.di.big.mg4j.index.cluster.DocumentalCluster;
-import it.unimi.dsi.fastutil.io.BinIO;
-import it.unimi.dsi.util.BloomFilter;
-import java.io.BufferedInputStream;
import java.io.File;
-import java.io.FileInputStream;
import java.io.FilenameFilter;
import java.io.IOException;
-import java.io.InputStream;
import java.nio.file.Files;
import java.nio.file.StandardCopyOption;
import java.util.Arrays;
@@ -121,7 +116,7 @@
}
if(!dbSahClass.isAssignableFrom(sah.getClass())) {
throw new IndexException("Cannot convert mentions index mentions-" +
- subIndexIdx + " because it does not use the DH H2 " +
+ subIndexIdx + " because it does not use the DB H2 " +
"Annotation Helper, which is the only one supported by " +
"this automatic upgrade process");
}
@@ -154,6 +149,20 @@
upgradeSubIndex(indexDirectory, subIndexIdx, sic.isDirectIndexEnabled(),
sic);
}
+ // cleanup old dirs (only if empty)
+ if(sourceDir.listFiles().length == 0) {
+ if(!sourceDir.delete()) {
+ logger.info("Could not delete old MG4J directory " + sourceDir +
+ " even though it appears empty.");
+ }
+ }
+ File sourceDBDir = new File(indexDirectory, "db");
+ if(sourceDBDir.listFiles().length == 0) {
+ if(!sourceDBDir.delete()) {
+ logger.info("Could not delete old DB directory " + sourceDBDir +
+ " even though it appears empty.");
+ }
+ }
}
/**
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Flow-based real-time traffic analytics software. Cisco certified tool.
Monitor traffic, SLAs, QoS, Medianet, WAAS etc. with NetFlow Analyzer
Customize your own dashboards, set traffic alerts and generate reports.
Network behavioral analysis & security monitoring. All-in-one tool.
http://pubads.g.doubleclick.net/gampad/clk?id=126839071&iu=/4140/ostg.clktrk
_______________________________________________
GATE-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gate-cvs