hadoop-mapreduce-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acmur...@apache.org
Subject svn commit: r1096670 - in /hadoop/mapreduce/branches/MR-279: ./ mr-client/hadoop-mapreduce-client-common/src/main/java/org/apache/hadoop/mapreduce/ mr-client/hadoop-mapreduce-client-jobclient/src/main/java/org/apache/hadoop/mapred/ mr-client/hadoop-map...
Date Tue, 26 Apr 2011 06:26:44 GMT
Author: acmurthy
Date: Tue Apr 26 06:26:43 2011
New Revision: 1096670

URL: http://svn.apache.org/viewvc?rev=1096670&view=rev
Log:
Add ACLs for queues and command-line utilities for viewing them.

Added:
    hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/GetQueueUserAclsInfoRequest.java
    hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/GetQueueUserAclsInfoResponse.java
    hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/impl/pb/GetQueueUserAclsInfoRequestPBImpl.java
    hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/impl/pb/GetQueueUserAclsInfoResponsePBImpl.java
    hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/QueueACL.java
    hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/QueueUserACLInfo.java
    hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/QueueUserACLInfoPBImpl.java
Modified:
    hadoop/mapreduce/branches/MR-279/CHANGES.txt
    hadoop/mapreduce/branches/MR-279/mr-client/hadoop-mapreduce-client-common/src/main/java/org/apache/hadoop/mapreduce/TypeConverter.java
    hadoop/mapreduce/branches/MR-279/mr-client/hadoop-mapreduce-client-jobclient/src/main/java/org/apache/hadoop/mapred/ResourceMgrDelegate.java
    hadoop/mapreduce/branches/MR-279/mr-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapred/TestClientRedirect.java
    hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/java/org/apache/hadoop/yarn/api/ClientRMProtocol.java
    hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/QueueInfoPBImpl.java
    hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/java/org/apache/hadoop/yarn/util/ProtoUtils.java
    hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/proto/client_RM_protocol.proto
    hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/proto/yarn_protos.proto
    hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/proto/yarn_service_protos.proto
    hadoop/mapreduce/branches/MR-279/yarn/yarn-common/src/main/java/org/apache/hadoop/yarn/api/impl/pb/client/ClientRMProtocolPBClientImpl.java
    hadoop/mapreduce/branches/MR-279/yarn/yarn-common/src/main/java/org/apache/hadoop/yarn/api/impl/pb/service/ClientRMProtocolPBServiceImpl.java
    hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ClientRMService.java
    hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/Queue.java
    hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/YarnScheduler.java
    hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/CapacityScheduler.java
    hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/CapacitySchedulerConfiguration.java
    hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/LeafQueue.java
    hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/ParentQueue.java
    hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/Queue.java
    hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fifo/FifoScheduler.java
    hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/TestAMLaunchFailure.java
    hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/TestAMRMRPCResponseId.java
    hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/TestAMRestart.java
    hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/TestSchedulerNegotiator.java

Modified: hadoop/mapreduce/branches/MR-279/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/CHANGES.txt?rev=1096670&r1=1096669&r2=1096670&view=diff
==============================================================================
--- hadoop/mapreduce/branches/MR-279/CHANGES.txt (original)
+++ hadoop/mapreduce/branches/MR-279/CHANGES.txt Tue Apr 26 06:26:43 2011
@@ -3,6 +3,9 @@ Hadoop MapReduce Change Log
 Trunk (unreleased changes)
 
   MAPREDUCE-279
+   
+    Add ACLs for queues and command-line utilities for viewing them.
+    (acmurthy)
 
     Add Containers' logs' view to NM UI and link it from AM UI. (vinodkv)
 

Modified: hadoop/mapreduce/branches/MR-279/mr-client/hadoop-mapreduce-client-common/src/main/java/org/apache/hadoop/mapreduce/TypeConverter.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/mr-client/hadoop-mapreduce-client-common/src/main/java/org/apache/hadoop/mapreduce/TypeConverter.java?rev=1096670&r1=1096669&r2=1096670&view=diff
==============================================================================
--- hadoop/mapreduce/branches/MR-279/mr-client/hadoop-mapreduce-client-common/src/main/java/org/apache/hadoop/mapreduce/TypeConverter.java (original)
+++ hadoop/mapreduce/branches/MR-279/mr-client/hadoop-mapreduce-client-common/src/main/java/org/apache/hadoop/mapreduce/TypeConverter.java Tue Apr 26 06:26:43 2011
@@ -47,6 +47,8 @@ import org.apache.hadoop.yarn.api.record
 import org.apache.hadoop.yarn.api.records.ApplicationId;
 import org.apache.hadoop.yarn.api.records.ApplicationState;
 import org.apache.hadoop.yarn.api.records.NodeManagerInfo;
+import org.apache.hadoop.yarn.api.records.QueueACL;
+import org.apache.hadoop.yarn.api.records.QueueUserACLInfo;
 import org.apache.hadoop.yarn.factory.providers.RecordFactoryProvider;
 
 public class TypeConverter {
@@ -425,5 +427,22 @@ public class TypeConverter {
     return queueInfos.toArray(new QueueInfo[queueInfos.size()]);
   }
 
+  public static QueueAclsInfo[] fromYarnQueueUserAclsInfo(
+      List<QueueUserACLInfo> userAcls) {
+    List<QueueAclsInfo> acls = new ArrayList<QueueAclsInfo>();
+    for (QueueUserACLInfo aclInfo : userAcls) {
+      List<String> operations = new ArrayList<String>();
+      for (QueueACL qAcl : aclInfo.getUserAcls()) {
+        operations.add(qAcl.toString());
+      }
+      
+      QueueAclsInfo acl = 
+        new QueueAclsInfo(aclInfo.getQueueName(), 
+            operations.toArray(new String[operations.size()]));
+      acls.add(acl);
+    }
+    return acls.toArray(new QueueAclsInfo[acls.size()]);
+  }
+
 }
 

Modified: hadoop/mapreduce/branches/MR-279/mr-client/hadoop-mapreduce-client-jobclient/src/main/java/org/apache/hadoop/mapred/ResourceMgrDelegate.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/mr-client/hadoop-mapreduce-client-jobclient/src/main/java/org/apache/hadoop/mapred/ResourceMgrDelegate.java?rev=1096670&r1=1096669&r2=1096670&view=diff
==============================================================================
--- hadoop/mapreduce/branches/MR-279/mr-client/hadoop-mapreduce-client-jobclient/src/main/java/org/apache/hadoop/mapred/ResourceMgrDelegate.java (original)
+++ hadoop/mapreduce/branches/MR-279/mr-client/hadoop-mapreduce-client-jobclient/src/main/java/org/apache/hadoop/mapred/ResourceMgrDelegate.java Tue Apr 26 06:26:43 2011
@@ -54,11 +54,13 @@ import org.apache.hadoop.yarn.api.protoc
 import org.apache.hadoop.yarn.api.protocolrecords.GetClusterNodesResponse;
 import org.apache.hadoop.yarn.api.protocolrecords.GetNewApplicationIdRequest;
 import org.apache.hadoop.yarn.api.protocolrecords.GetQueueInfoRequest;
+import org.apache.hadoop.yarn.api.protocolrecords.GetQueueUserAclsInfoRequest;
 import org.apache.hadoop.yarn.api.protocolrecords.SubmitApplicationRequest;
 import org.apache.hadoop.yarn.api.records.ApplicationId;
 import org.apache.hadoop.yarn.api.records.ApplicationMaster;
 import org.apache.hadoop.yarn.api.records.ApplicationState;
 import org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext;
+import org.apache.hadoop.yarn.api.records.QueueUserACLInfo;
 import org.apache.hadoop.yarn.api.records.YarnClusterMetrics;
 import org.apache.hadoop.yarn.conf.YARNApplicationConstants;
 import org.apache.hadoop.yarn.conf.YarnConfiguration;
