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.Public;
024import org.apache.hadoop.classification.InterfaceStability.Unstable;
025import org.apache.hadoop.yarn.api.ApplicationHistoryProtocol;
026import org.apache.hadoop.yarn.api.records.ApplicationAttemptReport;
027import org.apache.hadoop.yarn.util.Records;
028
029/**
030 * <p>
031 * The response sent by the <code>ResourceManager</code> to a client requesting
032 * a list of {@link ApplicationAttemptReport} for application attempts.
033 * </p>
034 * 
035 * <p>
036 * The <code>ApplicationAttemptReport</code> for each application includes the
037 * details of an application attempt.
038 * </p>
039 * 
040 * @see ApplicationAttemptReport
041 * @see ApplicationHistoryProtocol#getApplicationAttempts(GetApplicationAttemptsRequest)
042 */
043@Public
044@Unstable
045public abstract class GetApplicationAttemptsResponse {
046
047  @Public
048  @Unstable
049  public static GetApplicationAttemptsResponse newInstance(
050      List<ApplicationAttemptReport> applicationAttempts) {
051    GetApplicationAttemptsResponse response =
052        Records.newRecord(GetApplicationAttemptsResponse.class);
053    response.setApplicationAttemptList(applicationAttempts);
054    return response;
055  }
056
057  /**
058   * Get a list of <code>ApplicationReport</code> of an application.
059   * 
060   * @return a list of <code>ApplicationReport</code> of an application
061   */
062  @Public
063  @Unstable
064  public abstract List<ApplicationAttemptReport> getApplicationAttemptList();
065
066  /**
067   * Get a list of <code>ApplicationReport</code> of an application.
068   * 
069   * @param applicationAttempts
070   *          a list of <code>ApplicationReport</code> of an application
071   */
072  @Public
073  @Unstable
074  public abstract void setApplicationAttemptList(
075      List<ApplicationAttemptReport> applicationAttempts);
076}