Skip to content
Merged
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 @@ -33,4 +33,27 @@ public static RefreshAdminAclsRequest newInstance() {
Records.newRecord(RefreshAdminAclsRequest.class);
return request;
}

@Public
@Stable
public static RefreshAdminAclsRequest newInstance(String subClusterId) {
RefreshAdminAclsRequest request =
Records.newRecord(RefreshAdminAclsRequest.class);
request.setSubClusterId(subClusterId);
return request;
}

/**
* Get the subClusterId.
*
* @return subClusterId.
*/
public abstract String getSubClusterId();

/**
* Set the subClusterId.
*
* @param subClusterId subCluster Id.
*/
public abstract void setSubClusterId(String subClusterId);
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,27 @@ public static RefreshServiceAclsRequest newInstance() {
Records.newRecord(RefreshServiceAclsRequest.class);
return request;
}

@Public
@Stable
public static RefreshServiceAclsRequest newInstance(String subClusterId) {
RefreshServiceAclsRequest request =
Records.newRecord(RefreshServiceAclsRequest.class);
request.setSubClusterId(subClusterId);
return request;
}

/**
* Get the subClusterId.
*
* @return subClusterId.
*/
public abstract String getSubClusterId();

/**
* Set the subClusterId.
*
* @param subClusterId subCluster Id.
*/
public abstract void setSubClusterId(String subClusterId);
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,13 @@ message RefreshUserToGroupsMappingsResponseProto {
}

message RefreshAdminAclsRequestProto {
optional string sub_cluster_id = 1;
}
message RefreshAdminAclsResponseProto {
}

