Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,12 @@ public static void uploadFileCleanup(AsynchronousFileChannel channel, ClientLogg
}
}

/* PULLED FROM RELEASE
* Computes the md5 of the data.
*
/**
* It computes the MD5 of the provided buffer
* @param data The data.
* @param logger Logger to log errors.
* @return The md5 of the data.
*/
public static byte[] computeMd5(ByteBuffer data, ClientLogger logger) {
if (data == null) {
return null;
Expand All @@ -165,7 +165,7 @@ public static byte[] computeMd5(ByteBuffer data, ClientLogger logger) {
} catch (NoSuchAlgorithmException e) {
throw logger.logExceptionAsError(new RuntimeException(e));
}
} */
}

/**
* Computes the md5 of the data and wraps it with the data.
Expand Down
2 changes: 1 addition & 1 deletion sdk/storage/azure-storage-file-share/assets.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"AssetsRepo": "Azure/azure-sdk-assets",
"AssetsRepoPrefixPath": "java",
"TagPrefix": "java/storage/azure-storage-file-share",
"Tag": "java/storage/azure-storage-file-share_62019cc18e"
"Tag": "java/storage/azure-storage-file-share_1e9eb49640"
}
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,8 @@ public Mono<Response<ShareDirectoryInfo>> createWithResponse(FileSmbProperties s
public Mono<Response<ShareDirectoryInfo>> createWithResponse(ShareDirectoryCreateOptions options) {
try {
return withContext(context -> createWithResponse(options.getSmbProperties(), options.getFilePermission(),
options.getFilePermissionFormat(), options.getPosixProperties(), options.getMetadata(), null, context));
options.getFilePermissionFormat(), options.getPosixProperties(), options.getMetadata(),
options.getFilePropertySemantics(), context));
} catch (RuntimeException ex) {
return monoError(LOGGER, ex);
}
Expand All @@ -367,7 +368,7 @@ Mono<Response<ShareDirectoryInfo>> createWithResponse(FileSmbProperties smbPrope
smbProperties.getFilePermissionKey(), smbProperties.getNtfsFileAttributesString(),
smbProperties.getFileCreationTimeString(), smbProperties.getFileLastWriteTimeString(),
smbProperties.getFileChangeTimeString(), posixProperties.getOwner(), posixProperties.getGroup(),
posixProperties.getFileMode(), null, context)
posixProperties.getFileMode(), filePropertySemantics, context)
.map(ModelHelper::mapShareDirectoryInfo);
}

Expand Down Expand Up @@ -448,14 +449,14 @@ Mono<Response<ShareDirectoryInfo>> createIfNotExistsWithResponse(ShareDirectoryC
try {
options = options == null ? new ShareDirectoryCreateOptions() : options;
return createWithResponse(options.getSmbProperties(), options.getFilePermission(),
options.getFilePermissionFormat(), options.getPosixProperties(), options.getMetadata(), null, context)
.onErrorResume(
t -> t instanceof ShareStorageException && ((ShareStorageException) t).getStatusCode() == 409,
t -> {
HttpResponse response = ((ShareStorageException) t).getResponse();
return Mono.just(new SimpleResponse<>(response.getRequest(), response.getStatusCode(),
response.getHeaders(), null));
});
options.getFilePermissionFormat(), options.getPosixProperties(), options.getMetadata(),
options.getFilePropertySemantics(), context).onErrorResume(
t -> t instanceof ShareStorageException && ((ShareStorageException) t).getStatusCode() == 409,
t -> {
HttpResponse response = ((ShareStorageException) t).getResponse();
return Mono.just(new SimpleResponse<>(response.getRequest(), response.getStatusCode(),
response.getHeaders(), null));
});
} catch (RuntimeException ex) {
return monoError(LOGGER, ex);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ public Response<ShareDirectoryInfo> createWithResponse(ShareDirectoryCreateOptio
smbProperties.getFilePermissionKey(), smbProperties.getNtfsFileAttributesString(),
smbProperties.getFileCreationTimeString(), smbProperties.getFileLastWriteTimeString(),
smbProperties.getFileChangeTimeString(), fileposixProperties.getOwner(), fileposixProperties.getGroup(),
fileposixProperties.getFileMode(), null, finalContext);
fileposixProperties.getFileMode(), finalOptions.getFilePropertySemantics(), finalContext);

return ModelHelper.mapShareDirectoryInfo(sendRequest(operation, timeout, ShareStorageException.class));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -450,8 +450,8 @@ public Mono<Response<ShareFileInfo>> createWithResponse(ShareFileCreateOptions o
StorageImplUtils.assertNotNull("options", options);
return withContext(context -> createWithResponse(options.getSize(), options.getShareFileHttpHeaders(),
options.getSmbProperties(), options.getFilePermission(), options.getFilePermissionFormat(),
options.getPosixProperties(), options.getMetadata(), options.getRequestConditions(), null, null,
context));
options.getPosixProperties(), options.getMetadata(), options.getRequestConditions(),
options.getFilePropertySemantics(), options.getData(), context));
} catch (RuntimeException ex) {
return monoError(LOGGER, ex);
}
Expand All @@ -461,15 +461,16 @@ Mono<Response<ShareFileInfo>> createWithResponse(long maxSize, ShareFileHttpHead
FileSmbProperties smbProperties, String filePermission, FilePermissionFormat filePermissionFormat,
FilePosixProperties filePosixProperties, Map<String, String> metadata, ShareRequestConditions requestConditions,
FilePropertySemantics filePropertySemantics, BinaryData binaryData, Context context) {
context = context == null ? Context.NONE : context;
requestConditions = requestConditions == null ? new ShareRequestConditions() : requestConditions;
smbProperties = smbProperties == null ? new FileSmbProperties() : smbProperties;
filePosixProperties = filePosixProperties == null ? new FilePosixProperties() : filePosixProperties;
final Context contextLocal = context == null ? Context.NONE : context;
final ShareRequestConditions requestConditionsLocal
= requestConditions == null ? new ShareRequestConditions() : requestConditions;
final FileSmbProperties smbPropertiesLocal = smbProperties == null ? new FileSmbProperties() : smbProperties;
final FilePosixProperties filePosixPropertiesLocal
= filePosixProperties == null ? new FilePosixProperties() : filePosixProperties;

// Checks that file permission and file permission key are valid
ModelHelper.validateFilePermissionAndKey(filePermission, smbProperties.getFilePermissionKey());
ModelHelper.validateFilePermissionAndKey(filePermission, smbPropertiesLocal.getFilePermissionKey());

/* PULLED FROM RELEASE
Mono<UploadUtils.FluxMd5Wrapper> contentMD5Mono;
Long contentLength;
if (binaryData != null) {
Expand All @@ -478,17 +479,17 @@ Mono<Response<ShareFileInfo>> createWithResponse(long maxSize, ShareFileHttpHead
} else {
contentLength = null;
contentMD5Mono = UploadUtils.computeMd5(null, false, LOGGER);
} */
}

