Skip to content

Commit 75a22c9

Browse files
Move gcloud -> cloud (issue #877)
1 parent 5644d92 commit 75a22c9

40 files changed

+162
-191
lines changed

gcloud-java-contrib/gcloud-java-nio-examples/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
Demonstrates how to use the gcloud-java-nio jar to add GCS functionality to legacy code.
1010
</description>
1111
<parent>
12-
<groupId>com.google.gcloud</groupId>
12+
<groupId>com.google.cloud</groupId>
1313
<artifactId>gcloud-java-contrib</artifactId>
1414
<version>0.1.6-SNAPSHOT</version>
1515
</parent>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package com.google.gcloud.nio.examples;
17+
package com.google.cloud.nio.examples;
1818

1919
import java.io.IOException;
2020
import java.net.URI;

gcloud-java-contrib/gcloud-java-nio/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
FileSystemProvider for Java NIO to access GCS transparently.
1010
</description>
1111
<parent>
12-
<groupId>com.google.gcloud</groupId>
12+
<groupId>com.google.cloud</groupId>
1313
<artifactId>gcloud-java-contrib</artifactId>
1414
<version>0.1.6-SNAPSHOT</version>
1515
</parent>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package com.google.gcloud.storage.contrib.nio;
17+
package com.google.cloud.storage.contrib.nio;
1818

1919
import static com.google.common.base.Preconditions.checkArgument;
2020

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package com.google.gcloud.storage.contrib.nio;
17+
package com.google.cloud.storage.contrib.nio;
1818

1919
import static com.google.common.base.Preconditions.checkNotNull;
2020

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package com.google.gcloud.storage.contrib.nio;
17+
package com.google.cloud.storage.contrib.nio;
1818

1919
import com.google.common.base.Optional;
2020
import com.google.common.collect.ImmutableMap;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package com.google.gcloud.storage.contrib.nio;
17+
package com.google.cloud.storage.contrib.nio;
1818

1919
import static com.google.common.base.Preconditions.checkArgument;
2020
import static com.google.common.base.Preconditions.checkNotNull;
Lines changed: 25 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,11 @@
1414
* limitations under the License.
1515
*/
1616

17-
package com.google.gcloud.storage.contrib.nio;
17+
package com.google.cloud.storage.contrib.nio;
1818

1919
import static com.google.common.base.Preconditions.checkArgument;
2020
import static com.google.common.base.Preconditions.checkNotNull;
2121
import static com.google.common.base.Strings.isNullOrEmpty;
22-
import static com.google.gcloud.storage.contrib.nio.CloudStorageFileSystem.URI_SCHEME;
23-
import static com.google.gcloud.storage.contrib.nio.CloudStorageUtil.checkBucket;
24-
import static com.google.gcloud.storage.contrib.nio.CloudStorageUtil.checkNotNullArray;
25-
import static com.google.gcloud.storage.contrib.nio.CloudStorageUtil.checkPath;
26-
import static com.google.gcloud.storage.contrib.nio.CloudStorageUtil.stripPathFromUri;
2722

2823
import com.google.auto.service.AutoService;
2924
import com.google.common.annotations.VisibleForTesting;
@@ -147,7 +142,7 @@ public CloudStorageFileSystemProvider() {
147142

148143
@Override
149144
public String getScheme() {
150-
return URI_SCHEME;
145+
return CloudStorageFileSystem.URI_SCHEME;
151146
}
152147

153148
/**
@@ -164,12 +159,12 @@ public CloudStorageFileSystem getFileSystem(URI uri) {
164159
@Override
165160
public CloudStorageFileSystem newFileSystem(URI uri, Map<String, ?> env) {
166161
checkArgument(
167-
uri.getScheme().equalsIgnoreCase(URI_SCHEME),
162+
uri.getScheme().equalsIgnoreCase(CloudStorageFileSystem.URI_SCHEME),
168163
"Cloud Storage URIs must have '%s' scheme: %s",
169-
URI_SCHEME,
164+
CloudStorageFileSystem.URI_SCHEME,
170165
uri);
171166
checkArgument(
172-
!isNullOrEmpty(uri.getHost()), "%s:// URIs must have a host: %s", URI_SCHEME, uri);
167+
!isNullOrEmpty(uri.getHost()), "%s:// URIs must have a host: %s", CloudStorageFileSystem.URI_SCHEME, uri);
173168
checkArgument(
174169
uri.getPort() == -1
175170
&& isNullOrEmpty(uri.getPath())
@@ -178,20 +173,20 @@ && isNullOrEmpty(uri.getFragment())
178173
&& isNullOrEmpty(uri.getUserInfo()),
179174
"GCS FileSystem URIs mustn't have: port, userinfo, path, query, or fragment: %s",
180175
uri);
181-
checkBucket(uri.getHost());
176+
CloudStorageUtil.checkBucket(uri.getHost());
182177
return new CloudStorageFileSystem(this, uri.getHost(), CloudStorageConfiguration.fromMap(env));
183178
}
184179

185180
@Override
186181
public CloudStoragePath getPath(URI uri) {
187-
return CloudStoragePath.getPath(getFileSystem(stripPathFromUri(uri)), uri.getPath());
182+
return CloudStoragePath.getPath(getFileSystem(CloudStorageUtil.stripPathFromUri(uri)), uri.getPath());
188183
}
189184

190185
@Override
191186
public SeekableByteChannel newByteChannel(
192187
Path path, Set<? extends OpenOption> options, FileAttribute<?>... attrs) throws IOException {
193188
checkNotNull(path);
194-
checkNotNullArray(attrs);
189+
CloudStorageUtil.checkNotNullArray(attrs);
195190
if (options.contains(StandardOpenOption.WRITE)) {
196191
// TODO: Make our OpenOptions implement FileAttribute. Also remove buffer option.
197192
return newWriteChannel(path, options);
@@ -227,7 +222,7 @@ private SeekableByteChannel newReadChannel(Path path, Set<? extends OpenOption>
227222
throw new UnsupportedOperationException(option.toString());
228223
}
229224
}
230-
CloudStoragePath cloudPath = checkPath(path);
225+
CloudStoragePath cloudPath = CloudStorageUtil.checkPath(path);
231226
if (cloudPath.seemsLikeADirectoryAndUsePseudoDirectories()) {
232227
throw new CloudStoragePseudoDirectoryException(cloudPath);
233228
}
@@ -237,7 +232,7 @@ private SeekableByteChannel newReadChannel(Path path, Set<? extends OpenOption>
237232
private SeekableByteChannel newWriteChannel(Path path, Set<? extends OpenOption> options)
238233
throws IOException {
239234

240-
CloudStoragePath cloudPath = checkPath(path);
235+
CloudStoragePath cloudPath = CloudStorageUtil.checkPath(path);
241236
if (cloudPath.seemsLikeADirectoryAndUsePseudoDirectories()) {
242237
throw new CloudStoragePseudoDirectoryException(cloudPath);
243238
}
@@ -311,7 +306,7 @@ private SeekableByteChannel newWriteChannel(Path path, Set<? extends OpenOption>
311306
@Override
312307
public InputStream newInputStream(Path path, OpenOption... options) throws IOException {
313308
InputStream result = super.newInputStream(path, options);
314-
CloudStoragePath cloudPath = checkPath(path);
309+
CloudStoragePath cloudPath = CloudStorageUtil.checkPath(path);
315310
int blockSize = cloudPath.getFileSystem().config().blockSize();
316311
for (OpenOption option : options) {
317312
if (option instanceof OptionBlockSize) {
@@ -323,7 +318,7 @@ public InputStream newInputStream(Path path, OpenOption... options) throws IOExc
323318

324319
@Override
325320
public boolean deleteIfExists(Path path) throws IOException {
326-
CloudStoragePath cloudPath = checkPath(path);
321+
CloudStoragePath cloudPath = CloudStorageUtil.checkPath(path);
327322
if (cloudPath.seemsLikeADirectoryAndUsePseudoDirectories()) {
328323
throw new CloudStoragePseudoDirectoryException(cloudPath);
329324
}
@@ -332,7 +327,7 @@ public boolean deleteIfExists(Path path) throws IOException {
332327

333328
@Override
334329
public void delete(Path path) throws IOException {
335-
CloudStoragePath cloudPath = checkPath(path);
330+
CloudStoragePath cloudPath = CloudStorageUtil.checkPath(path);
336331
if (!deleteIfExists(cloudPath)) {
337332
throw new NoSuchFileException(cloudPath.toString());
338333
}
@@ -361,7 +356,7 @@ public void copy(Path source, Path target, CopyOption... options) throws IOExcep
361356
boolean setContentEncoding = false;
362357
boolean setContentDisposition = false;
363358

364-
CloudStoragePath toPath = checkPath(target);
359+
CloudStoragePath toPath = CloudStorageUtil.checkPath(target);
365360
BlobInfo.Builder tgtInfoBuilder = BlobInfo.builder(toPath.getBlobId()).contentType("");
366361

367362
int blockSize = -1;
@@ -402,7 +397,7 @@ public void copy(Path source, Path target, CopyOption... options) throws IOExcep
402397
}
403398
}
404399

405-
CloudStoragePath fromPath = checkPath(source);
400+
CloudStoragePath fromPath = CloudStorageUtil.checkPath(source);
406401

407402
blockSize =
408403
blockSize != -1
@@ -470,15 +465,15 @@ public void copy(Path source, Path target, CopyOption... options) throws IOExcep
470465

471466
@Override
472467
public boolean isSameFile(Path path, Path path2) {
473-
return checkPath(path).equals(checkPath(path2));
468+
return CloudStorageUtil.checkPath(path).equals(CloudStorageUtil.checkPath(path2));
474469
}
475470

476471
/**
477472
* Always returns {@code false}, because GCS doesn't support hidden files.
478473
*/
479474
@Override
480475
public boolean isHidden(Path path) {
481-
checkPath(path);
476+
CloudStorageUtil.checkPath(path);
482477
return false;
483478
}
484479

@@ -494,7 +489,7 @@ public void checkAccess(Path path, AccessMode... modes) throws IOException {
494489
throw new UnsupportedOperationException(mode.toString());
495490
}
496491
}
497-
CloudStoragePath cloudPath = checkPath(path);
492+
CloudStoragePath cloudPath = CloudStorageUtil.checkPath(path);
498493
if (cloudPath.seemsLikeADirectoryAndUsePseudoDirectories()) {
499494
return;
500495
}
@@ -508,11 +503,11 @@ public void checkAccess(Path path, AccessMode... modes) throws IOException {
508503
public <A extends BasicFileAttributes> A readAttributes(
509504
Path path, Class<A> type, LinkOption... options) throws IOException {
510505
checkNotNull(type);
511-
checkNotNullArray(options);
506+
CloudStorageUtil.checkNotNullArray(options);
512507
if (type != CloudStorageFileAttributes.class && type != BasicFileAttributes.class) {
513508
throw new UnsupportedOperationException(type.getSimpleName());
514509
}
515-
CloudStoragePath cloudPath = checkPath(path);
510+
CloudStoragePath cloudPath = CloudStorageUtil.checkPath(path);
516511
if (cloudPath.seemsLikeADirectoryAndUsePseudoDirectories()) {
517512
@SuppressWarnings("unchecked")
518513
A result = (A) new CloudStoragePseudoDirectoryAttributes(cloudPath);
@@ -543,11 +538,11 @@ public Map<String, Object> readAttributes(Path path, String attributes, LinkOpti
543538
public <V extends FileAttributeView> V getFileAttributeView(
544539
Path path, Class<V> type, LinkOption... options) {
545540
checkNotNull(type);
546-
checkNotNullArray(options);
541+
CloudStorageUtil.checkNotNullArray(options);
547542
if (type != CloudStorageFileAttributeView.class && type != BasicFileAttributeView.class) {
548543
throw new UnsupportedOperationException(type.getSimpleName());
549544
}
550-
CloudStoragePath cloudPath = checkPath(path);
545+
CloudStoragePath cloudPath = CloudStorageUtil.checkPath(path);
551546
@SuppressWarnings("unchecked")
552547
V result = (V) new CloudStorageFileAttributeView(storage, cloudPath);
553548
return result;
@@ -558,13 +553,13 @@ public <V extends FileAttributeView> V getFileAttributeView(
558553
*/
559554
@Override
560555
public void createDirectory(Path dir, FileAttribute<?>... attrs) {
561-
checkPath(dir);
562-
checkNotNullArray(attrs);
556+
CloudStorageUtil.checkPath(dir);
557+
CloudStorageUtil.checkNotNullArray(attrs);
563558
}
564559

565560
@Override
566561
public DirectoryStream<Path> newDirectoryStream(Path dir, final Filter<? super Path> filter) {
567-
final CloudStoragePath cloudPath = checkPath(dir);
562+
final CloudStoragePath cloudPath = CloudStorageUtil.checkPath(dir);
568563
checkNotNull(filter);
569564
String prefix = cloudPath.toString();
570565
final Iterator<Blob> blobIterator = storage.list(cloudPath.bucket(), Storage.BlobListOption.prefix(prefix), Storage.BlobListOption.fields()).iterateAll();
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414
* limitations under the License.
1515
*/
1616

17-
package com.google.gcloud.storage.contrib.nio;
17+
package com.google.cloud.storage.contrib.nio;
1818

1919
import static com.google.common.base.Preconditions.checkNotNull;
20-
import static com.google.gcloud.storage.contrib.nio.CloudStorageFileSystem.FILE_TIME_UNKNOWN;
20+
import static com.google.cloud.storage.contrib.nio.CloudStorageFileSystem.FILE_TIME_UNKNOWN;
2121

2222
import com.google.common.base.MoreObjects;
2323
import com.google.common.base.Optional;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package com.google.gcloud.storage.contrib.nio;
17+
package com.google.cloud.storage.contrib.nio;
1818

1919
/**
2020
* Exception reminding user that Cloud Storage objects can't be mutated.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package com.google.gcloud.storage.contrib.nio;
17+
package com.google.cloud.storage.contrib.nio;
1818

1919
import java.nio.file.CopyOption;
2020
import java.nio.file.OpenOption;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package com.google.gcloud.storage.contrib.nio;
17+
package com.google.cloud.storage.contrib.nio;
1818

1919
import com.google.gcloud.storage.Acl;
2020

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,10 @@
1414
* limitations under the License.
1515
*/
1616

17-
package com.google.gcloud.storage.contrib.nio;
17+
package com.google.cloud.storage.contrib.nio;
1818

1919
import static com.google.common.base.Preconditions.checkArgument;
2020
import static com.google.common.base.Preconditions.checkNotNull;
21-
import static com.google.gcloud.storage.contrib.nio.CloudStorageFileSystem.URI_SCHEME;
22-
import static com.google.gcloud.storage.contrib.nio.CloudStorageUtil.checkNotNullArray;
23-
import static com.google.gcloud.storage.contrib.nio.CloudStorageUtil.checkPath;
2421

2522
import com.google.common.collect.UnmodifiableIterator;
2623
import com.google.gcloud.storage.BlobId;
@@ -126,7 +123,7 @@ public CloudStoragePath toAbsolutePath() {
126123
*/
127124
@Override
128125
public CloudStoragePath toRealPath(LinkOption... options) {
129-
checkNotNullArray(options);
126+
CloudStorageUtil.checkNotNullArray(options);
130127
return newPath(toRealPathInternal(true));
131128
}
132129

@@ -156,7 +153,7 @@ public CloudStoragePath normalize() {
156153

157154
@Override
158155
public CloudStoragePath resolve(Path object) {
159-
return newPath(path.resolve(checkPath(object).path));
156+
return newPath(path.resolve(CloudStorageUtil.checkPath(object).path));
160157
}
161158

162159
@Override
@@ -166,7 +163,7 @@ public CloudStoragePath resolve(String other) {
166163

167164
@Override
168165
public CloudStoragePath resolveSibling(Path other) {
169-
return newPath(path.resolveSibling(checkPath(other).path));
166+
return newPath(path.resolveSibling(CloudStorageUtil.checkPath(other).path));
170167
}
171168

172169
@Override
@@ -176,7 +173,7 @@ public CloudStoragePath resolveSibling(String other) {
176173

177174
@Override
178175
public CloudStoragePath relativize(Path object) {
179-
return newPath(path.relativize(checkPath(object).path));
176+
return newPath(path.relativize(CloudStorageUtil.checkPath(object).path));
180177
}
181178

182179
@Nullable
@@ -311,7 +308,7 @@ public String toString() {
311308
@Override
312309
public URI toUri() {
313310
try {
314-
return new URI(URI_SCHEME, bucket(), path.toAbsolutePath().toString(), null);
311+
return new URI(CloudStorageFileSystem.URI_SCHEME, bucket(), path.toAbsolutePath().toString(), null);
315312
} catch (URISyntaxException e) {
316313
throw new AssertionError(e);
317314
}
Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package com.google.gcloud.storage.contrib.nio;
18-
19-
import static com.google.gcloud.storage.contrib.nio.CloudStorageFileSystem.FILE_TIME_UNKNOWN;
17+
package com.google.cloud.storage.contrib.nio;
2018

2119
import com.google.common.base.Optional;
2220
import com.google.common.collect.ImmutableMap;
@@ -68,17 +66,17 @@ public long size() {
6866

6967
@Override
7068
public FileTime lastModifiedTime() {
71-
return FILE_TIME_UNKNOWN;
69+
return CloudStorageFileSystem.FILE_TIME_UNKNOWN;
7270
}
7371

7472
@Override
7573
public FileTime creationTime() {
76-
return FILE_TIME_UNKNOWN;
74+
return CloudStorageFileSystem.FILE_TIME_UNKNOWN;
7775
}
7876

7977
@Override
8078
public FileTime lastAccessTime() {
81-
return FILE_TIME_UNKNOWN;
79+
return CloudStorageFileSystem.FILE_TIME_UNKNOWN;
8280
}
8381

8482
@Override

0 commit comments

Comments
 (0)