001/**
002 * Licensed to the Apache Software Foundation (ASF) under one
003 * or more contributor license agreements.  See the NOTICE file
004 * distributed with this work for additional information
005 * regarding copyright ownership.  The ASF licenses this file
006 * to you under the Apache License, Version 2.0 (the
007 * "License"); you may not use this file except in compliance
008 * with the License.  You may obtain a copy of the License at
009 *
010 *     http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing, software
013 * distributed under the License is distributed on an "AS IS" BASIS,
014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015 * See the License for the specific language governing permissions and
016 * limitations under the License.
017 */
018
019package org.apache.hadoop.yarn.api.protocolrecords;
020
021import java.util.List;
022
023import org.apache.hadoop.classification.InterfaceAudience.Private;
024import org.apache.hadoop.classification.InterfaceAudience.Public;
025import org.apache.hadoop.classification.InterfaceStability.Stable;
026import org.apache.hadoop.classification.InterfaceStability.Unstable;
027import org.apache.hadoop.yarn.api.ApplicationClientProtocol;
028import org.apache.hadoop.yarn.api.records.ApplicationReport;
029import org.apache.hadoop.yarn.util.Records;
030
031/**
032 * <p>The response sent by the <code>ResourceManager</code> to a client
033 * requesting an {@link ApplicationReport} for applications.</p>
034 *
035 * <p>The <code>ApplicationReport</code> for each application includes details
036 * such as user, queue, name, host on which the <code>ApplicationMaster</code>
037 * is running, RPC port, tracking URL, diagnostics, start time etc.</p>
038 *
039 * @see ApplicationReport
040 * @see ApplicationClientProtocol#getApplications(GetApplicationsRequest)
041 */
042@Public
043@Stable
044public abstract class GetApplicationsResponse {
045  @Private
046  @Unstable
047  public static GetApplicationsResponse newInstance(
048      List<ApplicationReport> applications) {
049    GetApplicationsResponse response =
050        Records.newRecord(GetApplicationsResponse.class);
051    response.setApplicationList(applications);
052    return response;
053  }
054
055  /**
056   * Get <code>ApplicationReport</code> for applications.
057   * @return <code>ApplicationReport</code> for applications
058   */
059  @Public
060  @Stable
061  public abstract List<ApplicationReport> getApplicationList();
062
063  @Private
064  @Unstable
065  public abstract void setApplicationList(List<ApplicationReport> applications);
066}