aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com
diff options
context:
space:
mode:
authorGravatar tomlu <tomlu@google.com>2017-12-11 18:23:51 -0800
committerGravatar Copybara-Service <copybara-piper@google.com>2017-12-11 18:25:36 -0800
commit52aff7dcac17c73a221487acc147e631c75124cd (patch)
tree10dcc3fe0007cc3c42df9ab4b570f140dac63316 /src/main/java/com
parent15feaf99b780e4a2c4cdd2647e5b51ea98579aad (diff)
Thread FileSystem instance through a few call sites.
PiperOrigin-RevId: 178704585
Diffstat (limited to 'src/main/java/com')
-rw-r--r--src/main/java/com/google/devtools/build/lib/unix/UnixFileSystem.java6
-rw-r--r--src/main/java/com/google/devtools/build/lib/vfs/FileSystem.java16
-rw-r--r--src/main/java/com/google/devtools/build/lib/vfs/JavaIoFileSystem.java6
-rw-r--r--src/main/java/com/google/devtools/build/lib/vfs/ReadonlyFileSystem.java6
-rw-r--r--src/main/java/com/google/devtools/build/lib/vfs/ReadonlyFileSystemWithCustomStat.java6
-rw-r--r--src/main/java/com/google/devtools/build/lib/vfs/UnionFileSystem.java6
-rw-r--r--src/main/java/com/google/devtools/build/lib/vfs/inmemoryfs/InMemoryFileSystem.java6
7 files changed, 24 insertions, 28 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/unix/UnixFileSystem.java b/src/main/java/com/google/devtools/build/lib/unix/UnixFileSystem.java
index cfd07b336c..7b82dcc06a 100644
--- a/src/main/java/com/google/devtools/build/lib/unix/UnixFileSystem.java
+++ b/src/main/java/com/google/devtools/build/lib/unix/UnixFileSystem.java
@@ -270,7 +270,7 @@ public class UnixFileSystem extends AbstractFileSystemWithCustomStat {
}
@Override
- protected void setWritable(Path path, boolean writable) throws IOException {
+ public void setWritable(Path path, boolean writable) throws IOException {
modifyPermissionBits(path, 0200, writable);
}
@@ -307,7 +307,7 @@ public class UnixFileSystem extends AbstractFileSystemWithCustomStat {
}
@Override
- protected boolean createDirectory(Path path) throws IOException {
+ public boolean createDirectory(Path path) throws IOException {
synchronized (path) {
// Note: UNIX mkdir(2), FilesystemUtils.mkdir() and createDirectory all
// have different ways of representing failure!
@@ -361,7 +361,7 @@ public class UnixFileSystem extends AbstractFileSystemWithCustomStat {
}
@Override
- protected boolean delete(Path path) throws IOException {
+ public boolean delete(Path path) throws IOException {
String name = path.toString();
long startTime = Profiler.nanoTimeMaybe();
synchronized (path) {
diff --git a/src/main/java/com/google/devtools/build/lib/vfs/FileSystem.java b/src/main/java/com/google/devtools/build/lib/vfs/FileSystem.java
index 33fb154fdd..fef88b892b 100644
--- a/src/main/java/com/google/devtools/build/lib/vfs/FileSystem.java
+++ b/src/main/java/com/google/devtools/build/lib/vfs/FileSystem.java
@@ -250,12 +250,11 @@ public abstract class FileSystem {
return fileSystem;
}
-
/**
- * Creates a directory with the name of the current path. See
- * {@link Path#createDirectory} for specification.
+ * Creates a directory with the name of the current path. See {@link Path#createDirectory} for
+ * specification.
*/
- protected abstract boolean createDirectory(Path path) throws IOException;
+ public abstract boolean createDirectory(Path path) throws IOException;
/**
* Returns the size in bytes of the file denoted by {@code path}. See {@link
@@ -267,11 +266,8 @@ public abstract class FileSystem {
*/
protected abstract long getFileSize(Path path, boolean followSymlinks) throws IOException;
- /**
- * Deletes the file denoted by {@code path}. See {@link Path#delete} for
- * specification.
- */
- protected abstract boolean delete(Path path) throws IOException;
+ /** Deletes the file denoted by {@code path}. See {@link Path#delete} for specification. */
+ public abstract boolean delete(Path path) throws IOException;
/**
* Returns the last modification time of the file denoted by {@code path}. See {@link
@@ -693,7 +689,7 @@ public abstract class FileSystem {
*
* @throws IOException if there was an error reading or writing the file's metadata
*/
- protected abstract void setWritable(Path path, boolean writable) throws IOException;
+ public abstract void setWritable(Path path, boolean writable) throws IOException;
/**
* Returns true iff the file represented by the path is executable.
diff --git a/src/main/java/com/google/devtools/build/lib/vfs/JavaIoFileSystem.java b/src/main/java/com/google/devtools/build/lib/vfs/JavaIoFileSystem.java
index e55877dd66..dca8b95906 100644
--- a/src/main/java/com/google/devtools/build/lib/vfs/JavaIoFileSystem.java
+++ b/src/main/java/com/google/devtools/build/lib/vfs/JavaIoFileSystem.java
@@ -179,7 +179,7 @@ public class JavaIoFileSystem extends AbstractFileSystemWithCustomStat {
}
@Override
- protected void setWritable(Path path, boolean writable) throws IOException {
+ public void setWritable(Path path, boolean writable) throws IOException {
File file = getIoFile(path);
if (!file.exists()) {
throw new FileNotFoundException(path + ERR_NO_SUCH_FILE_OR_DIR);
@@ -217,7 +217,7 @@ public class JavaIoFileSystem extends AbstractFileSystemWithCustomStat {
}
@Override
- protected boolean createDirectory(Path path) throws IOException {
+ public boolean createDirectory(Path path) throws IOException {
// We always synchronize on the current path before doing it on the parent path and file system
// path structure ensures that this locking order will never be reversed.
@@ -344,7 +344,7 @@ public class JavaIoFileSystem extends AbstractFileSystemWithCustomStat {
}
@Override
- protected boolean delete(Path path) throws IOException {
+ public boolean delete(Path path) throws IOException {
File file = getIoFile(path);
long startTime = Profiler.nanoTimeMaybe();
synchronized (path) {
diff --git a/src/main/java/com/google/devtools/build/lib/vfs/ReadonlyFileSystem.java b/src/main/java/com/google/devtools/build/lib/vfs/ReadonlyFileSystem.java
index 5369443c42..bfcc4f97e0 100644
--- a/src/main/java/com/google/devtools/build/lib/vfs/ReadonlyFileSystem.java
+++ b/src/main/java/com/google/devtools/build/lib/vfs/ReadonlyFileSystem.java
@@ -56,7 +56,7 @@ public abstract class ReadonlyFileSystem extends AbstractFileSystem {
}
@Override
- protected void setWritable(Path path, boolean writable) throws IOException {
+ public void setWritable(Path path, boolean writable) throws IOException {
throw modificationException();
}
@@ -86,7 +86,7 @@ public abstract class ReadonlyFileSystem extends AbstractFileSystem {
}
@Override
- protected boolean createDirectory(Path path) throws IOException {
+ public boolean createDirectory(Path path) throws IOException {
throw modificationException();
}
@@ -101,7 +101,7 @@ public abstract class ReadonlyFileSystem extends AbstractFileSystem {
}
@Override
- protected boolean delete(Path path) throws IOException {
+ public boolean delete(Path path) throws IOException {
throw modificationException();
}
diff --git a/src/main/java/com/google/devtools/build/lib/vfs/ReadonlyFileSystemWithCustomStat.java b/src/main/java/com/google/devtools/build/lib/vfs/ReadonlyFileSystemWithCustomStat.java
index 2c57bd26b6..de5daca181 100644
--- a/src/main/java/com/google/devtools/build/lib/vfs/ReadonlyFileSystemWithCustomStat.java
+++ b/src/main/java/com/google/devtools/build/lib/vfs/ReadonlyFileSystemWithCustomStat.java
@@ -41,7 +41,7 @@ public abstract class ReadonlyFileSystemWithCustomStat extends AbstractFileSyste
}
@Override
- protected void setWritable(Path path, boolean writable) throws IOException {
+ public void setWritable(Path path, boolean writable) throws IOException {
throw modificationException();
}
@@ -71,7 +71,7 @@ public abstract class ReadonlyFileSystemWithCustomStat extends AbstractFileSyste
}
@Override
- protected boolean createDirectory(Path path) throws IOException {
+ public boolean createDirectory(Path path) throws IOException {
throw modificationException();
}
@@ -92,7 +92,7 @@ public abstract class ReadonlyFileSystemWithCustomStat extends AbstractFileSyste
}
@Override
- protected boolean delete(Path path) throws IOException {
+ public boolean delete(Path path) throws IOException {
throw modificationException();
}
diff --git a/src/main/java/com/google/devtools/build/lib/vfs/UnionFileSystem.java b/src/main/java/com/google/devtools/build/lib/vfs/UnionFileSystem.java
index bdb3216223..824e71dc69 100644
--- a/src/main/java/com/google/devtools/build/lib/vfs/UnionFileSystem.java
+++ b/src/main/java/com/google/devtools/build/lib/vfs/UnionFileSystem.java
@@ -179,7 +179,7 @@ public class UnionFileSystem extends FileSystem {
}
@Override
- protected boolean createDirectory(Path path) throws IOException {
+ public boolean createDirectory(Path path) throws IOException {
checkModifiable(path);
// When creating the exact directory that is mapped,
// create it on both the parent's delegate and the path's delegate.
@@ -213,7 +213,7 @@ public class UnionFileSystem extends FileSystem {
}
@Override
- protected boolean delete(Path path) throws IOException {
+ public boolean delete(Path path) throws IOException {
checkModifiable(path);
FileSystem delegate = getDelegate(path);
return delegate.delete(adjustPath(path, delegate));
@@ -379,7 +379,7 @@ public class UnionFileSystem extends FileSystem {
}
@Override
- protected void setWritable(Path path, boolean writable) throws IOException {
+ public void setWritable(Path path, boolean writable) throws IOException {
checkModifiable(path);
path = internalResolveSymlink(path);
FileSystem delegate = getDelegate(path);
diff --git a/src/main/java/com/google/devtools/build/lib/vfs/inmemoryfs/InMemoryFileSystem.java b/src/main/java/com/google/devtools/build/lib/vfs/inmemoryfs/InMemoryFileSystem.java
index b439603bba..ff6d88a387 100644
--- a/src/main/java/com/google/devtools/build/lib/vfs/inmemoryfs/InMemoryFileSystem.java
+++ b/src/main/java/com/google/devtools/build/lib/vfs/inmemoryfs/InMemoryFileSystem.java
@@ -553,7 +553,7 @@ public class InMemoryFileSystem extends FileSystem {
}
@Override
- protected void setWritable(Path path, boolean writable) throws IOException {
+ public void setWritable(Path path, boolean writable) throws IOException {
InMemoryContentInfo status;
synchronized (this) {
status = scopeLimitedStat(path, true);
@@ -597,7 +597,7 @@ public class InMemoryFileSystem extends FileSystem {
}
@Override
- protected boolean createDirectory(Path path) throws IOException {
+ public boolean createDirectory(Path path) throws IOException {
if (path.equals(getRootDirectory())) {
throw Error.EACCES.exception(path);
}
@@ -678,7 +678,7 @@ public class InMemoryFileSystem extends FileSystem {
}
@Override
- protected boolean delete(Path path) throws IOException {
+ public boolean delete(Path path) throws IOException {
if (path.equals(getRootDirectory())) {
throw Error.EBUSY.exception(path);
}