浏览代码

commit b568029a39bcb5a895732495146de63537ae7299
Author: Vinay Kumar Thota <vinayt@yahoo-inc.com>
Date: Fri Oct 1 11:12:15 2010 +0000

HADOOP-6944 from https://issues.apache.org/jira/browse/HADOOP-6944


git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-0.20-security-patches@1077758 13f79535-47bb-0310-9956-ffa450edef68

Owen O'Malley 14 年之前
父节点
当前提交
09ba11a6fc
共有 1 个文件被更改,包括 90 次插入0 次删除
  1. 90 0
      src/test/system/java/org/apache/hadoop/test/system/ProxyUserDefinitions.java

+ 90 - 0
src/test/system/java/org/apache/hadoop/test/system/ProxyUserDefinitions.java

@@ -0,0 +1,90 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.test.system;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.io.IOException;
+import java.net.URI;
+
+/**
+ *  Its the data container which contains host names and
+ *  groups against each proxy user.
+ */
+public abstract class ProxyUserDefinitions {
+
+  /**
+   *  Groups and host names container
+   */
+  public 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>();
+  }
+
+  /**
+   * Add proxy user data to a container.
+   * @param userName - proxy user name.
+   * @param definitions - groups and host names.
+   */
+  public void addProxyUser (String userName, GroupsAndHost definitions) {
+    proxyUsers.put(userName, definitions);
+  }
+
+  /**
+   * Get the host names and groups against given proxy user.
+   * @return - GroupsAndHost object.
+   */
+  public GroupsAndHost getProxyUser (String userName) {
+    return proxyUsers.get(userName);
+  }
+
+  /**
+   * Get the Proxy users data which contains the host names
+   * and groups against each user.
+   * @return - the proxy users data as hash map.
+   */
+  public Map<String, GroupsAndHost> getProxyUsers () {
+    return proxyUsers;
+  }
+
+  /**
+   * 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;
+}