use of org.eclipse.tycho.locking.facade.FileLocker in project tycho by eclipse.
the class LocalMavenRepositoryTool method getArtifactIndexLines.
public Set<String> getArtifactIndexLines() throws IOException {
File indexFile = getArtifactIndexFile();
FileLocker locker = fileLockService.getFileLocker(indexFile);
locker.lock();
try {
return readLines(indexFile);
} finally {
locker.release();
}
}
use of org.eclipse.tycho.locking.facade.FileLocker in project tycho by eclipse.
the class ProductExportMojo method unzipDirectory.
private void unzipDirectory(File source, String sourceRelPath, File target, String excludes) throws IOException {
FileLocker locker = fileLockService.getFileLocker(source);
locker.lock();
try {
ZipFile zip = new ZipFile(source);
try {
Enumeration<? extends ZipEntry> entries = zip.entries();
while (entries.hasMoreElements()) {
ZipEntry entry = entries.nextElement();
if (entry.isDirectory()) {
continue;
}
String name = entry.getName();
if (name.startsWith(sourceRelPath) && !SelectorUtils.matchPath(excludes, name)) {
File targetFile = new File(target, name.substring(sourceRelPath.length()));
targetFile.getParentFile().mkdirs();
FileUtils.copyStreamToFile(new RawInputStreamFacade(zip.getInputStream(entry)), targetFile);
}
}
} finally {
zip.close();
}
} finally {
locker.release();
}
}
Aggregations