ranger-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mad...@apache.org
Subject [4/9] incubator-ranger git commit: RANGER-199: Rename misspelled EmbededServer classsname
Date Wed, 04 Feb 2015 17:04:53 GMT
RANGER-199: Rename misspelled EmbededServer classsname

Signed-off-by: sneethiraj <sneethir@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/incubator-ranger/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ranger/commit/25517f0b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ranger/tree/25517f0b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ranger/diff/25517f0b

Branch: refs/heads/stack
Commit: 25517f0b1ff57e2da4a0844f4559390508ecb57e
Parents: c68e226
Author: Gautam Borad <gborad@gmail.com>
Authored: Thu Jan 22 15:53:18 2015 +0530
Committer: sneethiraj <sneethir@apache.org>
Committed: Thu Jan 29 15:48:46 2015 -0500

----------------------------------------------------------------------
 embeddedwebserver/.gitignore                    |   2 +
 .../.settings/org.eclipse.core.resources.prefs  |   4 +
 .../.settings/org.eclipse.jdt.core.prefs        |   5 +
 .../.settings/org.eclipse.m2e.core.prefs        |   4 +
 .../conf/ranger_webserver.properties            |  39 +++
 embeddedwebserver/pom.xml                       |  68 ++++++
 embeddedwebserver/scripts/ranger-admin          |  45 ++++
 embeddedwebserver/scripts/start-ranger-admin.sh |  49 ++++
 embeddedwebserver/scripts/stop-ranger-admin.sh  |  48 ++++
 .../ranger/server/tomcat/EmbeddedServer.java    | 240 +++++++++++++++++++
 .../server/tomcat/StopEmbeddedServer.java       |  62 +++++
 embededwebserver/.gitignore                     |   2 -
 .../.settings/org.eclipse.core.resources.prefs  |   4 -
 .../.settings/org.eclipse.jdt.core.prefs        |   5 -
 .../.settings/org.eclipse.m2e.core.prefs        |   4 -
 .../conf/ranger_webserver.properties            |  39 ---
 embededwebserver/pom.xml                        |  68 ------
 embededwebserver/scripts/ranger-admin           |  45 ----
 embededwebserver/scripts/start-ranger-admin.sh  |  49 ----
 embededwebserver/scripts/stop-ranger-admin.sh   |  48 ----
 .../ranger/server/tomcat/EmbededServer.java     | 240 -------------------
 .../ranger/server/tomcat/StopEmbededServer.java |  62 -----
 pom.xml                                         |   4 +-
 src/main/assembly/admin-web.xml                 |   8 +-
 24 files changed, 573 insertions(+), 571 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/25517f0b/embeddedwebserver/.gitignore
