[37/50] [abbrv] hadoop git commit: YARN-5307. Federation Application State Store internal APIs
http://git-wip-us.apache.org/repos/asf/hadoop/blob/89f43e63/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/store/records/impl/pb/GetApplicationsHomeSubClusterResponsePBImpl.java -- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/store/records/impl/pb/GetApplicationsHomeSubClusterResponsePBImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/store/records/impl/pb/GetApplicationsHomeSubClusterResponsePBImpl.java new file mode 100644 index 000..8b72a1e --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/store/records/impl/pb/GetApplicationsHomeSubClusterResponsePBImpl.java @@ -0,0 +1,190 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with this + * work for additional information regarding copyright ownership. The ASF + * licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ + +package org.apache.hadoop.yarn.server.federation.store.records.impl.pb; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import org.apache.hadoop.classification.InterfaceAudience.Private; +import org.apache.hadoop.classification.InterfaceStability.Unstable; +import org.apache.hadoop.yarn.federation.proto.YarnServerFederationProtos.ApplicationHomeSubClusterProto; +import org.apache.hadoop.yarn.federation.proto.YarnServerFederationProtos.GetApplicationsHomeSubClusterResponseProto; +import org.apache.hadoop.yarn.federation.proto.YarnServerFederationProtos.GetApplicationsHomeSubClusterResponseProtoOrBuilder; +import org.apache.hadoop.yarn.server.federation.store.records.ApplicationHomeSubCluster; +import org.apache.hadoop.yarn.server.federation.store.records.GetApplicationsHomeSubClusterResponse; + +import com.google.protobuf.TextFormat; + +/** + * Protocol buffer based implementation of + * {@link GetApplicationsHomeSubClusterResponse}. + */ +@Private +@Unstable +public class GetApplicationsHomeSubClusterResponsePBImpl +extends GetApplicationsHomeSubClusterResponse { + + private GetApplicationsHomeSubClusterResponseProto proto = + GetApplicationsHomeSubClusterResponseProto.getDefaultInstance(); + private GetApplicationsHomeSubClusterResponseProto.Builder builder = null; + private boolean viaProto = false; + + private List appsHomeSubCluster; + + public GetApplicationsHomeSubClusterResponsePBImpl() { +builder = GetApplicationsHomeSubClusterResponseProto.newBuilder(); + } + + public GetApplicationsHomeSubClusterResponsePBImpl( + GetApplicationsHomeSubClusterResponseProto proto) { +this.proto = proto; +viaProto = true; + } + + public GetApplicationsHomeSubClusterResponseProto getProto() { +mergeLocalToProto(); +proto = viaProto ? proto : builder.build(); +viaProto = true; +return proto; + } + + private void mergeLocalToProto() { +if (viaProto) { + maybeInitBuilder(); +} +mergeLocalToBuilder(); +proto = builder.build(); +viaProto = true; + } + + private void maybeInitBuilder() { +if (viaProto || builder == null) { + builder = GetApplicationsHomeSubClusterResponseProto.newBuilder(proto); +} +viaProto = false; + } + + private void mergeLocalToBuilder() { +if (this.appsHomeSubCluster != null) { + addSubClustersInfoToProto(); +} + } + + @Override + public int hashCode() { +return getProto().hashCode(); + } + + @Override + public boolean equals(Object other) { +if (other == null) { + return false; +} +if (other.getClass().isAssignableFrom(this.getClass())) { + return this.getProto().equals(this.getClass().cast(other).getProto()); +} +return false; + } + + @Override + public String toString() { +return TextFormat.shortDebugString(getProto()); + } + + @Override + public List getAppsHomeSubClusters() { +initSubClustersInfoList(); +return appsHomeSubCluster; + } + + @Override + public void setAppsHomeSubClusters( + List appsHomeSubClusters) { +maybeInitBuilder(); +if
[37/50] [abbrv] hadoop git commit: YARN-5307. Federation Application State Store internal APIs
http://git-wip-us.apache.org/repos/asf/hadoop/blob/12b495ea/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/store/records/impl/pb/GetApplicationsHomeSubClusterResponsePBImpl.java -- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/store/records/impl/pb/GetApplicationsHomeSubClusterResponsePBImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/store/records/impl/pb/GetApplicationsHomeSubClusterResponsePBImpl.java new file mode 100644 index 000..8b72a1e --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/store/records/impl/pb/GetApplicationsHomeSubClusterResponsePBImpl.java @@ -0,0 +1,190 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with this + * work for additional information regarding copyright ownership. The ASF + * licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ + +package org.apache.hadoop.yarn.server.federation.store.records.impl.pb; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import org.apache.hadoop.classification.InterfaceAudience.Private; +import org.apache.hadoop.classification.InterfaceStability.Unstable; +import org.apache.hadoop.yarn.federation.proto.YarnServerFederationProtos.ApplicationHomeSubClusterProto; +import org.apache.hadoop.yarn.federation.proto.YarnServerFederationProtos.GetApplicationsHomeSubClusterResponseProto; +import org.apache.hadoop.yarn.federation.proto.YarnServerFederationProtos.GetApplicationsHomeSubClusterResponseProtoOrBuilder; +import org.apache.hadoop.yarn.server.federation.store.records.ApplicationHomeSubCluster; +import org.apache.hadoop.yarn.server.federation.store.records.GetApplicationsHomeSubClusterResponse; + +import com.google.protobuf.TextFormat; + +/** + * Protocol buffer based implementation of + * {@link GetApplicationsHomeSubClusterResponse}. + */ +@Private +@Unstable +public class GetApplicationsHomeSubClusterResponsePBImpl +extends GetApplicationsHomeSubClusterResponse { + + private GetApplicationsHomeSubClusterResponseProto proto = + GetApplicationsHomeSubClusterResponseProto.getDefaultInstance(); + private GetApplicationsHomeSubClusterResponseProto.Builder builder = null; + private boolean viaProto = false; + + private List appsHomeSubCluster; + + public GetApplicationsHomeSubClusterResponsePBImpl() { +builder = GetApplicationsHomeSubClusterResponseProto.newBuilder(); + } + + public GetApplicationsHomeSubClusterResponsePBImpl( + GetApplicationsHomeSubClusterResponseProto proto) { +this.proto = proto; +viaProto = true; + } + + public GetApplicationsHomeSubClusterResponseProto getProto() { +mergeLocalToProto(); +proto = viaProto ? proto : builder.build(); +viaProto = true; +return proto; + } + + private void mergeLocalToProto() { +if (viaProto) { + maybeInitBuilder(); +} +mergeLocalToBuilder(); +proto = builder.build(); +viaProto = true; + } + + private void maybeInitBuilder() { +if (viaProto || builder == null) { + builder = GetApplicationsHomeSubClusterResponseProto.newBuilder(proto); +} +viaProto = false; + } + + private void mergeLocalToBuilder() { +if (this.appsHomeSubCluster != null) { + addSubClustersInfoToProto(); +} + } + + @Override + public int hashCode() { +return getProto().hashCode(); + } + + @Override + public boolean equals(Object other) { +if (other == null) { + return false; +} +if (other.getClass().isAssignableFrom(this.getClass())) { + return this.getProto().equals(this.getClass().cast(other).getProto()); +} +return false; + } + + @Override + public String toString() { +return TextFormat.shortDebugString(getProto()); + } + + @Override + public List getAppsHomeSubClusters() { +initSubClustersInfoList(); +return appsHomeSubCluster; + } + + @Override + public void setAppsHomeSubClusters( + List appsHomeSubClusters) { +maybeInitBuilder(); +if