//return contentMD5Mono.flatMap(fluxMD5wrapper -> azureFileStorageClient.getFiles()
return azureFileStorageClient.getFiles()
return contentMD5Mono.flatMap(fluxMD5wrapper -> azureFileStorageClient.getFiles()
.createWithResponseAsync(shareName, filePath, maxSize, null, metadata, filePermission, filePermissionFormat,
smbProperties.getFilePermissionKey(), smbProperties.getNtfsFileAttributesString(),
smbProperties.getFileCreationTimeString(), smbProperties.getFileLastWriteTimeString(),
smbProperties.getFileChangeTimeString(), requestConditions.getLeaseId(), filePosixProperties.getOwner(),
filePosixProperties.getGroup(), filePosixProperties.getFileMode(), filePosixProperties.getFileType(),
null, null, null, (Flux<ByteBuffer>) null, httpHeaders, context)
.map(ModelHelper::createFileInfoResponse);
smbPropertiesLocal.getFilePermissionKey(), smbPropertiesLocal.getNtfsFileAttributesString(),
smbPropertiesLocal.getFileCreationTimeString(), smbPropertiesLocal.getFileLastWriteTimeString(),
smbPropertiesLocal.getFileChangeTimeString(), requestConditionsLocal.getLeaseId(),
filePosixPropertiesLocal.getOwner(), filePosixPropertiesLocal.getGroup(),
filePosixPropertiesLocal.getFileMode(), filePosixPropertiesLocal.getFileType(), fluxMD5wrapper.getMd5(),
filePropertySemantics, contentLength, fluxMD5wrapper.getData(), httpHeaders, contextLocal)
.map(ModelHelper::createFileInfoResponse));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import com.azure.storage.common.implementation.SasImplUtils;
import com.azure.storage.common.implementation.StorageImplUtils;
import com.azure.storage.common.implementation.StorageSeekableByteChannel;
import com.azure.storage.common.implementation.UploadUtils;
import com.azure.storage.file.share.implementation.AzureFileStorageImpl;
import com.azure.storage.file.share.implementation.models.CopyFileSmbInfo;
import com.azure.storage.file.share.implementation.models.DestinationLeaseAccessConditions;
Expand Down Expand Up @@ -540,7 +541,6 @@ public Response<ShareFileInfo> createWithResponse(ShareFileCreateOptions options
// Checks that file permission and file permission key are valid
ModelHelper.validateFilePermissionAndKey(options.getFilePermission(), smbProperties.getFilePermissionKey());

/* PULLED FROM RELEASE
Long contentLength;
byte[] contentMD5;
if (options.getData() != null) {
Expand All @@ -549,16 +549,17 @@ public Response<ShareFileInfo> createWithResponse(ShareFileCreateOptions options
} else {
contentLength = null;
contentMD5 = null;
} */
}