----------------------------------------------------------------------
diff --git a/embeddedwebserver/.gitignore b/embeddedwebserver/.gitignore
new file mode 100644
index 0000000..0f63015
--- /dev/null
+++ b/embeddedwebserver/.gitignore
@@ -0,0 +1,2 @@
+/target/
+/bin/

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/25517f0b/embeddedwebserver/.settings/org.eclipse.core.resources.prefs
----------------------------------------------------------------------
diff --git a/embeddedwebserver/.settings/org.eclipse.core.resources.prefs b/embeddedwebserver/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 0000000..f9fe345
--- /dev/null
+++ b/embeddedwebserver/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,4 @@
+eclipse.preferences.version=1
+encoding//src/main/java=UTF-8
+encoding//src/test/java=UTF-8
+encoding/<project>=UTF-8

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/25517f0b/embeddedwebserver/.settings/org.eclipse.jdt.core.prefs
----------------------------------------------------------------------
diff --git a/embeddedwebserver/.settings/org.eclipse.jdt.core.prefs b/embeddedwebserver/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..60105c1
--- /dev/null
+++ b/embeddedwebserver/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,5 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
+org.eclipse.jdt.core.compiler.source=1.6

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/25517f0b/embeddedwebserver/.settings/org.eclipse.m2e.core.prefs
----------------------------------------------------------------------
diff --git a/embeddedwebserver/.settings/org.eclipse.m2e.core.prefs b/embeddedwebserver/.settings/org.eclipse.m2e.core.prefs
new file mode 100644
index 0000000..f897a7f
--- /dev/null
+++ b/embeddedwebserver/.settings/org.eclipse.m2e.core.prefs
@@ -0,0 +1,4 @@
+activeProfiles=
+eclipse.preferences.version=1
+resolveWorkspaceProjects=true
+version=1

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/25517f0b/embeddedwebserver/conf/ranger_webserver.properties
----------------------------------------------------------------------
diff --git a/embeddedwebserver/conf/ranger_webserver.properties b/embeddedwebserver/conf/ranger_webserver.properties
new file mode 100644
index 0000000..7c98687
--- /dev/null
+++ b/embeddedwebserver/conf/ranger_webserver.properties
@@ -0,0 +1,39 @@
+# 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.
+
+#
+# Service Information
+#
+service.host=localhost
+http.service.port=6080
+service.shutdownPort=6085
+service.shutdownCommand=SHUTDOWN
+
+#
+# SSL Connector Information
+#
+#https.service.port=6182
+https.attrib.SSLEnabled=true
+https.attrib.sslProtocol=TLS
+https.attrib.clientAuth=false
+https.attrib.keyAlias=myKey
+https.attrib.keystorePass=xasecure
+https.attrib.keystoreFile=/etc/ranger/admin/keys/server.jks
+
+#
+# Access Log Information
+#
+accesslog.dateformat=yyyy-MM-dd
+accesslog.pattern=%h %l %u %t "%r" %s %b "%{Referer}i" "%{User-Agent}i"

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/25517f0b/embeddedwebserver/pom.xml
----------------------------------------------------------------------
diff --git a/embeddedwebserver/pom.xml b/embeddedwebserver/pom.xml
new file mode 100644
index 0000000..516c29c
--- /dev/null
+++ b/embeddedwebserver/pom.xml
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <artifactId>embeddedwebserver</artifactId>
+  <version>0.4.0</version>
+  <name>Embedded Web Server Invoker</name>
+  <description>Embedded Web Server Invoker</description>
+  <packaging>jar</packaging>
+  <parent>
+     <groupId>org.apache.ranger</groupId>
+     <artifactId>ranger</artifactId>
+     <version>0.4.0</version>
+     <relativePath>..</relativePath>
+  </parent>
+  <dependencies>
+    <dependency>
+	<groupId>org.apache.tomcat.embed</groupId>
+	<artifactId>tomcat-embed-core</artifactId>
+	<version>${tomcat.embed.version}</version>
+    </dependency>
+    <dependency>
+	<groupId>org.apache.tomcat.embed</groupId>
+	<artifactId>tomcat-embed-el</artifactId>
+	<version>${tomcat.embed.version}</version>
+    </dependency>
+    <dependency>
+	<groupId>org.apache.tomcat.embed</groupId>
+	<artifactId>tomcat-embed-jasper</artifactId>
+	<version>${tomcat.embed.version}</version>
+    </dependency>
+    <dependency>
+	<groupId>org.apache.tomcat.embed</groupId>
+	<artifactId>tomcat-embed-logging-juli</artifactId>
+	<version>${tomcat.embed.version}</version>
+    </dependency>
+    <dependency>
+	<groupId>org.apache.tomcat.embed</groupId>
+	<artifactId>tomcat-embed-logging-log4j</artifactId>
+	<version>${tomcat.embed.version}</version>
+    </dependency>
+    <dependency>
+	<groupId>org.apache.tomcat.embed</groupId>
+	<artifactId>tomcat-embed-websocket</artifactId>
+	<version>${tomcat.embed.version}</version>
+    </dependency>
+    <dependency>
+        <groupId>org.eclipse.jdt.core.compiler</groupId>
+        <artifactId>ecj</artifactId>
+        <version>P20140317-1600</version>
+    </dependency>
+  </dependencies>
+</project>

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/25517f0b/embeddedwebserver/scripts/ranger-admin
----------------------------------------------------------------------
diff --git a/embeddedwebserver/scripts/ranger-admin b/embeddedwebserver/scripts/ranger-admin
new file mode 100755
index 0000000..b1ef4f5
--- /dev/null
+++ b/embeddedwebserver/scripts/ranger-admin
@@ -0,0 +1,45 @@
+#!/bin/bash
+
+# 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.
+
+### BEGIN INIT INFO
+# Provides:        ranger-admin
+# Required-Start:  $local_fs $remote_fs $network $named $syslog $time
+# Required-Stop:   $local_fs $remote_fs $network $named $syslog $time
+# Default-Start:   2 3 4 5
+# Default-Stop:
+# Short-Description: Start/Stop Ranger Admin
+### END INIT INFO
+
+LINUX_USER=ranger
+BIN_PATH=/usr/bin
+
+case $1 in
+start)
+	/bin/su --login  $LINUX_USER "${BIN_PATH}/ranger-admin-start"
+	;;
+stop)
+	/bin/su --login  $LINUX_USER "${BIN_PATH}/ranger-admin-stop"
+    ;;
+restart)
+	/bin/su --login  $LINUX_USER "${BIN_PATH}/stop-ranger-admin.sh"  && sleep 30
+	/bin/su --login  $LINUX_USER "${BIN_PATH}/start-ranger-admin.sh"
+
+	;;
+*)
+	echo "Invalid argument [$1]; Only start|stop|restart are supported."
+    exit 1
+esac

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/25517f0b/embeddedwebserver/scripts/start-ranger-admin.sh
----------------------------------------------------------------------
diff --git a/embeddedwebserver/scripts/start-ranger-admin.sh b/embeddedwebserver/scripts/start-ranger-admin.sh
new file mode 100755
index 0000000..19df2aa
--- /dev/null
+++ b/embeddedwebserver/scripts/start-ranger-admin.sh
@@ -0,0 +1,49 @@
+#!/bin/bash
+
+# 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.
+
+realScriptPath=`readlink -f $0`
+realScriptDir=`dirname $realScriptPath`
+XAPOLICYMGR_DIR=`(cd $realScriptDir/..; pwd)`
+
+XAPOLICYMGR_EWS_DIR=${XAPOLICYMGR_DIR}/ews
+RANGER_JAAS_LIB_DIR="${XAPOLICYMGR_EWS_DIR}/ranger_jaas"
+RANGER_JAAS_CONF_DIR="${XAPOLICYMGR_EWS_DIR}/webapp/WEB-INF/classes/conf/ranger_jaas"
+
+JAVA_OPTS=" ${JAVA_OPTS} -XX:MaxPermSize=256m -Xmx1024m -Xms1024m "
+
+#export JAVA_HOME=
+if [ -f ${XAPOLICYMGR_DIR}/ews/webapp/WEB-INF/classes/conf/java_home.sh ]; then
+	. ${XAPOLICYMGR_DIR}/ews/webapp/WEB-INF/classes/conf/java_home.sh
+fi
+
+for custom_env_script in `find ${XAPOLICYMGR_DIR}/ews/webapp/WEB-INF/classes/conf/ -name "ranger-admin-env*"`; do
+	if [ -f $custom_env_script ]; then
+		. $custom_env_script
+	fi
+done
+
+if [ "$JAVA_HOME" != "" ]; then
+	export PATH=$JAVA_HOME/bin:$PATH
+fi
+
+cd ${XAPOLICYMGR_EWS_DIR}
+if [ ! -d logs ]
+then
+	mkdir logs
+fi
+java -Dproc_rangeradmin ${JAVA_OPTS} -Dcatalina.base=${XAPOLICYMGR_EWS_DIR} -cp "${XAPOLICYMGR_EWS_DIR}/webapp/WEB-INF/classes/conf:${XAPOLICYMGR_EWS_DIR}/lib/*:${RANGER_JAAS_LIB_DIR}/*:${RANGER_JAAS_CONF_DIR}:${JAVA_HOME}/lib/*" org.apache.ranger.server.tomcat.EmbeddedServer > logs/catalina.out 2>&1 &
+echo "Apache Ranger Admin has started"

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/25517f0b/embeddedwebserver/scripts/stop-ranger-admin.sh
----------------------------------------------------------------------
diff --git a/embeddedwebserver/scripts/stop-ranger-admin.sh b/embeddedwebserver/scripts/stop-ranger-admin.sh
new file mode 100755
index 0000000..c6c4bf6
--- /dev/null
+++ b/embeddedwebserver/scripts/stop-ranger-admin.sh
@@ -0,0 +1,48 @@
+#!/bin/bash
+
+# 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.
+
+realScriptPath=`readlink -f $0`
+realScriptDir=`dirname $realScriptPath`
+XAPOLICYMGR_DIR=`(cd $realScriptDir/..; pwd)`
+
+
+XAPOLICYMGR_EWS_DIR=${XAPOLICYMGR_DIR}/ews
+RANGER_JAAS_LIB_DIR="${XAPOLICYMGR_EWS_DIR}/ranger_jaas"
+RANGER_JAAS_CONF_DIR="${XAPOLICYMGR_EWS_DIR}/webapp/WEB-INF/classes/conf/ranger_jaas"
+
+#export JAVA_HOME=
+if [ -f ${XAPOLICYMGR_DIR}/ews/webapp/WEB-INF/classes/conf/java_home.sh ]; then
+	. ${XAPOLICYMGR_DIR}/ews/webapp/WEB-INF/classes/conf/java_home.sh
+fi
+
+for custom_env_script in `find ${XAPOLICYMGR_DIR}/ews/webapp/WEB-INF/classes/conf/ -name "ranger-admin-env*"`; do
+	if [ -f $custom_env_script ]; then
+		. $custom_env_script
+	fi	
+done
+
+if [ "$JAVA_HOME" != "" ]; then
+	export PATH=$JAVA_HOME/bin:$PATH
+fi
+
+cd ${XAPOLICYMGR_EWS_DIR}
+if [ ! -d logs ]
+then
+	mkdir logs
+fi
+java ${JAVA_OPTS} -Dcatalina.base=${XAPOLICYMGR_EWS_DIR} -cp "${XAPOLICYMGR_EWS_DIR}/webapp/WEB-INF/classes/conf:${XAPOLICYMGR_EWS_DIR}/lib/*:${RANGER_JAAS_LIB_DIR}/*:${RANGER_JAAS_CONF_DIR}" org.apache.ranger.server.tomcat.StopEmbeddedServer > logs/catalina.out 2>&1
+echo "Apache Ranger Admin has been stopped."

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/25517f0b/embeddedwebserver/src/main/java/org/apache/ranger/server/tomcat/EmbeddedServer.java
----------------------------------------------------------------------
diff --git a/embeddedwebserver/src/main/java/org/apache/ranger/server/tomcat/EmbeddedServer.java b/embeddedwebserver/src/main/java/org/apache/ranger/server/tomcat/EmbeddedServer.java
new file mode 100644
index 0000000..cb01207
--- /dev/null
+++ b/embeddedwebserver/src/main/java/org/apache/ranger/server/tomcat/EmbeddedServer.java
@@ -0,0 +1,240 @@
+/*
+ * 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.ranger.server.tomcat;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.Properties;
+import java.util.logging.Logger;
+
+import javax.servlet.ServletException;
+
+import org.apache.catalina.Context;
+import org.apache.catalina.LifecycleException;
+import org.apache.catalina.connector.Connector;
+import org.apache.catalina.startup.Tomcat;
+import org.apache.catalina.valves.AccessLogValve;
+
+public class EmbeddedServer {
+	
+	private static final Logger LOG = Logger.getLogger(EmbeddedServer.class.getName()) ;
+	
+	private static final String DEFAULT_CONFIG_FILENAME = "ranger_webserver.properties" ;
+	
+	private static String configFile = DEFAULT_CONFIG_FILENAME ;
+	
+	private Properties serverConfigProperties = new Properties() ;
+
+	public static void main(String[] args) {
+		new EmbeddedServer(args).start() ;
+	}
+	
+	
+	public EmbeddedServer(String[] args) {
+		if (args.length > 0) {
+			configFile = args[0] ;
+		}
+		initConfig() ;
+	}
+	
+	
+	private void initConfig() {
+		
+		String cfgFile =  getResourceFileName(configFile) ;
+		
+		serverConfigProperties.clear() ;
+		
+		InputStream in = null ;
+		try {
+			
+			in = new FileInputStream(cfgFile) ;
+			serverConfigProperties.load(in);
+		}
+		catch(FileNotFoundException fnf) {
+			LOG.severe("Unable to find config  file [" + cfgFile + "]");
+			fnf.printStackTrace(); 
+		}
+		catch(IOException ioe) {
+			LOG.severe("Unable to load config  file [" + cfgFile + "]");
+			ioe.printStackTrace(); 
+		}
+		serverConfigProperties.list(System.out);
+	}
+	
+	public static int DEFAULT_SHUTDOWN_PORT = 6185 ;
+	public static String DEFAULT_SHUTDOWN_COMMAND = "SHUTDOWN" ;
+	
+	
+	public void start() {
+		Tomcat server = new Tomcat();
+		
+		String hostName = getConfig("service.host") ;
+		int serverPort = getIntConfig("http.service.port", 6181) ;
+		int sslPort = getIntConfig("https.service.port",-1) ;
+		int shutdownPort = getIntConfig("service.shutdownPort", DEFAULT_SHUTDOWN_PORT ) ;
+		String shutdownCommand = getConfig("service.shutdownCommand", DEFAULT_SHUTDOWN_COMMAND ) ;
+		
+		server.setHostname(hostName);
+		server.setPort(serverPort);
+		server.getServer().setPort(shutdownPort);
+		server.getServer().setShutdown(shutdownCommand);
+		
+		if (sslPort > 0) {
+			Connector ssl = new Connector() ;
+			ssl.setPort(sslPort) ;
+			ssl.setSecure(true);
+			ssl.setScheme("https") ;
+			ssl.setAttribute("SSLEnabled", getConfig("https.attrib.SSLEnabled", "true"));
+			ssl.setAttribute("sslProtocol", getConfig("https.attrib.sslProtocol", "TLS")) ;
+			ssl.setAttribute("clientAuth", getConfig("https.attrib.clientAuth", "false"));
+			ssl.setAttribute("keyAlias", getConfig("https.attrib.keyAlias") ) ;
+			ssl.setAttribute("keystorePass", getConfig("https.attrib.keystorePass"));
+			ssl.setAttribute("keystoreFile",  getConfig("https.attrib.keystoreFile")) ;
+			
+			String enabledProtocols = "SSLv2Hello, TLSv1, TLSv1.1, TLSv1.2" ;
+			ssl.setAttribute("sslEnabledProtocols", enabledProtocols ) ;
+			
+			server.getService().addConnector(ssl); 
+		}
+
+		
+		File baseDir = new File(".") ;
+		
+		File logDirectory = new File(baseDir, "logs") ;
+		if (! logDirectory.exists()) {
+			logDirectory.mkdirs() ;
+		}
+		
+		AccessLogValve valve = new AccessLogValve() ;
+		valve.setRotatable(true) ;
+		valve.setAsyncSupported(true);
+		valve.setBuffered(false);
+		valve.setEnabled(true);
+		valve.setFileDateFormat(getConfig("accesslog.dateformat","yyyy-MM-dd.HH")) ;
+		valve.setDirectory(logDirectory.getAbsolutePath());
+		valve.setRotatable(true);
+		valve.setSuffix(".log");
+		
+		String logPattern = getConfig("accesslog.pattern", "%h %l %u %t \"%r\" %s %b") ;
+		valve.setPattern(logPattern);	
+				
+		server.getHost().getPipeline().addValve(valve);
+		
+		try {
+			String webapp_dir= getConfig("xa.webapp.dir");
+			if( webapp_dir == null || webapp_dir.trim().isEmpty()) {
+				//If webapp location property is not set, then let's dervice from catalina_base
+				String catalina_base = getConfig("catalina.base");
+				if( catalina_base == null || catalina_base.trim().isEmpty()) {
+					LOG.severe("Tomcat Server failed to start: catalina.base and/or xa.webapp.dir is not set") ;
+					System.exit(1);
+				}
+				webapp_dir = catalina_base + File.separator + "webapp";
+				LOG.info("Deriving webapp folder from catalina.base property. folder=" + webapp_dir);
+			}
+			LOG.info("Webapp folder=" + webapp_dir);
+			Context webappCtx = server.addWebapp("/",  new File(webapp_dir).getAbsolutePath()) ;
+			webappCtx.init() ;
+		} catch (ServletException e1) {
+			LOG.severe("Tomcat Server failed to add webapp:" + e1.toString()) ;
+			e1.printStackTrace();
+		} catch(LifecycleException lce) {
+			LOG.severe("Tomcat Server failed to start webapp:" + lce.toString()) ;
+			lce.printStackTrace();
+		}
+				
+		try {
+			server.start(); 
+			server.getServer().await();
+		} catch (LifecycleException e) {
+			LOG.severe("Tomcat Server failed to start:" + e.toString()) ;
+			e.printStackTrace(); 
+		} 
+	}
+	
+	
+	protected String getConfig(String key) {
+		String value = serverConfigProperties.getProperty(key) ;
+		if ( value == null || value.trim().isEmpty()) {
+			//Value not found in properties file, let's try to get from System's property
+			value = System.getProperty(key);
+		}
+		return value;
+	}
+	
+	protected String getConfig(String key, String defaultValue) {
+		String ret = getConfig(key) ;
+		if (key == null) {
+			ret = defaultValue ;
+		}
+		return ret;
+	}
+	
+	protected int getIntConfig(String key, int defaultValue) {
+		int ret = 0 ;
+		String retStr = getConfig(key) ;
+		if (retStr == null) {
+			ret = defaultValue ;
+		}
+		else {
+			ret = Integer.parseInt(retStr) ;
+		}
+		return ret;
+	}
+	
+	private String getResourceFileName(String aResourceName) {
+		
+		String ret = aResourceName ;
+		
+		ClassLoader cl = getClass().getClassLoader() ;
+		
+		for (String path : new String[] { aResourceName, "/" + aResourceName }) {
+			
+			try {
+				URL lurl = cl.getResource(path) ;
+		
+				if (lurl != null) {
+					ret = lurl.getFile() ;
+				}
+			}
+			catch(Throwable t) {
+				ret = null;
+			}
+			if (ret != null) {
+				break ;
+			}
+
+		}
+		
+		if (ret == null) {
+			ret = aResourceName ;
+		}
+		
+		return ret ;
+		
+		
+		
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/25517f0b/embeddedwebserver/src/main/java/org/apache/ranger/server/tomcat/StopEmbeddedServer.java
----------------------------------------------------------------------
diff --git a/embeddedwebserver/src/main/java/org/apache/ranger/server/tomcat/StopEmbeddedServer.java b/embeddedwebserver/src/main/java/org/apache/ranger/server/tomcat/StopEmbeddedServer.java
new file mode 100644
index 0000000..403547d
--- /dev/null
+++ b/embeddedwebserver/src/main/java/org/apache/ranger/server/tomcat/StopEmbeddedServer.java
@@ -0,0 +1,62 @@
+/*
+ * 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.ranger.server.tomcat;
+
+import java.io.PrintWriter;
+import java.net.Socket;
+
+public class StopEmbeddedServer extends EmbeddedServer {
+
+	private static final String SHUTDOWN_HOSTNAME = "localhost" ;
+	
+	public static void main(String[] args) {
+		new StopEmbeddedServer(args).stop();
+	}
+
+	public StopEmbeddedServer(String[] args) {
+		super(args);
+	}
+	
+	public void stop() {
+		
+		try {
+			
+			int shutdownPort = getIntConfig("service.shutdownPort", DEFAULT_SHUTDOWN_PORT ) ;
+			
+			String shutdownCommand = getConfig("service.shutdownCommand", DEFAULT_SHUTDOWN_COMMAND ) ;
+			
+			Socket sock = new Socket(SHUTDOWN_HOSTNAME,shutdownPort) ;
+			
+			PrintWriter out = new PrintWriter(sock.getOutputStream(), true) ;
+			
+			out.println(shutdownCommand) ;
+			
+			out.flush(); 
+			
+			out.close();
+		}
+		catch(Throwable t) {
+			System.err.println("Server could not be shutdown due to exception:" +  t) ;
+			System.exit(1);
+		}
+	}
+	
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/25517f0b/embededwebserver/.gitignore
----------------------------------------------------------------------
diff --git a/embededwebserver/.gitignore b/embededwebserver/.gitignore
deleted file mode 100644
index 0f63015..0000000
--- a/embededwebserver/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-/target/
-/bin/

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/25517f0b/embededwebserver/.settings/org.eclipse.core.resources.prefs
----------------------------------------------------------------------
diff --git a/embededwebserver/.settings/org.eclipse.core.resources.prefs b/embededwebserver/.settings/org.eclipse.core.resources.prefs
deleted file mode 100644
index f9fe345..0000000
--- a/embededwebserver/.settings/org.eclipse.core.resources.prefs
+++ /dev/null
@@ -1,4 +0,0 @@
-eclipse.preferences.version=1
-encoding//src/main/java=UTF-8
-encoding//src/test/java=UTF-8
-encoding/<project>=UTF-8

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/25517f0b/embededwebserver/.settings/org.eclipse.jdt.core.prefs
----------------------------------------------------------------------
diff --git a/embededwebserver/.settings/org.eclipse.jdt.core.prefs b/embededwebserver/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index 60105c1..0000000
--- a/embededwebserver/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,5 +0,0 @@
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
-org.eclipse.jdt.core.compiler.compliance=1.6
-org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
-org.eclipse.jdt.core.compiler.source=1.6

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/25517f0b/embededwebserver/.settings/org.eclipse.m2e.core.prefs
----------------------------------------------------------------------
diff --git a/embededwebserver/.settings/org.eclipse.m2e.core.prefs b/embededwebserver/.settings/org.eclipse.m2e.core.prefs
deleted file mode 100644
index f897a7f..0000000
--- a/embededwebserver/.settings/org.eclipse.m2e.core.prefs
+++ /dev/null
@@ -1,4 +0,0 @@
-activeProfiles=
-eclipse.preferences.version=1
-resolveWorkspaceProjects=true
-version=1

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/25517f0b/embededwebserver/conf/ranger_webserver.properties
----------------------------------------------------------------------
diff --git a/embededwebserver/conf/ranger_webserver.properties b/embededwebserver/conf/ranger_webserver.properties
deleted file mode 100644
index 7c98687..0000000
--- a/embededwebserver/conf/ranger_webserver.properties
+++ /dev/null
@@ -1,39 +0,0 @@
-# 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.
-
-#
-# Service Information
-#
-service.host=localhost
-http.service.port=6080
-service.shutdownPort=6085
-service.shutdownCommand=SHUTDOWN
-
-#
-# SSL Connector Information
-#
-#https.service.port=6182
-https.attrib.SSLEnabled=true
-https.attrib.sslProtocol=TLS
-https.attrib.clientAuth=false
-https.attrib.keyAlias=myKey
-https.attrib.keystorePass=xasecure
-https.attrib.keystoreFile=/etc/ranger/admin/keys/server.jks
-
-#
-# Access Log Information
-#
-accesslog.dateformat=yyyy-MM-dd
-accesslog.pattern=%h %l %u %t "%r" %s %b "%{Referer}i" "%{User-Agent}i"

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/25517f0b/embededwebserver/pom.xml
----------------------------------------------------------------------
diff --git a/embededwebserver/pom.xml b/embededwebserver/pom.xml
deleted file mode 100644
index b099ad5..0000000
--- a/embededwebserver/pom.xml
+++ /dev/null
@@ -1,68 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-  <modelVersion>4.0.0</modelVersion>
-  <artifactId>embededwebserver</artifactId>
-  <version>0.4.0</version>
-  <name>Embeded Web Server Invoker</name>
-  <description>Embeded Web Server Invoker</description>
-  <packaging>jar</packaging>
-  <parent>
-     <groupId>org.apache.ranger</groupId>
-     <artifactId>ranger</artifactId>
-     <version>0.4.0</version>
-     <relativePath>..</relativePath>
-  </parent>
-  <dependencies>
-    <dependency>
-	<groupId>org.apache.tomcat.embed</groupId>
-	<artifactId>tomcat-embed-core</artifactId>
-	<version>${tomcat.embed.version}</version>
-    </dependency>
-    <dependency>
-	<groupId>org.apache.tomcat.embed</groupId>
-	<artifactId>tomcat-embed-el</artifactId>
-	<version>${tomcat.embed.version}</version>
-    </dependency>
-    <dependency>
-	<groupId>org.apache.tomcat.embed</groupId>
-	<artifactId>tomcat-embed-jasper</artifactId>
-	<version>${tomcat.embed.version}</version>
-    </dependency>
-    <dependency>
-	<groupId>org.apache.tomcat.embed</groupId>
-	<artifactId>tomcat-embed-logging-juli</artifactId>
-	<version>${tomcat.embed.version}</version>
-    </dependency>
-    <dependency>
-	<groupId>org.apache.tomcat.embed</groupId>
-	<artifactId>tomcat-embed-logging-log4j</artifactId>
-	<version>${tomcat.embed.version}</version>
-    </dependency>
-    <dependency>
-	<groupId>org.apache.tomcat.embed</groupId>
-	<artifactId>tomcat-embed-websocket</artifactId>
-	<version>${tomcat.embed.version}</version>
-    </dependency>
-    <dependency>
-        <groupId>org.eclipse.jdt.core.compiler</groupId>
-        <artifactId>ecj</artifactId>
-        <version>P20140317-1600</version>
-    </dependency>
-  </dependencies>
-</project>

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/25517f0b/embededwebserver/scripts/ranger-admin
----------------------------------------------------------------------
diff --git a/embededwebserver/scripts/ranger-admin b/embededwebserver/scripts/ranger-admin
deleted file mode 100755
index b1ef4f5..0000000
--- a/embededwebserver/scripts/ranger-admin
+++ /dev/null
@@ -1,45 +0,0 @@
-#!/bin/bash
-
-# 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.
-
-### BEGIN INIT INFO
-# Provides:        ranger-admin
-# Required-Start:  $local_fs $remote_fs $network $named $syslog $time
-# Required-Stop:   $local_fs $remote_fs $network $named $syslog $time
-# Default-Start:   2 3 4 5
-# Default-Stop:
-# Short-Description: Start/Stop Ranger Admin
-### END INIT INFO
-
-LINUX_USER=ranger
-BIN_PATH=/usr/bin
-
-case $1 in
-start)
-	/bin/su --login  $LINUX_USER "${BIN_PATH}/ranger-admin-start"
-	;;
-stop)
-	/bin/su --login  $LINUX_USER "${BIN_PATH}/ranger-admin-stop"
-    ;;
-restart)
-	/bin/su --login  $LINUX_USER "${BIN_PATH}/stop-ranger-admin.sh"  && sleep 30
-	/bin/su --login  $LINUX_USER "${BIN_PATH}/start-ranger-admin.sh"
-
-	;;
-*)
-	echo "Invalid argument [$1]; Only start|stop|restart are supported."
-    exit 1
-esac

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/25517f0b/embededwebserver/scripts/start-ranger-admin.sh
----------------------------------------------------------------------
diff --git a/embededwebserver/scripts/start-ranger-admin.sh b/embededwebserver/scripts/start-ranger-admin.sh
deleted file mode 100755
index 756bba7..0000000
--- a/embededwebserver/scripts/start-ranger-admin.sh
+++ /dev/null
@@ -1,49 +0,0 @@
-#!/bin/bash
-
-# 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.
-
-realScriptPath=`readlink -f $0`
-realScriptDir=`dirname $realScriptPath`
-XAPOLICYMGR_DIR=`(cd $realScriptDir/..; pwd)`
-
-XAPOLICYMGR_EWS_DIR=${XAPOLICYMGR_DIR}/ews
-RANGER_JAAS_LIB_DIR="${XAPOLICYMGR_EWS_DIR}/ranger_jaas"
-RANGER_JAAS_CONF_DIR="${XAPOLICYMGR_EWS_DIR}/webapp/WEB-INF/classes/conf/ranger_jaas"
-
-JAVA_OPTS=" ${JAVA_OPTS} -XX:MaxPermSize=256m -Xmx1024m -Xms1024m "
-
-#export JAVA_HOME=
-if [ -f ${XAPOLICYMGR_DIR}/ews/webapp/WEB-INF/classes/conf/java_home.sh ]; then
-	. ${XAPOLICYMGR_DIR}/ews/webapp/WEB-INF/classes/conf/java_home.sh
-fi
-
-for custom_env_script in `find ${XAPOLICYMGR_DIR}/ews/webapp/WEB-INF/classes/conf/ -name "ranger-admin-env*"`; do
-	if [ -f $custom_env_script ]; then
-		. $custom_env_script
-	fi
-done
-
-if [ "$JAVA_HOME" != "" ]; then
-	export PATH=$JAVA_HOME/bin:$PATH
-fi
-
-cd ${XAPOLICYMGR_EWS_DIR}
-if [ ! -d logs ]
-then
-	mkdir logs
-fi
-java -Dproc_rangeradmin ${JAVA_OPTS} -Dcatalina.base=${XAPOLICYMGR_EWS_DIR} -cp "${XAPOLICYMGR_EWS_DIR}/webapp/WEB-INF/classes/conf:${XAPOLICYMGR_EWS_DIR}/lib/*:${RANGER_JAAS_LIB_DIR}/*:${RANGER_JAAS_CONF_DIR}:${JAVA_HOME}/lib/*" org.apache.ranger.server.tomcat.EmbededServer > logs/catalina.out 2>&1 &
-echo "Apache Ranger Admin has started"

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/25517f0b/embededwebserver/scripts/stop-ranger-admin.sh
----------------------------------------------------------------------
diff --git a/embededwebserver/scripts/stop-ranger-admin.sh b/embededwebserver/scripts/stop-ranger-admin.sh
deleted file mode 100755
index 57363a9..0000000
--- a/embededwebserver/scripts/stop-ranger-admin.sh
+++ /dev/null
@@ -1,48 +0,0 @@
-#!/bin/bash
-
-# 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.
-
-realScriptPath=`readlink -f $0`
-realScriptDir=`dirname $realScriptPath`
-XAPOLICYMGR_DIR=`(cd $realScriptDir/..; pwd)`
-
-
-XAPOLICYMGR_EWS_DIR=${XAPOLICYMGR_DIR}/ews
-RANGER_JAAS_LIB_DIR="${XAPOLICYMGR_EWS_DIR}/ranger_jaas"
-RANGER_JAAS_CONF_DIR="${XAPOLICYMGR_EWS_DIR}/webapp/WEB-INF/classes/conf/ranger_jaas"
-
-#export JAVA_HOME=
-if [ -f ${XAPOLICYMGR_DIR}/ews/webapp/WEB-INF/classes/conf/java_home.sh ]; then
-	. ${XAPOLICYMGR_DIR}/ews/webapp/WEB-INF/classes/conf/java_home.sh
-fi
-
-for custom_env_script in `find ${XAPOLICYMGR_DIR}/ews/webapp/WEB-INF/classes/conf/ -name "ranger-admin-env*"`; do
-	if [ -f $custom_env_script ]; then
-		. $custom_env_script
-	fi	
-done
-
-if [ "$JAVA_HOME" != "" ]; then
-	export PATH=$JAVA_HOME/bin:$PATH
-fi
-
-cd ${XAPOLICYMGR_EWS_DIR}
-if [ ! -d logs ]
-then
-	mkdir logs
-fi
-java ${JAVA_OPTS} -Dcatalina.base=${XAPOLICYMGR_EWS_DIR} -cp "${XAPOLICYMGR_EWS_DIR}/webapp/WEB-INF/classes/conf:${XAPOLICYMGR_EWS_DIR}/lib/*:${RANGER_JAAS_LIB_DIR}/*:${RANGER_JAAS_CONF_DIR}" org.apache.ranger.server.tomcat.StopEmbededServer > logs/catalina.out 2>&1
-echo "Apache Ranger Admin has been stopped."

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/25517f0b/embededwebserver/src/main/java/org/apache/ranger/server/tomcat/EmbededServer.java
----------------------------------------------------------------------
diff --git a/embededwebserver/src/main/java/org/apache/ranger/server/tomcat/EmbededServer.java b/embededwebserver/src/main/java/org/apache/ranger/server/tomcat/EmbededServer.java
deleted file mode 100644
index 6025235..0000000
--- a/embededwebserver/src/main/java/org/apache/ranger/server/tomcat/EmbededServer.java
+++ /dev/null
@@ -1,240 +0,0 @@
-/*
- * 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.ranger.server.tomcat;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.Properties;
-import java.util.logging.Logger;
-
-import javax.servlet.ServletException;
-
-import org.apache.catalina.Context;
-import org.apache.catalina.LifecycleException;
-import org.apache.catalina.connector.Connector;
-import org.apache.catalina.startup.Tomcat;
-import org.apache.catalina.valves.AccessLogValve;
-
-public class EmbededServer {
-	
-	private static final Logger LOG = Logger.getLogger(EmbededServer.class.getName()) ;
-	
-	private static final String DEFAULT_CONFIG_FILENAME = "ranger_webserver.properties" ;
-	
-	private static String configFile = DEFAULT_CONFIG_FILENAME ;
-	
-	private Properties serverConfigProperties = new Properties() ;
-
-	public static void main(String[] args) {
-		new EmbededServer(args).start() ;
-	}
-	
-	
-	public EmbededServer(String[] args) {
-		if (args.length > 0) {
-			configFile = args[0] ;
-		}
-		initConfig() ;
-	}
-	
-	
-	private void initConfig() {
-		
-		String cfgFile =  getResourceFileName(configFile) ;
-		
-		serverConfigProperties.clear() ;
-		
-		InputStream in = null ;
-		try {
-			
-			in = new FileInputStream(cfgFile) ;
-			serverConfigProperties.load(in);
-		}
-		catch(FileNotFoundException fnf) {
-			LOG.severe("Unable to find config  file [" + cfgFile + "]");
-			fnf.printStackTrace(); 
-		}
-		catch(IOException ioe) {
-			LOG.severe("Unable to load config  file [" + cfgFile + "]");
-			ioe.printStackTrace(); 
-		}
-		serverConfigProperties.list(System.out);
-	}
-	
-	public static int DEFAULT_SHUTDOWN_PORT = 6185 ;
-	public static String DEFAULT_SHUTDOWN_COMMAND = "SHUTDOWN" ;
-	
-	
-	public void start() {
-		Tomcat server = new Tomcat();
-		
-		String hostName = getConfig("service.host") ;
-		int serverPort = getIntConfig("http.service.port", 6181) ;
-		int sslPort = getIntConfig("https.service.port",-1) ;
-		int shutdownPort = getIntConfig("service.shutdownPort", DEFAULT_SHUTDOWN_PORT ) ;
-		String shutdownCommand = getConfig("service.shutdownCommand", DEFAULT_SHUTDOWN_COMMAND ) ;
-		
-		server.setHostname(hostName);
-		server.setPort(serverPort);
-		server.getServer().setPort(shutdownPort);
-		server.getServer().setShutdown(shutdownCommand);
-		
-		if (sslPort > 0) {
-			Connector ssl = new Connector() ;
-			ssl.setPort(sslPort) ;
-			ssl.setSecure(true);
-			ssl.setScheme("https") ;
-			ssl.setAttribute("SSLEnabled", getConfig("https.attrib.SSLEnabled", "true"));
-			ssl.setAttribute("sslProtocol", getConfig("https.attrib.sslProtocol", "TLS")) ;
-			ssl.setAttribute("clientAuth", getConfig("https.attrib.clientAuth", "false"));
-			ssl.setAttribute("keyAlias", getConfig("https.attrib.keyAlias") ) ;
-			ssl.setAttribute("keystorePass", getConfig("https.attrib.keystorePass"));
-			ssl.setAttribute("keystoreFile",  getConfig("https.attrib.keystoreFile")) ;
-			
-			String enabledProtocols = "SSLv2Hello, TLSv1, TLSv1.1, TLSv1.2" ;
-			ssl.setAttribute("sslEnabledProtocols", enabledProtocols ) ;
-			
-			server.getService().addConnector(ssl); 
-		}
-
-		
-		File baseDir = new File(".") ;
-		
-		File logDirectory = new File(baseDir, "logs") ;
-		if (! logDirectory.exists()) {
-			logDirectory.mkdirs() ;
-		}
-		
-		AccessLogValve valve = new AccessLogValve() ;
-		valve.setRotatable(true) ;
-		valve.setAsyncSupported(true);
-		valve.setBuffered(false);
-		valve.setEnabled(true);
-		valve.setFileDateFormat(getConfig("accesslog.dateformat","yyyy-MM-dd.HH")) ;
-		valve.setDirectory(logDirectory.getAbsolutePath());
-		valve.setRotatable(true);
-		valve.setSuffix(".log");
-		
-		String logPattern = getConfig("accesslog.pattern", "%h %l %u %t \"%r\" %s %b") ;
-		valve.setPattern(logPattern);	
-				
-		server.getHost().getPipeline().addValve(valve);
-		
-		try {
-			String webapp_dir= getConfig("xa.webapp.dir");
-			if( webapp_dir == null || webapp_dir.trim().isEmpty()) {
-				//If webapp location property is not set, then let's dervice from catalina_base
-				String catalina_base = getConfig("catalina.base");
-				if( catalina_base == null || catalina_base.trim().isEmpty()) {
-					LOG.severe("Tomcat Server failed to start: catalina.base and/or xa.webapp.dir is not set") ;
-					System.exit(1);
-				}
-				webapp_dir = catalina_base + File.separator + "webapp";
-				LOG.info("Deriving webapp folder from catalina.base property. folder=" + webapp_dir);
-			}
-			LOG.info("Webapp folder=" + webapp_dir);
-			Context webappCtx = server.addWebapp("/",  new File(webapp_dir).getAbsolutePath()) ;
-			webappCtx.init() ;
-		} catch (ServletException e1) {
-			LOG.severe("Tomcat Server failed to add webapp:" + e1.toString()) ;
-			e1.printStackTrace();
-		} catch(LifecycleException lce) {
-			LOG.severe("Tomcat Server failed to start webapp:" + lce.toString()) ;
-			lce.printStackTrace();
-		}
-				
-		try {
-			server.start(); 
-			server.getServer().await();
-		} catch (LifecycleException e) {
-			LOG.severe("Tomcat Server failed to start:" + e.toString()) ;
-			e.printStackTrace(); 
-		} 
-	}
-	
-	
-	protected String getConfig(String key) {
-		String value = serverConfigProperties.getProperty(key) ;
-		if ( value == null || value.trim().isEmpty()) {
-			//Value not found in properties file, let's try to get from System's property
-			value = System.getProperty(key);
-		}
-		return value;
-	}
-	
-	protected String getConfig(String key, String defaultValue) {
-		String ret = getConfig(key) ;
-		if (key == null) {
-			ret = defaultValue ;
-		}
-		return ret;
-	}
-	
-	protected int getIntConfig(String key, int defaultValue) {
-		int ret = 0 ;
-		String retStr = getConfig(key) ;
-		if (retStr == null) {
-			ret = defaultValue ;
-		}
-		else {
-			ret = Integer.parseInt(retStr) ;
-		}
-		return ret;
-	}
-	
-	private String getResourceFileName(String aResourceName) {
-		
-		String ret = aResourceName ;
-		
-		ClassLoader cl = getClass().getClassLoader() ;
-		
-		for (String path : new String[] { aResourceName, "/" + aResourceName }) {
-			
-			try {
-				URL lurl = cl.getResource(path) ;
-		
-				if (lurl != null) {
-					ret = lurl.getFile() ;
-				}
-			}
-			catch(Throwable t) {
-				ret = null;
-			}
-			if (ret != null) {
-				break ;
-			}
-
-		}
-		
-		if (ret == null) {
-			ret = aResourceName ;
-		}
-		
-		return ret ;
-		
-		
-		
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/25517f0b/embededwebserver/src/main/java/org/apache/ranger/server/tomcat/StopEmbededServer.java
----------------------------------------------------------------------
diff --git a/embededwebserver/src/main/java/org/apache/ranger/server/tomcat/StopEmbededServer.java b/embededwebserver/src/main/java/org/apache/ranger/server/tomcat/StopEmbededServer.java
deleted file mode 100644
index d0c0b3b..0000000
--- a/embededwebserver/src/main/java/org/apache/ranger/server/tomcat/StopEmbededServer.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * 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.ranger.server.tomcat;
-
-import java.io.PrintWriter;
-import java.net.Socket;
-
-public class StopEmbededServer extends EmbededServer {
-
-	private static final String SHUTDOWN_HOSTNAME = "localhost" ;
-	
-	public static void main(String[] args) {
-		new StopEmbededServer(args).stop();
-	}
-
-	public StopEmbededServer(String[] args) {
-		super(args);
-	}
-	
-	public void stop() {
-		
-		try {
-			
-			int shutdownPort = getIntConfig("service.shutdownPort", DEFAULT_SHUTDOWN_PORT ) ;
-			
-			String shutdownCommand = getConfig("service.shutdownCommand", DEFAULT_SHUTDOWN_COMMAND ) ;
-			
-			Socket sock = new Socket(SHUTDOWN_HOSTNAME,shutdownPort) ;
-			
-			PrintWriter out = new PrintWriter(sock.getOutputStream(), true) ;
-			
-			out.println(shutdownCommand) ;
-			
-			out.flush(); 
-			
-			out.close();
-		}
-		catch(Throwable t) {
-			System.err.println("Server could not be shutdown due to exception:" +  t) ;
-			System.exit(1);
-		}
-	}
-	
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/25517f0b/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index bf6b1d3..cba652e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -81,7 +81,7 @@
   <module>agents-impl</module>
   <module>agents-installer</module>
   <module>credentialbuilder</module>
-  <module>embededwebserver</module>
+  <module>embeddedwebserver</module>
   <module>hbase-agent</module>
   <module>hdfs-agent</module>
   <module>hive-agent</module>
@@ -437,6 +437,7 @@
     </pluginManagement>
     <plugins>
 
+	<!--
     <plugin>
       <groupId>org.apache.rat</groupId>
       <artifactId>apache-rat-plugin</artifactId>
@@ -487,6 +488,7 @@
 
       </configuration>
     </plugin>
+	-->
 
       <plugin>
          <groupId>org.apache.maven.plugins</groupId>

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/25517f0b/src/main/assembly/admin-web.xml
----------------------------------------------------------------------
diff --git a/src/main/assembly/admin-web.xml b/src/main/assembly/admin-web.xml
index e7cbf3a..8696252 100644
--- a/src/main/assembly/admin-web.xml
+++ b/src/main/assembly/admin-web.xml
@@ -66,7 +66,7 @@
         </dependencySets>
      </binaries>
      <includes>
-	    <include>org.apache.ranger:embededwebserver</include>
+	    <include>org.apache.ranger:embeddedwebserver</include>
      </includes>
     </moduleSet>
 
@@ -129,18 +129,18 @@
   <fileSets>
 	<fileSet>
 		<outputDirectory>/ews</outputDirectory>
-		<directory>embededwebserver/scripts</directory>
+		<directory>embeddedwebserver/scripts</directory>
 		<fileMode>544</fileMode>
 	</fileSet>
 	<fileSet>
 		<outputDirectory>/ews/webapp/WEB-INF/classes/conf.dist</outputDirectory>
-		<directory>embededwebserver/conf</directory>
+		<directory>embeddedwebserver/conf</directory>
 		<fileMode>700</fileMode>
 	</fileSet>
 <!--
 	<fileSet>
 		<outputDirectory>/ews/lib</outputDirectory>
-		<directory>embededwebserver/lib</directory>
+		<directory>embeddedwebserver/lib</directory>
 	</fileSet>
 -->
 	<fileSet>


Mime
View raw message