Bladeren bron

[core] Remove Static Group Mapping lib

Romain Rigaux 12 jaren geleden
bovenliggende
commit
32fc52a52f

+ 1 - 24
desktop/libs/hadoop/Makefile

@@ -44,12 +44,6 @@ PLUGIN_JAVA_LIB := $(PLUGIN_DIR)/java-lib
 PLUGIN_JAVA_DIR := $(PLUGIN_DIR)/java
 BLD_DIR_PLUGINS := $(PLUGIN_DIR)/java/target
 
-STATIC_GROUP_MAPPING_DIR := $(realpath .)/static-group-mapping
-STATIC_GROUP_MAPPING_SRC := $(STATIC_GROUP_MAPPING_DIR)/src
-STATIC_GROUP_MAPPING_BUILD := $(STATIC_GROUP_MAPPING_DIR)/target
-STATIC_GROUP_MAPPING_LIB := $(STATIC_GROUP_MAPPING_DIR)/java-lib
-STATIC_GROUP_MAPPING := $(STATIC_GROUP_MAPPING_LIB)/static-group-mapping-$(DESKTOP_VERSION).jar
-
 SUDO_SHELL_DIR := $(realpath .)/sudo-shell
 SUDO_SHELL_SRC := $(SUDO_SHELL_DIR)/src
 SUDO_SHELL_BUILD := $(SUDO_SHELL_DIR)/target
@@ -62,7 +56,7 @@ CREDENTIALS_MERGER_BUILD := $(CREDENTIALS_MERGER_DIR)/target
 CREDENTIALS_MERGER_LIB := $(CREDENTIALS_MERGER_DIR)/java-lib
 CREDENTIALS_MERGER := $(CREDENTIALS_MERGER_LIB)/credentials-merger-$(DESKTOP_VERSION).jar
 
-compile: $(DESKTOP_PLUGIN_JAR) $(STATIC_GROUP_MAPPING) $(SUDO_SHELL) $(CREDENTIALS_MERGER)
+compile: $(DESKTOP_PLUGIN_JAR) $(SUDO_SHELL) $(CREDENTIALS_MERGER)
 
 # Build the plugin jar iff the source is present
 ifneq (,$(wildcard $(PLUGIN_JAVA_DIR)))
@@ -80,22 +74,6 @@ $(DESKTOP_PLUGIN_JAR):
 	$(error Cannot build hadoop plugin without source)
 endif
 
-# Build the static group mapping jar iff the source is present
-ifneq (,$(wildcard $(STATIC_GROUP_MAPPING_SRC)))
-$(STATIC_GROUP_MAPPING): $(shell find $(STATIC_GROUP_MAPPING_SRC) -type f)
-	mkdir -p $(STATIC_GROUP_MAPPING_LIB)
-	@echo "--- Building static UserGroupMappingService"
-	cd $(STATIC_GROUP_MAPPING_DIR) && mvn clean install -DskipTests $(MAVEN_OPTIONS)
-	cp $(STATIC_GROUP_MAPPING_BUILD)/static-group-mapping-$(MAVEN_VERSION).jar $(STATIC_GROUP_MAPPING)
-
-clean::
-	rm -rf $(STATIC_GROUP_MAPPING_LIB)
-	cd $(STATIC_GROUP_MAPPING_DIR) && mvn clean $(MAVEN_OPTIONS) ||:
-else
-$(STATIC_GROUP_MAPPING):
-	$(error Cannot build static-group-mapping jar without source)
-endif
-
 # Build the sudo shell jar iff the source is present
 ifneq (,$(wildcard $(SUDO_SHELL_SRC)))
 $(SUDO_SHELL): $(shell find $(SUDO_SHELL_SRC) -type f)
@@ -133,6 +111,5 @@ endif
 #
 BDIST_EXCLUDES += \
 	--exclude=java \
-	--exclude=static-group-mapping/src \
 	--exclude=sudo-shell/src \
 	--exclude=regenerate-thrift.sh

