Skip to content

Commit 8784dfa

Browse files
committed
Added refactoring changes
1 parent aacd092 commit 8784dfa

13 files changed

+48
-55
lines changed
Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,18 @@
1414
* limitations under the License.
1515
*/
1616

17-
package com.google.cloud.storage.multipartuploader;
17+
package com.google.cloud.storage;
1818

19-
import com.google.cloud.storage.multipartuploader.data.CompleteMultipartRequest;
20-
import com.google.cloud.storage.multipartuploader.data.CompleteMultipartResponse;
21-
import com.google.cloud.storage.multipartuploader.data.CreateMultipartUploadRequest;
22-
import com.google.cloud.storage.multipartuploader.data.CreateMultipartUploadResponse;
23-
import com.google.cloud.storage.multipartuploader.data.RequestBody;
24-
import com.google.cloud.storage.multipartuploader.data.UploadPartRequest;
25-
import com.google.cloud.storage.multipartuploader.data.UploadPartResponse;
19+
import com.google.cloud.storage.multipartupload.model.CompleteMultipartRequest;
20+
import com.google.cloud.storage.multipartupload.model.CompleteMultipartResponse;
21+
import com.google.cloud.storage.multipartupload.model.CreateMultipartUploadRequest;
22+
import com.google.cloud.storage.multipartupload.model.CreateMultipartUploadResponse;
23+
import com.google.cloud.storage.multipartupload.model.UploadPartRequest;
24+
import com.google.cloud.storage.multipartupload.model.UploadPartResponse;
2625
import java.io.IOException;
27-
import java.net.MalformedURLException;
28-
import java.net.ProtocolException;
2926
import java.security.NoSuchAlgorithmException;
3027