message RefreshServiceAclsRequestProto {
optional string sub_cluster_id = 1;
}
message RefreshServiceAclsResponseProto {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,22 @@

package org.apache.hadoop.yarn.server.api.protocolrecords.impl.pb;

import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.hadoop.classification.InterfaceAudience.Private;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.yarn.proto.YarnServerResourceManagerServiceProtos.RefreshAdminAclsRequestProto;
import org.apache.hadoop.yarn.proto.YarnServerResourceManagerServiceProtos.RefreshAdminAclsRequestProtoOrBuilder;
import org.apache.hadoop.yarn.server.api.protocolrecords.RefreshAdminAclsRequest;

import org.apache.hadoop.thirdparty.protobuf.TextFormat;

@Private
@Unstable
public class RefreshAdminAclsRequestPBImpl
extends RefreshAdminAclsRequest {
public class RefreshAdminAclsRequestPBImpl extends RefreshAdminAclsRequest {

RefreshAdminAclsRequestProto proto = RefreshAdminAclsRequestProto.getDefaultInstance();
RefreshAdminAclsRequestProto.Builder builder = null;
boolean viaProto = false;
private RefreshAdminAclsRequestProto proto = RefreshAdminAclsRequestProto.getDefaultInstance();
private RefreshAdminAclsRequestProto.Builder builder = null;
private boolean viaProto = false;

public RefreshAdminAclsRequestPBImpl() {
builder = RefreshAdminAclsRequestProto.newBuilder();
Expand All @@ -48,6 +49,13 @@ public RefreshAdminAclsRequestProto getProto() {
viaProto = true;
return proto;
}

private synchronized void maybeInitBuilder() {
if (viaProto || builder == null) {
builder = RefreshAdminAclsRequestProto.newBuilder(proto);
}
viaProto = false;
}

@Override
public int hashCode() {
Expand All @@ -56,16 +64,39 @@ public int hashCode() {

@Override
public boolean equals(Object other) {
if (other == null)

if (!(other instanceof RefreshAdminAclsRequest)) {
return false;
if (other.getClass().isAssignableFrom(this.getClass())) {
return this.getProto().equals(this.getClass().cast(other).getProto());
}
return false;

RefreshAdminAclsRequestPBImpl otherImpl = this.getClass().cast(other);
return new EqualsBuilder()
.append(this.getProto(), otherImpl.getProto())
.isEquals();
}

@Override
public String toString() {
return TextFormat.shortDebugString(getProto());
}

@Override
public String getSubClusterId() {
RefreshAdminAclsRequestProtoOrBuilder p = viaProto ? proto : builder;
boolean hasSubClusterId = p.hasSubClusterId();
if (hasSubClusterId) {
return p.getSubClusterId();
}
return null;
}

@Override
public void setSubClusterId(String subClusterId) {
maybeInitBuilder();
if (subClusterId == null) {
builder.clearSubClusterId();
return;
}
builder.setSubClusterId(subClusterId);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@

package org.apache.hadoop.yarn.server.api.protocolrecords.impl.pb;

import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.hadoop.classification.InterfaceAudience.Private;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.yarn.proto.YarnServerResourceManagerServiceProtos.RefreshServiceAclsRequestProto;
import org.apache.hadoop.yarn.proto.YarnServerResourceManagerServiceProtos.RefreshServiceAclsRequestProtoOrBuilder;
import org.apache.hadoop.yarn.server.api.protocolrecords.RefreshServiceAclsRequest;

import org.apache.hadoop.thirdparty.protobuf.TextFormat;
Expand All @@ -29,10 +31,10 @@
@Unstable
public class RefreshServiceAclsRequestPBImpl extends RefreshServiceAclsRequest {

RefreshServiceAclsRequestProto proto =
private RefreshServiceAclsRequestProto proto =
RefreshServiceAclsRequestProto.getDefaultInstance();
RefreshServiceAclsRequestProto.Builder builder = null;
boolean viaProto = false;
private RefreshServiceAclsRequestProto.Builder builder = null;
private boolean viaProto = false;

public RefreshServiceAclsRequestPBImpl() {
builder = RefreshServiceAclsRequestProto.newBuilder();
Expand All @@ -50,23 +52,53 @@ public RefreshServiceAclsRequestProto getProto() {
return proto;
}

private synchronized void maybeInitBuilder() {
if (viaProto || builder == null) {
builder = RefreshServiceAclsRequestProto.newBuilder(proto);
}
viaProto = false;
}

@Override
public int hashCode() {
return getProto().hashCode();
}

@Override
public boolean equals(Object other) {
if (other == null)

if (!(other instanceof RefreshServiceAclsRequest)) {
return false;
if (other.getClass().isAssignableFrom(this.getClass())) {
return this.getProto().equals(this.getClass().cast(other).getProto());
}
return false;

RefreshServiceAclsRequestPBImpl otherImpl = this.getClass().cast(other);
return new EqualsBuilder()
.append(this.getProto(), otherImpl.getProto())
.isEquals();
}

@Override
public String toString() {
return TextFormat.shortDebugString(getProto());
}

@Override
public String getSubClusterId() {
RefreshServiceAclsRequestProtoOrBuilder p = viaProto ? proto : builder;
boolean hasSubClusterId = p.hasSubClusterId();
if (hasSubClusterId) {
return p.getSubClusterId();
}
return null;
}

@Override
public void setSubClusterId(String subClusterId) {
maybeInitBuilder();
if (subClusterId == null) {
builder.clearSubClusterId();
return;
}
builder.setSubClusterId(subClusterId);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

import org.apache.hadoop.classification.VisibleForTesting;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.CommonConfigurationKeysPublic;
import org.apache.hadoop.metrics2.lib.DefaultMetricsSystem;
import org.apache.hadoop.security.token.Token;
import org.apache.hadoop.test.GenericTestUtils;
Expand Down Expand Up @@ -55,8 +56,13 @@
import org.apache.hadoop.yarn.event.DrainDispatcher;
import org.apache.hadoop.yarn.event.EventHandler;
import org.apache.hadoop.yarn.exceptions.YarnException;
import org.apache.hadoop.yarn.factories.RecordFactory;
import org.apache.hadoop.yarn.factory.providers.RecordFactoryProvider;
import org.apache.hadoop.yarn.ipc.RPCUtil;
import org.apache.hadoop.yarn.security.AMRMTokenIdentifier;
import org.apache.hadoop.yarn.server.api.protocolrecords.NMContainerStatus;
import org.apache.hadoop.yarn.server.api.protocolrecords.RefreshServiceAclsRequest;
import org.apache.hadoop.yarn.server.api.protocolrecords.RefreshServiceAclsResponse;
import org.apache.hadoop.yarn.server.api.records.NodeStatus;
import org.apache.hadoop.yarn.server.resourcemanager.amlauncher.AMLauncherEvent;
import org.apache.hadoop.yarn.server.resourcemanager.amlauncher.ApplicationMasterLauncher;
Expand Down Expand Up @@ -789,6 +795,7 @@ protected void serviceStop() {

@Override
protected AdminService createAdminService() {
RecordFactory recordFactory = RecordFactoryProvider.getRecordFactory(null);
return new AdminService(this) {
@Override
protected void startServer() {
Expand All @@ -799,6 +806,19 @@ protected void startServer() {
protected void stopServer() {
// don't do anything
}

@Override
public RefreshServiceAclsResponse refreshServiceAcls(RefreshServiceAclsRequest request)
throws YarnException, IOException {
Configuration config = this.getConfig();
boolean authorization =
config.getBoolean(CommonConfigurationKeysPublic.HADOOP_SECURITY_AUTHORIZATION, false);
if (!authorization) {
throw RPCUtil.getRemoteException(new IOException("Service Authorization (" +
CommonConfigurationKeysPublic.HADOOP_SECURITY_AUTHORIZATION + ") not enabled."));
}
return recordFactory.newRecordInstance(RefreshServiceAclsResponse.class);
}
};
}

Expand Down
Loading