Callable<ResponseBase<FilesCreateHeaders, Void>> operation = () -> this.azureFileStorageClient.getFiles()
.createWithResponse(shareName, filePath, options.getSize(), null, options.getMetadata(),
options.getFilePermission(), options.getFilePermissionFormat(), smbProperties.getFilePermissionKey(),
smbProperties.getNtfsFileAttributesString(), smbProperties.getFileCreationTimeString(),
smbProperties.getFileLastWriteTimeString(), smbProperties.getFileChangeTimeString(),
requestConditions.getLeaseId(), fileposixProperties.getOwner(), fileposixProperties.getGroup(),
fileposixProperties.getFileMode(), fileposixProperties.getFileType(), null, null, null, null,
options.getShareFileHttpHeaders(), finalContext);
fileposixProperties.getFileMode(), fileposixProperties.getFileType(), contentMD5,
options.getFilePropertySemantics(), contentLength, options.getData(), options.getShareFileHttpHeaders(),
finalContext);

return ModelHelper.createFileInfoResponse(sendRequest(operation, timeout, ShareStorageException.class));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import com.azure.storage.file.share.FileSmbProperties;
import com.azure.storage.file.share.models.FilePermissionFormat;
import com.azure.storage.file.share.models.FilePosixProperties;
import com.azure.storage.file.share.models.FilePropertySemantics;

import java.util.Map;

