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.records;
020
021import org.apache.hadoop.classification.InterfaceAudience.Public;
022import org.apache.hadoop.classification.InterfaceStability.Stable;
023import org.apache.hadoop.yarn.api.ContainerManager;
024
025/**
026 * <p><code>LocalResource</code> represents a local resource required to
027 * run a container.</p>
028 * 
029 * <p>The <code>NodeManager</code> is responsible for localizing the resource 
030 * prior to launching the container.</p>
031 * 
032 * <p>Applications can specify {@link LocalResourceType} and 
033 * {@link LocalResourceVisibility}.</p>
034 * 
035 * @see LocalResourceType
036 * @see LocalResourceVisibility
037 * @see ContainerLaunchContext
038 * @see ApplicationSubmissionContext
039 * @see ContainerManager#startContainer(org.apache.hadoop.yarn.api.protocolrecords.StartContainerRequest)
040 */
041@Public
042@Stable
043public interface LocalResource {
044  /**
045   * Get the <em>location</em> of the resource to be localized.
046   * @return <em>location</em> of the resource to be localized
047   */
048  public URL getResource();
049  
050  /**
051   * Set <em>location</em> of the resource to be localized.
052   * @param resource <em>location</em> of the resource to be localized
053   */
054  public void setResource(URL resource);
055  
056  /**
057   * Get the <em>size</em> of the resource to be localized.
058   * @return <em>size</em> of the resource to be localized
059   */
060  public long getSize();
061  
062  /**
063   * Set the <em>size</em> of the resource to be localized.
064   * @param size <em>size</em> of the resource to be localized
065   */
066  public void setSize(long size);
067  
068  /**
069   * Get the original <em>timestamp</em> of the resource to be localized, used
070   * for verification.
071   * @return <em>timestamp</em> of the resource to be localized
072   */
073  public long getTimestamp();
074  
075  /**
076   * Set the <em>timestamp</em> of the resource to be localized, used
077   * for verification.
078   * @param timestamp <em>timestamp</em> of the resource to be localized
079   */
080  public void setTimestamp(long timestamp);
081  
082  /**
083   * Get the <code>LocalResourceType</code> of the resource to be localized.
084   * @return <code>LocalResourceType</code> of the resource to be localized
085   */
086  public LocalResourceType getType();
087  
088  /**
089   * Set the <code>LocalResourceType</code> of the resource to be localized.
090   * @param type <code>LocalResourceType</code> of the resource to be localized
091   */
092  public void setType(LocalResourceType type);
093  
094  /**
095   * Get the <code>LocalResourceVisibility</code> of the resource to be 
096   * localized.
097   * @return <code>LocalResourceVisibility</code> of the resource to be 
098   *         localized
099   */
100  public LocalResourceVisibility getVisibility();
101  
102  /**
103   * Set the <code>LocalResourceVisibility</code> of the resource to be 
104   * localized.
105   * @param visibility <code>LocalResourceVisibility</code> of the resource to be 
106   *                   localized
107   */
108  public void setVisibility(LocalResourceVisibility visibility);
109  
110  /**
111   * Get the <em>pattern</em> that should be used to extract entries from the
112   * archive (only used when type is <code>PATTERN</code>).
113   * @return <em>pattern</em> that should be used to extract entries from the 
114   * archive. 
115   */
116  public String getPattern();
117  
118  /**
119   * Set the <em>pattern</em> that should be used to extract entries from the
120   * archive (only used when type is <code>PATTERN</code>).
121   * @param pattern <em>pattern</em> that should be used to extract entries 
122   * from the archive.
123   */
124  public void setPattern(String pattern);
125}