hadoop-yarn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vino...@apache.org
Subject svn commit: r1485890 [1/2] - in /hadoop/common/branches/branch-2/hadoop-yarn-project: ./ hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/...
Date Thu, 23 May 2013 22:48:14 GMT
Author: vinodkv
Date: Thu May 23 22:48:13 2013
New Revision: 1485890

URL: http://svn.apache.org/r1485890
Log:
YARN-711. Copied BuilderUtil methods in individual API records as BuilderUtils is going to be dismantled. Contributed by Jian He.
svn merge --ignore-ancestry -c 1485888 ../../trunk/

Removed:
    hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationMaster.java
    hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationStatus.java
    hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ApplicationMasterPBImpl.java
    hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ApplicationStatusPBImpl.java
Modified:
    hadoop/common/branches/branch-2/hadoop-yarn-project/CHANGES.txt
    hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationAttemptId.java
    hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationReport.java
    hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationResourceUsageReport.java
    hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationSubmissionContext.java
    hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/Container.java
    hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ContainerId.java
    hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ContainerLaunchContext.java
    hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ContainerStatus.java
    hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/LocalResource.java
    hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/NodeHealthStatus.java
    hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/NodeId.java
    hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/NodeReport.java
    hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/Priority.java
    hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/QueueInfo.java
    hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/QueueUserACLInfo.java
    hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/Resource.java
    hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ResourceRequest.java
    hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/URL.java
    hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/YarnClusterMetrics.java
    hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ApplicationReportPBImpl.java
    hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ApplicationResourceUsageReportPBImpl.java
    hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ApplicationSubmissionContextPBImpl.java
    hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ContainerLaunchContextPBImpl.java
    hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ContainerPBImpl.java
    hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ContainerStatusPBImpl.java
    hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/LocalResourcePBImpl.java
    hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/NodeHealthStatusPBImpl.java
    hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/NodeReportPBImpl.java
    hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/QueueInfoPBImpl.java
    hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/QueueUserACLInfoPBImpl.java
    hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/URLPBImpl.java
    hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/YarnClusterMetricsPBImpl.java
    hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/localizer/LocalResourceRequest.java
    hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/MockAsm.java
    hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/TestAMLaunchFailure.java
    hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/TestAMRestart.java
    hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/TestASMStateMachine.java
    hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/TestSchedulerNegotiator.java

Modified: hadoop/common/branches/branch-2/hadoop-yarn-project/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-yarn-project/CHANGES.txt?rev=1485890&r1=1485889&r2=1485890&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-yarn-project/CHANGES.txt (original)
+++ hadoop/common/branches/branch-2/hadoop-yarn-project/CHANGES.txt Thu May 23 22:48:13 2013
@@ -192,6 +192,9 @@ Release 2.0.5-beta - UNRELEASED
     YARN-708. Moved RecordFactory classes to hadoop-yarn-api, and put some
     miscellaneous fixes to the interfaces. (Siddharth Seth via vinodkv)
 
+    YARN-711. Copied BuilderUtil methods in individual API records as
+    BuilderUtils is going to be dismantled. (Jian He via vinodkv)
+
   OPTIMIZATIONS
 
   BUG FIXES

Modified: hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationAttemptId.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationAttemptId.java?rev=1485890&r1=1485889&r2=1485890&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationAttemptId.java (original)
+++ hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationAttemptId.java Thu May 23 22:48:13 2013
@@ -24,6 +24,7 @@ import org.apache.hadoop.classification.
 import org.apache.hadoop.classification.InterfaceAudience.Public;
 import org.apache.hadoop.classification.InterfaceStability.Stable;
 import org.apache.hadoop.classification.InterfaceStability.Unstable;
+import org.apache.hadoop.yarn.util.Records;
 
 /**
  * <p><code>ApplicationAttemptId</code> denotes the particular <em>attempt</em>
@@ -37,9 +38,19 @@ import org.apache.hadoop.classification.
 @Stable
 public abstract class ApplicationAttemptId implements
     Comparable<ApplicationAttemptId> {
-  
+
   public static final String appAttemptIdStrPrefix = "appattempt_";
 
+  @Private
+  public static ApplicationAttemptId newInstance(ApplicationId appId,
+      int attemptId) {
+    ApplicationAttemptId appAttemptId =
+        Records.newRecord(ApplicationAttemptId.class);
+    appAttemptId.setApplicationId(appId);
+    appAttemptId.setAttemptId(attemptId);
+    return appAttemptId;
+  }
+
   /**
    * Get the <code>ApplicationId</code> of the <code>ApplicationAttempId</code>. 
    * @return <code>ApplicationId</code> of the <code>ApplicationAttempId</code>

Modified: hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationReport.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationReport.java?rev=1485890&r1=1485889&r2=1485890&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationReport.java (original)
+++ hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationReport.java Thu May 23 22:48:13 2013
@@ -23,6 +23,7 @@ import org.apache.hadoop.classification.
 import org.apache.hadoop.classification.InterfaceStability.Stable;
 import org.apache.hadoop.classification.InterfaceStability.Unstable;
 import org.apache.hadoop.yarn.api.ClientRMProtocol;
+import org.apache.hadoop.yarn.util.Records;
 
 /**
  * <p><code>ApplicationReport</code> is a report of an application.</p>
@@ -47,7 +48,37 @@ import org.apache.hadoop.yarn.api.Client
  */
 @Public
 @Stable
