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    
019    package org.apache.hadoop.yarn.api.records;
020    
021    import java.util.List;
022    
023    import org.apache.hadoop.classification.InterfaceAudience.Public;
024    import org.apache.hadoop.classification.InterfaceStability.Unstable;
025    import org.apache.hadoop.yarn.util.Records;
026    
027    /**
028     * {@link ReservationRequests} captures the set of resource and constraints the
029     * user cares about regarding a reservation.
030     * 
031     * @see ReservationRequest
032     * 
033     */
034    @Public
035    @Unstable
036    public abstract class ReservationRequests {
037    
038      @Public
039      @Unstable
040      public static ReservationRequests newInstance(
041          List<ReservationRequest> reservationResources,
042          ReservationRequestInterpreter type) {
043        ReservationRequests reservationRequests =
044            Records.newRecord(ReservationRequests.class);
045        reservationRequests.setReservationResources(reservationResources);
046        reservationRequests.setInterpreter(type);
047        return reservationRequests;
048      }
049    
050      /**
051       * Get the list of {@link ReservationRequest} representing the resources
052       * required by the application
053       * 
054       * @return the list of {@link ReservationRequest}
055       */
056      @Public
057      @Unstable
058      public abstract List<ReservationRequest> getReservationResources();
059    
060      /**
061       * Set the list of {@link ReservationRequest} representing the resources
062       * required by the application
063       * 
064       * @param reservationResources the list of {@link ReservationRequest}
065       */
066      @Public
067      @Unstable
068      public abstract void setReservationResources(
069          List<ReservationRequest> reservationResources);
070    
071      /**
072       * Get the {@link ReservationRequestInterpreter}, representing how the list of
073       * resources should be allocated, this captures temporal ordering and other
074       * constraints.
075       * 
076       * @return the list of {@link ReservationRequestInterpreter}
077       */
078      @Public
079      @Unstable
080      public abstract ReservationRequestInterpreter getInterpreter();
081    
082      /**
083       * Set the {@link ReservationRequestInterpreter}, representing how the list of
084       * resources should be allocated, this captures temporal ordering and other
085       * constraints.
086       * 
087       * @param interpreter the {@link ReservationRequestInterpreter} for this
088       *          reservation
089       */
090      @Public
091      @Unstable
092      public abstract void setInterpreter(ReservationRequestInterpreter interpreter);
093    
094    }