@@ -192,7 +194,11 @@ public class ResourceMgrDelegate {
 
   public QueueAclsInfo[] getQueueAclsForCurrentUser() throws IOException,
       InterruptedException {
-    throw new IOException("Not implemented");
+    GetQueueUserAclsInfoRequest request = 
+      recordFactory.newRecordInstance(GetQueueUserAclsInfoRequest.class);
+    List<QueueUserACLInfo> userAcls = 
+      applicationsManager.getQueueUserAcls(request).getUserAclsInfoList();
+    return TypeConverter.fromYarnQueueUserAclsInfo(userAcls);
   }
 
 

Modified: hadoop/mapreduce/branches/MR-279/mr-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapred/TestClientRedirect.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/mr-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapred/TestClientRedirect.java?rev=1096670&r1=1096669&r2=1096670&view=diff
==============================================================================
--- hadoop/mapreduce/branches/MR-279/mr-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapred/TestClientRedirect.java (original)
+++ hadoop/mapreduce/branches/MR-279/mr-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapred/TestClientRedirect.java Tue Apr 26 06:26:43 2011
@@ -75,6 +75,8 @@ import org.apache.hadoop.yarn.api.protoc
 import org.apache.hadoop.yarn.api.protocolrecords.GetNewApplicationIdResponse;
 import org.apache.hadoop.yarn.api.protocolrecords.GetQueueInfoRequest;
 import org.apache.hadoop.yarn.api.protocolrecords.GetQueueInfoResponse;
+import org.apache.hadoop.yarn.api.protocolrecords.GetQueueUserAclsInfoRequest;
+import org.apache.hadoop.yarn.api.protocolrecords.GetQueueUserAclsInfoResponse;
 import org.apache.hadoop.yarn.api.protocolrecords.SubmitApplicationRequest;
 import org.apache.hadoop.yarn.api.protocolrecords.SubmitApplicationResponse;
 import org.apache.hadoop.yarn.api.records.ApplicationId;
@@ -240,6 +242,13 @@ public class TestClientRedirect {
       // TODO Auto-generated method stub
       return null;
     }
+
+    @Override
+    public GetQueueUserAclsInfoResponse getQueueUserAcls(
+        GetQueueUserAclsInfoRequest request) throws YarnRemoteException {
+      // TODO Auto-generated method stub
+      return null;
+    }
   }
 
   class HistoryService extends AMService {

Modified: hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/java/org/apache/hadoop/yarn/api/ClientRMProtocol.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/java/org/apache/hadoop/yarn/api/ClientRMProtocol.java?rev=1096670&r1=1096669&r2=1096670&view=diff
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/java/org/apache/hadoop/yarn/api/ClientRMProtocol.java (original)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/java/org/apache/hadoop/yarn/api/ClientRMProtocol.java Tue Apr 26 06:26:43 2011
@@ -14,6 +14,8 @@ import org.apache.hadoop.yarn.api.protoc
 import org.apache.hadoop.yarn.api.protocolrecords.GetNewApplicationIdResponse;
 import org.apache.hadoop.yarn.api.protocolrecords.GetQueueInfoRequest;
 import org.apache.hadoop.yarn.api.protocolrecords.GetQueueInfoResponse;
+import org.apache.hadoop.yarn.api.protocolrecords.GetQueueUserAclsInfoRequest;
+import org.apache.hadoop.yarn.api.protocolrecords.GetQueueUserAclsInfoResponse;
 import org.apache.hadoop.yarn.api.protocolrecords.SubmitApplicationRequest;
 import org.apache.hadoop.yarn.api.protocolrecords.SubmitApplicationResponse;
 import org.apache.hadoop.yarn.exceptions.YarnRemoteException;
@@ -27,4 +29,5 @@ public interface ClientRMProtocol {
   public GetAllApplicationsResponse getAllApplications(GetAllApplicationsRequest request) throws YarnRemoteException;
   public GetClusterNodesResponse getClusterNodes(GetClusterNodesRequest request) throws YarnRemoteException;
   public GetQueueInfoResponse getQueueInfo(GetQueueInfoRequest request) throws YarnRemoteException;
+  public GetQueueUserAclsInfoResponse getQueueUserAcls(GetQueueUserAclsInfoRequest request) throws YarnRemoteException;
 }

Added: hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/GetQueueUserAclsInfoRequest.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/GetQueueUserAclsInfoRequest.java?rev=1096670&view=auto
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/GetQueueUserAclsInfoRequest.java (added)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/GetQueueUserAclsInfoRequest.java Tue Apr 26 06:26:43 2011
@@ -0,0 +1,5 @@
+package org.apache.hadoop.yarn.api.protocolrecords;
+
+public interface GetQueueUserAclsInfoRequest {
+
+}

Added: hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/GetQueueUserAclsInfoResponse.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/GetQueueUserAclsInfoResponse.java?rev=1096670&view=auto
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/GetQueueUserAclsInfoResponse.java (added)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/GetQueueUserAclsInfoResponse.java Tue Apr 26 06:26:43 2011
@@ -0,0 +1,13 @@
+package org.apache.hadoop.yarn.api.protocolrecords;
+
+import java.util.List;
+
+import org.apache.hadoop.yarn.api.records.QueueUserACLInfo;
+
+public interface GetQueueUserAclsInfoResponse {
+
+  public List<QueueUserACLInfo> getUserAclsInfoList();
+  
+  public void setUserAclsInfoList(List<QueueUserACLInfo> queueUserAclsList);
+  
+}

Added: hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/impl/pb/GetQueueUserAclsInfoRequestPBImpl.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/impl/pb/GetQueueUserAclsInfoRequestPBImpl.java?rev=1096670&view=auto
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/impl/pb/GetQueueUserAclsInfoRequestPBImpl.java (added)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/impl/pb/GetQueueUserAclsInfoRequestPBImpl.java Tue Apr 26 06:26:43 2011
@@ -0,0 +1,32 @@
+package org.apache.hadoop.yarn.api.protocolrecords.impl.pb;
+
+import org.apache.hadoop.yarn.api.protocolrecords.GetQueueUserAclsInfoRequest;
+import org.apache.hadoop.yarn.api.records.ProtoBase;
+import org.apache.hadoop.yarn.proto.YarnServiceProtos.GetQueueUserAclsInfoRequestProto;
+
+public class GetQueueUserAclsInfoRequestPBImpl extends
+    ProtoBase<GetQueueUserAclsInfoRequestProto> implements
+    GetQueueUserAclsInfoRequest {
+
+  GetQueueUserAclsInfoRequestProto proto = 
+    GetQueueUserAclsInfoRequestProto.getDefaultInstance();
+  GetQueueUserAclsInfoRequestProto.Builder builder = null;
+  boolean viaProto = false;
+
+  public GetQueueUserAclsInfoRequestPBImpl() {
+    builder = GetQueueUserAclsInfoRequestProto.newBuilder();
+  }
+
+  public GetQueueUserAclsInfoRequestPBImpl(GetQueueUserAclsInfoRequestProto proto) {
+    this.proto = proto;
+    viaProto = true;
+  }
+  
+  @Override
+  public GetQueueUserAclsInfoRequestProto getProto() {
+    proto = viaProto ? proto : builder.build();
+    viaProto = true;
+    return proto;
+  }
+
+}

Added: hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/impl/pb/GetQueueUserAclsInfoResponsePBImpl.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/impl/pb/GetQueueUserAclsInfoResponsePBImpl.java?rev=1096670&view=auto
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/impl/pb/GetQueueUserAclsInfoResponsePBImpl.java (added)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/impl/pb/GetQueueUserAclsInfoResponsePBImpl.java Tue Apr 26 06:26:43 2011
@@ -0,0 +1,135 @@
+package org.apache.hadoop.yarn.api.protocolrecords.impl.pb;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.hadoop.yarn.api.protocolrecords.GetQueueUserAclsInfoResponse;
+import org.apache.hadoop.yarn.api.records.QueueUserACLInfo;
+import org.apache.hadoop.yarn.api.records.ProtoBase;
+import org.apache.hadoop.yarn.api.records.impl.pb.QueueUserACLInfoPBImpl;
+import org.apache.hadoop.yarn.proto.YarnProtos.QueueUserACLInfoProto;
+import org.apache.hadoop.yarn.proto.YarnServiceProtos.GetQueueUserAclsInfoResponseProto;
+import org.apache.hadoop.yarn.proto.YarnServiceProtos.GetQueueUserAclsInfoResponseProtoOrBuilder;
+
+public class GetQueueUserAclsInfoResponsePBImpl extends 
+ProtoBase<GetQueueUserAclsInfoResponseProto> 
+implements GetQueueUserAclsInfoResponse {
+
+  List<QueueUserACLInfo> queueUserAclsInfoList;
+
+  GetQueueUserAclsInfoResponseProto proto = 
+    GetQueueUserAclsInfoResponseProto.getDefaultInstance();
+  GetQueueUserAclsInfoResponseProto.Builder builder = null;
+  boolean viaProto = false;
+
+  public GetQueueUserAclsInfoResponsePBImpl() {
+    builder = GetQueueUserAclsInfoResponseProto.newBuilder();
+  }
+  
+  public GetQueueUserAclsInfoResponsePBImpl(
+      GetQueueUserAclsInfoResponseProto proto) {
+    this.proto = proto;
+    viaProto = true;
+  }
+
+  @Override
+  public List<QueueUserACLInfo> getUserAclsInfoList() {
+    initLocalQueueUserAclsList();
+    return queueUserAclsInfoList;
+  }
+
+  @Override
+  public void setUserAclsInfoList(List<QueueUserACLInfo> queueUserAclsList) {
+    if (queueUserAclsList == null) {
+      builder.clearQueueUserAcls();
+    }
+    this.queueUserAclsInfoList = queueUserAclsList;
+  }
+
+  @Override
+  public GetQueueUserAclsInfoResponseProto getProto() {
+    mergeLocalToProto();
+    proto = viaProto ? proto : builder.build();
+    viaProto = true;
+    return proto;
+  }
+
+  private void mergeLocalToBuilder() {
+    if (this.queueUserAclsInfoList != null) {
+      addLocalQueueUserACLInfosToProto();
+    }
+  }
+
+  private void mergeLocalToProto() {
+    if (viaProto) 
+      maybeInitBuilder();
+    mergeLocalToBuilder();
+    proto = builder.build();
+    viaProto = true;
+  }
+
+  private void maybeInitBuilder() {
+    if (viaProto || builder == null) {
+      builder = GetQueueUserAclsInfoResponseProto.newBuilder(proto);
+    }
+    viaProto = false;
+  }
+
+  //Once this is called. containerList will never be null - untill a getProto is called.
+  private void initLocalQueueUserAclsList() {
+    if (this.queueUserAclsInfoList != null) {
+      return;
+    }
+    GetQueueUserAclsInfoResponseProtoOrBuilder p = viaProto ? proto : builder;
+    List<QueueUserACLInfoProto> list = p.getQueueUserAclsList();
+    queueUserAclsInfoList = new ArrayList<QueueUserACLInfo>();
+
+    for (QueueUserACLInfoProto a : list) {
+      queueUserAclsInfoList.add(convertFromProtoFormat(a));
+    }
+  }
+
+  private void addLocalQueueUserACLInfosToProto() {
+    maybeInitBuilder();
+    builder.clearQueueUserAcls();
+    if (queueUserAclsInfoList == null)
+      return;
+    Iterable<QueueUserACLInfoProto> iterable = new Iterable<QueueUserACLInfoProto>() {
+      @Override
+      public Iterator<QueueUserACLInfoProto> iterator() {
+        return new Iterator<QueueUserACLInfoProto>() {
+
+          Iterator<QueueUserACLInfo> iter = queueUserAclsInfoList.iterator();
+
+          @Override
+          public boolean hasNext() {
+            return iter.hasNext();
+          }
+
+          @Override
+          public QueueUserACLInfoProto next() {
+            return convertToProtoFormat(iter.next());
+          }
+
+          @Override
+          public void remove() {
+            throw new UnsupportedOperationException();
+
+          }
+        };
+
+      }
+    };
+    builder.addAllQueueUserAcls(iterable);
+  }
+
+  private QueueUserACLInfoPBImpl convertFromProtoFormat(QueueUserACLInfoProto p) {
+    return new QueueUserACLInfoPBImpl(p);
+  }
+
+  private QueueUserACLInfoProto convertToProtoFormat(QueueUserACLInfo t) {
+    return ((QueueUserACLInfoPBImpl)t).getProto();
+  }
+
+}

Added: hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/QueueACL.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/QueueACL.java?rev=1096670&view=auto
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/QueueACL.java (added)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/QueueACL.java Tue Apr 26 06:26:43 2011
@@ -0,0 +1,7 @@
+package org.apache.hadoop.yarn.api.records;
+
+public enum QueueACL {
+  SUBMIT_JOB,
+  ADMINISTER_QUEUE_JOBS,       // currently unused
+  ADMINISTER_QUEUE;            // currently unused
+}
\ No newline at end of file

Added: hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/QueueUserACLInfo.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/QueueUserACLInfo.java?rev=1096670&view=auto
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/QueueUserACLInfo.java (added)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/QueueUserACLInfo.java Tue Apr 26 06:26:43 2011
@@ -0,0 +1,11 @@
+package org.apache.hadoop.yarn.api.records;
+
+import java.util.List;
+
+public interface QueueUserACLInfo {
+  String getQueueName();
+  void setQueueName(String queueName);
+  
+  List<QueueACL> getUserAcls();
+  void setUserAcls(List<QueueACL> acls);
+}

Modified: hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/QueueInfoPBImpl.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/QueueInfoPBImpl.java?rev=1096670&r1=1096669&r2=1096670&view=diff
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/QueueInfoPBImpl.java (original)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/QueueInfoPBImpl.java Tue Apr 26 06:26:43 2011
@@ -9,7 +9,6 @@ import org.apache.hadoop.yarn.api.record
 import org.apache.hadoop.yarn.api.records.QueueInfo;
 import org.apache.hadoop.yarn.api.records.QueueState;
 import org.apache.hadoop.yarn.proto.YarnProtos.ApplicationProto;
-import org.apache.hadoop.yarn.proto.YarnProtos.LocalResourceProtoOrBuilder;
 import org.apache.hadoop.yarn.proto.YarnProtos.QueueInfoProto;
 import org.apache.hadoop.yarn.proto.YarnProtos.QueueInfoProtoOrBuilder;
 import org.apache.hadoop.yarn.proto.YarnProtos.QueueStateProto;

Added: hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/QueueUserACLInfoPBImpl.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/QueueUserACLInfoPBImpl.java?rev=1096670&view=auto
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/QueueUserACLInfoPBImpl.java (added)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/QueueUserACLInfoPBImpl.java Tue Apr 26 06:26:43 2011
@@ -0,0 +1,146 @@
+package org.apache.hadoop.yarn.api.records.impl.pb;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.hadoop.yarn.api.records.QueueACL;
+import org.apache.hadoop.yarn.api.records.ProtoBase;
+import org.apache.hadoop.yarn.api.records.QueueUserACLInfo;
+import org.apache.hadoop.yarn.proto.YarnProtos.QueueACLProto;
+import org.apache.hadoop.yarn.proto.YarnProtos.QueueUserACLInfoProto;
+import org.apache.hadoop.yarn.proto.YarnProtos.QueueUserACLInfoProtoOrBuilder;
+import org.apache.hadoop.yarn.util.ProtoUtils;
+
+public class QueueUserACLInfoPBImpl extends ProtoBase<QueueUserACLInfoProto> 
+implements QueueUserACLInfo {
+
+  QueueUserACLInfoProto proto = QueueUserACLInfoProto.getDefaultInstance();
+  QueueUserACLInfoProto.Builder builder = null;
+  boolean viaProto = false;
+
+  List<QueueACL> userAclsList;
+
+  public QueueUserACLInfoPBImpl() {
+    builder = QueueUserACLInfoProto.newBuilder();
+  }
+  
+  public QueueUserACLInfoPBImpl(QueueUserACLInfoProto proto) {
+    this.proto = proto;
+    viaProto = true;
+  }
+
+  @Override
+  public String getQueueName() {
+    QueueUserACLInfoProtoOrBuilder p = viaProto ? proto : builder;
+    return (p.hasQueueName()) ? p.getQueueName() : null;
+  }
+
+  @Override
+  public List<QueueACL> getUserAcls() {
+    initLocalQueueUserAclsList();
+    return this.userAclsList;
+  }
+
+  @Override
+  public void setQueueName(String queueName) {
+    maybeInitBuilder();
+    if (queueName == null) {
+      builder.clearQueueName();
+    }
+    builder.setQueueName(queueName);
+  }
+
+  @Override
+  public void setUserAcls(List<QueueACL> userAclsList) {
+    if (userAclsList == null) {
+      builder.clearUserAcls();
+    }
+    this.userAclsList = userAclsList;
+  }
+
+  @Override
+  public QueueUserACLInfoProto getProto() {
+    mergeLocalToProto();
+    proto = viaProto ? proto : builder.build();
+    viaProto = true;
+    return proto;
+  }
+
+  private void initLocalQueueUserAclsList() {
+    if (this.userAclsList != null) {
+      return;
+    }
+    QueueUserACLInfoProtoOrBuilder p = viaProto ? proto : builder;
+    List<QueueACLProto> list = p.getUserAclsList();
+    userAclsList = new ArrayList<QueueACL>();
+
+    for (QueueACLProto a : list) {
+      userAclsList.add(convertFromProtoFormat(a));
+    }
+  }
+
+  private void addQueueACLsToProto() {
+    maybeInitBuilder();
+    builder.clearUserAcls();
+    if (userAclsList == null)
+      return;
+    Iterable<QueueACLProto> iterable = new Iterable<QueueACLProto>() {
+      @Override
+      public Iterator<QueueACLProto> iterator() {
+        return new Iterator<QueueACLProto>() {
+  
+          Iterator<QueueACL> iter = userAclsList.iterator();
+  
+          @Override
+          public boolean hasNext() {
+            return iter.hasNext();
+          }
+  
+          @Override
+          public QueueACLProto next() {
+            return convertToProtoFormat(iter.next());
+          }
+  
+          @Override
+          public void remove() {
+            throw new UnsupportedOperationException();
+  
+          }
+        };
+  
+      }
+    };
+    builder.addAllUserAcls(iterable);
+  }
+
+  private void maybeInitBuilder() {
+    if (viaProto || builder == null) {
+      builder = QueueUserACLInfoProto.newBuilder(proto);
+    }
+    viaProto = false;
+  }
+
+  private void mergeLocalToBuilder() {
+    if (this.userAclsList != null) {
+      addQueueACLsToProto();
+    }
+  }
+
+  private void mergeLocalToProto() {
+    if (viaProto) 
+      maybeInitBuilder();
+    mergeLocalToBuilder();
+    proto = builder.build();
+    viaProto = true;
+  }
+
+  private QueueACL convertFromProtoFormat(QueueACLProto q) {
+    return ProtoUtils.convertFromProtoFormat(q);
+  }
+  
+  private QueueACLProto convertToProtoFormat(QueueACL queueAcl) {
+    return ProtoUtils.convertToProtoFormat(queueAcl);
+  }
+
+}

Modified: hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/java/org/apache/hadoop/yarn/util/ProtoUtils.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/java/org/apache/hadoop/yarn/util/ProtoUtils.java?rev=1096670&r1=1096669&r2=1096670&view=diff
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/java/org/apache/hadoop/yarn/util/ProtoUtils.java (original)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/java/org/apache/hadoop/yarn/util/ProtoUtils.java Tue Apr 26 06:26:43 2011
@@ -6,12 +6,14 @@ import org.apache.hadoop.yarn.api.record
 import org.apache.hadoop.yarn.api.records.ContainerState;
 import org.apache.hadoop.yarn.api.records.LocalResourceType;
 import org.apache.hadoop.yarn.api.records.LocalResourceVisibility;
+import org.apache.hadoop.yarn.api.records.QueueACL;
 import org.apache.hadoop.yarn.api.records.QueueState;
 import org.apache.hadoop.yarn.api.records.YarnContainerTags;
 import org.apache.hadoop.yarn.proto.YarnProtos.ApplicationStateProto;
 import org.apache.hadoop.yarn.proto.YarnProtos.ContainerStateProto;
 import org.apache.hadoop.yarn.proto.YarnProtos.LocalResourceTypeProto;
 import org.apache.hadoop.yarn.proto.YarnProtos.LocalResourceVisibilityProto;
+import org.apache.hadoop.yarn.proto.YarnProtos.QueueACLProto;
 import org.apache.hadoop.yarn.proto.YarnProtos.QueueStateProto;
 import org.apache.hadoop.yarn.proto.YarnProtos.YarnContainerTagsProto;
 
@@ -101,5 +103,16 @@ public class ProtoUtils {
   public static QueueState convertFromProtoFormat(QueueStateProto e) {
     return QueueState.valueOf(e.name().replace(QUEUE_STATE_PREFIX, ""));
   }
+  
+  /*
+   * QueueACL
+   */
+  private static String QUEUE_ACL_PREFIX = "Q_";
+  public static QueueACLProto convertToProtoFormat(QueueACL e) {
+    return QueueACLProto.valueOf(QUEUE_ACL_PREFIX + e.name());
+  }
+  public static QueueACL convertFromProtoFormat(QueueACLProto e) {
+    return QueueACL.valueOf(e.name().replace(QUEUE_ACL_PREFIX, ""));
+  }
 
 }

Modified: hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/proto/client_RM_protocol.proto
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/proto/client_RM_protocol.proto?rev=1096670&r1=1096669&r2=1096670&view=diff
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/proto/client_RM_protocol.proto (original)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/proto/client_RM_protocol.proto Tue Apr 26 06:26:43 2011
@@ -5,11 +5,6 @@ option java_generate_equals_and_hash = t
 
 import "yarn_service_protos.proto";
 
-
-
-
-
-
 service ClientRMProtocolService {
   rpc getNewApplicationId (GetNewApplicationIdRequestProto) returns (GetNewApplicationIdResponseProto);
   rpc getApplicationMaster (GetApplicationMasterRequestProto) returns (GetApplicationMasterResponseProto);
@@ -19,5 +14,6 @@ service ClientRMProtocolService {
   rpc getAllApplications (GetAllApplicationsRequestProto) returns (GetAllApplicationsResponseProto);
   rpc getClusterNodes (GetClusterNodesRequestProto) returns (GetClusterNodesResponseProto);
   rpc getQueueInfo (GetQueueInfoRequestProto) returns (GetQueueInfoResponseProto);
+  rpc getQueueUserAcls (GetQueueUserAclsInfoRequestProto) returns (GetQueueUserAclsInfoResponseProto);
 }
 

Modified: hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/proto/yarn_protos.proto
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/proto/yarn_protos.proto?rev=1096670&r1=1096669&r2=1096670&view=diff
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/proto/yarn_protos.proto (original)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/proto/yarn_protos.proto Tue Apr 26 06:26:43 2011
@@ -179,6 +179,16 @@ message QueueInfoProto {
   repeated ApplicationProto applications = 7;
 }
 
+enum QueueACLProto {
+  Q_SUBMIT_JOB = 1;
+  Q_ADMINISTER_QUEUE_JOBS = 2;
+  Q_ADMINISTER_QUEUE = 3;
+}
+
+message QueueUserACLInfoProto {
+  optional string queueName = 1;
+  repeated QueueACLProto userAcls = 2;
+}
 
 ////////////////////////////////////////////////////////////////////////
 ////// From container_manager //////////////////////////////////////////

Modified: hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/proto/yarn_service_protos.proto
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/proto/yarn_service_protos.proto?rev=1096670&r1=1096669&r2=1096670&view=diff
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/proto/yarn_service_protos.proto (original)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/proto/yarn_service_protos.proto Tue Apr 26 06:26:43 2011
@@ -99,6 +99,13 @@ message GetQueueInfoResponseProto {
   optional QueueInfoProto queueInfo = 1;
 }
 
+message GetQueueUserAclsInfoRequestProto {
+}
+
+message GetQueueUserAclsInfoResponseProto {
+  repeated QueueUserACLInfoProto queueUserAcls = 1; 
+}
+
 //////////////////////////////////////////////////////
 /////// client_NM_Protocol ///////////////////////////
 //////////////////////////////////////////////////////

Modified: hadoop/mapreduce/branches/MR-279/yarn/yarn-common/src/main/java/org/apache/hadoop/yarn/api/impl/pb/client/ClientRMProtocolPBClientImpl.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-common/src/main/java/org/apache/hadoop/yarn/api/impl/pb/client/ClientRMProtocolPBClientImpl.java?rev=1096670&r1=1096669&r2=1096670&view=diff
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-common/src/main/java/org/apache/hadoop/yarn/api/impl/pb/client/ClientRMProtocolPBClientImpl.java (original)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-common/src/main/java/org/apache/hadoop/yarn/api/impl/pb/client/ClientRMProtocolPBClientImpl.java Tue Apr 26 06:26:43 2011
@@ -21,6 +21,8 @@ import org.apache.hadoop.yarn.api.protoc
 import org.apache.hadoop.yarn.api.protocolrecords.GetNewApplicationIdResponse;
 import org.apache.hadoop.yarn.api.protocolrecords.GetQueueInfoRequest;
 import org.apache.hadoop.yarn.api.protocolrecords.GetQueueInfoResponse;
+import org.apache.hadoop.yarn.api.protocolrecords.GetQueueUserAclsInfoRequest;
+import org.apache.hadoop.yarn.api.protocolrecords.GetQueueUserAclsInfoResponse;
 import org.apache.hadoop.yarn.api.protocolrecords.SubmitApplicationRequest;
 import org.apache.hadoop.yarn.api.protocolrecords.SubmitApplicationResponse;
 import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.FinishApplicationRequestPBImpl;
@@ -37,6 +39,8 @@ import org.apache.hadoop.yarn.api.protoc
 import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.GetNewApplicationIdResponsePBImpl;
 import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.GetQueueInfoRequestPBImpl;
 import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.GetQueueInfoResponsePBImpl;
+import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.GetQueueUserAclsInfoRequestPBImpl;
+import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.GetQueueUserAclsInfoResponsePBImpl;
 import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.SubmitApplicationRequestPBImpl;
 import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.SubmitApplicationResponsePBImpl;
 import org.apache.hadoop.yarn.exceptions.YarnRemoteException;
@@ -48,6 +52,7 @@ import org.apache.hadoop.yarn.proto.Yarn
 import org.apache.hadoop.yarn.proto.YarnServiceProtos.GetClusterMetricsRequestProto;
 import org.apache.hadoop.yarn.proto.YarnServiceProtos.GetClusterNodesRequestProto;
 import org.apache.hadoop.yarn.proto.YarnServiceProtos.GetNewApplicationIdRequestProto;
+import org.apache.hadoop.yarn.proto.YarnServiceProtos.GetQueueUserAclsInfoRequestProto;
 import org.apache.hadoop.yarn.proto.YarnServiceProtos.SubmitApplicationRequestProto;
 import org.apache.hadoop.yarn.proto.YarnServiceProtos.GetQueueInfoRequestProto;
 import org.apache.hadoop.yarn.proto.YarnServiceProtos.GetQueueInfoResponseProto;
@@ -206,4 +211,23 @@ public class ClientRMProtocolPBClientImp
     }
   }
 
