throw new PlatformException("Database location " + db + " already exists. Cannot re-initialize workspace from baseline.");
if (REQUIRE_INDEX_IN_BASELINE) {
Path index = workspaceLocation.resolve(INDEX_DIRECTORY);
- if (!Files.exists(index) || !isEmptyDirectory(index))
+ if (Files.exists(index) || !isEmptyDirectory(index))
throw new PlatformException("Index location " + index + " already exists. Cannot re-initialize workspace from baseline.");
}
} catch (IOException e) {
}
}
+ public static void initializeWorkspaceWithBaseline(Path baseline, Path workspaceLocation, Path indicatorPath) throws PlatformException {
+ try {
+ Files.createDirectories(workspaceLocation);
+ FileUtils.extractZip(baseline.toFile(), workspaceLocation.toFile());
+ if (indicatorPath != null)
+ Files.write(indicatorPath, DatabaseBaselines.baselineIndicatorContents(indicatorPath));
+ } catch (IOException e) {
+ throw new PlatformException(e);
+ }
+ }
+
public static void main(String[] args) throws IOException {
packageBaseline(Paths.get("D:/temp/desktop/workspace"), Paths.get("d:/temp/desktop/workspace/baseline.zip"));
}