-public interface ApplicationReport {
+public abstract class ApplicationReport {
+
+  @Private
+  public static ApplicationReport newInstance(ApplicationId applicationId,
+      ApplicationAttemptId applicationAttemptId, String user, String queue,
+      String name, String host, int rpcPort, ClientToken clientToken,
+      YarnApplicationState state, String diagnostics, String url,
+      long startTime, long finishTime, FinalApplicationStatus finalStatus,
+      ApplicationResourceUsageReport appResources, String origTrackingUrl,
+      float progress, String applicationType) {
+    ApplicationReport report = Records.newRecord(ApplicationReport.class);
+    report.setApplicationId(applicationId);
+    report.setCurrentApplicationAttemptId(applicationAttemptId);
+    report.setUser(user);
+    report.setQueue(queue);
+    report.setName(name);
+    report.setHost(host);
+    report.setRpcPort(rpcPort);
+    report.setClientToken(clientToken);
+    report.setYarnApplicationState(state);
+    report.setDiagnostics(diagnostics);
+    report.setTrackingUrl(url);
+    report.setStartTime(startTime);
+    report.setFinishTime(finishTime);
+    report.setFinalApplicationStatus(finalStatus);
+    report.setApplicationResourceUsageReport(appResources);
+    report.setOriginalTrackingUrl(origTrackingUrl);
+    report.setProgress(progress);
+    report.setApplicationType(applicationType);
+    return report;
+  }
 
   /**
    * Get the <code>ApplicationId</code> of the application.
@@ -55,11 +86,11 @@ public interface ApplicationReport {
    */
   @Public
   @Stable
-  ApplicationId getApplicationId();
+  public abstract ApplicationId getApplicationId();
 
   @Private
   @Unstable
-  void setApplicationId(ApplicationId applicationId);
+  public abstract void setApplicationId(ApplicationId applicationId);
   
   /**
    * Get the <code>ApplicationAttemptId</code> of the current
@@ -68,11 +99,11 @@ public interface ApplicationReport {
    */
   @Private
   @Unstable
-  ApplicationAttemptId getCurrentApplicationAttemptId();
+  public abstract ApplicationAttemptId getCurrentApplicationAttemptId();
   
   @Private
   @Unstable
-  void setCurrentApplicationAttemptId(ApplicationAttemptId applicationAttemptId);
+  public abstract void setCurrentApplicationAttemptId(ApplicationAttemptId applicationAttemptId);
 
   /**
    * Get the <em>user</em> who submitted the application.
@@ -80,11 +111,11 @@ public interface ApplicationReport {
    */
   @Public
   @Stable
-  String getUser();
+  public abstract String getUser();
 
   @Private
   @Unstable
-  void setUser(String user);
+  public abstract void setUser(String user);
 
   /**
    * Get the <em>queue</em> to which the application was submitted.
@@ -92,11 +123,11 @@ public interface ApplicationReport {
    */
   @Public
   @Stable
-  String getQueue();
+  public abstract String getQueue();
 
   @Private
   @Unstable
-  void setQueue(String queue);
+  public abstract void setQueue(String queue);
 
   /**
    * Get the user-defined <em>name</em> of the application.
@@ -104,11 +135,11 @@ public interface ApplicationReport {
    */
   @Public
   @Stable
-  String getName();
+  public abstract String getName();
 
   @Private
   @Unstable
-  void setName(String name);
+  public abstract void setName(String name);
 
   /**
    * Get the <em>host</em> on which the <code>ApplicationMaster</code>
@@ -118,11 +149,11 @@ public interface ApplicationReport {
    */
   @Public
   @Stable
-  String getHost();
+  public abstract String getHost();
 
   @Private
   @Unstable
-  void setHost(String host);
+  public abstract void setHost(String host);
 
   /**
    * Get the <em>RPC port</em> of the <code>ApplicationMaster</code>.
@@ -130,11 +161,11 @@ public interface ApplicationReport {
    */
   @Public
   @Stable
-  int getRpcPort();
+  public abstract int getRpcPort();
 
   @Private
   @Unstable
-  void setRpcPort(int rpcPort);
+  public abstract void setRpcPort(int rpcPort);
 
   /**
    * Get the <em>client token</em> for communicating with the
@@ -144,11 +175,11 @@ public interface ApplicationReport {
    */
   @Public
   @Stable
-  ClientToken getClientToken();
+  public abstract ClientToken getClientToken();
 
   @Private
   @Unstable
-  void setClientToken(ClientToken clientToken);
+  public abstract void setClientToken(ClientToken clientToken);
 
   /**
    * Get the <code>YarnApplicationState</code> of the application.
@@ -156,11 +187,11 @@ public interface ApplicationReport {
    */
   @Public
   @Stable
-  YarnApplicationState getYarnApplicationState();
+  public abstract YarnApplicationState getYarnApplicationState();
 
   @Private
   @Unstable
-  void setYarnApplicationState(YarnApplicationState state);
+  public abstract void setYarnApplicationState(YarnApplicationState state);
 
   /**
    * Get  the <em>diagnositic information</em> of the application in case of
@@ -170,11 +201,11 @@ public interface ApplicationReport {
    */
   @Public
   @Stable
-  String getDiagnostics();
+  public abstract String getDiagnostics();
 
   @Private
   @Unstable
-  void setDiagnostics(String diagnostics);
+  public abstract void setDiagnostics(String diagnostics);
 
   /**
    * Get the <em>tracking url</em> for the application.
@@ -182,11 +213,11 @@ public interface ApplicationReport {
    */
   @Public
   @Stable
-  String getTrackingUrl();
+  public abstract String getTrackingUrl();
 
   @Private
   @Unstable
-  void setTrackingUrl(String url);
+  public abstract void setTrackingUrl(String url);
   
   /**
    * Get the original not-proxied <em>tracking url</em> for the application.
@@ -195,11 +226,11 @@ public interface ApplicationReport {
    */
   @Private
   @Unstable
-  String getOriginalTrackingUrl();
+  public abstract String getOriginalTrackingUrl();
 
   @Private
   @Unstable
-  void setOriginalTrackingUrl(String url);
+  public abstract void setOriginalTrackingUrl(String url);
 
   /**
    * Get the <em>start time</em> of the application.
@@ -207,11 +238,11 @@ public interface ApplicationReport {
    */
   @Public
   @Stable
-  long getStartTime();
+  public abstract long getStartTime();
 
   @Private
   @Unstable
-  void setStartTime(long startTime);
+  public abstract void setStartTime(long startTime);
 
   /**
    * Get the <em>finish time</em> of the application.
@@ -219,11 +250,11 @@ public interface ApplicationReport {
    */
   @Public
   @Stable
-  long getFinishTime();
+  public abstract long getFinishTime();
 
   @Private
   @Unstable
-  void setFinishTime(long finishTime);
+  public abstract void setFinishTime(long finishTime);
 
 
   /**
@@ -232,11 +263,11 @@ public interface ApplicationReport {
    */
   @Public
   @Stable
-  FinalApplicationStatus getFinalApplicationStatus();
+  public abstract FinalApplicationStatus getFinalApplicationStatus();
 
   @Private
   @Unstable
-  void setFinalApplicationStatus(FinalApplicationStatus finishState);
+  public abstract void setFinalApplicationStatus(FinalApplicationStatus finishState);
 
   /**
    * Retrieve the structure containing the job resources for this application
@@ -244,7 +275,7 @@ public interface ApplicationReport {
    */
   @Public
   @Stable
-  ApplicationResourceUsageReport getApplicationResourceUsageReport();
+  public abstract ApplicationResourceUsageReport getApplicationResourceUsageReport();
 
   /**
    * Store the structure containing the job resources for this application
@@ -252,7 +283,7 @@ public interface ApplicationReport {
    */
   @Private
   @Unstable
-  void setApplicationResourceUsageReport(ApplicationResourceUsageReport appResources);
+  public abstract void setApplicationResourceUsageReport(ApplicationResourceUsageReport appResources);
 
   /**
    * Get the application's progress ( range 0.0 to 1.0 )
@@ -260,11 +291,11 @@ public interface ApplicationReport {
    */
   @Public
   @Stable
-  float getProgress();
+  public abstract float getProgress();
 
   @Private
   @Unstable
-  void setProgress(float progress);
+  public abstract void setProgress(float progress);
   
   /**
    * Get the application's Type 
@@ -272,9 +303,9 @@ public interface ApplicationReport {
    */
   @Public
   @Stable
-  String getApplicationType();
+  public abstract String getApplicationType();
 
   @Private
   @Unstable
-  void setApplicationType(String applicationType);
+  public abstract void setApplicationType(String applicationType);
 }

Modified: hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationResourceUsageReport.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationResourceUsageReport.java?rev=1485890&r1=1485889&r2=1485890&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationResourceUsageReport.java (original)
+++ hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationResourceUsageReport.java Thu May 23 22:48:13 2013
@@ -18,21 +18,32 @@
 
 package org.apache.hadoop.yarn.api.records;
 
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-
 import org.apache.hadoop.classification.InterfaceAudience.Private;
 import org.apache.hadoop.classification.InterfaceAudience.Public;
 import org.apache.hadoop.classification.InterfaceStability.Stable;
 import org.apache.hadoop.classification.InterfaceStability.Unstable;
+import org.apache.hadoop.yarn.util.Records;
 
 /**
  * Contains various scheduling metrics to be reported by UI and CLI.
  */
 @Public
 @Stable
-public interface ApplicationResourceUsageReport {
+public abstract class ApplicationResourceUsageReport {
+
+  @Private
+  public static ApplicationResourceUsageReport newInstance(
+      int numUsedContainers, int numReservedContainers, Resource usedResources,
+      Resource reservedResources, Resource neededResources) {
+    ApplicationResourceUsageReport report =
+        Records.newRecord(ApplicationResourceUsageReport.class);
+    report.setNumUsedContainers(numUsedContainers);
+    report.setNumReservedContainers(numReservedContainers);
+    report.setUsedResources(usedResources);
+    report.setReservedResources(reservedResources);
+    report.setNeededResources(neededResources);
+    return report;
+  }
 
   /**
    * Get the number of used containers
@@ -40,7 +51,7 @@ public interface ApplicationResourceUsag
    */
   @Public
   @Stable
-  int getNumUsedContainers();
+  public abstract int getNumUsedContainers();
 
   /**
    * Set the number of used containers
@@ -48,7 +59,7 @@ public interface ApplicationResourceUsag
    */
   @Private
   @Unstable
-  void setNumUsedContainers(int num_containers);
+  public abstract void setNumUsedContainers(int num_containers);
 
   /**
    * Get the number of reserved containers
@@ -56,7 +67,7 @@ public interface ApplicationResourceUsag
    */
   @Public
   @Stable
-  int getNumReservedContainers();
+  public abstract int getNumReservedContainers();
 
   /**
    * Set the number of reserved containers
@@ -64,7 +75,7 @@ public interface ApplicationResourceUsag
    */
   @Private
   @Unstable
-  void setNumReservedContainers(int num_reserved_containers);
+  public abstract void setNumReservedContainers(int num_reserved_containers);
 
   /**
    * Get the used <code>Resource</code>
@@ -72,11 +83,11 @@ public interface ApplicationResourceUsag
    */
   @Public
   @Stable
-  Resource getUsedResources();
+  public abstract Resource getUsedResources();
 
   @Private
   @Unstable
-  void setUsedResources(Resource resources);
+  public abstract void setUsedResources(Resource resources);
 
   /**
    * Get the reserved <code>Resource</code>
@@ -84,11 +95,11 @@ public interface ApplicationResourceUsag
    */
   @Public
   @Stable
-  Resource getReservedResources();
+  public abstract Resource getReservedResources();
 
   @Private
   @Unstable
-  void setReservedResources(Resource reserved_resources);
+  public abstract void setReservedResources(Resource reserved_resources);
 
   /**
    * Get the needed <code>Resource</code>
@@ -96,9 +107,9 @@ public interface ApplicationResourceUsag
    */
   @Public
   @Stable
-  Resource getNeededResources();
+  public abstract Resource getNeededResources();
 
   @Private
   @Unstable
-  void setNeededResources(Resource needed_resources);
+  public abstract void setNeededResources(Resource needed_resources);
 }

Modified: hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationSubmissionContext.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationSubmissionContext.java?rev=1485890&r1=1485889&r2=1485890&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationSubmissionContext.java (original)
+++ hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationSubmissionContext.java Thu May 23 22:48:13 2013
@@ -23,6 +23,7 @@ import org.apache.hadoop.classification.
 import org.apache.hadoop.classification.InterfaceStability.Stable;
 import org.apache.hadoop.classification.InterfaceStability.Unstable;
 import org.apache.hadoop.yarn.api.ClientRMProtocol;
+import org.apache.hadoop.yarn.util.Records;
 
 /**
  * <p><code>ApplicationSubmissionContext</code> represents all of the
@@ -47,14 +48,49 @@ import org.apache.hadoop.yarn.api.Client
  */
 @Public
 @Stable
-public interface ApplicationSubmissionContext {
+public abstract class ApplicationSubmissionContext {
+
+  @Public
+  @Stable
+  public static ApplicationSubmissionContext newInstance(
+      ApplicationId applicationId, String applicationName, String queue,
+      Priority priority, ContainerLaunchContext amContainer,
+      boolean isUnmanagedAM, boolean cancelTokensWhenComplete,
+      int maxAppAttempts, Resource resource, String applicationType) {
+    ApplicationSubmissionContext context =
+        Records.newRecord(ApplicationSubmissionContext.class);
+    context.setApplicationId(applicationId);
+    context.setApplicationName(applicationName);
+    context.setQueue(queue);
+    context.setPriority(priority);
+    context.setAMContainerSpec(amContainer);
+    context.setUnmanagedAM(isUnmanagedAM);
+    context.setCancelTokensWhenComplete(cancelTokensWhenComplete);
+    context.setMaxAppAttempts(maxAppAttempts);
+    context.setResource(resource);
+    context.setApplicationType(applicationType);
+    return context;
+  }
+
+  @Public
+  @Stable
+  public static ApplicationSubmissionContext newInstance(
+      ApplicationId applicationId, String applicationName, String queue,
+      Priority priority, ContainerLaunchContext amContainer,
+      boolean isUnmanagedAM, boolean cancelTokensWhenComplete,
+      int maxAppAttempts, Resource resource) {
+    return newInstance(applicationId, applicationName, queue, priority,
+      amContainer, isUnmanagedAM, cancelTokensWhenComplete, maxAppAttempts,
+      resource, null);
+  }
+
   /**
    * Get the <code>ApplicationId</code> of the submitted application.
    * @return <code>ApplicationId</code> of the submitted application
    */
   @Public
   @Stable
-  public ApplicationId getApplicationId();
+  public abstract ApplicationId getApplicationId();
   
   /**
    * Set the <code>ApplicationId</code> of the submitted application.
@@ -63,7 +99,7 @@ public interface ApplicationSubmissionCo
    */
   @Public
   @Stable
-  public void setApplicationId(ApplicationId applicationId);
+  public abstract void setApplicationId(ApplicationId applicationId);
 
   /**
    * Get the application <em>name</em>.
@@ -71,7 +107,7 @@ public interface ApplicationSubmissionCo
    */
   @Public
   @Stable
-  public String getApplicationName();
+  public abstract String getApplicationName();
   
   /**
    * Set the application <em>name</em>.
@@ -79,7 +115,7 @@ public interface ApplicationSubmissionCo
    */
   @Public
   @Stable
-  public void setApplicationName(String applicationName);
+  public abstract void setApplicationName(String applicationName);
   
   /**
    * Get the <em>queue</em> to which the application is being submitted.
@@ -87,7 +123,7 @@ public interface ApplicationSubmissionCo
    */
   @Public
   @Stable
-  public String getQueue();
+  public abstract String getQueue();
   
   /**
    * Set the <em>queue</em> to which the application is being submitted
@@ -95,7 +131,7 @@ public interface ApplicationSubmissionCo
    */
   @Public
   @Stable
-  public void setQueue(String queue);
+  public abstract void setQueue(String queue);
   
   /**
    * Get the <code>Priority</code> of the application.
@@ -103,7 +139,7 @@ public interface ApplicationSubmissionCo
    */
   @Public
   @Stable
-  public Priority getPriority();
+  public abstract Priority getPriority();
 
   /**
    * Set the <code>Priority</code> of the application.
@@ -111,7 +147,7 @@ public interface ApplicationSubmissionCo
    */
   @Public
   @Stable
-  public void setPriority(Priority priority);
+  public abstract void setPriority(Priority priority);
 
   /**
    * Get the <code>ContainerLaunchContext</code> to describe the 
@@ -122,7 +158,7 @@ public interface ApplicationSubmissionCo
    */
   @Public
   @Stable
-  public ContainerLaunchContext getAMContainerSpec();
+  public abstract ContainerLaunchContext getAMContainerSpec();
   
   /**
    * Set the <code>ContainerLaunchContext</code> to describe the 
@@ -133,7 +169,7 @@ public interface ApplicationSubmissionCo
    */
   @Public
   @Stable
-  public void setAMContainerSpec(ContainerLaunchContext amContainer);
+  public abstract void setAMContainerSpec(ContainerLaunchContext amContainer);
   
   /**
    * Get if the RM should manage the execution of the AM. 
@@ -148,21 +184,21 @@ public interface ApplicationSubmissionCo
    */
   @Public
   @Unstable
-  public boolean getUnmanagedAM();
+  public abstract boolean getUnmanagedAM();
   
   /**
    * @param value true if RM should not manage the AM
    */
   @Public
   @Unstable
-  public void setUnmanagedAM(boolean value);
+  public abstract void setUnmanagedAM(boolean value);
 
   /**
    * @return true if tokens should be canceled when the app completes.
    */
   @LimitedPrivate("mapreduce")
   @Unstable
-  public boolean getCancelTokensWhenComplete();
+  public abstract boolean getCancelTokensWhenComplete();
   
   /**
    * Set to false if tokens should not be canceled when the app finished else
@@ -172,14 +208,14 @@ public interface ApplicationSubmissionCo
    */
   @LimitedPrivate("mapreduce")
   @Unstable
-  public void setCancelTokensWhenComplete(boolean cancel);
+  public abstract void setCancelTokensWhenComplete(boolean cancel);
 
   /**
    * @return the number of max attempts of the application to be submitted
    */
   @Public
   @Unstable
-  public int getMaxAppAttempts();
+  public abstract int getMaxAppAttempts();
 
   /**
    * Set the number of max attempts of the application to be submitted. WARNING:
@@ -190,15 +226,15 @@ public interface ApplicationSubmissionCo
    */
   @Public
   @Unstable
-  public void setMaxAppAttempts(int maxAppAttempts);
+  public abstract void setMaxAppAttempts(int maxAppAttempts);
 
   @Public
   @Stable
-  public Resource getResource();
+  public abstract Resource getResource();
 
   @Public
   @Stable
-  public void setResource(Resource resource);
+  public abstract void setResource(Resource resource);
   
   /**
    * Get the <em>applicationType</em> is the application type
@@ -207,7 +243,7 @@ public interface ApplicationSubmissionCo
    */
   @Public
   @Stable
-  public String getApplicationType();
+  public abstract String getApplicationType();
 
   /**
    * Set the <em>applicationType</em> is the application type
@@ -217,5 +253,5 @@ public interface ApplicationSubmissionCo
    */
   @Public
   @Stable
-  public void setApplicationType(String applicationType);
+  public abstract void setApplicationType(String applicationType);
 }
\ No newline at end of file

Modified: hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/Container.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/Container.java?rev=1485890&r1=1485889&r2=1485890&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/Container.java (original)
+++ hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/Container.java Thu May 23 22:48:13 2013
@@ -24,6 +24,7 @@ import org.apache.hadoop.classification.
 import org.apache.hadoop.classification.InterfaceStability.Unstable;
 import org.apache.hadoop.yarn.api.AMRMProtocol;
 import org.apache.hadoop.yarn.api.ContainerManager;
+import org.apache.hadoop.yarn.util.Records;
 
 /**
  * <p><code>Container</code> represents an allocated resource in the cluster.
@@ -63,18 +64,34 @@ import org.apache.hadoop.yarn.api.Contai
  */
 @Public
 @Stable
-public interface Container extends Comparable<Container> {
+public abstract class Container implements Comparable<Container> {
+
+  @Private
+  public static Container newInstance(ContainerId containerId, NodeId nodeId,
+      String nodeHttpAddress, Resource resource, Priority priority,
+      ContainerToken containerToken, long rmIdentifier) {
+    Container container = Records.newRecord(Container.class);
+    container.setId(containerId);
+    container.setNodeId(nodeId);
+    container.setNodeHttpAddress(nodeHttpAddress);
+    container.setResource(resource);
+    container.setPriority(priority);
+    container.setContainerToken(containerToken);
+    container.setRMIdentifier(rmIdentifier);
+    return container;
+  }
+
   /**
    * Get the globally unique identifier for the container.
    * @return globally unique identifier for the container
    */
   @Public
   @Stable
-  ContainerId getId();
+  public abstract ContainerId getId();
   
   @Private
   @Unstable
-  void setId(ContainerId id);
+  public abstract void setId(ContainerId id);
 
   /**
    * Get the identifier of the node on which the container is allocated.
@@ -82,11 +99,11 @@ public interface Container extends Compa
    */
   @Public
   @Stable
-  NodeId getNodeId();
+  public abstract NodeId getNodeId();
   
   @Private
   @Unstable
-  void setNodeId(NodeId nodeId);
+  public abstract void setNodeId(NodeId nodeId);
   
   /**
    * Get the http uri of the node on which the container is allocated.
@@ -94,11 +111,11 @@ public interface Container extends Compa
    */
   @Public
   @Stable
-  String getNodeHttpAddress();
+  public abstract String getNodeHttpAddress();
   
   @Private
   @Unstable
-  void setNodeHttpAddress(String nodeHttpAddress);
+  public abstract void setNodeHttpAddress(String nodeHttpAddress);
   
   /**
    * Get the <code>Resource</code> allocated to the container.
@@ -106,11 +123,11 @@ public interface Container extends Compa
    */
   @Public
   @Stable
-  Resource getResource();
+  public abstract Resource getResource();
   
   @Private
   @Unstable
-  void setResource(Resource resource);
+  public abstract void setResource(Resource resource);
 
   /**
    * Get the <code>Priority</code> at which the <code>Container</code> was
@@ -118,11 +135,11 @@ public interface Container extends Compa
    * @return <code>Priority</code> at which the <code>Container</code> was
    *         allocated
    */
-  Priority getPriority();
+  public abstract Priority getPriority();
   
   @Private
   @Unstable
-  void setPriority(Priority priority);
+  public abstract void setPriority(Priority priority);
   
   /**
    * Get the <code>ContainerToken</code> for the container.
@@ -130,11 +147,11 @@ public interface Container extends Compa
    */
   @Public
   @Stable
-  ContainerToken getContainerToken();
+  public abstract ContainerToken getContainerToken();
   
   @Private
   @Unstable
-  void setContainerToken(ContainerToken containerToken);
+  public abstract void setContainerToken(ContainerToken containerToken);
 
   /**
    * Get the RMIdentifier of RM in which containers are allocated
@@ -142,9 +159,9 @@ public interface Container extends Compa
    */
   @Private
   @Unstable
-  long getRMIdentifer();
+  public abstract long getRMIdentifer();
 
   @Private
   @Unstable
-  void setRMIdentifier(long rmIdentifier);
+  public abstract void setRMIdentifier(long rmIdentifier);
 }

Modified: hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ContainerId.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ContainerId.java?rev=1485890&r1=1485889&r2=1485890&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ContainerId.java (original)
+++ hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ContainerId.java Thu May 23 22:48:13 2013
@@ -24,6 +24,7 @@ import org.apache.hadoop.classification.
 import org.apache.hadoop.classification.InterfaceAudience.Public;
 import org.apache.hadoop.classification.InterfaceStability.Stable;
 import org.apache.hadoop.classification.InterfaceStability.Unstable;
+import org.apache.hadoop.yarn.util.Records;
 
 /**
  * <p><code>ContainerId</code> represents a globally unique identifier
@@ -32,6 +33,16 @@ import org.apache.hadoop.classification.
 @Public
 @Stable
 public abstract class ContainerId implements Comparable<ContainerId>{
+
+  @Private
+  public static ContainerId newInstance(ApplicationAttemptId appAttemptId,
+      int containerId) {
+    ContainerId id = Records.newRecord(ContainerId.class);
+    id.setId(containerId);
+    id.setApplicationAttemptId(appAttemptId);
+    return id;
+  }
+
   /**
    * Get the <code>ApplicationAttemptId</code> of the application to which
    * the <code>Container</code> was assigned.

Modified: hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ContainerLaunchContext.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ContainerLaunchContext.java?rev=1485890&r1=1485889&r2=1485890&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ContainerLaunchContext.java (original)
+++ hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ContainerLaunchContext.java Thu May 23 22:48:13 2013
@@ -25,6 +25,7 @@ import java.util.Map;
 import org.apache.hadoop.classification.InterfaceAudience.Public;
 import org.apache.hadoop.classification.InterfaceStability.Stable;
 import org.apache.hadoop.yarn.api.ContainerManager;
+import org.apache.hadoop.yarn.util.Records;
 
 /**
  * <p><code>ContainerLaunchContext</code> represents all of the information
@@ -50,14 +51,34 @@ import org.apache.hadoop.yarn.api.Contai
  */
 @Public
 @Stable
-public interface ContainerLaunchContext {
+public abstract class ContainerLaunchContext {
+
+  @Public
+  @Stable
+  public static ContainerLaunchContext newInstance(
+      String user, Map<String, LocalResource> localResources,
+      Map<String, String> environment, List<String> commands,
+      Map<String, ByteBuffer> serviceData,  ByteBuffer tokens,
+      Map<ApplicationAccessType, String> acls) {
+    ContainerLaunchContext container =
+        Records.newRecord(ContainerLaunchContext.class);
+    container.setUser(user);
+    container.setLocalResources(localResources);
+    container.setEnvironment(environment);
+    container.setCommands(commands);
+    container.setServiceData(serviceData);
+    container.setTokens(tokens);
+    container.setApplicationACLs(acls);
+    return container;
+  }
+
   /**
    * Get the <em>user</em> to whom the container has been allocated.
    * @return the <em>user</em> to whom the container has been allocated
    */
   @Public
   @Stable
-  String getUser();
+  public abstract String getUser();
   
   /**
    * Set the <em>user</em> to whom the container has been allocated
@@ -65,7 +86,7 @@ public interface ContainerLaunchContext 
    */
   @Public
   @Stable
-  void setUser(String user);
+  public abstract void setUser(String user);
 
   /**
    * Get all the tokens needed by this container. It may include file-system
@@ -77,7 +98,7 @@ public interface ContainerLaunchContext 
    */
   @Public
   @Stable
-  ByteBuffer getTokens();
+  public abstract ByteBuffer getTokens();
 
   /**
    * Set security tokens needed by this container.
@@ -85,7 +106,7 @@ public interface ContainerLaunchContext 
    */
   @Public
   @Stable
-  void setTokens(ByteBuffer tokens);
+  public abstract void setTokens(ByteBuffer tokens);
 
   /**
    * Get <code>LocalResource</code> required by the container.
@@ -93,7 +114,7 @@ public interface ContainerLaunchContext 
    */
   @Public
   @Stable
-  Map<String, LocalResource> getLocalResources();
+  public abstract Map<String, LocalResource> getLocalResources();
   
   /**
    * Set <code>LocalResource</code> required by the container. All pre-existing
@@ -102,7 +123,7 @@ public interface ContainerLaunchContext 
    */
   @Public
   @Stable
-  void setLocalResources(Map<String, LocalResource> localResources);
+  public abstract void setLocalResources(Map<String, LocalResource> localResources);
 
   /**
    * Get application-specific binary <em>service data</em>.
@@ -110,7 +131,7 @@ public interface ContainerLaunchContext 
    */
   @Public
   @Stable
-  Map<String, ByteBuffer> getServiceData();
+  public abstract Map<String, ByteBuffer> getServiceData();
   
   /**
    * Set application-specific binary <em>service data</em>. All pre-existing Map
@@ -119,7 +140,7 @@ public interface ContainerLaunchContext 
    */
   @Public
   @Stable
-  void setServiceData(Map<String, ByteBuffer> serviceData);
+  public abstract void setServiceData(Map<String, ByteBuffer> serviceData);
 
   /**
    * Get <em>environment variables</em> for the container.
@@ -127,7 +148,7 @@ public interface ContainerLaunchContext 
    */
   @Public
   @Stable
-  Map<String, String> getEnvironment();
+  public abstract Map<String, String> getEnvironment();
     
   /**
    * Add <em>environment variables</em> for the container. All pre-existing Map
@@ -136,7 +157,7 @@ public interface ContainerLaunchContext 
    */
   @Public
   @Stable
-  void setEnvironment(Map<String, String> environment);
+  public abstract void setEnvironment(Map<String, String> environment);
 
   /**
    * Get the list of <em>commands</em> for launching the container.
@@ -144,7 +165,7 @@ public interface ContainerLaunchContext 
    */
   @Public
   @Stable
-  List<String> getCommands();
+  public abstract List<String> getCommands();
   
   /**
    * Add the list of <em>commands</em> for launching the container. All
@@ -153,7 +174,7 @@ public interface ContainerLaunchContext 
    */
   @Public
   @Stable
-  void setCommands(List<String> commands);
+  public abstract void setCommands(List<String> commands);
 
   /**
    * Get the <code>ApplicationACL</code>s for the application. 
@@ -161,7 +182,7 @@ public interface ContainerLaunchContext 
    */
   @Public
   @Stable
-  public Map<ApplicationAccessType, String> getApplicationACLs();
+  public abstract  Map<ApplicationAccessType, String> getApplicationACLs();
 
   /**
    * Set the <code>ApplicationACL</code>s for the application. All pre-existing
@@ -170,5 +191,5 @@ public interface ContainerLaunchContext 
    */
   @Public
   @Stable
-  public void setApplicationACLs(Map<ApplicationAccessType, String> acls);
+  public abstract  void setApplicationACLs(Map<ApplicationAccessType, String> acls);
 }

Modified: hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ContainerStatus.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ContainerStatus.java?rev=1485890&r1=1485889&r2=1485890&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ContainerStatus.java (original)
+++ hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ContainerStatus.java Thu May 23 22:48:13 2013
@@ -22,6 +22,7 @@ import org.apache.hadoop.classification.
 import org.apache.hadoop.classification.InterfaceAudience.Public;
 import org.apache.hadoop.classification.InterfaceStability.Stable;
 import org.apache.hadoop.classification.InterfaceStability.Unstable;
+import org.apache.hadoop.yarn.util.Records;
 
 /**
  * <p><code>ContainerStatus</code> represents the current status of a 
@@ -38,18 +39,30 @@ import org.apache.hadoop.classification.
  */
 @Public
 @Stable
-public interface ContainerStatus {
+public abstract class ContainerStatus {
+
+  @Private
+  public static ContainerStatus newInstance(ContainerId containerId,
+      ContainerState containerState, String diagnostics, int exitStatus) {
+    ContainerStatus containerStatus = Records.newRecord(ContainerStatus.class);
+    containerStatus.setState(containerState);
+    containerStatus.setContainerId(containerId);
+    containerStatus.setDiagnostics(diagnostics);
+    containerStatus.setExitStatus(exitStatus);
+    return containerStatus;
+  }
+
   /**
    * Get the <code>ContainerId</code> of the container.
    * @return <code>ContainerId</code> of the container
    */
   @Public
   @Stable
-  ContainerId getContainerId();
+  public abstract ContainerId getContainerId();
   
   @Private
   @Unstable
-  void setContainerId(ContainerId containerId);
+  public abstract void setContainerId(ContainerId containerId);
 
   /**
    * Get the <code>ContainerState</code> of the container.
@@ -57,11 +70,11 @@ public interface ContainerStatus {
    */
   @Public
   @Stable
-  ContainerState getState();
+  public abstract ContainerState getState();
   
   @Private
   @Unstable
-  void setState(ContainerState state);
+  public abstract void setState(ContainerState state);
 
   /**
    * <p>Get the <em>exit status</em> for the container.</p>
@@ -84,11 +97,11 @@ public interface ContainerStatus {
    */
   @Public
   @Stable
-  int getExitStatus();
+  public abstract int getExitStatus();
   
   @Private
   @Unstable
-  void setExitStatus(int exitStatus);
+  public abstract void setExitStatus(int exitStatus);
 
   /**
    * Get <em>diagnostic messages</em> for failed containers.
@@ -96,9 +109,9 @@ public interface ContainerStatus {
    */
   @Public
   @Stable
-  String getDiagnostics();
+  public abstract String getDiagnostics();
   
   @Private
   @Unstable
-  void setDiagnostics(String diagnostics);
+  public abstract void setDiagnostics(String diagnostics);
 }

Modified: hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/LocalResource.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/LocalResource.java?rev=1485890&r1=1485889&r2=1485890&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/LocalResource.java (original)
+++ hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/LocalResource.java Thu May 23 22:48:13 2013
@@ -21,6 +21,7 @@ package org.apache.hadoop.yarn.api.recor
 import org.apache.hadoop.classification.InterfaceAudience.Public;
 import org.apache.hadoop.classification.InterfaceStability.Stable;
 import org.apache.hadoop.yarn.api.ContainerManager;
+import org.apache.hadoop.yarn.util.Records;
 
 /**
  * <p><code>LocalResource</code> represents a local resource required to
@@ -40,56 +41,79 @@ import org.apache.hadoop.yarn.api.Contai
  */
 @Public
 @Stable
-public interface LocalResource {
+public abstract class LocalResource {
+
+  @Public
+  @Stable
+  public static LocalResource newInstance(URL url, LocalResourceType type,
+      LocalResourceVisibility visibility, long size, long timestamp,
+      String pattern) {
+    LocalResource resource = Records.newRecord(LocalResource.class);
+    resource.setResource(url);
+    resource.setType(type);
+    resource.setVisibility(visibility);
+    resource.setSize(size);
+    resource.setTimestamp(timestamp);
+    resource.setPattern(pattern);
+    return resource;
+  }
+
+  @Public
+  @Stable
+  public static LocalResource newInstance(URL url, LocalResourceType type,
+      LocalResourceVisibility visibility, long size, long timestamp) {
+    return newInstance(url, type, visibility, size, timestamp, null);
+  }
+
   /**
    * Get the <em>location</em> of the resource to be localized.
    * @return <em>location</em> of the resource to be localized
    */
-  public URL getResource();
+  public abstract URL getResource();
   
   /**
    * Set <em>location</em> of the resource to be localized.
    * @param resource <em>location</em> of the resource to be localized
    */
-  public void setResource(URL resource);
+  public abstract void setResource(URL resource);
   
   /**
    * Get the <em>size</em> of the resource to be localized.
    * @return <em>size</em> of the resource to be localized
    */
-  public long getSize();
+  public abstract long getSize();
   
   /**
    * Set the <em>size</em> of the resource to be localized.
    * @param size <em>size</em> of the resource to be localized
    */
-  public void setSize(long size);
+  public abstract void setSize(long size);
   
   /**
    * Get the original <em>timestamp</em> of the resource to be localized, used
    * for verification.
    * @return <em>timestamp</em> of the resource to be localized
    */
-  public long getTimestamp();
+  public abstract long getTimestamp();
   
   /**
    * Set the <em>timestamp</em> of the resource to be localized, used
    * for verification.
    * @param timestamp <em>timestamp</em> of the resource to be localized
    */
-  public void setTimestamp(long timestamp);
+  public abstract void setTimestamp(long timestamp);
   
   /**
    * Get the <code>LocalResourceType</code> of the resource to be localized.
    * @return <code>LocalResourceType</code> of the resource to be localized
    */
-  public LocalResourceType getType();
+  public abstract LocalResourceType getType();
   
   /**
    * Set the <code>LocalResourceType</code> of the resource to be localized.
    * @param type <code>LocalResourceType</code> of the resource to be localized
    */
-  public void setType(LocalResourceType type);
+  public abstract void setType(LocalResourceType type);
   
   /**
    * Get the <code>LocalResourceVisibility</code> of the resource to be 
@@ -97,7 +121,7 @@ public interface LocalResource {
    * @return <code>LocalResourceVisibility</code> of the resource to be 
    *         localized
    */
-  public LocalResourceVisibility getVisibility();
+  public abstract LocalResourceVisibility getVisibility();
   
   /**
    * Set the <code>LocalResourceVisibility</code> of the resource to be 
@@ -105,7 +129,7 @@ public interface LocalResource {
    * @param visibility <code>LocalResourceVisibility</code> of the resource to be 
    *                   localized
    */
-  public void setVisibility(LocalResourceVisibility visibility);
+  public abstract void setVisibility(LocalResourceVisibility visibility);
   
   /**
    * Get the <em>pattern</em> that should be used to extract entries from the
@@ -113,7 +137,7 @@ public interface LocalResource {
    * @return <em>pattern</em> that should be used to extract entries from the 
    * archive. 
    */
-  public String getPattern();
+  public abstract String getPattern();
   
   /**
    * Set the <em>pattern</em> that should be used to extract entries from the
@@ -121,5 +145,5 @@ public interface LocalResource {
    * @param pattern <em>pattern</em> that should be used to extract entries 
    * from the archive.
    */
-  public void setPattern(String pattern);
+  public abstract void setPattern(String pattern);
 }

Modified: hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/NodeHealthStatus.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/NodeHealthStatus.java?rev=1485890&r1=1485889&r2=1485890&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/NodeHealthStatus.java (original)
+++ hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/NodeHealthStatus.java Thu May 23 22:48:13 2013
@@ -22,6 +22,7 @@ import org.apache.hadoop.classification.
 import org.apache.hadoop.classification.InterfaceStability.Stable;
 import org.apache.hadoop.classification.InterfaceStability.Unstable;
 import org.apache.hadoop.yarn.api.ClientRMProtocol;
+import org.apache.hadoop.yarn.util.Records;
 
 /**
  * <p><code>NodeHealthStatus</code> is a summary of the health status of the
@@ -43,7 +44,17 @@ import org.apache.hadoop.yarn.api.Client
  */
 @Public
 @Stable
-public interface NodeHealthStatus {
+public abstract class NodeHealthStatus {
+
+  @Private
+  public static NodeHealthStatus newInstance(boolean isNodeHealthy,
+      String healthReport, long lastHealthReport) {
+    NodeHealthStatus status = Records.newRecord(NodeHealthStatus.class);
+    status.setIsNodeHealthy(isNodeHealthy);
+    status.setHealthReport(healthReport);
+    status.setLastHealthReportTime(lastHealthReport);
+    return status;
+  }
 
   /**
    * Is the node healthy?
@@ -51,11 +62,11 @@ public interface NodeHealthStatus {
    */
   @Public
   @Stable
-  boolean getIsNodeHealthy();
+  public abstract boolean getIsNodeHealthy();
 
   @Private
   @Unstable
-  void setIsNodeHealthy(boolean isNodeHealthy);
+  public abstract void setIsNodeHealthy(boolean isNodeHealthy);
 
   /**
    * Get the <em>diagnostic health report</em> of the node.
@@ -63,11 +74,11 @@ public interface NodeHealthStatus {
    */
   @Public
   @Stable
-  String getHealthReport();
+  public abstract String getHealthReport();
 
   @Private
   @Unstable
-  void setHealthReport(String healthReport);
+  public abstract void setHealthReport(String healthReport);
 
   /**
    * Get the <em>last timestamp</em> at which the health report was received.
@@ -75,9 +86,9 @@ public interface NodeHealthStatus {
    */
   @Public
   @Stable
-  long getLastHealthReportTime();
+  public abstract long getLastHealthReportTime();
 
   @Private
   @Unstable
-  void setLastHealthReportTime(long lastHealthReport);
+  public abstract void setLastHealthReportTime(long lastHealthReport);
 }
\ No newline at end of file

Modified: hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/NodeId.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/NodeId.java?rev=1485890&r1=1485889&r2=1485890&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/NodeId.java (original)
+++ hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/NodeId.java Thu May 23 22:48:13 2013
@@ -22,6 +22,7 @@ import org.apache.hadoop.classification.
 import org.apache.hadoop.classification.InterfaceAudience.Public;
 import org.apache.hadoop.classification.InterfaceStability.Stable;
 import org.apache.hadoop.classification.InterfaceStability.Unstable;
+import org.apache.hadoop.yarn.util.Records;
 
 /**
  * <p><code>NodeId</code> is the unique identifier for a node.</p>
@@ -34,6 +35,14 @@ import org.apache.hadoop.classification.
 @Stable
 public abstract class NodeId implements Comparable<NodeId> {
 
+  @Private
+  public static NodeId newInstance(String host, int port) {
+    NodeId nodeId = Records.newRecord(NodeId.class);
+    nodeId.setHost(host);
+    nodeId.setPort(port);
+    return nodeId;
+  }
+
   /**
    * Get the <em>hostname</em> of the node.
    * @return <em>hostname</em> of the node

Modified: hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/NodeReport.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/NodeReport.java?rev=1485890&r1=1485889&r2=1485890&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/NodeReport.java (original)
+++ hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/NodeReport.java Thu May 23 22:48:13 2013
@@ -23,6 +23,7 @@ import org.apache.hadoop.classification.
 import org.apache.hadoop.classification.InterfaceStability.Stable;
 import org.apache.hadoop.classification.InterfaceStability.Unstable;
 import org.apache.hadoop.yarn.api.ClientRMProtocol;
+import org.apache.hadoop.yarn.util.Records;
 
 /**
  * <p><code>NodeReport</code> is a summary of runtime information of a 
@@ -45,26 +46,43 @@ import org.apache.hadoop.yarn.api.Client
  */
 @Public
 @Stable
-public interface NodeReport {
+public abstract class NodeReport {
+
+  @Private
+  public static NodeReport newInstance(NodeId nodeId, NodeState nodeState,
+      String httpAddress, String rackName, Resource used, Resource capability,
+      int numContainers, NodeHealthStatus nodeHealthStatus) {
+    NodeReport nodeReport = Records.newRecord(NodeReport.class);
+    nodeReport.setNodeId(nodeId);
+    nodeReport.setNodeState(nodeState);
+    nodeReport.setHttpAddress(httpAddress);
+    nodeReport.setRackName(rackName);
+    nodeReport.setUsed(used);
+    nodeReport.setCapability(capability);
+    nodeReport.setNumContainers(numContainers);
+    nodeReport.setNodeHealthStatus(nodeHealthStatus);
+    return nodeReport;
+  }
+
   /**
    * Get the <code>NodeId</code> of the node.
    * @return <code>NodeId</code> of the node
    */
-  NodeId getNodeId();
+  public abstract NodeId getNodeId();
   
   @Private
   @Unstable
-  void setNodeId(NodeId nodeId);
+  public abstract void setNodeId(NodeId nodeId);
   
   /**
    * Get the <code>NodeState</code> of the node.
    * @return <code>NodeState</code> of the node
    */
-  NodeState getNodeState();
+  public abstract NodeState getNodeState();
   
   @Private
   @Unstable
-  void setNodeState(NodeState nodeState);
+  public abstract void setNodeState(NodeState nodeState);
   
   /**
    * Get the <em>http address</em> of the node.
@@ -72,11 +90,11 @@ public interface NodeReport {
    */
   @Public
   @Stable
-  String getHttpAddress();
+  public abstract String getHttpAddress();
   
   @Private
   @Unstable
-  void setHttpAddress(String httpAddress);
+  public abstract void setHttpAddress(String httpAddress);
   
   /**
    * Get the <em>rack name</em> for the node.
@@ -84,11 +102,11 @@ public interface NodeReport {
    */
   @Public
   @Stable
-  String getRackName();
+  public abstract String getRackName();
   
   @Private
   @Unstable
-  void setRackName(String rackName);
+  public abstract void setRackName(String rackName);
   
   /**
    * Get <em>used</em> <code>Resource</code> on the node.
@@ -96,11 +114,11 @@ public interface NodeReport {
    */
   @Public
   @Stable
-  Resource getUsed();        
+  public abstract Resource getUsed();
   
   @Private
   @Unstable
-  void setUsed(Resource used);
+  public abstract void setUsed(Resource used);
   
   /**
    * Get the <em>total</em> <code>Resource</code> on the node.
@@ -108,11 +126,11 @@ public interface NodeReport {
    */
   @Public
   @Stable
-  Resource getCapability();
+  public abstract Resource getCapability();
   
   @Private
   @Unstable
-  void setCapability(Resource capability);
+  public abstract void setCapability(Resource capability);
   
   /**
    * Get the <em>number of running containers</em> on the node.
@@ -120,11 +138,11 @@ public interface NodeReport {
    */
   @Public
   @Stable
-  int getNumContainers();
+  public abstract int getNumContainers();
   
   @Private
   @Unstable
-  void setNumContainers(int numContainers);
+  public abstract void setNumContainers(int numContainers);
   
   /**
    * Get the <code>NodeHealthStatus</code> of the node. 
@@ -132,9 +150,9 @@ public interface NodeReport {
    */
   @Public
   @Stable
-  NodeHealthStatus getNodeHealthStatus();
+  public abstract NodeHealthStatus getNodeHealthStatus();
   
   @Private
   @Unstable
-  void setNodeHealthStatus(NodeHealthStatus nodeHealthStatus);
+  public abstract void setNodeHealthStatus(NodeHealthStatus nodeHealthStatus);
 }

Modified: hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/Priority.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/Priority.java?rev=1485890&r1=1485889&r2=1485890&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/Priority.java (original)
+++ hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/Priority.java Thu May 23 22:48:13 2013
@@ -18,13 +18,25 @@
 
 package org.apache.hadoop.yarn.api.records;
 
+import org.apache.hadoop.classification.InterfaceAudience.Public;
+import org.apache.hadoop.classification.InterfaceStability.Stable;
+import org.apache.hadoop.yarn.util.Records;
+
 /**
  * The priority assigned to a ResourceRequest or Application or Container 
  * allocation 
  *
  */
 public abstract class Priority implements Comparable<Priority> {
-  
+
+  @Public
+  @Stable
+  public static Priority newInstance(int p) {
+    Priority priority = Records.newRecord(Priority.class);
+    priority.setPriority(p);
+    return priority;
+  }
+
   /**
    * Get the assigned priority
    * @return the assigned priority

Modified: hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/QueueInfo.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/QueueInfo.java?rev=1485890&r1=1485889&r2=1485890&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/QueueInfo.java (original)
+++ hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/QueueInfo.java Thu May 23 22:48:13 2013
@@ -25,6 +25,7 @@ import org.apache.hadoop.classification.
 import org.apache.hadoop.classification.InterfaceStability.Stable;
 import org.apache.hadoop.classification.InterfaceStability.Unstable;
 import org.apache.hadoop.yarn.api.ClientRMProtocol;
+import org.apache.hadoop.yarn.util.Records;
 
 /**
  * <p>QueueInfo is a report of the runtime information of the queue.</p>
@@ -46,18 +47,35 @@ import org.apache.hadoop.yarn.api.Client
  */
 @Public
 @Stable
-public interface QueueInfo {
+public abstract class QueueInfo {
+
+  @Private
+  public static QueueInfo newInstance(String queueName, float capacity,
+      float maximumCapacity, float currentCapacity,
+      List<QueueInfo> childQueues, List<ApplicationReport> applications,
+      QueueState queueState) {
+    QueueInfo queueInfo = Records.newRecord(QueueInfo.class);
+    queueInfo.setQueueName(queueName);
+    queueInfo.setCapacity(capacity);
+    queueInfo.setMaximumCapacity(maximumCapacity);
+    queueInfo.setCurrentCapacity(currentCapacity);
+    queueInfo.setChildQueues(childQueues);
+    queueInfo.setApplications(applications);
+    queueInfo.setQueueState(queueState);
+    return queueInfo;
+  }
+
   /**
    * Get the <em>name</em> of the queue.
    * @return <em>name</em> of the queue
    */
   @Public
   @Stable
-  String getQueueName();
+  public abstract String getQueueName();
   
   @Private
   @Unstable
-  void setQueueName(String queueName);
+  public abstract void setQueueName(String queueName);
   
   /**
    * Get the <em>configured capacity</em> of the queue.
@@ -65,11 +83,11 @@ public interface QueueInfo {
    */
   @Public
   @Stable
-  float getCapacity();
+  public abstract float getCapacity();
   
   @Private
   @Unstable
-  void setCapacity(float capacity);
+  public abstract void setCapacity(float capacity);
   
   /**
    * Get the <em>maximum capacity</em> of the queue.
@@ -77,11 +95,11 @@ public interface QueueInfo {
    */
   @Public
   @Stable
-  float getMaximumCapacity();
+  public abstract float getMaximumCapacity();
   
   @Private
   @Unstable
-  void setMaximumCapacity(float maximumCapacity);
+  public abstract void setMaximumCapacity(float maximumCapacity);
   
   /**
    * Get the <em>current capacity</em> of the queue.
@@ -89,11 +107,11 @@ public interface QueueInfo {
    */
   @Public
   @Stable
-  float getCurrentCapacity();
+  public abstract float getCurrentCapacity();
   
   @Private
   @Unstable
-  void setCurrentCapacity(float currentCapacity);
+  public abstract void setCurrentCapacity(float currentCapacity);
   
   /**
    * Get the <em>child queues</em> of the queue.
@@ -101,11 +119,11 @@ public interface QueueInfo {
    */
   @Public
   @Stable
-  List<QueueInfo> getChildQueues();
+  public abstract List<QueueInfo> getChildQueues();
   
   @Private
   @Unstable
-  void setChildQueues(List<QueueInfo> childQueues);
+  public abstract void setChildQueues(List<QueueInfo> childQueues);
   
   /**
    * Get the <em>running applications</em> of the queue.
@@ -113,11 +131,11 @@ public interface QueueInfo {
    */
   @Public
   @Stable
-  List<ApplicationReport> getApplications();
+  public abstract List<ApplicationReport> getApplications();
   
   @Private
   @Unstable
-  void setApplications(List<ApplicationReport> applications);
+  public abstract void setApplications(List<ApplicationReport> applications);
   
   /**
    * Get the <code>QueueState</code> of the queue.
@@ -125,9 +143,9 @@ public interface QueueInfo {
    */
   @Public
   @Stable
-  QueueState getQueueState();
+  public abstract QueueState getQueueState();
   
   @Private
   @Unstable
-  void setQueueState(QueueState queueState);
+  public abstract void setQueueState(QueueState queueState);
 }

Modified: hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/QueueUserACLInfo.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/QueueUserACLInfo.java?rev=1485890&r1=1485889&r2=1485890&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/QueueUserACLInfo.java (original)
+++ hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/QueueUserACLInfo.java Thu May 23 22:48:13 2013
@@ -25,6 +25,7 @@ import org.apache.hadoop.classification.
 import org.apache.hadoop.classification.InterfaceStability.Stable;
 import org.apache.hadoop.classification.InterfaceStability.Unstable;
 import org.apache.hadoop.yarn.api.ClientRMProtocol;
+import org.apache.hadoop.yarn.util.Records;
 
 /**
  * <p><code>QueueUserACLInfo</code> provides information {@link QueueACL} for
@@ -35,18 +36,28 @@ import org.apache.hadoop.yarn.api.Client
  */
 @Public
 @Stable
-public interface QueueUserACLInfo {
+public abstract class QueueUserACLInfo {
+
+  @Private
+  public static QueueUserACLInfo newInstance(String queueName,
+      List<QueueACL> acls) {
+    QueueUserACLInfo info = Records.newRecord(QueueUserACLInfo.class);
+    info.setQueueName(queueName);
+    info.setUserAcls(acls);
+    return info;
+  }
+
   /**
    * Get the <em>queue name</em> of the queue.
    * @return <em>queue name</em> of the queue
    */
   @Public
   @Stable
-  String getQueueName();
+  public abstract String getQueueName();
   
   @Private
   @Unstable
-  void setQueueName(String queueName);
+  public abstract void setQueueName(String queueName);
 
   /**
    * Get the list of <code>QueueACL</code> for the given user.
@@ -54,9 +65,9 @@ public interface QueueUserACLInfo {
    */
   @Public
   @Stable
-  List<QueueACL> getUserAcls();
+  public abstract List<QueueACL> getUserAcls();
 
   @Private
   @Unstable
-  void setUserAcls(List<QueueACL> acls);
+  public abstract void setUserAcls(List<QueueACL> acls);
 }

Modified: hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/Resource.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/Resource.java?rev=1485890&r1=1485889&r2=1485890&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/Resource.java (original)
+++ hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/Resource.java Thu May 23 22:48:13 2013
@@ -22,6 +22,7 @@ import org.apache.hadoop.classification.
 import org.apache.hadoop.classification.InterfaceStability.Evolving;
 import org.apache.hadoop.classification.InterfaceStability.Stable;
 import org.apache.hadoop.yarn.api.AMRMProtocol;
+import org.apache.hadoop.yarn.util.Records;
 
 /**
  * <p><code>Resource</code> models a set of computer resources in the 
@@ -39,6 +40,15 @@ import org.apache.hadoop.yarn.api.AMRMPr
 @Stable
 public abstract class Resource implements Comparable<Resource> {
 
+  @Public
+  @Stable
+  public static Resource newInstance(int memory, int vCores) {
+    Resource resource = Records.newRecord(Resource.class);
+    resource.setMemory(memory);
+    resource.setVirtualCores(vCores);
+    return resource;
+  }
+
   /**
    * Get <em>memory</em> of the resource.
    * @return <em>memory</em> of the resource

Modified: hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ResourceRequest.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ResourceRequest.java?rev=1485890&r1=1485889&r2=1485890&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ResourceRequest.java (original)
+++ hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ResourceRequest.java Thu May 23 22:48:13 2013
@@ -21,6 +21,7 @@ package org.apache.hadoop.yarn.api.recor
 import org.apache.hadoop.classification.InterfaceAudience.Public;
 import org.apache.hadoop.classification.InterfaceStability.Stable;
 import org.apache.hadoop.yarn.api.AMRMProtocol;
+import org.apache.hadoop.yarn.util.Records;
 
 /**
  * <p><code>ResourceRequest</code> represents the request made by an
@@ -50,6 +51,18 @@ import org.apache.hadoop.yarn.api.AMRMPr
 @Stable
 public abstract class ResourceRequest implements Comparable<ResourceRequest> {
 
+  @Public
+  @Stable
+  public static ResourceRequest newInstance(Priority priority,
+      String hostName, Resource capability, int numContainers) {
+    ResourceRequest request = Records.newRecord(ResourceRequest.class);
+    request.setPriority(priority);
+    request.setHostName(hostName);
+    request.setCapability(capability);
+    request.setNumContainers(numContainers);
+    return request;
+  }
+
   /**
    * The constant string representing no locality.
    * It should be used by all references that want to pass an arbitrary host

Modified: hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/URL.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/URL.java?rev=1485890&r1=1485889&r2=1485890&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/URL.java (original)
+++ hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/URL.java Thu May 23 22:48:13 2013
@@ -20,14 +20,27 @@ package org.apache.hadoop.yarn.api.recor
 
 import org.apache.hadoop.classification.InterfaceAudience.Public;
 import org.apache.hadoop.classification.InterfaceStability.Evolving;
+import org.apache.hadoop.classification.InterfaceStability.Stable;
+import org.apache.hadoop.yarn.util.Records;
 
 /**
  * <p><code>URL</code> represents a serializable {@link java.net.URL}.</p>
  */
 @Public
 @Evolving
-public interface URL {
-  
+public abstract class URL {
+
+  @Public
+  @Stable
+  public static URL newInstance(String scheme, String host, int port, String file) {
+    URL url = Records.newRecord(URL.class);
+    url.setScheme(scheme);
+    url.setHost(host);
+    url.setPort(port);
+    url.setFile(file);
+    return url;
+  }
+
   /**
    * Get the scheme of the URL.
    * @return scheme of the URL

Modified: hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/YarnClusterMetrics.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/YarnClusterMetrics.java?rev=1485890&r1=1485889&r2=1485890&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/YarnClusterMetrics.java (original)
+++ hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/YarnClusterMetrics.java Thu May 23 22:48:13 2013
@@ -22,6 +22,7 @@ import org.apache.hadoop.classification.
 import org.apache.hadoop.classification.InterfaceAudience.Public;
 import org.apache.hadoop.classification.InterfaceStability.Stable;
 import org.apache.hadoop.classification.InterfaceStability.Unstable;
+import org.apache.hadoop.yarn.util.Records;
 
 /**
  * <p><code>YarnClusterMetrics</code> represents cluster metrics.</p>
@@ -30,8 +31,15 @@ import org.apache.hadoop.classification.
  */
 @Public
 @Stable
-public interface YarnClusterMetrics {
+public abstract class YarnClusterMetrics {
   
+  @Private
+  public static YarnClusterMetrics newInstance(int numNodeManagers) {
+    YarnClusterMetrics metrics = Records.newRecord(YarnClusterMetrics.class);
+    metrics.setNumNodeManagers(numNodeManagers);
+    return metrics;
+  }
+
   /**
    * Get the number of <code>NodeManager</code>s in the cluster.
    * @return number of <code>NodeManager</code>s in the cluster

Modified: hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ApplicationReportPBImpl.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ApplicationReportPBImpl.java?rev=1485890&r1=1485889&r2=1485890&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ApplicationReportPBImpl.java (original)
+++ hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ApplicationReportPBImpl.java Thu May 23 22:48:13 2013
@@ -25,7 +25,6 @@ import org.apache.hadoop.yarn.api.record
 import org.apache.hadoop.yarn.api.records.ApplicationResourceUsageReport;
 import org.apache.hadoop.yarn.api.records.ClientToken;
 import org.apache.hadoop.yarn.api.records.FinalApplicationStatus;
-import org.apache.hadoop.yarn.api.records.ProtoBase;
 import org.apache.hadoop.yarn.api.records.YarnApplicationState;
 import org.apache.hadoop.yarn.proto.YarnProtos.ApplicationAttemptIdProto;
 import org.apache.hadoop.yarn.proto.YarnProtos.ApplicationIdProto;
@@ -36,8 +35,7 @@ import org.apache.hadoop.yarn.proto.Yarn
 import org.apache.hadoop.yarn.proto.YarnProtos.YarnApplicationStateProto;
 import org.apache.hadoop.yarn.util.ProtoUtils;
 
-public class ApplicationReportPBImpl extends ProtoBase<ApplicationReportProto>
-implements ApplicationReport {
+public class ApplicationReportPBImpl extends ApplicationReport {
   ApplicationReportProto proto = ApplicationReportProto.getDefaultInstance();
   ApplicationReportProto.Builder builder = null;
   boolean viaProto = false;
@@ -376,7 +374,6 @@ implements ApplicationReport {
     builder.setProgress(progress);
   }
 
-  @Override
   public ApplicationReportProto getProto() {
     mergeLocalToProto();
     proto = viaProto ? proto : builder.build();
@@ -384,6 +381,26 @@ implements ApplicationReport {
     return proto;
   }
 
+  @Override
+  public int hashCode() {
+    return getProto().hashCode();
+  }
+
+  @Override
+  public boolean equals(Object other) {
+    if (other == null)
+      return false;
+    if (other.getClass().isAssignableFrom(this.getClass())) {
+      return this.getProto().equals(this.getClass().cast(other).getProto());
+    }
+    return false;
+  }
+
+  @Override
+  public String toString() {
+    return getProto().toString().replaceAll("\\n", ", ").replaceAll("\\s+", " ");
+  }
+
   private void mergeLocalToBuilder() {
     if (this.applicationId != null
         && !((ApplicationIdPBImpl) this.applicationId).getProto().equals(

Modified: hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ApplicationResourceUsageReportPBImpl.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ApplicationResourceUsageReportPBImpl.java?rev=1485890&r1=1485889&r2=1485890&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ApplicationResourceUsageReportPBImpl.java (original)
+++ hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ApplicationResourceUsageReportPBImpl.java Thu May 23 22:48:13 2013
@@ -19,15 +19,13 @@
 package org.apache.hadoop.yarn.api.records.impl.pb;
 
 import org.apache.hadoop.yarn.api.records.ApplicationResourceUsageReport;
-import org.apache.hadoop.yarn.api.records.ProtoBase;
 import org.apache.hadoop.yarn.api.records.Resource;
 import org.apache.hadoop.yarn.proto.YarnProtos.ApplicationResourceUsageReportProto;
 import org.apache.hadoop.yarn.proto.YarnProtos.ApplicationResourceUsageReportProtoOrBuilder;
 import org.apache.hadoop.yarn.proto.YarnProtos.ResourceProto;
 
 public class ApplicationResourceUsageReportPBImpl 
-extends ProtoBase<ApplicationResourceUsageReportProto> 
-implements ApplicationResourceUsageReport {
+extends ApplicationResourceUsageReport {
   ApplicationResourceUsageReportProto proto = 
       ApplicationResourceUsageReportProto.getDefaultInstance();
   ApplicationResourceUsageReportProto.Builder builder = null;
@@ -54,6 +52,26 @@ implements ApplicationResourceUsageRepor
     return proto;
   }
 
+  @Override
+  public int hashCode() {
+    return getProto().hashCode();
+  }
+
+  @Override
+  public boolean equals(Object other) {
+    if (other == null)
+      return false;
+    if (other.getClass().isAssignableFrom(this.getClass())) {
+      return this.getProto().equals(this.getClass().cast(other).getProto());
+    }
+    return false;
+  }
+
+  @Override
+  public String toString() {
+    return getProto().toString().replaceAll("\\n", ", ").replaceAll("\\s+", " ");
+  }
+
   private void mergeLocalToBuilder() {
     if (this.usedResources != null
         && !((ResourcePBImpl) this.usedResources).getProto().equals(

Modified: hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ApplicationSubmissionContextPBImpl.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ApplicationSubmissionContextPBImpl.java?rev=1485890&r1=1485889&r2=1485890&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ApplicationSubmissionContextPBImpl.java (original)
+++ hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ApplicationSubmissionContextPBImpl.java Thu May 23 22:48:13 2013
@@ -22,7 +22,6 @@ import org.apache.hadoop.yarn.api.record
 import org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext;
 import org.apache.hadoop.yarn.api.records.ContainerLaunchContext;
 import org.apache.hadoop.yarn.api.records.Priority;
-import org.apache.hadoop.yarn.api.records.ProtoBase;
 import org.apache.hadoop.yarn.api.records.Resource;
 import org.apache.hadoop.yarn.proto.YarnProtos.ApplicationIdProto;
 import org.apache.hadoop.yarn.proto.YarnProtos.ApplicationSubmissionContextProto;
@@ -32,8 +31,7 @@ import org.apache.hadoop.yarn.proto.Yarn
 import org.apache.hadoop.yarn.proto.YarnProtos.ResourceProto;
     
 public class ApplicationSubmissionContextPBImpl 
-extends ProtoBase<ApplicationSubmissionContextProto> 
-implements ApplicationSubmissionContext {
+extends ApplicationSubmissionContext {
   ApplicationSubmissionContextProto proto = 
       ApplicationSubmissionContextProto.getDefaultInstance();
   ApplicationSubmissionContextProto.Builder builder = null;
@@ -61,6 +59,26 @@ implements ApplicationSubmissionContext 
     return proto;
   }
 
+  @Override
+  public int hashCode() {
+    return getProto().hashCode();
+  }
+
+  @Override
+  public boolean equals(Object other) {
+    if (other == null)
+      return false;
+    if (other.getClass().isAssignableFrom(this.getClass())) {
+      return this.getProto().equals(this.getClass().cast(other).getProto());
+    }
+    return false;
+  }
+
+  @Override
+  public String toString() {
+    return getProto().toString().replaceAll("\\n", ", ").replaceAll("\\s+", " ");
+  }
+
   private void mergeLocalToBuilder() {
     if (this.applicationId != null) {
       builder.setApplicationId(convertToProtoFormat(this.applicationId));

Modified: hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ContainerLaunchContextPBImpl.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ContainerLaunchContextPBImpl.java?rev=1485890&r1=1485889&r2=1485890&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ContainerLaunchContextPBImpl.java (original)
+++ hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ContainerLaunchContextPBImpl.java Thu May 23 22:48:13 2013
@@ -28,7 +28,6 @@ import java.util.Map;
 import org.apache.hadoop.yarn.api.records.ApplicationAccessType;
 import org.apache.hadoop.yarn.api.records.ContainerLaunchContext;
 import org.apache.hadoop.yarn.api.records.LocalResource;
-import org.apache.hadoop.yarn.api.records.ProtoBase;
 import org.apache.hadoop.yarn.proto.YarnProtos.ApplicationACLMapProto;
 import org.apache.hadoop.yarn.proto.YarnProtos.ContainerLaunchContextProto;
 import org.apache.hadoop.yarn.proto.YarnProtos.ContainerLaunchContextProtoOrBuilder;
@@ -38,9 +37,10 @@ import org.apache.hadoop.yarn.proto.Yarn
 import org.apache.hadoop.yarn.proto.YarnProtos.StringStringMapProto;
 import org.apache.hadoop.yarn.util.ProtoUtils;
 
+import com.google.protobuf.ByteString;
+
 public class ContainerLaunchContextPBImpl 
-extends ProtoBase<ContainerLaunchContextProto> 
-implements ContainerLaunchContext {
+extends ContainerLaunchContext {
   ContainerLaunchContextProto proto = 
       ContainerLaunchContextProto.getDefaultInstance();
   ContainerLaunchContextProto.Builder builder = null;
@@ -68,7 +68,35 @@ implements ContainerLaunchContext {
     viaProto = true;
     return proto;
   }
-  
+
+  @Override
+  public int hashCode() {
+    return getProto().hashCode();
+  }
+
+  @Override
+  public boolean equals(Object other) {
+    if (other == null)
+      return false;
+    if (other.getClass().isAssignableFrom(this.getClass())) {
+      return this.getProto().equals(this.getClass().cast(other).getProto());
+    }
+    return false;
+  }
+
+  @Override
+  public String toString() {
+    return getProto().toString().replaceAll("\\n", ", ").replaceAll("\\s+", " ");
+  }
+
+  protected final ByteBuffer convertFromProtoFormat(ByteString byteString) {
+    return ProtoUtils.convertFromProtoFormat(byteString);
+  }
+
+  protected final ByteString convertToProtoFormat(ByteBuffer byteBuffer) {
+    return ProtoUtils.convertToProtoFormat(byteBuffer);
+  }
+
   private void mergeLocalToBuilder() {
     if (this.localResources != null) {
       addLocalResourcesToProto();



Mime
View raw message