+  @Override
+  public GetQueueUserAclsInfoResponse getQueueUserAcls(
+      GetQueueUserAclsInfoRequest request) throws YarnRemoteException {
+    GetQueueUserAclsInfoRequestProto requestProto =
+      ((GetQueueUserAclsInfoRequestPBImpl)request).getProto();
+    try {
+      return new GetQueueUserAclsInfoResponsePBImpl(
+          proxy.getQueueUserAcls(null, requestProto));
+    } catch (ServiceException e) {
+      if (e.getCause() instanceof YarnRemoteException) {
+        throw (YarnRemoteException)e.getCause();
+      } else if (e.getCause() instanceof UndeclaredThrowableException) {
+        throw (UndeclaredThrowableException)e.getCause();
+      } else {
+        throw new UndeclaredThrowableException(e);
+      }
+    }
+  }
+
 }

Modified: hadoop/mapreduce/branches/MR-279/yarn/yarn-common/src/main/java/org/apache/hadoop/yarn/api/impl/pb/service/ClientRMProtocolPBServiceImpl.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-common/src/main/java/org/apache/hadoop/yarn/api/impl/pb/service/ClientRMProtocolPBServiceImpl.java?rev=1096670&r1=1096669&r2=1096670&view=diff
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-common/src/main/java/org/apache/hadoop/yarn/api/impl/pb/service/ClientRMProtocolPBServiceImpl.java (original)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-common/src/main/java/org/apache/hadoop/yarn/api/impl/pb/service/ClientRMProtocolPBServiceImpl.java Tue Apr 26 06:26:43 2011
@@ -8,6 +8,7 @@ import org.apache.hadoop.yarn.api.protoc
 import org.apache.hadoop.yarn.api.protocolrecords.GetClusterNodesResponse;
 import org.apache.hadoop.yarn.api.protocolrecords.GetNewApplicationIdResponse;
 import org.apache.hadoop.yarn.api.protocolrecords.GetQueueInfoResponse;