31-
public interface MultipartUploader {
28+
public interface MultipartUpload {
3229

3330
CreateMultipartUploadResponse createMultipartUpload(CreateMultipartUploadRequest request)
3431
throws IOException;
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
package com.google.cloud.storage.multipartuploader;
16+
package com.google.cloud.storage;
1717

18-
public class MultipartUploaderConfig {
18+
public class MultipartUploadConfig {
1919

2020
}
Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13,40 +13,36 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
package com.google.cloud.storage.multipartuploader;
17-
18-
import static com.google.cloud.storage.multipartuploader.MultipartUploaderUtility.getRfc1123Date;
19-
import static com.google.cloud.storage.multipartuploader.MultipartUploaderUtility.readStream;
20-
import static com.google.cloud.storage.multipartuploader.MultipartUploaderUtility.signRequest;
21-
22-
import com.google.cloud.storage.multipartuploader.data.CompleteMultipartRequest;
23-
import com.google.cloud.storage.multipartuploader.data.CompleteMultipartResponse;
24-
import com.google.cloud.storage.multipartuploader.data.CompletedPart;
25-
import com.google.cloud.storage.multipartuploader.data.CreateMultipartUploadRequest;
26-
import com.google.cloud.storage.multipartuploader.data.CreateMultipartUploadResponse;
27-
import com.google.cloud.storage.multipartuploader.data.RequestBody;
28-
import com.google.cloud.storage.multipartuploader.data.UploadPartRequest;
29-
import com.google.cloud.storage.multipartuploader.data.UploadPartResponse;
16+
package com.google.cloud.storage;
17+
18+
import static com.google.cloud.storage.MultipartUploadUtility.getRfc1123Date;
19+
import static com.google.cloud.storage.MultipartUploadUtility.readStream;
20+
import static com.google.cloud.storage.MultipartUploadUtility.signRequest;
21+
22+
import com.google.cloud.storage.multipartupload.model.CompleteMultipartRequest;
23+
import com.google.cloud.storage.multipartupload.model.CompleteMultipartResponse;
24+
import com.google.cloud.storage.multipartupload.model.CompletedPart;
25+
import com.google.cloud.storage.multipartupload.model.CreateMultipartUploadRequest;
26+
import com.google.cloud.storage.multipartupload.model.CreateMultipartUploadResponse;
27+
import com.google.cloud.storage.multipartupload.model.UploadPartRequest;
28+
import com.google.cloud.storage.multipartupload.model.UploadPartResponse;
3029
import java.io.IOException;
3130
import java.io.OutputStream;
3231
import java.net.HttpURLConnection;
33-
import java.net.MalformedURLException;
34-
import java.net.ProtocolException;
3532
import java.net.URL;
3633
import java.nio.charset.StandardCharsets;
3734
import java.security.MessageDigest;
3835
import java.security.NoSuchAlgorithmException;
3936
import java.util.Base64;
4037

41-
public class MultipartUploaderImpl implements MultipartUploader {
38+
public class MultipartUploadImpl implements MultipartUpload {
4239

4340
private static final String BUCKET_NAME = "shreyassinha";
4441
private static final String OBJECT_NAME = "5mb"; // The name for the object in GCS
4542
private static final String FILE_PATH = "5mb-examplefile-com.txt"; // The local file to upload
4643

4744
// Add HMAC keys from GCS Settings > Interoperability
4845

49-
5046
// --- End Configuration ---
5147
private static final String GCS_ENDPOINT = "https://storage.googleapis.com";
5248

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
package com.google.cloud.storage.multipartuploader;
16+
package com.google.cloud.storage;
1717

1818
import java.io.BufferedReader;
1919
import java.io.File;
@@ -29,7 +29,7 @@
2929
import javax.crypto.Mac;
3030
import javax.crypto.spec.SecretKeySpec;
3131

32-
public class MultipartUploaderUtility {
32+
public class MultipartUploadUtility {
3333
public static String readStream(InputStream inputStream) throws IOException {
3434
if (inputStream == null) return "";
3535
StringBuilder response = new StringBuilder();
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@
1414
* limitations under the License.
1515
*/
1616

17-
package com.google.cloud.storage.multipartuploader.data;
17+
package com.google.cloud.storage;
1818

1919
import java.nio.ByteBuffer;
2020

21-
public class RequestBody {
21+
public final class RequestBody {
2222
private byte[] partDate;
2323

2424
public static RequestBody fromByteBuffer(ByteBuffer b) {
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2023 Google LLC
2+
* Copyright 2025 Google LLC
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -14,12 +14,12 @@
1414
* limitations under the License.
1515
*/
1616

17-
package com.google.cloud.storage.multipartuploader.data;
17+
package com.google.cloud.storage.multipartupload.model;
1818

1919
import com.google.common.base.MoreObjects;
2020
import java.util.Objects;
2121

22-
public class CompleteMultipartRequest {
22+
public final class CompleteMultipartRequest {
2323

2424
private final String bucket;
2525
private final String key;
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2023 Google LLC
2+
* Copyright 2025 Google LLC
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package com.google.cloud.storage.multipartuploader.data;
17+
package com.google.cloud.storage.multipartupload.model;
1818

1919
public class CompleteMultipartResponse {
2020

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2023 Google LLC
2+
* Copyright 2025 Google LLC
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -13,7 +13,7 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
package com.google.cloud.storage.multipartuploader.data;
16+
package com.google.cloud.storage.multipartupload.model;
1717

1818
import com.google.common.base.MoreObjects;
1919
import java.util.List;
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2023 Google LLC
2+
* Copyright 2025 Google LLC
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -13,9 +13,9 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
package com.google.cloud.storage.multipartuploader.data;
16+
package com.google.cloud.storage.multipartupload.model;
1717

18-
public class CompletedPart {
18+
public final class CompletedPart {
1919

2020
private final int partNumber;
2121

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2023 Google LLC
2+
* Copyright 2025 Google LLC
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package com.google.cloud.storage.multipartuploader.data;
17+
package com.google.cloud.storage.multipartupload.model;
1818

1919
import com.google.common.base.MoreObjects;
2020
import java.util.Objects;

0 commit comments

Comments
 (0)