[ 
https://issues.apache.org/jira/browse/HADOOP-6944?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12912792#action_12912792
 ] 

Konstantin Boudnik commented on HADOOP-6944:
--------------------------------------------

I suggest to make the following changes:
  - change the signature of {{getHadoopMultiUsersList}} to
{{public ProxyUserDefinitions getHadoopMultiUsersList() throws IOException}}
and then
{noformat}
public abstract class ProxyUserDefinitions {
  class GroupsAndHost {
    private List<String> groups;
    private List<String> hosts;
    public List<String> getGroups() {
      return groups;
    }
    public void setGroups(List<String> groups) {
      this.groups = groups;
    }
    public List<String> getHosts() {
      return hosts;
    }
    public void setHosts(List<String> hosts) {
      this.hosts = hosts;
    }
  }
  
  protected Map<String, GroupsAndHost> proxyUsers;
  protected ProxyUserDefinitions () {
    proxyUsers = new HashMap<String, GroupsAndHost>();
  }  
  public void addProxyUser (String userName, GroupsAndHost definitions) {
    proxyUsers.put(userName, definitions);
  }
  public GroupsAndHost getProxyUser (String userName) {
    return proxyUsers.get(userName);
  }

  /**
   * The implementation of this method has to be provided by a child of the 
class
   * @param filePath
   * @return
   * @throws IOException
   */
  public abstract boolean writeToFile(URI filePath) throws IOException;
}{noformat}

so you will be able to store information in this form {{username: 
group[,group]*}} as well as the hostnames from where proxy users are allowed to 
connect. The purpose of this new method will be to extract only proxy-users 
related information from a daemon configuration and present it in the form a 
data container (above).

The data container provides the method {{writeToFile}} which has to be 
overwritten by an implementer in order to provide needed logic of how the 
content of object is stored into a file. Thus, you can inherit the class in 
your testcase (or whatever) and create writeToFile implementation you need 
(basically, the second method {{getProxyUsersFile}} of your patch  with some 
small modificaitons) for gridmix without adding unrelated functionality to 
Herriot base classes.

Makes sense?

> [Herriot] Implement a functionality for building proxy users file and proxy 
> users list.
> ---------------------------------------------------------------------------------------
>
>                 Key: HADOOP-6944
>                 URL: https://issues.apache.org/jira/browse/HADOOP-6944
>             Project: Hadoop Common
>          Issue Type: Task
>          Components: test
>            Reporter: Vinay Kumar Thota
>            Assignee: Vinay Kumar Thota
>         Attachments: HADOOP-6944.patch, HADOOP-6944.patch
>
>
> Gridmix should require a proxy user's file for impersonating various jobs. 
> So, implement couple of methods for getting the proxy users list and a proxy 
> users file (it's a combination of proxy users and groups) based on cluster 
> configuration.
> The proxy users list should require for map reduce jobs and proxy users file 
> should require for gridmix jobs.
> The following are methods signature,
> public String getProxyUsersFile() - getting the proxy users file based on 
> cluster configuration information.
> public String buildProxyUsersFile() - Build the proxy users file using the 
> cluster configuration.
> public ArraryList<String> getHadoopMultiUsersList() - get the list of proxy 
> users list based on cluster configuration.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to