+import org.apache.hadoop.yarn.api.protocolrecords.GetQueueUserAclsInfoResponse;
 import org.apache.hadoop.yarn.api.protocolrecords.SubmitApplicationResponse;
 import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.FinishApplicationRequestPBImpl;
 import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.FinishApplicationResponsePBImpl;
@@ -23,6 +24,8 @@ import org.apache.hadoop.yarn.api.protoc
 import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.GetNewApplicationIdResponsePBImpl;
 import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.GetQueueInfoRequestPBImpl;
 import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.GetQueueInfoResponsePBImpl;
+import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.GetQueueUserAclsInfoRequestPBImpl;
+import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.GetQueueUserAclsInfoResponsePBImpl;
 import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.SubmitApplicationRequestPBImpl;
 import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.SubmitApplicationResponsePBImpl;
 import org.apache.hadoop.yarn.exceptions.YarnRemoteException;
@@ -41,6 +44,8 @@ import org.apache.hadoop.yarn.proto.Yarn
 import org.apache.hadoop.yarn.proto.YarnServiceProtos.GetNewApplicationIdResponseProto;
 import org.apache.hadoop.yarn.proto.YarnServiceProtos.GetQueueInfoRequestProto;
 import org.apache.hadoop.yarn.proto.YarnServiceProtos.GetQueueInfoResponseProto;
