use of org.apache.lucene.mockfile.FilterFileSystem in project lucene-solr by apache.
the class TestUtil method hasVirusChecker.
public static boolean hasVirusChecker(Path path) {
FileSystem fs = path.getFileSystem();
while (fs instanceof FilterFileSystem) {
FilterFileSystem ffs = (FilterFileSystem) fs;
if (ffs.getParent() instanceof VirusCheckingFS) {
return true;
}
fs = ffs.getDelegate();
}
return false;
}
use of org.apache.lucene.mockfile.FilterFileSystem in project lucene-solr by apache.
the class TestUtil method enableVirusChecker.
public static void enableVirusChecker(Directory in) {
Directory dir = FilterDirectory.unwrap(in);
if (dir instanceof FSDirectory) {
FileSystem fs = ((FSDirectory) dir).getDirectory().getFileSystem();
while (fs instanceof FilterFileSystem) {
FilterFileSystem ffs = (FilterFileSystem) fs;
if (ffs.getParent() instanceof VirusCheckingFS) {
VirusCheckingFS vfs = (VirusCheckingFS) ffs.getParent();
vfs.enable();
return;
}
fs = ffs.getDelegate();
}
}
}
use of org.apache.lucene.mockfile.FilterFileSystem in project lucene-solr by apache.
the class TestUtil method disableVirusChecker.
/** Returns true if VirusCheckingFS is in use and was in fact already enabled */
public static boolean disableVirusChecker(Directory in) {
Directory dir = FilterDirectory.unwrap(in);
if (dir instanceof FSDirectory) {
FileSystem fs = ((FSDirectory) dir).getDirectory().getFileSystem();
while (fs instanceof FilterFileSystem) {
FilterFileSystem ffs = (FilterFileSystem) fs;
if (ffs.getParent() instanceof VirusCheckingFS) {
VirusCheckingFS vfs = (VirusCheckingFS) ffs.getParent();
boolean isEnabled = vfs.isEnabled();
vfs.disable();
return isEnabled;
}
fs = ffs.getDelegate();
}
}
return false;
}
use of org.apache.lucene.mockfile.FilterFileSystem in project lucene-solr by apache.
the class TestUtil method hasWindowsFS.
public static boolean hasWindowsFS(Directory dir) {
dir = FilterDirectory.unwrap(dir);
if (dir instanceof FSDirectory) {
Path path = ((FSDirectory) dir).getDirectory();
FileSystem fs = path.getFileSystem();
while (fs instanceof FilterFileSystem) {
FilterFileSystem ffs = (FilterFileSystem) fs;
if (ffs.getParent() instanceof WindowsFS) {
return true;
}
fs = ffs.getDelegate();
}
}
return false;
}
use of org.apache.lucene.mockfile.FilterFileSystem in project lucene-solr by apache.
the class TestUtil method hasWindowsFS.
public static boolean hasWindowsFS(Path path) {
FileSystem fs = path.getFileSystem();
while (fs instanceof FilterFileSystem) {
FilterFileSystem ffs = (FilterFileSystem) fs;
if (ffs.getParent() instanceof WindowsFS) {
return true;
}
fs = ffs.getDelegate();
}
return false;
}
Aggregations