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.protocolrecords;
020    
021    import org.apache.hadoop.classification.InterfaceAudience.Public;
022    import org.apache.hadoop.classification.InterfaceStability.Unstable;
023    import org.apache.hadoop.yarn.api.records.QueueInfo;
024    import org.apache.hadoop.yarn.api.records.ReservationDefinition;
025    import org.apache.hadoop.yarn.util.Records;
026    
027    /**
028     * {@link ReservationSubmissionRequest} captures the set of requirements the
029     * user has to create a reservation.
030     * 
031     * @see ReservationDefinition
032     * 
033     */
034    @Public
035    @Unstable
036    public abstract class ReservationSubmissionRequest {
037    
038      @Public
039      @Unstable
040      public static ReservationSubmissionRequest newInstance(
041          ReservationDefinition reservationDefinition, String queueName) {
042        ReservationSubmissionRequest request =
043            Records.newRecord(ReservationSubmissionRequest.class);
044        request.setReservationDefinition(reservationDefinition);
045        request.setQueue(queueName);
046        return request;
047      }
048    
049      /**
050       * Get the {@link ReservationDefinition} representing the user constraints for
051       * this reservation
052       * 
053       * @return the reservation definition representing user constraints
054       */
055      @Public
056      @Unstable
057      public abstract ReservationDefinition getReservationDefinition();
058    
059      /**
060       * Set the {@link ReservationDefinition} representing the user constraints for
061       * this reservation
062       * 
063       * @param reservationDefinition the reservation request representing the
064       *          reservation
065       */
066      @Public
067      @Unstable
068      public abstract void setReservationDefinition(
069          ReservationDefinition reservationDefinition);
070    
071      /**
072       * Get the name of the {@code Plan} that corresponds to the name of the
073       * {@link QueueInfo} in the scheduler to which the reservation will be
074       * submitted to.
075       * 
076       * @return the name of the {@code Plan} that corresponds to the name of the
077       *         {@link QueueInfo} in the scheduler to which the reservation will be
078       *         submitted to
079       */
080      @Public
081      @Unstable
082      public abstract String getQueue();
083    
084      /**
085       * Set the name of the {@code Plan} that corresponds to the name of the
086       * {@link QueueInfo} in the scheduler to which the reservation will be
087       * submitted to
088       * 
089       * @param queueName the name of the parent {@code Plan} that corresponds to
090       *          the name of the {@link QueueInfo} in the scheduler to which the
091       *          reservation will be submitted to
092       */
093      @Public
094      @Unstable
095      public abstract void setQueue(String queueName);
096    
097    }