Skip to content

Commit

Permalink
More GA Changes (Azure#40160)
Browse files Browse the repository at this point in the history
* changes

* readtofileoptions md5 boolean -> Boolean
  • Loading branch information
ibrandes authored May 15, 2024
1 parent f02a120 commit a2336de
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1477,7 +1477,7 @@ public Mono<PathProperties> readToFile(String filePath) {
*
* <!-- src_embed com.azure.storage.file.datalake.DataLakeFileAsyncClient.readToFile#ReadToFileOptions -->
* <pre>
* client.readToFile&#40;new ReadToFileOptions&#40;&#41;.setFilePath&#40;file&#41;&#41;
* client.readToFile&#40;new ReadToFileOptions&#40;file&#41;&#41;
* .subscribe&#40;response -&gt; System.out.println&#40;&quot;Completed download to file&quot;&#41;&#41;;
* </pre>
* <!-- end com.azure.storage.file.datalake.DataLakeFileAsyncClient.readToFile#ReadToFileOptions -->
Expand Down Expand Up @@ -1590,8 +1590,7 @@ public Mono<Response<PathProperties>> readToFileWithResponse(String filePath, Fi
*
* <!-- src_embed com.azure.storage.file.datalake.DataLakeFileAsyncClient.readToFileWithResponse#ReadToFileOptions -->
* <pre>
* ReadToFileOptions options = new ReadToFileOptions&#40;&#41;;
* options.setFilePath&#40;file&#41;;
* ReadToFileOptions options = new ReadToFileOptions&#40;file&#41;;
* options.setRange&#40;new FileRange&#40;1024, 2048L&#41;&#41;;
* options.setDownloadRetryOptions&#40;new DownloadRetryOptions&#40;&#41;.setMaxRetryRequests&#40;5&#41;&#41;;
* options.setOpenOptions&#40;new HashSet&lt;&gt;&#40;Arrays.asList&#40;StandardOpenOption.CREATE_NEW,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1226,7 +1226,7 @@ public PathProperties readToFile(String filePath) {
*
* <!-- src_embed com.azure.storage.file.datalake.DataLakeFileClient.readToFile#ReadToFileOptions -->
* <pre>
* client.readToFile&#40;new ReadToFileOptions&#40;&#41;.setFilePath&#40;file&#41;&#41;;
* client.readToFile&#40;new ReadToFileOptions&#40;file&#41;&#41;;
* System.out.println&#40;&quot;Completed download to file&quot;&#41;;
* </pre>
* <!-- end com.azure.storage.file.datalake.DataLakeFileClient.readToFile#ReadToFileOptions -->
Expand Down Expand Up @@ -1348,8 +1348,7 @@ public Response<PathProperties> readToFileWithResponse(String filePath, FileRang
*
* <!-- src_embed com.azure.storage.file.datalake.DataLakeFileClient.readToFileWithResponse#ReadToFileOptions-Duration-Context -->
* <pre>
* ReadToFileOptions options = new ReadToFileOptions&#40;&#41;;
* options.setFilePath&#40;file&#41;;
* ReadToFileOptions options = new ReadToFileOptions&#40;file&#41;;
* options.setRange&#40;new FileRange&#40;1024, 2048L&#41;&#41;;
* options.setDownloadRetryOptions&#40;new DownloadRetryOptions&#40;&#41;.setMaxRetryRequests&#40;5&#41;&#41;;
* options.setOpenOptions&#40;new HashSet&lt;&gt;&#40;Arrays.asList&#40;StandardOpenOption.CREATE_NEW,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
package com.azure.storage.file.datalake.options;

import com.azure.storage.common.ParallelTransferOptions;
import com.azure.storage.common.implementation.StorageImplUtils;
import com.azure.storage.file.datalake.DataLakeFileClient;
import com.azure.storage.file.datalake.models.DataLakeRequestConditions;
import com.azure.storage.file.datalake.models.DownloadRetryOptions;
Expand All @@ -18,29 +19,30 @@
* Parameters when calling readToFile() on {@link DataLakeFileClient}
*/
public class ReadToFileOptions {
private String filePath;
private final String filePath;
private FileRange range;
private ParallelTransferOptions parallelTransferOptions;
private DownloadRetryOptions downloadRetryOptions;
private DataLakeRequestConditions dataLakeRequestConditions;
private boolean rangeGetContentMd5;
private Boolean rangeGetContentMd5;
private Set<OpenOption> openOptions;
private Boolean userPrincipalName;

/**
* @return A {@link String} representing the filePath where the downloaded data will be written.
* Constructs a {@link ReadToFileOptions}.
*
* @param filePath Path of the file to download to.
*/
public String getFilePath() {
return filePath;
public ReadToFileOptions(String filePath) {
StorageImplUtils.assertNotNull("filePath", filePath);
this.filePath = filePath;
}

/**
* @param filePath A {@link String} representing the filePath where the downloaded data will be written.
* @return The updated options.
* @return A {@link String} representing the filePath where the downloaded data will be written.
*/
public ReadToFileOptions setFilePath(String filePath) {
this.filePath = filePath;
return this;
public String getFilePath() {
return filePath;
}

/**
Expand Down Expand Up @@ -113,15 +115,15 @@ public ReadToFileOptions setDataLakeRequestConditions(DataLakeRequestConditions
/**
* @return Whether the contentMD5 for the specified file range should be returned.
*/
public boolean isRangeGetContentMd5() {
public Boolean isRangeGetContentMd5() {
return rangeGetContentMd5;
}

/**
* @param rangeGetContentMd5 Whether the contentMD5 for the specified file range should be returned.
* @return The updated options.
*/
public ReadToFileOptions setRangeGetContentMd5(boolean rangeGetContentMd5) {
public ReadToFileOptions setRangeGetContentMd5(Boolean rangeGetContentMd5) {
this.rangeGetContentMd5 = rangeGetContentMd5;
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public void downloadToFileCodeSnippet() {
// END: com.azure.storage.file.datalake.DataLakeFileAsyncClient.readToFile#String

// BEGIN: com.azure.storage.file.datalake.DataLakeFileAsyncClient.readToFile#ReadToFileOptions
client.readToFile(new ReadToFileOptions().setFilePath(file))
client.readToFile(new ReadToFileOptions(file))
.subscribe(response -> System.out.println("Completed download to file"));
// END: com.azure.storage.file.datalake.DataLakeFileAsyncClient.readToFile#ReadToFileOptions

Expand All @@ -163,8 +163,7 @@ public void downloadToFileCodeSnippet() {
// END: com.azure.storage.file.datalake.DataLakeFileAsyncClient.readToFileWithResponse#String-FileRange-ParallelTransferOptions-DownloadRetryOptions-DataLakeRequestConditions-boolean-Set

// BEGIN: com.azure.storage.file.datalake.DataLakeFileAsyncClient.readToFileWithResponse#ReadToFileOptions
ReadToFileOptions options = new ReadToFileOptions();
options.setFilePath(file);
ReadToFileOptions options = new ReadToFileOptions(file);
options.setRange(new FileRange(1024, 2048L));
options.setDownloadRetryOptions(new DownloadRetryOptions().setMaxRetryRequests(5));
options.setOpenOptions(new HashSet<>(Arrays.asList(StandardOpenOption.CREATE_NEW,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public void downloadToFile() {
// END: com.azure.storage.file.datalake.DataLakeFileClient.readToFile#String

// BEGIN: com.azure.storage.file.datalake.DataLakeFileClient.readToFile#ReadToFileOptions
client.readToFile(new ReadToFileOptions().setFilePath(file));
client.readToFile(new ReadToFileOptions(file));
System.out.println("Completed download to file");
// END: com.azure.storage.file.datalake.DataLakeFileClient.readToFile#ReadToFileOptions

Expand All @@ -165,8 +165,7 @@ public void downloadToFile() {
// END: com.azure.storage.file.datalake.DataLakeFileClient.readToFileWithResponse#String-FileRange-ParallelTransferOptions-DownloadRetryOptions-DataLakeRequestConditions-boolean-Set-Duration-Context

// BEGIN: com.azure.storage.file.datalake.DataLakeFileClient.readToFileWithResponse#ReadToFileOptions-Duration-Context
ReadToFileOptions options = new ReadToFileOptions();
options.setFilePath(file);
ReadToFileOptions options = new ReadToFileOptions(file);
options.setRange(new FileRange(1024, 2048L));
options.setDownloadRetryOptions(new DownloadRetryOptions().setMaxRetryRequests(5));
options.setOpenOptions(new HashSet<>(Arrays.asList(StandardOpenOption.CREATE_NEW,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3473,9 +3473,9 @@ public void upnHeaderTest(Boolean upnHeader) {
if (outFile.exists()) {
assertTrue(outFile.delete());
}
ReadToFileOptions readToFileOptions = new ReadToFileOptions();
readToFileOptions.setUserPrincipalName(upnHeader).setFilePath(outFile.getPath()).setRange(null)
.setParallelTransferOptions(null).setDownloadRetryOptions(null).setDataLakeRequestConditions(null)
ReadToFileOptions readToFileOptions = new ReadToFileOptions(outFile.getPath());
readToFileOptions.setUserPrincipalName(upnHeader).setRange(null).setParallelTransferOptions(null)
.setDownloadRetryOptions(null).setDataLakeRequestConditions(null)
.setRangeGetContentMd5(false).setOpenOptions(null);

PathProperties readToFileResponse = fc.readToFile(readToFileOptions);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4692,9 +4692,9 @@ public void upnHeaderTest(Boolean upnHeader) {
if (outFile.exists()) {
assertTrue(outFile.delete());
}
ReadToFileOptions readToFileOptions = new ReadToFileOptions();
readToFileOptions.setUserPrincipalName(upnHeader).setFilePath(outFile.getPath()).setRange(null)
.setParallelTransferOptions(null).setDownloadRetryOptions(null).setDataLakeRequestConditions(null)
ReadToFileOptions readToFileOptions = new ReadToFileOptions(outFile.getPath());
readToFileOptions.setUserPrincipalName(upnHeader).setRange(null).setParallelTransferOptions(null)
.setDownloadRetryOptions(null).setDataLakeRequestConditions(null)
.setRangeGetContentMd5(false).setOpenOptions(null);

StepVerifier.create(fc.readToFile(readToFileOptions))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
module com.azure.storage.queue {
requires transitive com.azure.storage.common;

requires com.azure.xml;
requires java.xml;

exports com.azure.storage.queue;
exports com.azure.storage.queue.models;
exports com.azure.storage.queue.sas;
Expand Down

0 comments on commit a2336de

Please sign in to comment.