+import org.apache.hadoop.yarn.proto.YarnServiceProtos.GetQueueUserAclsInfoRequestProto;
+import org.apache.hadoop.yarn.proto.YarnServiceProtos.GetQueueUserAclsInfoResponseProto;
 import org.apache.hadoop.yarn.proto.YarnServiceProtos.SubmitApplicationRequestProto;
 import org.apache.hadoop.yarn.proto.YarnServiceProtos.SubmitApplicationResponseProto;
 
@@ -157,4 +162,18 @@ public class ClientRMProtocolPBServiceIm
     }
   }
 
+  @Override
+  public GetQueueUserAclsInfoResponseProto getQueueUserAcls(
+      RpcController controller, GetQueueUserAclsInfoRequestProto proto)
+      throws ServiceException {
+    GetQueueUserAclsInfoRequestPBImpl request =
+      new GetQueueUserAclsInfoRequestPBImpl(proto);
+    try {
+      GetQueueUserAclsInfoResponse response = real.getQueueUserAcls(request);
+      return ((GetQueueUserAclsInfoResponsePBImpl)response).getProto();
+    } catch (YarnRemoteException e) {
+      throw new ServiceException(e);
+    }
+  }
+
 }

Modified: hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ClientRMService.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ClientRMService.java?rev=1096670&r1=1096669&r2=1096670&view=diff
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ClientRMService.java (original)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ClientRMService.java Tue Apr 26 06:26:43 2011
@@ -45,6 +45,8 @@ import org.apache.hadoop.yarn.api.protoc
 import org.apache.hadoop.yarn.api.protocolrecords.GetNewApplicationIdResponse;
 import org.apache.hadoop.yarn.api.protocolrecords.GetQueueInfoRequest;
 import org.apache.hadoop.yarn.api.protocolrecords.GetQueueInfoResponse;
+import org.apache.hadoop.yarn.api.protocolrecords.GetQueueUserAclsInfoRequest;
+import org.apache.hadoop.yarn.api.protocolrecords.GetQueueUserAclsInfoResponse;
 import org.apache.hadoop.yarn.api.protocolrecords.SubmitApplicationRequest;
 import org.apache.hadoop.yarn.api.protocolrecords.SubmitApplicationResponse;
 import org.apache.hadoop.yarn.api.records.ApplicationId;
@@ -218,6 +220,15 @@ public class ClientRMService extends Abs
   }
 
   @Override
+  public GetQueueUserAclsInfoResponse getQueueUserAcls(
+      GetQueueUserAclsInfoRequest request) throws YarnRemoteException {
+    GetQueueUserAclsInfoResponse response = 
+      recordFactory.newRecordInstance(GetQueueUserAclsInfoResponse.class);
+    response.setUserAclsInfoList(scheduler.getQueueUserAclInfo());
+    return response;
+  }
+
+  @Override
   public void stop() {
     if (this.server != null) {
         this.server.close();

Modified: hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/Queue.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/Queue.java?rev=1096670&r1=1096669&r2=1096670&view=diff
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/Queue.java (original)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/Queue.java Tue Apr 26 06:26:43 2011
@@ -18,9 +18,16 @@
 
 package org.apache.hadoop.yarn.server.resourcemanager.scheduler;
 
+import java.util.List;
+import java.util.Map;
+
 import org.apache.hadoop.classification.InterfaceAudience.LimitedPrivate;
 import org.apache.hadoop.classification.InterfaceStability.Evolving;
+import org.apache.hadoop.security.UserGroupInformation;
+import org.apache.hadoop.security.authorize.AccessControlList;
+import org.apache.hadoop.yarn.api.records.QueueACL;
 import org.apache.hadoop.yarn.api.records.QueueInfo;
+import org.apache.hadoop.yarn.api.records.QueueUserACLInfo;
 
 @Evolving
 @LimitedPrivate("yarn")
@@ -31,7 +38,12 @@ public interface Queue {
    */
   String getQueueName();
 
-
+  /**
+   * Get ACLs for the queue.
+   * @return ACLs for the queue
+   */
+  public Map<QueueACL, AccessControlList> getQueueAcls();
+  
   /**
    * Get queue information
    * @param includeApplications include applications?
@@ -41,4 +53,11 @@ public interface Queue {
    */
   QueueInfo getQueueInfo(boolean includeApplications, 
       boolean includeChildQueues, boolean recursive);
+  
+  /**
+   * Get queue ACLs for given <code>user</code>.
+   * @param user username
+   * @return queue ACLs for user
+   */
+  List<QueueUserACLInfo> getQueueUserAclInfo(UserGroupInformation user);
 }

Modified: hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/YarnScheduler.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/YarnScheduler.java?rev=1096670&r1=1096669&r2=1096670&view=diff
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/YarnScheduler.java (original)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/YarnScheduler.java Tue Apr 26 06:26:43 2011
@@ -26,6 +26,7 @@ import org.apache.hadoop.yarn.api.record
 import org.apache.hadoop.yarn.api.records.Container;
 import org.apache.hadoop.yarn.api.records.Priority;
 import org.apache.hadoop.yarn.api.records.QueueInfo;
+import org.apache.hadoop.yarn.api.records.QueueUserACLInfo;
 import org.apache.hadoop.yarn.api.records.ResourceRequest;
 
 /**
@@ -78,4 +79,10 @@ public interface YarnScheduler {
       boolean includeChildQueues, boolean recursive) 
   throws IOException;
 
+  /**
+   * Get acls for queues for current user.
+   * @return acls for queues for current user
+   * @throws IOException
+   */
+  public List<QueueUserACLInfo> getQueueUserAclInfo();
 }

Modified: hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/CapacityScheduler.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/CapacityScheduler.java?rev=1096670&r1=1096669&r2=1096670&view=diff
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/CapacityScheduler.java (original)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/CapacityScheduler.java Tue Apr 26 06:26:43 2011
@@ -20,6 +20,7 @@ package org.apache.hadoop.yarn.server.re
 
 import java.io.IOException;
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.Comparator;
 import java.util.HashMap;
 import java.util.List;
@@ -34,10 +35,12 @@ import org.apache.hadoop.classification.
 import org.apache.hadoop.classification.InterfaceStability.Evolving;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.security.AccessControlException;
+import org.apache.hadoop.security.UserGroupInformation;
 import org.apache.hadoop.yarn.api.records.ApplicationId;
 import org.apache.hadoop.yarn.api.records.Container;
 import org.apache.hadoop.yarn.api.records.Priority;
 import org.apache.hadoop.yarn.api.records.QueueInfo;
+import org.apache.hadoop.yarn.api.records.QueueUserACLInfo;
 import org.apache.hadoop.yarn.api.records.Resource;
 import org.apache.hadoop.yarn.api.records.ResourceRequest;
 import org.apache.hadoop.yarn.factory.providers.RecordFactoryProvider;
@@ -320,6 +323,19 @@ implements ResourceScheduler, CapacitySc
     return queue.getQueueInfo(includeApplications, includeChildQueues, recursive);
   }
 
