Skip to content

Commit

Permalink
Run google-java-format on GCS NIO
Browse files Browse the repository at this point in the history
I also made the following additional changes:

- Don't use one-line javadocs, per request of @aozarov
- Minor cleanup to a few JavaDocs up a few javadocs
- Use public domain John Keats poetry published in 1819
  • Loading branch information
jart committed Mar 3, 2016
1 parent c32010c commit 70017a5
Show file tree
Hide file tree
Showing 25 changed files with 396 additions and 303 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@

import java.util.Map;

/** CloudStorageConfiguration is the configuration class for
* {@link CloudStorageFileSystem#forBucket}. */
/**
* Configuration for a {@link CloudStorageFileSystem} instance.
*/
@AutoValue
public abstract class CloudStorageConfiguration {

/** Returns the path of the current working directory. Defaults to the root directory.
/**
* Returns path of the current working directory. This defaults to the root directory.
*/
public abstract String workingDirectory();

Expand Down Expand Up @@ -107,7 +109,6 @@ public Builder blockSize(int value) {
return this;
}


/** Creates a new instance, but does not destroy the builder.
*/
public CloudStorageConfiguration build() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.google.gcloud.storage.contrib.nio;

import static com.google.common.base.Verify.verifyNotNull;
import static com.google.common.base.Preconditions.checkNotNull;

import com.google.common.base.MoreObjects;
import com.google.gcloud.storage.BlobInfo;
Expand All @@ -15,21 +15,22 @@
import javax.annotation.Nullable;
import javax.annotation.concurrent.Immutable;

/** Metadata view for a Google Cloud Storage object.
/**
* Metadata view for a Google Cloud Storage object.
*/
@Immutable
public final class CloudStorageFileAttributeView implements BasicFileAttributeView {

//private final CloudStorageFileSystemProvider provider;
private final Storage storage;
private final CloudStoragePath path;

CloudStorageFileAttributeView(Storage storage, CloudStoragePath path) {
this.storage = verifyNotNull(storage);
this.path = verifyNotNull(path);
this.storage = checkNotNull(storage);
this.path = checkNotNull(path);
}

/** Returns {@value CloudStorageFileSystem#GCS_VIEW}.
/**
* Returns {@value CloudStorageFileSystem#GCS_VIEW}.
*/
@Override
public String name() {
Expand All @@ -38,8 +39,7 @@ public String name() {

@Override
public CloudStorageFileAttributes readAttributes() throws IOException {
if (path.seemsLikeADirectory()
&& path.getFileSystem().config().usePseudoDirectories()) {
if (path.seemsLikeADirectory() && path.getFileSystem().config().usePseudoDirectories()) {
return new CloudStoragePseudoDirectoryAttributes(path);
}
BlobInfo blobInfo = storage.get(path.getBlobId());
Expand All @@ -62,8 +62,8 @@ public void setTimes(FileTime lastModifiedTime, FileTime lastAccessTime, FileTim
public boolean equals(@Nullable Object other) {
return this == other
|| other instanceof CloudStorageFileAttributeView
&& Objects.equals(storage, ((CloudStorageFileAttributeView) other).storage)
&& Objects.equals(path, ((CloudStorageFileAttributeView) other).path);
&& Objects.equals(storage, ((CloudStorageFileAttributeView) other).storage)
&& Objects.equals(path, ((CloudStorageFileAttributeView) other).path);
}

@Override
Expand All @@ -73,9 +73,6 @@ public int hashCode() {

@Override
public String toString() {
return MoreObjects.toStringHelper(this)
.add("storage", storage)
.add("path", path)
.toString();
return MoreObjects.toStringHelper(this).add("storage", storage).add("path", path).toString();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ public static CloudStorageFileSystem forBucket(String bucket) {
* @see #forBucket(String)
*/
public static CloudStorageFileSystem forBucket(String bucket, CloudStorageConfiguration config) {
checkArgument(!bucket.startsWith(URI_SCHEME + ":"),
"Bucket name must not have schema: %s", bucket);
checkArgument(
!bucket.startsWith(URI_SCHEME + ":"), "Bucket name must not have schema: %s", bucket);
return new CloudStorageFileSystem(
new CloudStorageFileSystemProvider(), bucket, checkNotNull(config));
}
Expand All @@ -75,9 +75,7 @@ public static CloudStorageFileSystem forBucket(String bucket, CloudStorageConfig
private final CloudStorageConfiguration config;

CloudStorageFileSystem(
CloudStorageFileSystemProvider provider,
String bucket,
CloudStorageConfiguration config) {
CloudStorageFileSystemProvider provider, String bucket, CloudStorageConfiguration config) {
checkArgument(!bucket.isEmpty(), "bucket");
this.provider = provider;
this.bucket = bucket;
Expand All @@ -89,47 +87,56 @@ public CloudStorageFileSystemProvider provider() {
return provider;
}

/** Returns the Cloud Storage bucket name being served by this file system.
*/
/**
* Returns the Cloud Storage bucket name being served by this file system.
*/
public String bucket() {
return bucket;
}

/** Returns the configuration object for this filesystem instance.
*/
/**
* Returns the configuration object for this filesystem instance.
*/
public CloudStorageConfiguration config() {
return config;
}

/** Converts a cloud storage object name to a {@link Path} object.
*/
/**
* Converts a cloud storage object name to a {@link Path} object.
*/
@Override
public CloudStoragePath getPath(String first, String... more) {
checkArgument(!first.startsWith(URI_SCHEME + ":"),
"GCS FileSystem.getPath() must not have schema and bucket name: %s", first);
checkArgument(
!first.startsWith(URI_SCHEME + ":"),
"GCS FileSystem.getPath() must not have schema and bucket name: %s",
first);
return CloudStoragePath.getPath(this, first, more);
}

/** Does nothing.
*/
/**
* Does nothing.
*/
@Override
public void close() {}

/** Returns {@code true}.
*/
/**
* Returns {@code true}.
*/
@Override
public boolean isOpen() {
return true;
}

/** Returns {@code false}.
*/
/**
* Returns {@code false}.
*/
@Override
public boolean isReadOnly() {
return false;
}

/** Returns {@value UnixPath#SEPARATOR}.
/**
* Returns {@value UnixPath#SEPARATOR}.
*/
@Override
public String getSeparator() {
Expand All @@ -151,22 +158,26 @@ public Set<String> supportedFileAttributeViews() {
return SUPPORTED_VIEWS;
}

/** Always throws {@link UnsupportedOperationException}. */
/**
* Throws {@link UnsupportedOperationException} because this feature hasn't been implemented yet.
*/
@Override
public PathMatcher getPathMatcher(String syntaxAndPattern) {
// TODO: Implement me.
throw new UnsupportedOperationException();
}

/** Always throws {@link UnsupportedOperationException}.
*/
/**
* Throws {@link UnsupportedOperationException} because this feature hasn't been implemented yet.
*/
@Override
public UserPrincipalLookupService getUserPrincipalLookupService() {
// TODO: Implement me.
throw new UnsupportedOperationException();
}

/** Always throws {@link UnsupportedOperationException}.
/**
* Throws {@link UnsupportedOperationException} because this feature hasn't been implemented yet.
*/
@Override
public WatchService newWatchService() throws IOException {
Expand All @@ -178,8 +189,8 @@ public WatchService newWatchService() throws IOException {
public boolean equals(@Nullable Object other) {
return this == other
|| other instanceof CloudStorageFileSystem
&& Objects.equals(config, ((CloudStorageFileSystem) other).config)
&& Objects.equals(bucket, ((CloudStorageFileSystem) other).bucket);
&& Objects.equals(config, ((CloudStorageFileSystem) other).config)
&& Objects.equals(bucket, ((CloudStorageFileSystem) other).bucket);
}

@Override
Expand Down
Loading

0 comments on commit 70017a5

Please sign in to comment.