Expand All @@ -20,7 +21,7 @@ public class ShareDirectoryCreateOptions {
private FilePermissionFormat filePermissionFormat;
private Map<String, String> metadata;
private FilePosixProperties posixProperties;
// private FilePropertySemantics filePropertySemantics; PULLED FROM RELEASE
private FilePropertySemantics filePropertySemantics;

/**
* Creates a new instance of {@link ShareDirectoryCreateOptions}.
Expand Down Expand Up @@ -135,19 +136,19 @@ public ShareDirectoryCreateOptions setPosixProperties(FilePosixProperties posixP
return this;
}

/* PULLED FROM RELEASE
/**
* Optional, only applicable to SMB directories. Gets how attributes and permissions should be set on the file.
* New: automatically adds the ARCHIVE file attribute flag to the file and uses Windows create file permissions
* semantics (ex: inherit from parent).
* Restore: does not modify file attribute flag and uses Windows update file permissions semantics.
* If Restore is specified, the file permission must also be provided, otherwise PropertySemantics will default to New.
*
* @return {@link FilePropertySemantics}

*/
public FilePropertySemantics getFilePropertySemantics() {
return filePropertySemantics;
}

/**
* Optional, only applicable to SMB directories. Sets how attributes and permissions should be set on the file.
* New: automatically adds the ARCHIVE file attribute flag to the file and uses Windows create file permissions
Expand All @@ -157,9 +158,9 @@ public FilePropertySemantics getFilePropertySemantics() {
*
* @param filePropertySemantics {@link FilePropertySemantics}
* @return The updated options.

*/
public ShareDirectoryCreateOptions setFilePropertySemantics(FilePropertySemantics filePropertySemantics) {
this.filePropertySemantics = filePropertySemantics;
return this;
} */
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@
package com.azure.storage.file.share.options;

import com.azure.core.annotation.Fluent;
import com.azure.core.util.BinaryData;
import com.azure.storage.file.share.FileSmbProperties;
import com.azure.storage.file.share.models.FilePermissionFormat;
import com.azure.storage.file.share.models.FilePosixProperties;
import com.azure.storage.file.share.models.FilePropertySemantics;
import com.azure.storage.file.share.models.ShareFileHttpHeaders;
import com.azure.storage.file.share.models.ShareRequestConditions;
import java.util.Map;
Expand All @@ -25,8 +27,8 @@ public class ShareFileCreateOptions {
private Map<String, String> metadata;
private ShareRequestConditions requestConditions;
private FilePosixProperties posixProperties;
// private FilePropertySemantics filePropertySemantics; PULLED FROM RELEASE
// private BinaryData binaryData;
private FilePropertySemantics filePropertySemantics;
private BinaryData binaryData;

/**
* Creates a new instance of {@link ShareFileCreateOptions}.
Expand Down Expand Up @@ -193,20 +195,20 @@ public ShareFileCreateOptions setPosixProperties(FilePosixProperties posixProper
return this;
}

/* PULLED FROM RELEASE
/**
* Optional, only applicable to SMB files. Gets how attributes and permissions should be set on the file.
* New: automatically adds the ARCHIVE file attribute flag to the file and uses Windows create file permissions
* semantics (ex: inherit from parent).
* Restore: does not modify file attribute flag and uses Windows update file permissions semantics.
* If Restore is specified, the file permission must also be provided, otherwise PropertySemantics will default to New.
*
* @return {@link FilePropertySemantics}

*/
public FilePropertySemantics getFilePropertySemantics() {
return filePropertySemantics;
}
/*

/**
* Optional, only applicable to SMB files. Sets how attributes and permissions should be set on the file.
* New: automatically adds the ARCHIVE file attribute flag to the file and uses Windows create file permissions
* semantics (ex: inherit from parent).
Expand All @@ -215,31 +217,31 @@ public FilePropertySemantics getFilePropertySemantics() {
*
* @param filePropertySemantics {@link FilePropertySemantics}
* @return The updated options.

*/
public ShareFileCreateOptions setFilePropertySemantics(FilePropertySemantics filePropertySemantics) {
this.filePropertySemantics = filePropertySemantics;
return this;
}
/*

/**
* Optional, valid for version 2026-02-06 and later.
* Gets the content to upload to the file when it is created. Must be less than or equal to 4 MiB in size.
*
* @return The {@link BinaryData}.

*/
public BinaryData getData() {
return binaryData;
}
/*

/**
* Optional, valid for version 2026-02-06 and later.
* Sets the content to upload to the file when it is created. Must be less than or equal to 4 MiB in size.
*
* @param binaryData The {@link BinaryData}.
* @return The updated options.

*/
public ShareFileCreateOptions setData(BinaryData binaryData) {
this.binaryData = binaryData;
return this;
} */
}
}
Loading
Loading