+  @Override
+  public List<QueueUserACLInfo> getQueueUserAclInfo() {
+    UserGroupInformation user = null;
+    try {
+      user = UserGroupInformation.getCurrentUser();
+    } catch (IOException ioe) {
+      // should never happen
+      return new ArrayList<QueueUserACLInfo>();
+    }
+
+    return root.getQueueUserAclInfo(user);
+  }
+
   private void normalizeRequests(List<ResourceRequest> asks) {
     for (ResourceRequest ask : asks) {
       normalizeRequest(ask);

Modified: hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/CapacitySchedulerConfiguration.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/CapacitySchedulerConfiguration.java?rev=1096670&r1=1096669&r2=1096670&view=diff
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/CapacitySchedulerConfiguration.java (original)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/CapacitySchedulerConfiguration.java Tue Apr 26 06:26:43 2011
@@ -18,11 +18,16 @@
 
 package org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity;
 
+import java.util.HashMap;
+import java.util.Map;
+
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.classification.InterfaceAudience.Private;
 import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.security.authorize.AccessControlList;
 import org.apache.hadoop.util.StringUtils;
+import org.apache.hadoop.yarn.api.records.QueueACL;
 import org.apache.hadoop.yarn.api.records.QueueState;
 import org.apache.hadoop.yarn.api.records.Resource;
 
@@ -85,6 +90,9 @@ public class CapacitySchedulerConfigurat
   @Private
   public static float DEFAULT_USER_LIMIT_FACTOR = 1.0f;
   
+  @Private
+  public static String DEFAULT_ACL = "*";
+  
   public CapacitySchedulerConfiguration() {
     this(new Configuration());
   }
@@ -116,6 +124,12 @@ public class CapacitySchedulerConfigurat
     return capacity;
   }
   
+  public void setCapacity(String queue, int capacity) {
+    setInt(getQueuePrefix(queue) + CAPACITY, capacity);
+    LOG.info("CSConf - setCapacity: queuePrefix=" + getQueuePrefix(queue) + 
+        ", capacity=" + capacity);
+  }
+
   public int getMaximumCapacity(String queue) {
     int maxCapacity = 
       getInt(getQueuePrefix(queue) + MAXIMUM_CAPACITY, UNDEFINED);
@@ -141,15 +155,26 @@ public class CapacitySchedulerConfigurat
   
   public QueueState getState(String queue) {
     String state = get(getQueuePrefix(queue) + STATE);
-    return (state != null) ? QueueState.valueOf(state.toUpperCase()) : QueueState.RUNNING;
+    return (state != null) ? 
+        QueueState.valueOf(state.toUpperCase()) : QueueState.RUNNING;
   }
-
-  public void setCapacity(String queue, int capacity) {
-    setInt(getQueuePrefix(queue) + CAPACITY, capacity);
-    LOG.info("CSConf - setCapacity: queuePrefix=" + getQueuePrefix(queue) + 
-        ", capacity=" + capacity);
+  
+  private static String getAclKey(QueueACL acl) {
+    return "acl_" + acl.toString().toLowerCase();
   }
   
+  public Map<QueueACL, AccessControlList> getAcls(String queue) {
+    Map<QueueACL, AccessControlList> acls = 
+      new HashMap<QueueACL, AccessControlList>();
+    String queuePrefix = getQueuePrefix(queue);
+    for (QueueACL acl : QueueACL.values()) {
+      acls.put(acl, 
+          new AccessControlList(get(queuePrefix + getAclKey(acl), 
+              DEFAULT_ACL)));
+    }
+    return acls;
+  }
+
   public String[] getQueues(String queue) {
     LOG.info("CSConf - getQueues called for: queuePrefix=" + getQueuePrefix(queue));
     String[] queues = getStrings(getQueuePrefix(queue) + QUEUES);

Modified: hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/LeafQueue.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/LeafQueue.java?rev=1096670&r1=1096669&r2=1096670&view=diff
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/LeafQueue.java (original)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/LeafQueue.java Tue Apr 26 06:26:43 2011
@@ -21,6 +21,7 @@ package org.apache.hadoop.yarn.server.re
 import java.io.IOException;
 import java.nio.ByteBuffer;
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.Comparator;
 import java.util.HashMap;
 import java.util.List;
@@ -34,12 +35,15 @@ import org.apache.hadoop.classification.
 import org.apache.hadoop.classification.InterfaceStability.Unstable;
 import org.apache.hadoop.security.AccessControlException;
 import org.apache.hadoop.security.UserGroupInformation;
+import org.apache.hadoop.security.authorize.AccessControlList;
 import org.apache.hadoop.yarn.api.records.ApplicationId;
 import org.apache.hadoop.yarn.api.records.Container;
 import org.apache.hadoop.yarn.api.records.ContainerToken;
 import org.apache.hadoop.yarn.api.records.Priority;
+import org.apache.hadoop.yarn.api.records.QueueACL;
 import org.apache.hadoop.yarn.api.records.QueueInfo;
 import org.apache.hadoop.yarn.api.records.QueueState;
+import org.apache.hadoop.yarn.api.records.QueueUserACLInfo;
 import org.apache.hadoop.yarn.api.records.Resource;
 import org.apache.hadoop.yarn.api.records.ResourceRequest;
 import org.apache.hadoop.yarn.factories.RecordFactory;
@@ -87,7 +91,10 @@ public class LeafQueue implements Queue 
   applicationInfos;
   
   private QueueState state;
-  
+
+  private Map<QueueACL, AccessControlList> acls = 
+    new HashMap<QueueACL, AccessControlList>();
+
   private final RecordFactory recordFactory = 
     RecordFactoryProvider.getRecordFactory(null);
 
@@ -128,11 +135,14 @@ public class LeafQueue implements Queue 
 
     QueueState state = cs.getConfiguration().getState(getQueuePath());
     
+    Map<QueueACL, AccessControlList> acls = 
+      cs.getConfiguration().getAcls(getQueuePath());
+    
     setupQueueConfigs(capacity, absoluteCapacity, 
         maximumCapacity, absoluteMaxCapacity, 
         userLimit, userLimitFactor, 
         maxApplications, maxApplicationsPerUser,
-        state);
+        state, acls);
 
     LOG.info("DEBUG --- LeafQueue:" +
     		" name=" + queueName + 
@@ -146,7 +156,7 @@ public class LeafQueue implements Queue 
           float maxCapacity, float absoluteMaxCapacity,
           int userLimit, float userLimitFactor,
           int maxApplications, int maxApplicationsPerUser,
-          QueueState state)
+          QueueState state, Map<QueueACL, AccessControlList> acls)
   {
     this.capacity = capacity; 
     this.absoluteCapacity = parent.getAbsoluteCapacity() * capacity;
@@ -162,10 +172,17 @@ public class LeafQueue implements Queue 
 
     this.state = state;
     
+    this.acls = acls;
+    
     this.queueInfo.setCapacity(capacity);
     this.queueInfo.setMaximumCapacity(maximumCapacity);
     this.queueInfo.setQueueState(state);
     
+    StringBuilder aclsString = new StringBuilder();
+    for (Map.Entry<QueueACL, AccessControlList> e : acls.entrySet()) {
+      aclsString.append(e.getKey() + ":" + e.getValue().getAclString());
+    }
+    
     LOG.info(queueName +
         ", capacity=" + capacity + 
         ", asboluteCapacity=" + absoluteCapacity + 
@@ -174,9 +191,9 @@ public class LeafQueue implements Queue 
         ", userLimit=" + userLimit + ", userLimitFactor=" + userLimitFactor + 
         ", maxApplications=" + maxApplications + 
         ", maxApplicationsPerUser=" + maxApplicationsPerUser + 
-        ", state=" + state);
+        ", state=" + state +
+        ", acls=" + aclsString);
   }
-      
 
   @Override
   public float getCapacity() {
@@ -260,6 +277,11 @@ public class LeafQueue implements Queue 
   }
 
   @Override
+  public synchronized Map<QueueACL, AccessControlList> getQueueAcls() {
+    return new HashMap<QueueACL, AccessControlList>(acls);
+  }
+
+  @Override
   public synchronized QueueInfo getQueueInfo(boolean includeApplications, 
       boolean includeChildQueues, boolean recursive) {
     queueInfo.setCurrentCapacity(usedCapacity);
@@ -276,6 +298,26 @@ public class LeafQueue implements Queue 
     return queueInfo;
   }
 
+  @Override
+  public synchronized List<QueueUserACLInfo> 
+  getQueueUserAclInfo(UserGroupInformation user) {
+    QueueUserACLInfo userAclInfo = 
+      recordFactory.newRecordInstance(QueueUserACLInfo.class);
+    List<QueueACL> operations = new ArrayList<QueueACL>();
+    for (Map.Entry<QueueACL, AccessControlList> e : acls.entrySet()) {
+      QueueACL operation = e.getKey();
+      AccessControlList acl = e.getValue();
+      
+      if (acl.isUserAllowed(user)) {
+        operations.add(operation);
+      }
+    }
+    
+    userAclInfo.setQueueName(getQueueName());
+    userAclInfo.setUserAcls(operations);
+    return Collections.singletonList(userAclInfo);
+  }
+
   public String toString() {
     return queueName + ":" + capacity + ":" + absoluteCapacity + ":" + 
       getUsedCapacity() + ":" + getUtilization() + ":" + 
@@ -306,20 +348,46 @@ public class LeafQueue implements Queue 
         leafQueue.maximumCapacity, leafQueue.absoluteMaxCapacity, 
         leafQueue.userLimit, leafQueue.userLimitFactor, 
         leafQueue.maxApplications, leafQueue.maxApplicationsPerUser,
-        leafQueue.state);
+        leafQueue.state, leafQueue.acls);
     
     update(clusterResource);
   }
 
   @Override
