HDDS-1738. Add nullable annotation for OMResponse classes

Closes #1499
This commit is contained in:
Yi Sheng 2019-09-25 12:14:07 +02:00 committed by Márton Elek
parent 8baebb54e1
commit e6fb6ee94d
No known key found for this signature in database
GPG Key ID: D51EA8F00EE79B28
19 changed files with 66 additions and 28 deletions

View File

@ -28,6 +28,9 @@ import org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos
.OMResponse;
import org.apache.hadoop.hdds.utils.db.BatchOperation;
import javax.annotation.Nullable;
import javax.annotation.Nonnull;
/**
* Response for CreateBucket request.
*/
@ -35,8 +38,8 @@ public final class OMBucketCreateResponse extends OMClientResponse {
private final OmBucketInfo omBucketInfo;
public OMBucketCreateResponse(OmBucketInfo omBucketInfo,
OMResponse omResponse) {
public OMBucketCreateResponse(@Nullable OmBucketInfo omBucketInfo,
@Nonnull OMResponse omResponse) {
super(omResponse);
this.omBucketInfo = omBucketInfo;
}
@ -56,6 +59,7 @@ public final class OMBucketCreateResponse extends OMClientResponse {
}
}
@Nullable
public OmBucketInfo getOmBucketInfo() {
return omBucketInfo;
}

View File

@ -25,6 +25,9 @@ import org.apache.hadoop.ozone.om.response.OMClientResponse;
import org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos;
import org.apache.hadoop.hdds.utils.db.BatchOperation;
import javax.annotation.Nullable;
import javax.annotation.Nonnull;
/**
* Response for DeleteBucket request.
*/
@ -35,7 +38,7 @@ public final class OMBucketDeleteResponse extends OMClientResponse {
public OMBucketDeleteResponse(
String volumeName, String bucketName,
OzoneManagerProtocolProtos.OMResponse omResponse) {
@Nonnull OzoneManagerProtocolProtos.OMResponse omResponse) {
super(omResponse);
this.volumeName = volumeName;
this.bucketName = bucketName;

View File

@ -27,14 +27,17 @@ import org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos
.OMResponse;
import org.apache.hadoop.hdds.utils.db.BatchOperation;
import javax.annotation.Nullable;
import javax.annotation.Nonnull;
/**
* Response for SetBucketProperty request.
*/
public class OMBucketSetPropertyResponse extends OMClientResponse {
private OmBucketInfo omBucketInfo;
public OMBucketSetPropertyResponse(OmBucketInfo omBucketInfo,
OMResponse omResponse) {
public OMBucketSetPropertyResponse(@Nullable OmBucketInfo omBucketInfo,
@Nonnull OMResponse omResponse) {
super(omResponse);
this.omBucketInfo = omBucketInfo;
}

View File

@ -29,6 +29,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.annotation.Nullable;
import javax.annotation.Nonnull;
import java.io.IOException;
/**
@ -41,7 +42,7 @@ public class OMDirectoryCreateResponse extends OMClientResponse {
private OmKeyInfo dirKeyInfo;
public OMDirectoryCreateResponse(@Nullable OmKeyInfo dirKeyInfo,
OMResponse omResponse) {
@Nonnull OMResponse omResponse) {
super(omResponse);
this.dirKeyInfo = dirKeyInfo;
}

View File

@ -19,6 +19,7 @@
package org.apache.hadoop.ozone.om.response.file;
import javax.annotation.Nullable;
import javax.annotation.Nonnull;
import org.apache.hadoop.ozone.om.helpers.OmKeyInfo;
import org.apache.hadoop.ozone.om.response.key.OMKeyCreateResponse;
@ -33,7 +34,7 @@ import org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos
public class OMFileCreateResponse extends OMKeyCreateResponse {
public OMFileCreateResponse(@Nullable OmKeyInfo omKeyInfo,
long openKeySessionID, OMResponse omResponse) {
long openKeySessionID, @Nonnull OMResponse omResponse) {
super(omKeyInfo, openKeySessionID, omResponse);
}

View File

@ -27,6 +27,8 @@ import org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos
import org.apache.hadoop.hdds.utils.db.BatchOperation;
import java.io.IOException;
import javax.annotation.Nullable;
import javax.annotation.Nonnull;
/**
* Response for AllocateBlock request.
@ -36,8 +38,8 @@ public class OMAllocateBlockResponse extends OMClientResponse {
private final OmKeyInfo omKeyInfo;
private final long clientID;
public OMAllocateBlockResponse(OmKeyInfo omKeyInfo,
long clientID, OMResponse omResponse) {
public OMAllocateBlockResponse(@Nullable OmKeyInfo omKeyInfo,
long clientID, @Nonnull OMResponse omResponse) {
super(omResponse);
this.omKeyInfo = omKeyInfo;
this.clientID = clientID;

View File

@ -25,6 +25,8 @@ import org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos;
import org.apache.hadoop.hdds.utils.db.BatchOperation;
import java.io.IOException;
import javax.annotation.Nullable;
import javax.annotation.Nonnull;
/**
* Response for CommitKey request.
@ -34,8 +36,8 @@ public class OMKeyCommitResponse extends OMClientResponse {
private OmKeyInfo omKeyInfo;
private long openKeySessionID;
public OMKeyCommitResponse(OmKeyInfo omKeyInfo, long openKeySessionID,
OzoneManagerProtocolProtos.OMResponse omResponse) {
public OMKeyCommitResponse(@Nullable OmKeyInfo omKeyInfo, long openKeySessionID,
@Nonnull OzoneManagerProtocolProtos.OMResponse omResponse) {
super(omResponse);
this.omKeyInfo = omKeyInfo;
this.openKeySessionID = openKeySessionID;

View File

@ -20,6 +20,7 @@ package org.apache.hadoop.ozone.om.response.key;
import java.io.IOException;
import javax.annotation.Nullable;
import javax.annotation.Nonnull;
import org.apache.hadoop.ozone.om.OMMetadataManager;
import org.apache.hadoop.ozone.om.helpers.OmKeyInfo;
@ -38,7 +39,7 @@ public class OMKeyCreateResponse extends OMClientResponse {
private long openKeySessionID;
public OMKeyCreateResponse(@Nullable OmKeyInfo omKeyInfo,
long openKeySessionID, OMResponse omResponse) {
long openKeySessionID, @Nonnull OMResponse omResponse) {
super(omResponse);
this.omKeyInfo = omKeyInfo;
this.openKeySessionID = openKeySessionID;

View File

@ -29,6 +29,8 @@ import org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos
import org.apache.hadoop.hdds.utils.db.BatchOperation;
import java.io.IOException;
import javax.annotation.Nullable;
import javax.annotation.Nonnull;
/**
* Response for DeleteKey request.
@ -36,7 +38,8 @@ import java.io.IOException;
public class OMKeyDeleteResponse extends OMClientResponse {
private OmKeyInfo omKeyInfo;
public OMKeyDeleteResponse(OmKeyInfo omKeyInfo, OMResponse omResponse) {
public OMKeyDeleteResponse(@Nullable OmKeyInfo omKeyInfo, @Nonnull OMResponse omResponse) {
super(omResponse);
this.omKeyInfo = omKeyInfo;
}
@ -83,7 +86,7 @@ public class OMKeyDeleteResponse extends OMClientResponse {
* @param keyInfo
* @return if empty true, else false.
*/
private boolean isKeyEmpty(OmKeyInfo keyInfo) {
private boolean isKeyEmpty(@Nullable OmKeyInfo keyInfo) {
for (OmKeyLocationInfoGroup keyLocationList : keyInfo
.getKeyLocationVersions()) {
if (keyLocationList.getLocationList().size() != 0) {

View File

@ -27,6 +27,7 @@ import org.apache.hadoop.hdds.utils.db.BatchOperation;
import java.io.IOException;
import java.util.List;
import javax.annotation.Nonnull;
/**
* Response for {@link OMKeyPurgeRequest} request.
@ -35,7 +36,7 @@ public class OMKeyPurgeResponse extends OMClientResponse {
private List<String> purgeKeyList;
public OMKeyPurgeResponse(List<String> keyList, OMResponse omResponse) {
public OMKeyPurgeResponse(List<String> keyList, @Nonnull OMResponse omResponse) {
super(omResponse);
this.purgeKeyList = keyList;
}

View File

@ -27,6 +27,8 @@ import org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos
import org.apache.hadoop.hdds.utils.db.BatchOperation;
import java.io.IOException;
import javax.annotation.Nullable;
import javax.annotation.Nonnull;
/**
* Response for RenameKey request.
@ -37,8 +39,8 @@ public class OMKeyRenameResponse extends OMClientResponse {
private final String toKeyName;
private final String fromKeyName;
public OMKeyRenameResponse(OmKeyInfo renameKeyInfo, String toKeyName,
String fromKeyName, OMResponse omResponse) {
public OMKeyRenameResponse(@Nullable OmKeyInfo renameKeyInfo, String toKeyName,
String fromKeyName, @Nonnull OMResponse omResponse) {
super(omResponse);
this.renameKeyInfo = renameKeyInfo;
this.toKeyName = toKeyName;

View File

@ -33,6 +33,8 @@ import org.apache.hadoop.hdds.utils.db.BatchOperation;
import java.io.IOException;
import java.util.Map;
import java.util.TreeMap;
import javax.annotation.Nullable;
import javax.annotation.Nonnull;
/**
* Response for Multipart Abort Request.
@ -43,7 +45,7 @@ public class S3MultipartUploadAbortResponse extends OMClientResponse {
private OmMultipartKeyInfo omMultipartKeyInfo;
public S3MultipartUploadAbortResponse(String multipartKey,
OmMultipartKeyInfo omMultipartKeyInfo, OMResponse omResponse) {
@Nullable OmMultipartKeyInfo omMultipartKeyInfo, @Nonnull OMResponse omResponse) {
super(omResponse);
this.multipartKey = multipartKey;
this.omMultipartKeyInfo = omMultipartKeyInfo;

View File

@ -34,6 +34,9 @@ import static org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos
import static org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos
.Status.OK;
import javax.annotation.Nullable;
import javax.annotation.Nonnull;
/**
* Response for S3MultipartUploadCommitPart request.
*/
@ -47,10 +50,10 @@ public class S3MultipartUploadCommitPartResponse extends OMClientResponse {
public S3MultipartUploadCommitPartResponse(String multipartKey,
String openKey, OmKeyInfo deletePartKeyInfo,
OmMultipartKeyInfo omMultipartKeyInfo,
OzoneManagerProtocolProtos.PartKeyInfo oldPartKeyInfo,
OMResponse omResponse) {
String openKey, @Nullable OmKeyInfo deletePartKeyInfo,
@Nullable OmMultipartKeyInfo omMultipartKeyInfo,
@Nullable OzoneManagerProtocolProtos.PartKeyInfo oldPartKeyInfo,
@Nonnull OMResponse omResponse) {
super(omResponse);
this.multipartKey = multipartKey;
this.openKey = openKey;

View File

@ -29,6 +29,7 @@ import org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos
import org.apache.hadoop.hdds.utils.db.BatchOperation;
import javax.annotation.Nullable;
import javax.annotation.Nonnull;
/**
* Response for Multipart Upload Complete request.
@ -39,7 +40,7 @@ public class S3MultipartUploadCompleteResponse extends OMClientResponse {
public S3MultipartUploadCompleteResponse(@Nullable String multipartKey,
@Nullable OmKeyInfo omKeyInfo, OMResponse omResponse) {
@Nullable OmKeyInfo omKeyInfo, @Nonnull OMResponse omResponse) {
super(omResponse);
this.multipartKey = multipartKey;
this.omKeyInfo = omKeyInfo;

View File

@ -25,6 +25,7 @@ import org.apache.hadoop.ozone.om.response.OMClientResponse;
import org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OMResponse;
import org.apache.hadoop.hdds.utils.db.BatchOperation;
import javax.annotation.Nonnull;
import java.io.IOException;
/**
@ -35,7 +36,7 @@ public class OMVolumeAclOpResponse extends OMClientResponse {
private OmVolumeArgs omVolumeArgs;
public OMVolumeAclOpResponse(OmVolumeArgs omVolumeArgs,
OMResponse omResponse) {
@Nonnull OMResponse omResponse) {
super(omResponse);
this.omVolumeArgs = omVolumeArgs;
}

View File

@ -32,6 +32,8 @@ import org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos
import org.apache.hadoop.hdds.utils.db.BatchOperation;
import javax.annotation.Nonnull;
/**
* Response for CreateBucket request.
*/
@ -41,7 +43,7 @@ public class OMVolumeCreateResponse extends OMClientResponse {
private OmVolumeArgs omVolumeArgs;
public OMVolumeCreateResponse(OmVolumeArgs omVolumeArgs,
VolumeList volumeList, OMResponse omResponse) {
VolumeList volumeList, @Nonnull OMResponse omResponse) {
super(omResponse);
this.omVolumeArgs = omVolumeArgs;
this.volumeList = volumeList;

View File

@ -29,6 +29,8 @@ import org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos
.VolumeList;
import org.apache.hadoop.hdds.utils.db.BatchOperation;
import javax.annotation.Nonnull;
/**
* Response for CreateVolume request.
*/
@ -38,7 +40,7 @@ public class OMVolumeDeleteResponse extends OMClientResponse {
private VolumeList updatedVolumeList;
public OMVolumeDeleteResponse(String volume, String owner,
VolumeList updatedVolumeList, OMResponse omResponse) {
VolumeList updatedVolumeList, @Nonnull OMResponse omResponse) {
super(omResponse);
this.volume = volume;
this.owner = owner;

View File

@ -31,6 +31,8 @@ import org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos
.OMResponse;
import org.apache.hadoop.hdds.utils.db.BatchOperation;
import javax.annotation.Nonnull;
/**
* Response for set owner request.
*/
@ -43,7 +45,7 @@ public class OMVolumeSetOwnerResponse extends OMClientResponse {
public OMVolumeSetOwnerResponse(String oldOwner,
VolumeList oldOwnerVolumeList, VolumeList newOwnerVolumeList,
OmVolumeArgs newOwnerVolumeArgs, OMResponse omResponse) {
OmVolumeArgs newOwnerVolumeArgs, @Nonnull OMResponse omResponse) {
super(omResponse);
this.oldOwner = oldOwner;
this.oldOwnerVolumeList = oldOwnerVolumeList;

View File

@ -28,6 +28,8 @@ import org.apache.hadoop.hdds.utils.db.BatchOperation;
import java.io.IOException;
import javax.annotation.Nonnull;
/**
* Response for set quota request.
*/
@ -35,7 +37,7 @@ public class OMVolumeSetQuotaResponse extends OMClientResponse {
private OmVolumeArgs omVolumeArgs;
public OMVolumeSetQuotaResponse(OmVolumeArgs omVolumeArgs,
OMResponse omResponse) {
@Nonnull OMResponse omResponse) {
super(omResponse);
this.omVolumeArgs = omVolumeArgs;
}