+ 0 - 63
desktop/libs/hadoop/static-group-mapping/pom.xml

@@ -1,63 +0,0 @@
-<?xml version="1.0"?>
-
-<!--
-   Licensed to Cloudera, Inc. 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.
--->
-
-<project>
-  <modelVersion>4.0.0</modelVersion>
-
-  <parent>
-    <groupId>com.cloudera.hue</groupId>
-    <artifactId>hue-parent</artifactId>
-    <relativePath>../../../../maven/pom.xml</relativePath>
-    <version>2.3.0-SNAPSHOT</version>
-  </parent>
-
-  <groupId>com.cloudera.hue</groupId>
-  <artifactId>static-group-mapping</artifactId>
-  <packaging>jar</packaging>
-
-  <name>Hue Static Group Mapping</name>
-
-  <scm>
-   <connection>scm:git:git://github.com/cloudera/hue.git</connection>
-   <developerConnection>scm:git:git@github.com:cloudera/hue.git</developerConnection>
-   <url>https://github.com/cloudera/hue</url>
-  </scm>  
-
-  <dependencies>
-    <dependency>
-      <groupId>org.apache.hadoop</groupId>
-      <artifactId>hadoop-client</artifactId>
-    </dependency>
-  </dependencies>
-
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-compiler-plugin</artifactId>
-        <version>3.0</version>
-        <configuration>
-          <source>1.6</source>
-          <target>1.6</target>
-        </configuration>
-      </plugin>
-    </plugins>
-  </build>
-</project>
-      

+ 0 - 86
desktop/libs/hadoop/static-group-mapping/src/main/java/org/apache/hadoop/security/StaticUserGroupMapping.java

@@ -1,86 +0,0 @@
-/**
- * Licensed to Cloudera, Inc. under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  Cloudera, Inc. 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.security;
-
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Map.Entry;
-import java.util.concurrent.ConcurrentHashMap;
-
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.util.StringUtils;
-
-/**
- * Implements getGroups() of the GroupMappingServiceProvider interface by
- * parsing a static, .properties-style file of the form:
- *
- * <code>username = comma,separated,list,of,groups</code>
- */
-public class StaticUserGroupMapping implements GroupMappingServiceProvider {
-
-  private static final String GROUP_MAPPING_CONF_KEY = "hadoop.security.static.group.mapping.file";
-  private static Map<String, List<String>> userGroupMapping = new ConcurrentHashMap<String, List<String>>();
-
-  static {
-    Properties properties = new Properties();
-    try {
-      String groupMappingFile = new Configuration().get(GROUP_MAPPING_CONF_KEY);
-      if (groupMappingFile == null) {
-        throw new RuntimeException("StaticUserGroupMapping class specified, but no static group " + 
-          "mapping file given. Set " + GROUP_MAPPING_CONF_KEY);
-      }
-      properties.load(new FileInputStream(groupMappingFile));
-      for (Entry<Object, Object> user : properties.entrySet()) {
-        userGroupMapping.put((String) user.getKey(), Arrays.asList(((String) user.getValue()).split(",")));
-      }
-    } catch (FileNotFoundException e) {
-      throw new RuntimeException(e);
-    } catch (IOException e) {
-      throw new RuntimeException(e);
-    }
-  }
-
-  @Override
-  public List<String> getGroups(String user) throws IOException {
-    return userGroupMapping.get(user);
-  }
-
-  @Override
-  public void cacheGroupsRefresh() throws IOException {
-    // does nothing in this provider of user to groups mapping
-  }
-
-  @Override
-  public void cacheGroupsAdd(List<String> groups) throws IOException {
-    // does nothing in this provider of user to groups mapping
-  }
-
-  public static void main(String[] args) {
-    for (Entry<String, List<String>> ugi : userGroupMapping.entrySet()) {
-      System.out.println(ugi.getKey() + " : " + ugi.getValue().size() + " : "
-          + StringUtils.join(StringUtils.COMMA_STR, ugi.getValue()));
-    }
-  }
-
-}