Skip to content

Commit

Permalink
HDDS-11684. Remove suppression of HiddenField (apache#7423)
Browse files Browse the repository at this point in the history
  • Loading branch information
adoroszlai authored Nov 13, 2024
1 parent a33d8a3 commit ee63232
Show file tree
Hide file tree
Showing 17 changed files with 72 additions and 88 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ public String toString() {
/**
* Builder class for CertInfo.
*/
@SuppressWarnings("checkstyle:hiddenfield")
public static class Builder {
private X509Certificate x509Certificate;
private long timestamp;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,6 @@ public void onLeaderReady() {
/**
* Builds a {@link FinalizationManagerImpl}.
*/
@SuppressWarnings("checkstyle:hiddenfield")
public static class Builder {
private OzoneConfiguration conf;
private HDDSLayoutVersionManager versionManager;
Expand All @@ -196,14 +195,14 @@ public Builder() {
executor = new DefaultUpgradeFinalizationExecutor<>();
}

public Builder setConfiguration(OzoneConfiguration conf) {
this.conf = conf;
public Builder setConfiguration(OzoneConfiguration configuration) {
this.conf = configuration;
return this;
}

public Builder setLayoutVersionManager(
HDDSLayoutVersionManager versionManager) {
this.versionManager = versionManager;
HDDSLayoutVersionManager layoutVersionManager) {
this.versionManager = layoutVersionManager;
return this;
}

Expand All @@ -212,8 +211,8 @@ public Builder setStorage(SCMStorageConfig storage) {
return this;
}

public Builder setHAManager(SCMHAManager scmHAManager) {
this.scmHAManager = scmHAManager;
public Builder setHAManager(SCMHAManager haManager) {
this.scmHAManager = haManager;
return this;
}

Expand All @@ -224,8 +223,8 @@ public Builder setFinalizationStore(
}

public Builder setFinalizationExecutor(
UpgradeFinalizationExecutor<SCMUpgradeFinalizationContext> executor) {
this.executor = executor;
UpgradeFinalizationExecutor<SCMUpgradeFinalizationContext> finalizationExecutor) {
this.executor = finalizationExecutor;
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ public SCMStorageConfig getStorage() {
/**
* Builds an {@link SCMUpgradeFinalizationContext}.
*/
@SuppressWarnings("checkstyle:hiddenfield")
public static final class Builder {
private PipelineManager pipelineManager;
private NodeManager nodeManager;
Expand Down Expand Up @@ -120,13 +119,13 @@ public Builder setStorage(SCMStorageConfig storage) {
}

public Builder setLayoutVersionManager(
HDDSLayoutVersionManager versionManager) {
this.versionManager = versionManager;
HDDSLayoutVersionManager layoutVersionManager) {
this.versionManager = layoutVersionManager;
return this;
}

public Builder setConfiguration(OzoneConfiguration conf) {
this.conf = conf;
public Builder setConfiguration(OzoneConfiguration configuration) {
this.conf = configuration;
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,13 @@ public boolean getForceCreationWhenVolumeExists() {
*
* @return Builder
*/
public static TenantArgs.Builder newBuilder() {
return new TenantArgs.Builder();
public static Builder newBuilder() {
return new Builder();
}

/**
* Builder for TenantArgs.
*/
@SuppressWarnings("checkstyle:hiddenfield")
public static class Builder {
private String volumeName;
private boolean forceCreationWhenVolumeExists;
Expand All @@ -77,12 +76,12 @@ public static class Builder {
public Builder() {
}

public TenantArgs.Builder setVolumeName(String volumeName) {
public Builder setVolumeName(String volumeName) {
this.volumeName = volumeName;
return this;
}

public TenantArgs.Builder setForceCreationWhenVolumeExists(
public Builder setForceCreationWhenVolumeExists(
boolean forceCreationWhenVolumeExists) {
this.forceCreationWhenVolumeExists = forceCreationWhenVolumeExists;
return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ public static DeleteTenantState.Builder newBuilder() {
/**
* Builder for TenantDeleted.
*/
@SuppressWarnings("checkstyle:hiddenfield")
public static final class Builder {
private String volumeName;
private long volRefCount;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ public boolean getIsDelegatedAdmin() {
/**
* Builder for OmDBAccessIdInfo.
*/
@SuppressWarnings("checkstyle:hiddenfield")
public static final class Builder {
private String tenantId;
private String userPrincipal;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,6 @@ public static OmDBTenantState getFromProtobuf(TenantState proto) {
/**
* Builder for OmDBTenantState.
*/
@SuppressWarnings("checkstyle:hiddenfield")
public static final class Builder {
private String tenantId;
private String bucketNamespaceName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ public static OmDBUserPrincipalInfo getFromProtobuf(
/**
* Builder for OmDBUserPrincipalInfo.
*/
@SuppressWarnings("checkstyle:hiddenfield")
public static final class Builder {
private Set<String> accessIds;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ public static OmRangerSyncArgs.Builder newBuilder() {
/**
* Builder for OmRangerSyncArgs.
*/
@SuppressWarnings("checkstyle:hiddenfield")
public static class Builder {
private long newServiceVersion;
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ public static OmTenantArgs.Builder newBuilder() {
/**
* Builder for OmTenantArgs.
*/
@SuppressWarnings("checkstyle:hiddenfield")
public static class Builder {
private String tenantId;
private String volumeName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ public static S3VolumeContext.Builder newBuilder() {
/**
* Builder for S3VolumeContext.
*/
@SuppressWarnings("checkstyle:hiddenfield")
public static final class Builder {
private OmVolumeArgs omVolumeArgs;
private String userPrincipal;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,28 +152,28 @@ public Response getDatanodes() {
}
});
try {
builder.withContainers(nodeManager.getContainerCount(datanode));
builder.withOpenContainers(openContainers.get());
builder.setContainers(nodeManager.getContainerCount(datanode));
builder.setOpenContainers(openContainers.get());
} catch (NodeNotFoundException ex) {
LOG.warn("Cannot get containers, datanode {} not found.",
datanode.getUuid(), ex);
}

DatanodeInfo dnInfo = (DatanodeInfo) datanode;
datanodes.add(builder.withHostname(nodeManager.getHostName(datanode))
.withDatanodeStorageReport(storageReport)
.withLastHeartbeat(nodeManager.getLastHeartbeat(datanode))
.withState(nodeState)
.withOperationalState(nodeOpState)
.withPipelines(pipelines)
.withLeaderCount(leaderCount.get())
.withUUid(datanode.getUuidString())
.withVersion(nodeManager.getVersion(datanode))
.withSetupTime(nodeManager.getSetupTime(datanode))
.withRevision(nodeManager.getRevision(datanode))
.withLayoutVersion(
datanodes.add(builder.setHostname(nodeManager.getHostName(datanode))
.setDatanodeStorageReport(storageReport)
.setLastHeartbeat(nodeManager.getLastHeartbeat(datanode))
.setState(nodeState)
.setOperationalState(nodeOpState)
.setPipelines(pipelines)
.setLeaderCount(leaderCount.get())
.setUuid(datanode.getUuidString())
.setVersion(nodeManager.getVersion(datanode))
.setSetupTime(nodeManager.getSetupTime(datanode))
.setRevision(nodeManager.getRevision(datanode))
.setLayoutVersion(
dnInfo.getLastKnownLayoutVersion().getMetadataLayoutVersion())
.withNetworkLocation(datanode.getNetworkLocation())
.setNetworkLocation(datanode.getNetworkLocation())
.build());
});

Expand Down Expand Up @@ -220,26 +220,26 @@ public Response removeDatanodes(List<String> uuids) {
try {
if (preChecksSuccess(nodeByUuid, failedNodeErrorResponseMap)) {
removedDatanodes.add(DatanodeMetadata.newBuilder()
.withHostname(nodeManager.getHostName(nodeByUuid))
.withUUid(uuid)
.withState(nodeManager.getNodeStatus(nodeByUuid).getHealth())
.setHostname(nodeManager.getHostName(nodeByUuid))
.setUuid(uuid)
.setState(nodeManager.getNodeStatus(nodeByUuid).getHealth())
.build());
nodeManager.removeNode(nodeByUuid);
LOG.info("Node {} removed successfully !!!", uuid);
} else {
failedDatanodes.add(DatanodeMetadata.newBuilder()
.withHostname(nodeManager.getHostName(nodeByUuid))
.withUUid(uuid)
.withOperationalState(nodeByUuid.getPersistedOpState())
.withState(nodeManager.getNodeStatus(nodeByUuid).getHealth())
.setHostname(nodeManager.getHostName(nodeByUuid))
.setUuid(uuid)
.setOperationalState(nodeByUuid.getPersistedOpState())
.setState(nodeManager.getNodeStatus(nodeByUuid).getHealth())
.build());
}
} catch (NodeNotFoundException nnfe) {
LOG.error("Selected node {} not found : {} ", uuid, nnfe);
notFoundDatanodes.add(DatanodeMetadata.newBuilder()
.withHostname("")
.withState(NodeState.DEAD)
.withUUid(uuid).build());
.setHostname("")
.setState(NodeState.DEAD)
.setUuid(uuid).build());
}
}
} catch (Exception exp) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ public static Builder newBuilder() {
/**
* Builder for AclMetadata.
*/
@SuppressWarnings("checkstyle:hiddenfield")
public static final class Builder {
private String type;
private String name;
Expand All @@ -84,23 +83,23 @@ public Builder() {

}

public Builder withType(String type) {
public Builder setType(String type) {
this.type = type;
return this;
}

public Builder withName(String name) {
public Builder setName(String name) {
this.name = name;
return this;
}

public Builder withScope(String scope) {
public Builder setScope(String scope) {
this.scope = scope;
return this;

}

public Builder withAclList(List<String> aclList) {
public Builder setAclList(List<String> aclList) {
this.aclList = aclList;
return this;
}
Expand All @@ -127,10 +126,10 @@ public static AclMetadata fromOzoneAcl(OzoneAcl ozoneAcl) {

AclMetadata.Builder builder = AclMetadata.newBuilder();

return builder.withType(ozoneAcl.getType().toString().toUpperCase())
.withName(ozoneAcl.getName())
.withScope(ozoneAcl.getAclScope().toString().toUpperCase())
.withAclList(ozoneAcl.getAclStringList())
return builder.setType(ozoneAcl.getType().toString().toUpperCase())
.setName(ozoneAcl.getName())
.setScope(ozoneAcl.getAclScope().toString().toUpperCase())
.setAclList(ozoneAcl.getAclStringList())
.build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ private ClusterStateResponse(Builder b) {
/**
* Builder for ClusterStateResponse.
*/
@SuppressWarnings("checkstyle:hiddenfield")
public static final class Builder {
private int pipelines;
private int totalDatanodes;
Expand Down
Loading

0 comments on commit ee63232

Please sign in to comment.