+  public boolean hasAccess(QueueACL acl, UserGroupInformation user) {
+    // Check if the leaf-queue allows access
+    synchronized (this) {
+      if (acls.get(acl).isUserAllowed(user)) {
+        return true;
+      }
+    }
+
+    // Check if parent-queue allows access
+    return parent.hasAccess(acl, user);
+  }
+
+  @Override
   public void submitApplication(Application application, String userName,
       String queue, Priority priority) 
   throws AccessControlException {
     // Careful! Locking order is important!
-    User user = null;
     
+    // Check queue ACLs
+    UserGroupInformation userUgi;
+    try {
+      userUgi = UserGroupInformation.getCurrentUser();
+    } catch (IOException ioe) {
+      throw new AccessControlException(ioe);
+    }
+    if (!hasAccess(QueueACL.SUBMIT_JOB, userUgi)) {
+      throw new AccessControlException("User " + userName + " cannot submit" +
+          " jobs to queue " + getQueuePath());
+    }
+    
+    User user = null;
     synchronized (this) {
       
+      // Check if the queue is accepting jobs
       if (state != QueueState.RUNNING) {
         throw new AccessControlException("Queue " + getQueuePath() +
             " is STOPPED. Cannot accept submission of application: " +

Modified: hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/ParentQueue.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/ParentQueue.java?rev=1096670&r1=1096669&r2=1096670&view=diff
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/ParentQueue.java (original)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/ParentQueue.java Tue Apr 26 06:26:43 2011
@@ -34,18 +34,21 @@ import org.apache.commons.logging.LogFac
 import org.apache.hadoop.classification.InterfaceAudience.Private;
 import org.apache.hadoop.classification.InterfaceStability.Evolving;
 import org.apache.hadoop.security.AccessControlException;
+import org.apache.hadoop.security.UserGroupInformation;
+import org.apache.hadoop.security.authorize.AccessControlList;
 import org.apache.hadoop.yarn.api.records.ApplicationId;
 import org.apache.hadoop.yarn.api.records.Container;
 import org.apache.hadoop.yarn.api.records.Priority;
+import org.apache.hadoop.yarn.api.records.QueueACL;
 import org.apache.hadoop.yarn.api.records.QueueInfo;
 import org.apache.hadoop.yarn.api.records.QueueState;
+import org.apache.hadoop.yarn.api.records.QueueUserACLInfo;
 import org.apache.hadoop.yarn.api.records.Resource;
 import org.apache.hadoop.yarn.factories.RecordFactory;
 import org.apache.hadoop.yarn.factory.providers.RecordFactoryProvider;
 import org.apache.hadoop.yarn.server.resourcemanager.resourcetracker.NodeInfo;
 import org.apache.hadoop.yarn.server.resourcemanager.scheduler.Application;
 import org.apache.hadoop.yarn.server.resourcemanager.scheduler.NodeManager;
-import org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.LeafQueue.User;
 
 @Private
 @Evolving
@@ -83,6 +86,9 @@ public class ParentQueue implements Queu
   private Map<ApplicationId, org.apache.hadoop.yarn.api.records.Application> 
   applicationInfos;
 
+  private Map<QueueACL, AccessControlList> acls = 
+    new HashMap<QueueACL, AccessControlList>();
+
   private final RecordFactory recordFactory = 
     RecordFactoryProvider.getRecordFactory(null);
 
@@ -108,13 +114,16 @@ public class ParentQueue implements Queu
           Float.MAX_VALUE :  (parentAbsoluteCapacity * maximumCapacity) / 100;
     
     QueueState state = cs.getConfiguration().getState(getQueuePath());
+
+    Map<QueueACL, AccessControlList> acls = 
+      cs.getConfiguration().getAcls(getQueuePath());
     
     this.queueInfo = recordFactory.newRecordInstance(QueueInfo.class);
     this.queueInfo.setQueueName(queueName);
     this.queueInfo.setChildQueues(new ArrayList<QueueInfo>());
 
     setupQueueConfigs(capacity, absoluteCapacity, 
-        maximumCapacity, absoluteMaxCapacity, state);
+        maximumCapacity, absoluteMaxCapacity, state, acls);
     
     this.queueComparator = comparator;
     this.childQueues = new TreeSet<Queue>(comparator);
@@ -132,7 +141,7 @@ public class ParentQueue implements Queu
   private synchronized void setupQueueConfigs(
           float capacity, float absoluteCapacity, 
           float maximumCapacity, float absoluteMaxCapacity,
-          QueueState state
+          QueueState state, Map<QueueACL, AccessControlList> acls
   ) {
     this.capacity = capacity;
     this.absoluteCapacity = absoluteCapacity;
@@ -140,17 +149,25 @@ public class ParentQueue implements Queu
     this.absoluteMaxCapacity = absoluteMaxCapacity;
 
     this.state = state;
+
+    this.acls = acls;
     
     this.queueInfo.setCapacity(capacity);
     this.queueInfo.setMaximumCapacity(maximumCapacity);
     this.queueInfo.setQueueState(state);
 
+    StringBuilder aclsString = new StringBuilder();
+    for (Map.Entry<QueueACL, AccessControlList> e : acls.entrySet()) {
+      aclsString.append(e.getKey() + ":" + e.getValue().getAclString());
+    }
+
     LOG.info(queueName +
         ", capacity=" + capacity +
         ", asboluteCapacity=" + absoluteCapacity +
         ", maxCapacity=" + maximumCapacity +
         ", asboluteMaxCapacity=" + absoluteMaxCapacity + 
-        ", state=" + state);
+        ", state=" + state +
+        ", acls=" + aclsString);
   }
 
   private static float PRECISION = 0.005f; // 0.05% precision
@@ -250,6 +267,11 @@ public class ParentQueue implements Queu
   }
 
   @Override
+  public Map<QueueACL, AccessControlList> getQueueAcls() {
+    return new HashMap<QueueACL, AccessControlList>(acls);
+  }
+
+  @Override
   public synchronized QueueInfo getQueueInfo(boolean includeApplications, 
       boolean includeChildQueues, boolean recursive) {
     queueInfo.setCurrentCapacity(usedCapacity);
@@ -274,7 +296,41 @@ public class ParentQueue implements Queu
     queueInfo.setChildQueues(childQueuesInfo);
     
     return queueInfo;
-}
+  }
+
+  private synchronized QueueUserACLInfo getUserAclInfo(
+      UserGroupInformation user) {
+    QueueUserACLInfo userAclInfo = 
+      recordFactory.newRecordInstance(QueueUserACLInfo.class);
+    List<QueueACL> operations = new ArrayList<QueueACL>();
+    for (Map.Entry<QueueACL, AccessControlList> e : acls.entrySet()) {
+      QueueACL operation = e.getKey();
+      AccessControlList acl = e.getValue();
+      
+      if (acl.isUserAllowed(user)) {
+        operations.add(operation);
+      }
+    }
+    
+    userAclInfo.setQueueName(getQueueName());
+    userAclInfo.setUserAcls(operations);
+    return userAclInfo;
+  }
+  
+  @Override
+  public synchronized List<QueueUserACLInfo> getQueueUserAclInfo(
+      UserGroupInformation user) {
+    List<QueueUserACLInfo> userAcls = new ArrayList<QueueUserACLInfo>();
+    
+    // Add parent queue acls
+    userAcls.add(getUserAclInfo(user));
+    
+    // Add children queue acls
+    for (Queue child : childQueues) {
+      userAcls.addAll(child.getQueueUserAclInfo(user));
+    }
+    return userAcls;
+  }
 
   public String toString() {
     return queueName + ":" + capacity + ":" + absoluteCapacity + ":" + 
@@ -320,7 +376,7 @@ public class ParentQueue implements Queu
     // Set new configs
     setupQueueConfigs(parentQueue.capacity, parentQueue.absoluteCapacity,
         parentQueue.maximumCapacity, parentQueue.absoluteMaxCapacity,
-        parentQueue.state);
+        parentQueue.state, parentQueue.acls);
 
     // Update
     update(clusterResource);
@@ -335,6 +391,21 @@ public class ParentQueue implements Queu
   }
   
   @Override
+  public boolean hasAccess(QueueACL acl, UserGroupInformation user) {
+    synchronized (this) {
+      if (acls.get(acl).isUserAllowed(user)) {
+        return true;
+      }
+    }
+    
+    if (parent != null) {
+      return parent.hasAccess(acl, user);
+    }
+    
+    return false;
+  }
+
+  @Override
   public void submitApplication(Application application, String user,
       String queue, Priority priority) 
   throws AccessControlException {

Modified: hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/Queue.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/Queue.java?rev=1096670&r1=1096669&r2=1096670&view=diff
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/Queue.java (original)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/Queue.java Tue Apr 26 06:26:43 2011
@@ -24,8 +24,10 @@ import java.util.List;
 import org.apache.hadoop.classification.InterfaceAudience.Private;
 import org.apache.hadoop.classification.InterfaceStability.Stable;
 import org.apache.hadoop.security.AccessControlException;
+import org.apache.hadoop.security.UserGroupInformation;
 import org.apache.hadoop.yarn.api.records.Container;
 import org.apache.hadoop.yarn.api.records.Priority;
+import org.apache.hadoop.yarn.api.records.QueueACL;
 import org.apache.hadoop.yarn.api.records.QueueState;
 import org.apache.hadoop.yarn.api.records.Resource;
 import org.apache.hadoop.yarn.server.resourcemanager.scheduler.Application;
@@ -128,6 +130,15 @@ extends org.apache.hadoop.yarn.server.re
   public List<Application> getApplications();
   
   /**
+   * Check if the <code>user</code> has permission to perform the operation
+   * @param acl ACL
+   * @param user user
+   * @return <code>true</code> if the user has the permission, 
+   *         <code>false</code> otherwise
+   */
+  public boolean hasAccess(QueueACL acl, UserGroupInformation user);
+  
+  /**
    * Submit a new application to the queue.
    * @param application application being submitted
    * @param user user who submitted the application

Modified: hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fifo/FifoScheduler.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fifo/FifoScheduler.java?rev=1096670&r1=1096669&r2=1096670&view=diff
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fifo/FifoScheduler.java (original)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fifo/FifoScheduler.java Tue Apr 26 06:26:43 2011
@@ -22,6 +22,8 @@ import java.io.IOException;
 import java.nio.ByteBuffer;
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Collections;
+import java.util.Enumeration;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -33,11 +35,14 @@ import org.apache.hadoop.classification.
 import org.apache.hadoop.classification.InterfaceStability.Evolving;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.security.UserGroupInformation;
+import org.apache.hadoop.security.authorize.AccessControlList;
 import org.apache.hadoop.yarn.api.records.ApplicationId;
 import org.apache.hadoop.yarn.api.records.Container;
 import org.apache.hadoop.yarn.api.records.ContainerToken;
 import org.apache.hadoop.yarn.api.records.Priority;
+import org.apache.hadoop.yarn.api.records.QueueACL;
 import org.apache.hadoop.yarn.api.records.QueueInfo;
+import org.apache.hadoop.yarn.api.records.QueueUserACLInfo;
 import org.apache.hadoop.yarn.api.records.Resource;
 import org.apache.hadoop.yarn.api.records.ResourceRequest;
 import org.apache.hadoop.yarn.factories.RecordFactory;
@@ -80,16 +85,18 @@ public class FifoScheduler implements Re
         new org.apache.hadoop.yarn.util.BuilderUtils.ApplicationIdComparator());
 
   private final Queue DEFAULT_QUEUE = new Queue() {
-    QueueInfo queueInfo;
+    
+    private static final String DEFAULT_QUEUE_NAME = "default";
     
     @Override
     public String getQueueName() {
-      return "default";
+      return DEFAULT_QUEUE_NAME;
     }
 
     @Override
     public QueueInfo getQueueInfo(boolean includeApplications, 
         boolean includeChildQueues, boolean recursive) {
+      QueueInfo queueInfo = recordFactory.newRecordInstance(QueueInfo.class);
       queueInfo.setQueueName(DEFAULT_QUEUE.getQueueName());
       queueInfo.setCapacity(100.0f);
       queueInfo.setMaximumCapacity(100.0f);
@@ -103,6 +110,26 @@ public class FifoScheduler implements Re
       }
       return queueInfo;
     }
+
+    @Override
+    public Map<QueueACL, AccessControlList> getQueueAcls() {
+      Map<QueueACL, AccessControlList> acls =
+        new HashMap<QueueACL, AccessControlList>();
+      for (QueueACL acl : QueueACL.values()) {
+        acls.put(acl, new AccessControlList("*"));
+      }
+      return acls;
+    }
+
+    @Override
+    public List<QueueUserACLInfo> getQueueUserAclInfo(
+        UserGroupInformation unused) {
+      QueueUserACLInfo queueUserAclInfo = 
+        recordFactory.newRecordInstance(QueueUserACLInfo.class);
+      queueUserAclInfo.setQueueName(DEFAULT_QUEUE_NAME);
+      queueUserAclInfo.setUserAcls(Arrays.asList(QueueACL.values()));
+      return Collections.singletonList(queueUserAclInfo);
+    }
   };
 
   public FifoScheduler() {}
@@ -484,11 +511,14 @@ public class FifoScheduler implements Re
   @Override
   public QueueInfo getQueueInfo(String queueName, boolean includeApplications,
       boolean includeChildQueues, boolean recursive) {
-    QueueInfo queueInfo = 
-      DEFAULT_QUEUE.getQueueInfo(includeApplications, false, false);
-    return queueInfo;
+    return DEFAULT_QUEUE.getQueueInfo(includeApplications, false, false);
   }
   
+  @Override
+  public List<QueueUserACLInfo> getQueueUserAclInfo() {
+    return DEFAULT_QUEUE.getQueueUserAclInfo(null); 
+  }
+
   private synchronized List<org.apache.hadoop.yarn.api.records.Application> 
   getApplications() {
     List<org.apache.hadoop.yarn.api.records.Application> applications = 

Modified: hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/TestAMLaunchFailure.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/TestAMLaunchFailure.java?rev=1096670&r1=1096669&r2=1096670&view=diff
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/TestAMLaunchFailure.java (original)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/TestAMLaunchFailure.java Tue Apr 26 06:26:43 2011
@@ -35,6 +35,7 @@ import org.apache.hadoop.yarn.api.record
 import org.apache.hadoop.yarn.api.records.Container;
 import org.apache.hadoop.yarn.api.records.Priority;
 import org.apache.hadoop.yarn.api.records.QueueInfo;
+import org.apache.hadoop.yarn.api.records.QueueUserACLInfo;
 import org.apache.hadoop.yarn.api.records.ResourceRequest;
 import org.apache.hadoop.yarn.conf.YarnConfiguration;
 import org.apache.hadoop.yarn.event.EventHandler;
@@ -88,6 +89,11 @@ public class TestAMLaunchFailure extends
         boolean recursive) throws IOException {
       return null;
     }
+
+    @Override
+    public List<QueueUserACLInfo> getQueueUserAclInfo() {
+      return null;
+    }
   }
 
   private class DummyApplicationTracker implements EventHandler<ASMEvent<ApplicationTrackerEventType>> {

Modified: hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/TestAMRMRPCResponseId.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/TestAMRMRPCResponseId.java?rev=1096670&r1=1096669&r2=1096670&view=diff
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/TestAMRMRPCResponseId.java (original)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/TestAMRMRPCResponseId.java Tue Apr 26 06:26:43 2011
@@ -34,6 +34,7 @@ import org.apache.hadoop.yarn.api.record
 import org.apache.hadoop.yarn.api.records.Container;
 import org.apache.hadoop.yarn.api.records.Priority;
 import org.apache.hadoop.yarn.api.records.QueueInfo;
+import org.apache.hadoop.yarn.api.records.QueueUserACLInfo;
 import org.apache.hadoop.yarn.api.records.ResourceRequest;
 import org.apache.hadoop.yarn.factories.RecordFactory;
 import org.apache.hadoop.yarn.factory.providers.RecordFactoryProvider;
@@ -98,6 +99,11 @@ public class TestAMRMRPCResponseId exten
         boolean recursive) throws IOException {
       return null;
     }
+
+    @Override
+    public List<QueueUserACLInfo> getQueueUserAclInfo() {
+      return null;
+    }
   }
   
   @Before

Modified: hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/TestAMRestart.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/TestAMRestart.java?rev=1096670&r1=1096669&r2=1096670&view=diff
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/TestAMRestart.java (original)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/TestAMRestart.java Tue Apr 26 06:26:43 2011
@@ -23,6 +23,7 @@ import org.apache.hadoop.yarn.api.record
 import org.apache.hadoop.yarn.api.records.ContainerToken;
 import org.apache.hadoop.yarn.api.records.Priority;
 import org.apache.hadoop.yarn.api.records.QueueInfo;
+import org.apache.hadoop.yarn.api.records.QueueUserACLInfo;
 import org.apache.hadoop.yarn.api.records.Resource;
 import org.apache.hadoop.yarn.api.records.ResourceRequest;
 import org.apache.hadoop.yarn.conf.YarnConfiguration;
@@ -196,6 +197,10 @@ public class TestAMRestart extends TestC
         boolean recursive) throws IOException {
       return null;
     }
+    @Override
+    public List<QueueUserACLInfo> getQueueUserAclInfo() {
+      return null;
+    }
   }
 
   @Before

Modified: hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/TestSchedulerNegotiator.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/TestSchedulerNegotiator.java?rev=1096670&r1=1096669&r2=1096670&view=diff
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/TestSchedulerNegotiator.java (original)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/TestSchedulerNegotiator.java Tue Apr 26 06:26:43 2011
@@ -32,6 +32,7 @@ import org.apache.hadoop.yarn.api.record
 import org.apache.hadoop.yarn.api.records.ContainerId;
 import org.apache.hadoop.yarn.api.records.Priority;
 import org.apache.hadoop.yarn.api.records.QueueInfo;
+import org.apache.hadoop.yarn.api.records.QueueUserACLInfo;
 import org.apache.hadoop.yarn.api.records.Resource;
 import org.apache.hadoop.yarn.api.records.ResourceRequest;
 import org.apache.hadoop.yarn.event.EventHandler;
@@ -110,6 +111,10 @@ public class TestSchedulerNegotiator ext
         boolean recursive) throws IOException {
       return null;
     }
+    @Override
+    public List<QueueUserACLInfo> getQueueUserAclInfo() {
+      return null;
+    }
   }
   
   @Before



Mime
View raw message