You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@atlas.apache.org by ma...@apache.org on 2017/09/27 04:25:26 UTC

[2/7] atlas git commit: ATLAS-2179: Split Atlas client library to avoid unnecessary dependencies

http://git-wip-us.apache.org/repos/asf/atlas/blob/187730dd/intg/src/main/java/org/apache/atlas/ApplicationProperties.java
----------------------------------------------------------------------
diff --git a/intg/src/main/java/org/apache/atlas/ApplicationProperties.java b/intg/src/main/java/org/apache/atlas/ApplicationProperties.java
new file mode 100644
index 0000000..a35bdfe
--- /dev/null
+++ b/intg/src/main/java/org/apache/atlas/ApplicationProperties.java
@@ -0,0 +1,203 @@
+/**
+ * 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.atlas;
+
+import org.apache.atlas.security.InMemoryJAASConfiguration;
+import org.apache.commons.configuration.Configuration;
+import org.apache.commons.configuration.ConfigurationException;
+import org.apache.commons.configuration.PropertiesConfiguration;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.Iterator;
+
+/**
+ * Application properties used by Atlas.
+ */
+public final class ApplicationProperties extends PropertiesConfiguration {
+    public static final String ATLAS_CONFIGURATION_DIRECTORY_PROPERTY = "atlas.conf";
+
+    private static final Logger LOG = LoggerFactory.getLogger(ApplicationProperties.class);
+
+    public static final String APPLICATION_PROPERTIES = "atlas-application.properties";
+
+    private static volatile Configuration instance = null;
+
+    private ApplicationProperties(URL url) throws ConfigurationException {
+        super(url);
+    }
+
+    public static void forceReload() {
+        if (instance != null) {
+            synchronized (ApplicationProperties.class) {
+                if (instance != null) {
+                    instance = null;
+                }
+            }
+        }
+    }
+
+    public static Configuration get() throws AtlasException {
+        if (instance == null) {
+            synchronized (ApplicationProperties.class) {
+                if (instance == null) {
+                    instance = get(APPLICATION_PROPERTIES);
+                    InMemoryJAASConfiguration.init(instance);
+                }
+            }
+        }
+        return instance;
+    }
+
+    public static Configuration get(String fileName) throws AtlasException {
+        String confLocation = System.getProperty(ATLAS_CONFIGURATION_DIRECTORY_PROPERTY);
+        try {
+            URL url = null;
+
+            if (confLocation == null) {
+                LOG.info("Looking for {} in classpath", fileName);
+
+                url = ApplicationProperties.class.getClassLoader().getResource(fileName);
+
+                if (url == null) {
+                    LOG.info("Looking for /{} in classpath", fileName);
+
+                    url = ApplicationProperties.class.getClassLoader().getResource("/" + fileName);
+                }
+            } else {
+                url = new File(confLocation, fileName).toURI().toURL();
+            }
+
+            LOG.info("Loading {} from {}", fileName, url);
+
+            Configuration configuration = new ApplicationProperties(url).interpolatedConfiguration();
+            logConfiguration(configuration);
+            return configuration;
+        } catch (Exception e) {
+            throw new AtlasException("Failed to load application properties", e);
+        }
+    }
+
+    private static void logConfiguration(Configuration configuration) {
+        if (LOG.isDebugEnabled()) {
+            Iterator<String> keys = configuration.getKeys();
+            LOG.debug("Configuration loaded:");
+            while (keys.hasNext()) {
+                String key = keys.next();
+                LOG.debug("{} = {}", key, configuration.getProperty(key));
+            }
+        }
+    }
+
+    public static Configuration getSubsetConfiguration(Configuration inConf, String prefix) {
+        return inConf.subset(prefix);
+    }
+
+    public static Class getClass(Configuration configuration, String propertyName, String defaultValue,
+                                 Class assignableClass) throws AtlasException {
+        try {
+            String propertyValue = configuration.getString(propertyName, defaultValue);
+            Class<?> clazz = Class.forName(propertyValue);
+            if (assignableClass == null || assignableClass.isAssignableFrom(clazz)) {
+                return clazz;
+            } else {
+                String message = "Class " + clazz.getName() + " specified in property " + propertyName
+                        + " is not assignable to class " + assignableClass.getName();
+                LOG.error(message);
+                throw new AtlasException(message);
+            }
+        } catch (Exception e) {
+            throw new AtlasException(e);
+        }
+    }
+
+    /**
+     * Get the specified property as an {@link InputStream}.
+     * If the property is not set, then the specified default filename
+     * is searched for in the following locations, in order of precedence:
+     * 1. Atlas configuration directory specified by the {@link #ATLAS_CONFIGURATION_DIRECTORY_PROPERTY} system property
+     * 2. relative to the working directory if {@link #ATLAS_CONFIGURATION_DIRECTORY_PROPERTY} is not set
+     * 3. as a classloader resource
+     *
+     * @param configuration
+     * @param propertyName
+     * @param defaultFileName name of file to use by default if specified property is not set in the configuration- if null,
+     * an {@link AtlasException} is thrown if the property is not set
+     * @return an {@link InputStream}
+     * @throws AtlasException if no file was found or if there was an error loading the file
+     */
+    public static InputStream getFileAsInputStream(Configuration configuration, String propertyName, String defaultFileName) throws AtlasException {
+        File fileToLoad = null;
+        String fileName = configuration.getString(propertyName);
+        if (fileName == null) {
+            if (defaultFileName == null) {
+                throw new AtlasException(propertyName + " property not set and no default value specified");
+            }
+            fileName = defaultFileName;
+            String atlasConfDir = System.getProperty(ATLAS_CONFIGURATION_DIRECTORY_PROPERTY);
+            if (atlasConfDir != null) {
+                // Look for default filename in Atlas config directory
+                fileToLoad = new File(atlasConfDir, fileName);
+            }
+            else {
+                // Look for default filename under the working directory
+                fileToLoad = new File(fileName);
+            }
+            if (LOG.isDebugEnabled()) {
+                LOG.debug("{} property not set - defaulting to {}", propertyName, fileToLoad.getPath());
+            }
+        }
+        else {
+            // Look for configured filename
+            fileToLoad = new File(fileName);
+            if (LOG.isDebugEnabled()) {
+                LOG.debug("Using {} property setting: {}", propertyName, fileToLoad.getPath());
+            }
+        }
+
+        InputStream inStr = null;
+        if (fileToLoad.exists()) {
+            try {
+                inStr = new FileInputStream(fileToLoad);
+            } catch (FileNotFoundException e) {
+                throw new AtlasException("Error loading file " + fileName, e);
+            }
+            if (LOG.isDebugEnabled()) {
+                LOG.debug("Loaded file from : {}", fileToLoad.getPath());
+            }
+        }
+        else {
+            // Look for file as class loader resource
+            inStr = Thread.currentThread().getContextClassLoader().getResourceAsStream(fileName);
+            if (inStr == null) {
+                String msg = fileName + " not found in file system or as class loader resource";
+                LOG.error(msg);
+                throw new AtlasException(msg);
+            }
+            if (LOG.isDebugEnabled()) {
+                LOG.debug("Loaded {} as resource from : {}", fileName, Thread.currentThread().getContextClassLoader().getResource(fileName).toString());
+            }
+        }
+        return inStr;
+    }
+}

http://git-wip-us.apache.org/repos/asf/atlas/blob/187730dd/intg/src/main/java/org/apache/atlas/AtlasException.java
----------------------------------------------------------------------
diff --git a/intg/src/main/java/org/apache/atlas/AtlasException.java b/intg/src/main/java/org/apache/atlas/AtlasException.java
new file mode 100644
index 0000000..45d91d4
--- /dev/null
+++ b/intg/src/main/java/org/apache/atlas/AtlasException.java
@@ -0,0 +1,43 @@
+/**
+ * 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.atlas;
+
+/**
+ * Base Exception class for Atlas API.
+ */
+public class AtlasException extends Exception {
+
+    public AtlasException() {
+    }
+
+    public AtlasException(String message) {
+        super(message);
+    }
+
+    public AtlasException(String message, Throwable cause) {
+        super(message, cause);
+    }
+
+    public AtlasException(Throwable cause) {
+        super(cause);
+    }
+
+    public AtlasException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
+        super(message, cause, enableSuppression, writableStackTrace);
+    }
+}

http://git-wip-us.apache.org/repos/asf/atlas/blob/187730dd/intg/src/main/java/org/apache/atlas/security/InMemoryJAASConfiguration.java
----------------------------------------------------------------------
diff --git a/intg/src/main/java/org/apache/atlas/security/InMemoryJAASConfiguration.java b/intg/src/main/java/org/apache/atlas/security/InMemoryJAASConfiguration.java
new file mode 100644
index 0000000..936311b
--- /dev/null
+++ b/intg/src/main/java/org/apache/atlas/security/InMemoryJAASConfiguration.java
@@ -0,0 +1,401 @@
+/**
+ * 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.atlas.security;
+
+import org.apache.atlas.AtlasException;
+import org.apache.commons.collections.MapUtils;
+import org.apache.commons.configuration.ConfigurationConverter;
+import org.apache.commons.lang.ArrayUtils;
+import org.apache.hadoop.security.SecurityUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.security.auth.login.AppConfigurationEntry;
+import javax.security.auth.login.Configuration;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.SortedSet;
+import java.util.StringTokenizer;
+import java.util.TreeSet;
+
+
+/**
+ * InMemoryJAASConfiguration
+ * <p>
+ * An utility class - which has a static method init to load all JAAS configuration from Application
+ * properties file (eg: atlas.properties) and set it as part of the default lookup configuration for
+ * all JAAS configuration lookup.
+ * <p>
+ * Example settings in jaas-application.properties:
+ *
+ * <pre class=code>
+ * atlas.jaas.KafkaClient.loginModuleName = com.sun.security.auth.module.Krb5LoginModule
+ * atlas.jaas.KafkaClient.loginModuleControlFlag = required
+ * atlas.jaas.KafkaClient.option.useKeyTab = true
+ * atlas.jaas.KafkaClient.option.storeKey = true
+ * atlas.jaas.KafkaClient.option.serviceName = kafka
+ * atlas.jaas.KafkaClient.option.keyTab = /etc/security/keytabs/kafka_client.keytab
+ * atlas.jaas.KafkaClient.option.principal = kafka-client-1@EXAMPLE.COM
+
+ * atlas.jaas.MyClient.0.loginModuleName = com.sun.security.auth.module.Krb5LoginModule
+ * atlas.jaas.MyClient.0.loginModuleControlFlag = required
+ * atlas.jaas.MyClient.0.option.useKeyTab = true
+ * atlas.jaas.MyClient.0.option.storeKey = true
+ * atlas.jaas.MyClient.0.option.serviceName = kafka
+ * atlas.jaas.MyClient.0.option.keyTab = /etc/security/keytabs/kafka_client.keytab
+ * atlas.jaas.MyClient.0.option.principal = kafka-client-1@EXAMPLE.COM
+ * atlas.jaas.MyClient.1.loginModuleName = com.sun.security.auth.module.Krb5LoginModule
+ * atlas.jaas.MyClient.1.loginModuleControlFlag = optional
+ * atlas.jaas.MyClient.1.option.useKeyTab = true
+ * atlas.jaas.MyClient.1.option.storeKey = true
+ * atlas.jaas.MyClient.1.option.serviceName = kafka
+ * atlas.jaas.MyClient.1.option.keyTab = /etc/security/keytabs/kafka_client.keytab
+ * atlas.jaas.MyClient.1.option.principal = kafka-client-1@EXAMPLE.COM </pre>
+ *
+ * <p>
+ * This will set the JAAS configuration - equivalent to the jaas.conf file entries:
+ *
+ * <pre class=code>
+ *  KafkaClient {
+ *      com.sun.security.auth.module.Krb5LoginModule required
+ *          useKeyTab=true
+ *          storeKey=true
+ *          serviceName=kafka
+ *          keyTab="/etc/security/keytabs/kafka_client.keytab"
+ *          principal="kafka-client-1@EXAMPLE.COM";
+ *  };
+ *  MyClient {
+ *      com.sun.security.auth.module.Krb5LoginModule required
+ *          useKeyTab=true
+ *          storeKey=true
+ *          serviceName=kafka keyTab="/etc/security/keytabs/kafka_client.keytab"
+ *          principal="kafka-client-1@EXAMPLE.COM";
+ *  };
+ *  MyClient {
+ *      com.sun.security.auth.module.Krb5LoginModule optional
+ *          useKeyTab=true
+ *          storeKey=true
+ *          serviceName=kafka
+ *          keyTab="/etc/security/keytabs/kafka_client.keytab"
+ *          principal="kafka-client-1@EXAMPLE.COM";
+ *  }; </pre>
+ * <p>
+ * Here is the syntax for atlas.properties to add JAAS configuration:
+ * <p>
+ * The property name has to begin with   'atlas.jaas.' +  clientId (in case of Kafka client,
+ * it expects the clientId to be  KafkaClient).
+ * <p>
+ * The following property must be there to specify the JAAS loginModule name
+ * <pre>         'atlas.jaas.' +  clientId  + '.loginModuleName' </pre>
+ * <p>
+ * The following optional property should be set to specify the loginModuleControlFlag
+ * <pre>         'atlas.jaas.' + clientId + '.loginModuleControlFlag'
+ *          Default value :  required ,  Possible values:  required, optional, sufficient, requisite </pre>
+ * <p>
+ * Then you can add additional optional parameters as options for the configuration using the following
+ *  syntax:
+ * <pre>         'atlas.jaas.' + clientId + '.option.' + <optionName>  = <optionValue> </pre>
+ * <p>
+ * The current setup will lookup JAAS configration from the atlas-application.properties first,
+ * if not available, it will delegate to the original configuration
+ *
+ */
+
+
+public final class InMemoryJAASConfiguration extends Configuration {
+
+    private static final Logger LOG = LoggerFactory.getLogger(InMemoryJAASConfiguration.class);
+
+    private static final String JAAS_CONFIG_PREFIX_PARAM = "atlas.jaas.";
+    private static final String JAAS_CONFIG_LOGIN_MODULE_NAME_PARAM = "loginModuleName";
+    private static final String JAAS_CONFIG_LOGIN_MODULE_CONTROL_FLAG_PARAM = "loginModuleControlFlag";
+    private static final String JAAS_CONFIG_LOGIN_OPTIONS_PREFIX = "option";
+    private static final String JAAS_PRINCIPAL_PROP = "principal";
+    private static final Map<String, String> CONFIG_SECTION_REDIRECTS = new HashMap<>();
+
+    private Configuration parent = null;
+    private Map<String, List<AppConfigurationEntry>> applicationConfigEntryMap = new HashMap<>();
+
+    public static void init(String propFile) throws AtlasException {
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("==> InMemoryJAASConfiguration.init({})", propFile);
+        }
+
+        InputStream in = null;
+
+        try {
+            Properties properties = new Properties();
+            in = ClassLoader.getSystemResourceAsStream(propFile);
+            if (in == null) {
+                if (!propFile.startsWith("/")) {
+                    in = ClassLoader.getSystemResourceAsStream("/" + propFile);
+                }
+                if (in == null) {
+                    in = new FileInputStream(new File(propFile));
+                }
+            }
+            properties.load(in);
+            init(properties);
+        } catch (IOException e) {
+            throw new AtlasException("Failed to load JAAS application properties", e);
+        } finally {
+            if (in != null) {
+                try {
+                    in.close();
+                } catch (Exception exception) {
+                    // Ignore
+                }
+            }
+        }
+
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("<== InMemoryJAASConfiguration.init({})", propFile);
+        }
+    }
+
+    public static void init(org.apache.commons.configuration.Configuration atlasConfiguration) throws AtlasException {
+        LOG.debug("==> InMemoryJAASConfiguration.init()");
+
+        if (atlasConfiguration != null && !atlasConfiguration.isEmpty()) {
+            Properties properties = ConfigurationConverter.getProperties(atlasConfiguration);
+            init(properties);
+        } else {
+            throw new AtlasException("Failed to load JAAS application properties: configuration NULL or empty!");
+        }
+
+        LOG.debug("<== InMemoryJAASConfiguration.init()");
+    }
+
+    public static void init(Properties properties) throws AtlasException {
+        LOG.debug("==> InMemoryJAASConfiguration.init()");
+
+        if (properties != null && MapUtils.isNotEmpty(properties)) {
+            InMemoryJAASConfiguration conf = new InMemoryJAASConfiguration(properties);
+            Configuration.setConfiguration(conf);
+        } else {
+            throw new AtlasException("Failed to load JAAS application properties: properties NULL or empty!");
+        }
+
+        LOG.debug("<== InMemoryJAASConfiguration.init()");
+    }
+
+    @Override
+    public AppConfigurationEntry[] getAppConfigurationEntry(String name) {
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("==> InMemoryJAASConfiguration.getAppConfigurationEntry({})", name);
+        }
+
+        AppConfigurationEntry[] ret = null;
+        List<AppConfigurationEntry> retList = null;
+        String redirectedName = getConfigSectionRedirect(name);
+
+        if (redirectedName != null) {
+            retList = applicationConfigEntryMap.get(redirectedName);
+
+            if (LOG.isDebugEnabled()) {
+                LOG.debug("Redirected jaasConfigSection ({} -> {}): ", name, redirectedName, retList);
+            }
+        }
+
+        if (retList == null || retList.size() == 0) {
+            retList = applicationConfigEntryMap.get(name);
+        }
+
+        if (retList == null || retList.size() == 0) {
+            if (parent != null) {
+                ret = parent.getAppConfigurationEntry(name);
+            }
+        } else {
+            int sz = retList.size();
+            ret = new AppConfigurationEntry[sz];
+            ret = retList.toArray(ret);
+        }
+
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("<== InMemoryJAASConfiguration.getAppConfigurationEntry({}): {}", name, ArrayUtils.toString(ret));
+        }
+
+        return ret;
+    }
+
+    private InMemoryJAASConfiguration(Properties prop) {
+        parent = Configuration.getConfiguration();
+        initialize(prop);
+    }
+
+    private void initialize(Properties properties) {
+        LOG.debug("==> InMemoryJAASConfiguration.initialize()");
+
+        int prefixLen = JAAS_CONFIG_PREFIX_PARAM.length();
+
+        Map<String, SortedSet<Integer>> jaasClients = new HashMap<>();
+        for (String key : properties.stringPropertyNames()) {
+            if (key.startsWith(JAAS_CONFIG_PREFIX_PARAM)) {
+                String jaasKey = key.substring(prefixLen);
+                StringTokenizer tokenizer = new StringTokenizer(jaasKey, ".");
+                int tokenCount = tokenizer.countTokens();
+                if (tokenCount > 0) {
+                    String clientId = tokenizer.nextToken();
+                    SortedSet<Integer> indexList = jaasClients.get(clientId);
+                    if (indexList == null) {
+                        indexList = new TreeSet<>();
+                        jaasClients.put(clientId, indexList);
+                    }
+                    String indexStr = tokenizer.nextToken();
+
+                    int indexId = isNumeric(indexStr) ? Integer.parseInt(indexStr) : -1;
+
+                    Integer clientIdIndex = Integer.valueOf(indexId);
+
+                    if (!indexList.contains(clientIdIndex)) {
+                        indexList.add(clientIdIndex);
+                    }
+
+                }
+            }
+        }
+        for (String jaasClient : jaasClients.keySet()) {
+
+            for (Integer index : jaasClients.get(jaasClient)) {
+
+                String keyPrefix = JAAS_CONFIG_PREFIX_PARAM + jaasClient + ".";
+
+                if (index > -1) {
+                    keyPrefix = keyPrefix + String.valueOf(index) + ".";
+                }
+
+                String keyParam = keyPrefix + JAAS_CONFIG_LOGIN_MODULE_NAME_PARAM;
+                String loginModuleName = properties.getProperty(keyParam);
+
+                if (loginModuleName == null) {
+                    LOG.error("Unable to add JAAS configuration for client [{}] as it is missing param [{}]. Skipping JAAS config for [{}]", jaasClient, keyParam, jaasClient);
+                    continue;
+                } else {
+                    loginModuleName = loginModuleName.trim();
+                }
+
+                keyParam = keyPrefix + JAAS_CONFIG_LOGIN_MODULE_CONTROL_FLAG_PARAM;
+                String controlFlag = properties.getProperty(keyParam);
+
+                AppConfigurationEntry.LoginModuleControlFlag loginControlFlag = null;
+                if (controlFlag != null) {
+                    controlFlag = controlFlag.trim().toLowerCase();
+                    switch (controlFlag) {
+                        case "optional":
+                            loginControlFlag = AppConfigurationEntry.LoginModuleControlFlag.OPTIONAL;
+                            break;
+                        case "requisite":
+                            loginControlFlag = AppConfigurationEntry.LoginModuleControlFlag.REQUISITE;
+                            break;
+                        case "sufficient":
+                            loginControlFlag = AppConfigurationEntry.LoginModuleControlFlag.SUFFICIENT;
+                            break;
+                        case "required":
+                            loginControlFlag = AppConfigurationEntry.LoginModuleControlFlag.REQUIRED;
+                            break;
+                        default:
+                            String validValues = "optional|requisite|sufficient|required";
+                            LOG.warn("Unknown JAAS configuration value for ({}) = [{}], valid value are [{}] using the default value, REQUIRED", keyParam, controlFlag, validValues);
+                            loginControlFlag = AppConfigurationEntry.LoginModuleControlFlag.REQUIRED;
+                            break;
+                    }
+                } else {
+                    LOG.warn("Unable to find JAAS configuration ({}); using the default value, REQUIRED", keyParam);
+                    loginControlFlag = AppConfigurationEntry.LoginModuleControlFlag.REQUIRED;
+                }
+
+
+                Map<String, String> options = new HashMap<>();
+                String optionPrefix = keyPrefix + JAAS_CONFIG_LOGIN_OPTIONS_PREFIX + ".";
+                int optionPrefixLen = optionPrefix.length();
+                for (String key : properties.stringPropertyNames()) {
+                    if (key.startsWith(optionPrefix)) {
+                        String optionKey = key.substring(optionPrefixLen);
+                        String optionVal = properties.getProperty(key);
+                        if (optionVal != null) {
+                            optionVal = optionVal.trim();
+
+                            try {
+                                if (optionKey.equalsIgnoreCase(JAAS_PRINCIPAL_PROP)) {
+                                    optionVal = SecurityUtil.getServerPrincipal(optionVal, (String) null);
+                                }
+                            } catch (IOException e) {
+                                LOG.warn("Failed to build serverPrincipal. Using provided value:[{}]", optionVal);
+                            }
+                        }
+                        options.put(optionKey, optionVal);
+                    }
+                }
+
+                AppConfigurationEntry entry = new AppConfigurationEntry(loginModuleName, loginControlFlag, options);
+
+                if (LOG.isDebugEnabled()) {
+                    StringBuilder sb = new StringBuilder();
+                    sb.append("Adding client: [").append(jaasClient).append("{").append(index).append("}]\n");
+                    sb.append("\tloginModule: [").append(loginModuleName).append("]\n");
+                    sb.append("\tcontrolFlag: [").append(loginControlFlag).append("]\n");
+                    for (String key : options.keySet()) {
+                        String val = options.get(key);
+                        sb.append("\tOptions:  [").append(key).append("] => [").append(val).append("]\n");
+                    }
+                    LOG.debug(sb.toString());
+                }
+
+                List<AppConfigurationEntry> retList = applicationConfigEntryMap.get(jaasClient);
+                if (retList == null) {
+                    retList = new ArrayList<>();
+                    applicationConfigEntryMap.put(jaasClient, retList);
+                }
+
+                retList.add(entry);
+            }
+        }
+
+        LOG.debug("<== InMemoryJAASConfiguration.initialize({})", applicationConfigEntryMap);
+    }
+
+    private static boolean isNumeric(String str) {
+        return str.matches("-?\\d+(\\.\\d+)?");  //match a number with optional '-' and decimal.
+    }
+
+    public static void setConfigSectionRedirect(String name, String redirectTo) {
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("setConfigSectionRedirect({}, {})", name, redirectTo);
+        }
+
+        if (name != null) {
+            if (redirectTo != null) {
+                CONFIG_SECTION_REDIRECTS.put(name, redirectTo);
+            } else {
+                CONFIG_SECTION_REDIRECTS.remove(name);
+            }
+        }
+    }
+
+    private static String getConfigSectionRedirect(String name) {
+        return name != null ? CONFIG_SECTION_REDIRECTS.get(name) : null;
+    }
+}

http://git-wip-us.apache.org/repos/asf/atlas/blob/187730dd/intg/src/main/java/org/apache/atlas/security/SecurityProperties.java
----------------------------------------------------------------------
diff --git a/intg/src/main/java/org/apache/atlas/security/SecurityProperties.java b/intg/src/main/java/org/apache/atlas/security/SecurityProperties.java
new file mode 100644
index 0000000..2e953eb
--- /dev/null
+++ b/intg/src/main/java/org/apache/atlas/security/SecurityProperties.java
@@ -0,0 +1,49 @@
+/**
+ * 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.atlas.security;
+
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ *
+ */
+public final class SecurityProperties {
+
+    private SecurityProperties() {
+    }
+
+    public static final String TLS_ENABLED = "atlas.enableTLS";
+    public static final String KEYSTORE_FILE_KEY = "keystore.file";
+    public static final String DEFAULT_KEYSTORE_FILE_LOCATION = "target/atlas.keystore";
+    public static final String KEYSTORE_PASSWORD_KEY = "keystore.password";
+    public static final String TRUSTSTORE_FILE_KEY = "truststore.file";
+    public static final String DEFATULT_TRUSTORE_FILE_LOCATION = "target/atlas.keystore";
+    public static final String TRUSTSTORE_PASSWORD_KEY = "truststore.password";
+    public static final String SERVER_CERT_PASSWORD_KEY = "password";
+    public static final String CLIENT_AUTH_KEY = "client.auth.enabled";
+    public static final String CERT_STORES_CREDENTIAL_PROVIDER_PATH = "cert.stores.credential.provider.path";
+    public static final String SSL_CLIENT_PROPERTIES = "ssl-client.xml";
+    public static final String BIND_ADDRESS = "atlas.server.bind.address";
+    public static final String ATLAS_SSL_EXCLUDE_CIPHER_SUITES = "atlas.ssl.exclude.cipher.suites";
+    public static final List<String> DEFAULT_CIPHER_SUITES = Arrays.asList(
+            ".*NULL.*", ".*RC4.*", ".*MD5.*", ".*DES.*", ".*DSS.*");
+    public static final String ATLAS_SSL_EXCLUDE_PROTOCOLS = "atlas.ssl.exclude.protocols";
+    public static final String[] DEFAULT_EXCLUDE_PROTOCOLS = new String[] { "TLSv1", "TLSv1.1" };
+
+}

http://git-wip-us.apache.org/repos/asf/atlas/blob/187730dd/intg/src/main/java/org/apache/atlas/utils/AuthenticationUtil.java
----------------------------------------------------------------------
diff --git a/intg/src/main/java/org/apache/atlas/utils/AuthenticationUtil.java b/intg/src/main/java/org/apache/atlas/utils/AuthenticationUtil.java
new file mode 100644
index 0000000..09d8085
--- /dev/null
+++ b/intg/src/main/java/org/apache/atlas/utils/AuthenticationUtil.java
@@ -0,0 +1,70 @@
+/**
+ * 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.atlas.utils;
+
+import org.apache.atlas.ApplicationProperties;
+import org.apache.atlas.AtlasException;
+import org.apache.commons.configuration.Configuration;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import java.io.Console;
+
+/**
+ * Util class for Authentication.
+ */
+public final class AuthenticationUtil {
+    private static final Logger LOG = LoggerFactory.getLogger(AuthenticationUtil.class);
+
+    private AuthenticationUtil() {
+    }
+
+    public static boolean isKerberosAuthenticationEnabled() {
+        boolean isKerberosAuthenticationEnabled = false;
+        try {
+            isKerberosAuthenticationEnabled = isKerberosAuthenticationEnabled(ApplicationProperties.get());
+        } catch (AtlasException e) {
+            LOG.error("Error while isKerberosAuthenticationEnabled ", e);
+        }
+        return isKerberosAuthenticationEnabled;
+    }
+
+    public static boolean isKerberosAuthenticationEnabled(Configuration atlasConf) {
+        return atlasConf.getBoolean("atlas.authentication.method.kerberos", false);
+    }
+
+    public static String[] getBasicAuthenticationInput() {
+        String username = null;
+        String password = null;
+
+        try {
+            Console console = System.console();
+            username = console.readLine("Enter username for atlas :- ");
+
+            char[] pwdChar = console.readPassword("Enter password for atlas :- ");
+            if(pwdChar != null) {
+                password = new String(pwdChar);
+            }
+
+        } catch (Exception e) {
+            System.out.print("Error while reading ");
+            System.exit(1);
+        }
+        return new String[]{username, password};
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/atlas/blob/187730dd/intg/src/test/java/org/apache/atlas/ApplicationPropertiesTest.java
----------------------------------------------------------------------
diff --git a/intg/src/test/java/org/apache/atlas/ApplicationPropertiesTest.java b/intg/src/test/java/org/apache/atlas/ApplicationPropertiesTest.java
new file mode 100644
index 0000000..89e5e9b
--- /dev/null
+++ b/intg/src/test/java/org/apache/atlas/ApplicationPropertiesTest.java
@@ -0,0 +1,129 @@
+/**
+ * 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.atlas;
+
+import java.io.InputStream;
+
+import org.apache.commons.configuration.Configuration;
+import org.testng.annotations.Test;
+import static org.testng.Assert.*;
+
+/**
+ * Unit test for {@link ApplicationProperties}
+ *
+ */
+public class ApplicationPropertiesTest {
+
+    @Test
+    public void testGetFileAsInputStream() throws Exception {
+        Configuration props = ApplicationProperties.get("test.properties");
+        InputStream inStr = null;
+
+        // configured file as class loader resource
+        try {
+            inStr = ApplicationProperties.getFileAsInputStream(props, "jaas.properties.file", null);
+            assertNotNull(inStr);
+        }
+        finally {
+            if (inStr != null) {
+                inStr.close();
+            }
+        }
+
+        // configured file from file system path
+        props.setProperty("jaas.properties.file", "src/test/resources/atlas-jaas.properties");
+        try {
+            inStr = ApplicationProperties.getFileAsInputStream(props, "jaas.properties.file", null);
+            assertNotNull(inStr);
+        }
+        finally {
+            if (inStr != null) {
+                inStr.close();
+            }
+        }
+
+        // default file as class loader resource
+        try {
+            inStr = ApplicationProperties.getFileAsInputStream(props, "property.not.specified.in.config", "atlas-jaas.properties");
+            assertNotNull(inStr);
+        }
+        finally {
+            if (inStr != null) {
+                inStr.close();
+            }
+        }
+
+        // default file relative to working directory
+        try {
+            inStr = ApplicationProperties.getFileAsInputStream(props, "property.not.specified.in.config", "src/test/resources/atlas-jaas.properties");
+            assertNotNull(inStr);
+        }
+        finally {
+            if (inStr != null) {
+                inStr.close();
+            }
+        }
+
+        // default file relative to atlas configuration directory
+        String originalConfDirSetting = System.setProperty(ApplicationProperties.ATLAS_CONFIGURATION_DIRECTORY_PROPERTY, "src/test/resources");
+        try {
+            inStr = ApplicationProperties.getFileAsInputStream(props, "property.not.specified.in.config", "atlas-jaas.properties");
+            assertNotNull(inStr);
+        }
+        finally {
+            if (inStr != null) {
+                inStr.close();
+            }
+            if (originalConfDirSetting != null) {
+                System.setProperty(ApplicationProperties.ATLAS_CONFIGURATION_DIRECTORY_PROPERTY, originalConfDirSetting);
+            }
+            else {
+                System.clearProperty(ApplicationProperties.ATLAS_CONFIGURATION_DIRECTORY_PROPERTY);
+            }
+        }
+
+        // non-existent property and no default file
+        try {
+            inStr = ApplicationProperties.getFileAsInputStream(props, "property.not.specified.in.config", null);
+            fail("Expected " + AtlasException.class.getSimpleName() + " but none thrown");
+        }
+        catch (AtlasException e) {
+            // good
+        }
+        finally {
+            if (inStr != null) {
+                inStr.close();
+            }
+        }
+
+        // configured file not found in file system or classpath
+        props.setProperty("jaas.properties.file", "does_not_exist.txt");
+        try {
+            inStr = ApplicationProperties.getFileAsInputStream(props, "jaas.properties.file", null);
+            fail("Expected " + AtlasException.class.getSimpleName() + " but none thrown");
+        }
+        catch (AtlasException e) {
+            // good
+        }
+        finally {
+            if (inStr != null) {
+                inStr.close();
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/atlas/blob/187730dd/intg/src/test/java/org/apache/atlas/security/InMemoryJAASConfigurationTest.java
----------------------------------------------------------------------
diff --git a/intg/src/test/java/org/apache/atlas/security/InMemoryJAASConfigurationTest.java b/intg/src/test/java/org/apache/atlas/security/InMemoryJAASConfigurationTest.java
new file mode 100644
index 0000000..b26ac7f
--- /dev/null
+++ b/intg/src/test/java/org/apache/atlas/security/InMemoryJAASConfigurationTest.java
@@ -0,0 +1,89 @@
+/**
+ * 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.atlas.security;
+
+import javax.security.auth.login.AppConfigurationEntry;
+import javax.security.auth.login.Configuration;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+import org.apache.hadoop.util.StringUtils;
+import org.testng.annotations.Test;
+
+
+//Unstable test. Disabling
+@Test(enabled=false)
+public class InMemoryJAASConfigurationTest extends TestCase {
+
+    private static final String ATLAS_JAAS_PROP_FILE = "atlas-jaas.properties";
+
+    protected void setUp() throws Exception {
+        super.setUp();
+        try {
+            InMemoryJAASConfiguration.init(ATLAS_JAAS_PROP_FILE);
+        } catch(Throwable t) {
+            fail("InMemoryJAASConfiguration.init() is not expected to throw Exception:" +  t);
+        }
+    }
+
+    protected void tearDown() throws Exception {
+        super.tearDown();
+    }
+
+    @Test(enabled=false)
+    public void testGetAppConfigurationEntryStringForKafkaClient() {
+        AppConfigurationEntry[] entries =
+                Configuration.getConfiguration().getAppConfigurationEntry("KafkaClient");
+        Assert.assertNotNull(entries);
+        Assert.assertEquals(1, entries.length);
+        String principal = (String) entries[0].getOptions().get("principal");
+        Assert.assertNotNull(principal);
+        String[] components = principal.split("[/@]");
+        Assert.assertEquals(3, components.length);
+        Assert.assertEquals(false, StringUtils.equalsIgnoreCase(components[1], "_HOST"));
+
+    }
+
+    @Test(enabled=false)
+    public void testGetAppConfigurationEntryStringForMyClient() {
+        AppConfigurationEntry[] entries =
+                Configuration.getConfiguration().getAppConfigurationEntry("myClient");
+        Assert.assertNotNull(entries);
+        Assert.assertEquals(2, entries.length);
+        String principal = (String) entries[0].getOptions().get("principal");
+        Assert.assertNotNull(principal);
+        String[] components = principal.split("[/@]");
+        Assert.assertEquals(3, components.length);
+        Assert.assertEquals(true, StringUtils.equalsIgnoreCase(components[1], "abcd"));
+
+        principal = (String) entries[1].getOptions().get("principal");
+        Assert.assertNotNull(principal);
+        components = principal.split("[/@]");
+        Assert.assertEquals(2, components.length);
+    }
+
+    @Test(enabled=false)
+    public void testGetAppConfigurationEntryStringForUnknownClient() {
+        AppConfigurationEntry[] entries =
+                Configuration.getConfiguration().getAppConfigurationEntry("UnknownClient");
+        Assert.assertNull(entries);
+    }
+
+}
+

http://git-wip-us.apache.org/repos/asf/atlas/blob/187730dd/intg/src/test/java/org/apache/atlas/security/InMemoryJAASConfigurationTicketBasedKafkaClientTest.java
----------------------------------------------------------------------
diff --git a/intg/src/test/java/org/apache/atlas/security/InMemoryJAASConfigurationTicketBasedKafkaClientTest.java b/intg/src/test/java/org/apache/atlas/security/InMemoryJAASConfigurationTicketBasedKafkaClientTest.java
new file mode 100644
index 0000000..3d8175f
--- /dev/null
+++ b/intg/src/test/java/org/apache/atlas/security/InMemoryJAASConfigurationTicketBasedKafkaClientTest.java
@@ -0,0 +1,60 @@
+/**
+ * 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.atlas.security;
+
+import javax.security.auth.login.AppConfigurationEntry;
+import javax.security.auth.login.Configuration;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+import org.testng.annotations.Test;
+
+
+@Test
+public class InMemoryJAASConfigurationTicketBasedKafkaClientTest extends TestCase {
+
+    private static final String ATLAS_JAAS_PROP_FILE = "atlas-jaas.properties";
+
+    protected void setUp() throws Exception {
+        super.setUp();
+        try {
+            InMemoryJAASConfiguration.init(ATLAS_JAAS_PROP_FILE);
+            InMemoryJAASConfiguration.setConfigSectionRedirect("KafkaClient", "ticketBased-KafkaClient");
+        } catch (Throwable t) {
+            fail("InMemoryJAASConfiguration.init() is not expected to throw Exception:" + t);
+        }
+    }
+
+    protected void tearDown() throws Exception {
+        super.tearDown();
+    }
+
+
+    @Test
+    public void testGetAppConfigurationEntryStringForticketBasedKafkaClient() {
+
+        AppConfigurationEntry[] entries =
+                Configuration.getConfiguration().getAppConfigurationEntry("KafkaClient");
+        Assert.assertNotNull(entries);
+        Assert.assertEquals((String) entries[0].getOptions().get("useTicketCache"), "true");
+    }
+
+
+}
+

http://git-wip-us.apache.org/repos/asf/atlas/blob/187730dd/intg/src/test/resources/atlas-jaas.properties
----------------------------------------------------------------------
diff --git a/intg/src/test/resources/atlas-jaas.properties b/intg/src/test/resources/atlas-jaas.properties
new file mode 100644
index 0000000..9412fae
--- /dev/null
+++ b/intg/src/test/resources/atlas-jaas.properties
@@ -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.
+#
+
+#########  Notification Configs  #########
+atlas.notification.embedded=true
+
+atlas.kafka.zookeeper.connect=localhost:19026
+atlas.kafka.bootstrap.servers=localhost:19027
+atlas.kafka.data=${sys:atlas.data}/kafka
+atlas.kafka.zookeeper.session.timeout.ms=4000
+atlas.kafka.zookeeper.sync.time.ms=20
+atlas.kafka.consumer.timeout.ms=100
+atlas.kafka.auto.commit.interval.ms=100
+atlas.kafka.hook.group.id=atlas
+atlas.kafka.entities.group.id=atlas_entities
+atlas.kafka.auto.commit.enable=false
+
+######## JAAS configs ##################
+
+atlas.jaas.KafkaClient.loginModuleName = com.sun.security.auth.module.Krb5LoginModule
+atlas.jaas.KafkaClient.loginModuleControlFlag = required
+atlas.jaas.KafkaClient.option.useKeyTab = true
+atlas.jaas.KafkaClient.option.storeKey = true
+atlas.jaas.KafkaClient.option.serviceName = kafka
+atlas.jaas.KafkaClient.option.keyTab = /etc/security/keytabs/kafka_client.keytab
+atlas.jaas.KafkaClient.option.principal = kafka-client-1/_HOST@EXAMPLE.COM
+
+atlas.jaas.myClient.0.loginModuleName = com.sun.security.auth.module.Krb5LoginModule
+atlas.jaas.myClient.0.loginModuleControlFlag = required
+atlas.jaas.myClient.0.option.useKeyTab = true
+atlas.jaas.myClient.0.option.storeKey = true
+atlas.jaas.myClient.0.option.serviceName = kafka
+atlas.jaas.myClient.0.option.keyTab = /etc/security/keytabs/kafka_client.keytab
+atlas.jaas.myClient.0.option.principal = kafka-client-1/abcd@EXAMPLE.COM
+
+atlas.jaas.myClient.1.loginModuleName = com.sun.security.auth.module.Krb5LoginModule
+atlas.jaas.myClient.1.loginModuleControlFlag = optional
+atlas.jaas.myClient.1.option.useKeyTab = true
+atlas.jaas.myClient.1.option.storeKey = true
+atlas.jaas.myClient.1.option.serviceName = kafka
+atlas.jaas.myClient.1.option.keyTab = /etc/security/keytabs/kafka_client.keytab
+atlas.jaas.myClient.1.option.principal = kafka-client-1@EXAMPLE.COM
+
+
+atlas.jaas.ticketBased-KafkaClient.loginModuleControlFlag=required
+atlas.jaas.ticketBased-KafkaClient.loginModuleName=com.sun.security.auth.module.Krb5LoginModule
+atlas.jaas.ticketBased-KafkaClient.option.useTicketCache=true
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/atlas/blob/187730dd/intg/src/test/resources/test.properties
----------------------------------------------------------------------
diff --git a/intg/src/test/resources/test.properties b/intg/src/test/resources/test.properties
new file mode 100644
index 0000000..395537f
--- /dev/null
+++ b/intg/src/test/resources/test.properties
@@ -0,0 +1,19 @@
+#
+# 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.
+#
+
+jaas.properties.file=atlas-jaas.properties

http://git-wip-us.apache.org/repos/asf/atlas/blob/187730dd/notification/pom.xml
----------------------------------------------------------------------
diff --git a/notification/pom.xml b/notification/pom.xml
index 192a3fc..9b36940 100644
--- a/notification/pom.xml
+++ b/notification/pom.xml
@@ -32,7 +32,7 @@
     <dependencies>
         <dependency>
             <groupId>org.apache.atlas</groupId>
-            <artifactId>atlas-client</artifactId>
+            <artifactId>atlas-client-v1</artifactId>
         </dependency>
 
         <dependency>

http://git-wip-us.apache.org/repos/asf/atlas/blob/187730dd/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 684535a..f793321 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1385,6 +1385,18 @@
 
             <dependency>
                 <groupId>org.apache.atlas</groupId>
+                <artifactId>atlas-client-v1</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+
+            <dependency>
+                <groupId>org.apache.atlas</groupId>
+                <artifactId>atlas-client-v2</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+
+            <dependency>
+                <groupId>org.apache.atlas</groupId>
                 <artifactId>atlas-common</artifactId>
                 <version>${project.version}</version>
             </dependency>

http://git-wip-us.apache.org/repos/asf/atlas/blob/187730dd/repository/pom.xml
----------------------------------------------------------------------
diff --git a/repository/pom.xml b/repository/pom.xml
index 4252751..b7eedde 100755
--- a/repository/pom.xml
+++ b/repository/pom.xml
@@ -49,7 +49,7 @@
 
         <dependency>
             <groupId>org.apache.atlas</groupId>
-            <artifactId>atlas-client</artifactId>
+            <artifactId>atlas-client-v1</artifactId>
         </dependency>
 
         <dependency>

http://git-wip-us.apache.org/repos/asf/atlas/blob/187730dd/repository/src/main/java/org/apache/atlas/repository/converters/AtlasInstanceConverter.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/repository/converters/AtlasInstanceConverter.java b/repository/src/main/java/org/apache/atlas/repository/converters/AtlasInstanceConverter.java
index 3426ae5..9bde5db 100644
--- a/repository/src/main/java/org/apache/atlas/repository/converters/AtlasInstanceConverter.java
+++ b/repository/src/main/java/org/apache/atlas/repository/converters/AtlasInstanceConverter.java
@@ -17,7 +17,6 @@
  */
 package org.apache.atlas.repository.converters;
 
-import org.apache.atlas.model.legacy.EntityResult;
 import org.apache.atlas.AtlasErrorCode;
 import org.apache.atlas.AtlasException;
 import org.apache.atlas.CreateUpdateEntitiesResult;
@@ -31,6 +30,8 @@ import org.apache.atlas.model.instance.EntityMutationResponse;
 import org.apache.atlas.model.instance.EntityMutations;
 import org.apache.atlas.model.instance.EntityMutations.EntityOperation;
 import org.apache.atlas.model.instance.GuidMapping;
+import org.apache.atlas.model.legacy.EntityResult;
+import org.apache.atlas.repository.converters.AtlasFormatConverter.ConverterContext;
 import org.apache.atlas.services.MetadataService;
 import org.apache.atlas.type.AtlasClassificationType;
 import org.apache.atlas.type.AtlasEntityType;
@@ -46,7 +47,6 @@ import org.apache.atlas.typesystem.exception.EntityExistsException;
 import org.apache.atlas.typesystem.exception.EntityNotFoundException;
 import org.apache.atlas.typesystem.exception.TraitNotFoundException;
 import org.apache.atlas.typesystem.exception.TypeNotFoundException;
-import org.apache.atlas.repository.converters.AtlasFormatConverter.ConverterContext;
 import org.apache.atlas.typesystem.types.ValueConversionException;
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.collections.MapUtils;

http://git-wip-us.apache.org/repos/asf/atlas/blob/187730dd/repository/src/main/java/org/apache/atlas/repository/graph/GraphBackedMetadataRepository.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/repository/graph/GraphBackedMetadataRepository.java b/repository/src/main/java/org/apache/atlas/repository/graph/GraphBackedMetadataRepository.java
index 50b7116..568f6b0 100755
--- a/repository/src/main/java/org/apache/atlas/repository/graph/GraphBackedMetadataRepository.java
+++ b/repository/src/main/java/org/apache/atlas/repository/graph/GraphBackedMetadataRepository.java
@@ -50,16 +50,7 @@ import org.springframework.stereotype.Component;
 
 import javax.inject.Inject;
 import javax.inject.Singleton;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
+import java.util.*;
 
 /**
  * An implementation backed by a Graph database provided
@@ -145,7 +136,7 @@ public class GraphBackedMetadataRepository implements MetadataRepository {
     @Override
     @GraphTransaction
     public CreateUpdateEntitiesResult createEntities(ITypedReferenceableInstance... entities) throws RepositoryException,
-        EntityExistsException {
+                                                                                                     EntityExistsException {
         if (LOG.isDebugEnabled()) {
             LOG.debug("adding entities={}", entities);
         }

http://git-wip-us.apache.org/repos/asf/atlas/blob/187730dd/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/EntityGraphRetriever.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/EntityGraphRetriever.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/EntityGraphRetriever.java
index ad88c1b..36cd980 100644
--- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/EntityGraphRetriever.java
+++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/EntityGraphRetriever.java
@@ -17,8 +17,6 @@
  */
 package org.apache.atlas.repository.store.graph.v1;
 
-import com.sun.istack.Nullable;
-import org.apache.atlas.AtlasClient;
 import org.apache.atlas.AtlasErrorCode;
 import org.apache.atlas.exception.AtlasBaseException;
 import org.apache.atlas.model.instance.AtlasClassification;
@@ -40,8 +38,15 @@ import org.apache.atlas.repository.graphdb.AtlasEdge;
 import org.apache.atlas.repository.graphdb.AtlasEdgeDirection;
 import org.apache.atlas.repository.graphdb.AtlasElement;
 import org.apache.atlas.repository.graphdb.AtlasVertex;
-import org.apache.atlas.type.*;
+import org.apache.atlas.type.AtlasArrayType;
+import org.apache.atlas.type.AtlasEntityType;
+import org.apache.atlas.type.AtlasMapType;
+import org.apache.atlas.type.AtlasRelationshipType;
+import org.apache.atlas.type.AtlasStructType;
 import org.apache.atlas.type.AtlasStructType.AtlasAttribute;
+import org.apache.atlas.type.AtlasType;
+import org.apache.atlas.type.AtlasTypeRegistry;
+import org.apache.atlas.type.AtlasTypeUtil;
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
@@ -58,17 +63,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
-import static org.apache.atlas.model.typedef.AtlasBaseTypeDef.ATLAS_TYPE_BIGDECIMAL;
-import static org.apache.atlas.model.typedef.AtlasBaseTypeDef.ATLAS_TYPE_BIGINTEGER;
-import static org.apache.atlas.model.typedef.AtlasBaseTypeDef.ATLAS_TYPE_BOOLEAN;
-import static org.apache.atlas.model.typedef.AtlasBaseTypeDef.ATLAS_TYPE_BYTE;
-import static org.apache.atlas.model.typedef.AtlasBaseTypeDef.ATLAS_TYPE_DATE;
-import static org.apache.atlas.model.typedef.AtlasBaseTypeDef.ATLAS_TYPE_DOUBLE;
-import static org.apache.atlas.model.typedef.AtlasBaseTypeDef.ATLAS_TYPE_FLOAT;
-import static org.apache.atlas.model.typedef.AtlasBaseTypeDef.ATLAS_TYPE_INT;
-import static org.apache.atlas.model.typedef.AtlasBaseTypeDef.ATLAS_TYPE_LONG;
-import static org.apache.atlas.model.typedef.AtlasBaseTypeDef.ATLAS_TYPE_SHORT;
-import static org.apache.atlas.model.typedef.AtlasBaseTypeDef.ATLAS_TYPE_STRING;
+import static org.apache.atlas.model.typedef.AtlasBaseTypeDef.*;
 import static org.apache.atlas.repository.graph.GraphHelper.EDGE_LABEL_PREFIX;
 import static org.apache.atlas.repository.store.graph.v1.AtlasGraphUtilsV1.getIdFromVertex;
 import static org.apache.atlas.type.AtlasStructType.AtlasAttribute.AtlasRelationshipEdgeDirection;
@@ -80,6 +75,12 @@ import static org.apache.atlas.type.AtlasStructType.AtlasAttribute.AtlasRelation
 public final class EntityGraphRetriever {
     private static final Logger LOG = LoggerFactory.getLogger(EntityGraphRetriever.class);
 
+    private final String NAME           = "name";
+    private final String DESCRIPTION    = "description";
+    private final String OWNER          = "owner";
+    private final String CREATE_TIME    = "createTime";
+    private final String QUALIFIED_NAME = "qualifiedName";
+
     private static final GraphHelper graphHelper = GraphHelper.getInstance();
 
     private final AtlasTypeRegistry typeRegistry;
@@ -232,16 +233,16 @@ public final class EntityGraphRetriever {
                 }
             }
 
-            Object name        = getVertexAttribute(entityVertex, entityType.getAttribute(AtlasClient.NAME));
-            Object description = getVertexAttribute(entityVertex, entityType.getAttribute(AtlasClient.DESCRIPTION));
-            Object owner       = getVertexAttribute(entityVertex, entityType.getAttribute(AtlasClient.OWNER));
-            Object createTime  = getVertexAttribute(entityVertex, entityType.getAttribute(AtlasClient.CREATE_TIME));
-            Object displayText = name != null ? name : ret.getAttribute(AtlasClient.QUALIFIED_NAME);
+            Object name        = getVertexAttribute(entityVertex, entityType.getAttribute(NAME));
+            Object description = getVertexAttribute(entityVertex, entityType.getAttribute(DESCRIPTION));
+            Object owner       = getVertexAttribute(entityVertex, entityType.getAttribute(OWNER));
+            Object createTime  = getVertexAttribute(entityVertex, entityType.getAttribute(CREATE_TIME));
+            Object displayText = name != null ? name : ret.getAttribute(QUALIFIED_NAME);
 
-            ret.setAttribute(AtlasClient.NAME, name);
-            ret.setAttribute(AtlasClient.DESCRIPTION, description);
-            ret.setAttribute(AtlasClient.OWNER, owner);
-            ret.setAttribute(AtlasClient.CREATE_TIME, createTime);
+            ret.setAttribute(NAME, name);
+            ret.setAttribute(DESCRIPTION, description);
+            ret.setAttribute(OWNER, owner);
+            ret.setAttribute(CREATE_TIME, createTime);
 
             if (displayText != null) {
                 ret.setDisplayText(displayText.toString());
@@ -339,7 +340,7 @@ public final class EntityGraphRetriever {
     }
 
 
-    private List<AtlasClassification> getClassifications(AtlasVertex instanceVertex, @Nullable String classificationNameFilter) throws AtlasBaseException {
+    private List<AtlasClassification> getClassifications(AtlasVertex instanceVertex, String classificationNameFilter) throws AtlasBaseException {
         List<AtlasClassification> classifications = new ArrayList<>();
         List<String> classificationNames = GraphHelper.getTraitNames(instanceVertex);
 
@@ -741,10 +742,10 @@ public final class EntityGraphRetriever {
         Object          ret        = null;
 
         if (entityType != null) {
-            ret = getVertexAttribute(entityVertex, entityType.getAttribute(AtlasClient.NAME));
+            ret = getVertexAttribute(entityVertex, entityType.getAttribute(NAME));
 
             if (ret == null) {
-                ret = getVertexAttribute(entityVertex, entityType.getAttribute(AtlasClient.QUALIFIED_NAME));
+                ret = getVertexAttribute(entityVertex, entityType.getAttribute(QUALIFIED_NAME));
             }
         }
 

http://git-wip-us.apache.org/repos/asf/atlas/blob/187730dd/repository/src/test/java/org/apache/atlas/TestUtils.java
----------------------------------------------------------------------
diff --git a/repository/src/test/java/org/apache/atlas/TestUtils.java b/repository/src/test/java/org/apache/atlas/TestUtils.java
index 4891279..56bfb82 100755
--- a/repository/src/test/java/org/apache/atlas/TestUtils.java
+++ b/repository/src/test/java/org/apache/atlas/TestUtils.java
@@ -528,9 +528,9 @@ public final class TestUtils {
         String entityjson = InstanceSerialization.toJson(entity, true);
         JSONArray entitiesJson = new JSONArray();
         entitiesJson.put(entityjson);
-        CreateUpdateEntitiesResult creationResult = metadataService.createEntities(entitiesJson.toString());
-        Map<String,String> guidMap = creationResult.getGuidMapping().getGuidAssignments();
-        Map<Id, Referenceable> referencedObjects = findReferencedObjects(entity);
+        CreateUpdateEntitiesResult creationResult    = metadataService.createEntities(entitiesJson.toString());
+        Map<String,String>         guidMap           = creationResult.getGuidMapping().getGuidAssignments();
+        Map<Id, Referenceable>     referencedObjects = findReferencedObjects(entity);
 
         for(Map.Entry<Id,Referenceable> entry : referencedObjects.entrySet()) {
             Id foundId = entry.getKey();

http://git-wip-us.apache.org/repos/asf/atlas/blob/187730dd/repository/src/test/java/org/apache/atlas/repository/graph/GraphBackedMetadataRepositoryDeleteTestBase.java
----------------------------------------------------------------------
diff --git a/repository/src/test/java/org/apache/atlas/repository/graph/GraphBackedMetadataRepositoryDeleteTestBase.java b/repository/src/test/java/org/apache/atlas/repository/graph/GraphBackedMetadataRepositoryDeleteTestBase.java
index 0e22080..0834601 100644
--- a/repository/src/test/java/org/apache/atlas/repository/graph/GraphBackedMetadataRepositoryDeleteTestBase.java
+++ b/repository/src/test/java/org/apache/atlas/repository/graph/GraphBackedMetadataRepositoryDeleteTestBase.java
@@ -237,10 +237,10 @@ public abstract class GraphBackedMetadataRepositoryDeleteTestBase {
     }
 
     private String createInstance(Referenceable entity) throws Exception {
-        ClassType dataType = typeSystem.getDataType(ClassType.class, entity.getTypeName());
+        ClassType                   dataType = typeSystem.getDataType(ClassType.class, entity.getTypeName());
         ITypedReferenceableInstance instance = dataType.convert(entity, Multiplicity.REQUIRED);
-        CreateUpdateEntitiesResult result = repositoryService.createEntities(instance);
-        List<String> results = result.getCreatedEntities();
+        CreateUpdateEntitiesResult  result   = repositoryService.createEntities(instance);
+        List<String>                results  = result.getCreatedEntities();
         return results.get(results.size() - 1);
     }
 

http://git-wip-us.apache.org/repos/asf/atlas/blob/187730dd/repository/src/test/java/org/apache/atlas/repository/graph/GraphBackedMetadataRepositoryTest.java
----------------------------------------------------------------------
diff --git a/repository/src/test/java/org/apache/atlas/repository/graph/GraphBackedMetadataRepositoryTest.java b/repository/src/test/java/org/apache/atlas/repository/graph/GraphBackedMetadataRepositoryTest.java
index d4c250c..6444328 100755
--- a/repository/src/test/java/org/apache/atlas/repository/graph/GraphBackedMetadataRepositoryTest.java
+++ b/repository/src/test/java/org/apache/atlas/repository/graph/GraphBackedMetadataRepositoryTest.java
@@ -22,8 +22,8 @@ import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableSet;
 import org.apache.atlas.AtlasException;
 import org.apache.atlas.CreateUpdateEntitiesResult;
-import org.apache.atlas.TestModules;
 import org.apache.atlas.RequestContext;
+import org.apache.atlas.TestModules;
 import org.apache.atlas.TestUtils;
 import org.apache.atlas.annotation.GraphTransaction;
 import org.apache.atlas.discovery.graph.GraphBackedDiscoveryService;

http://git-wip-us.apache.org/repos/asf/atlas/blob/187730dd/repository/src/test/java/org/apache/atlas/repository/graph/ReverseReferenceUpdateTestBase.java
----------------------------------------------------------------------
diff --git a/repository/src/test/java/org/apache/atlas/repository/graph/ReverseReferenceUpdateTestBase.java b/repository/src/test/java/org/apache/atlas/repository/graph/ReverseReferenceUpdateTestBase.java
index 26dc6a8..8518f93 100644
--- a/repository/src/test/java/org/apache/atlas/repository/graph/ReverseReferenceUpdateTestBase.java
+++ b/repository/src/test/java/org/apache/atlas/repository/graph/ReverseReferenceUpdateTestBase.java
@@ -255,10 +255,10 @@ public abstract class ReverseReferenceUpdateTestBase {
         a.set("oneB", b1);
         b1.set("manyA", Collections.singletonList(a));
 
-        CreateUpdateEntitiesResult result = repositoryService.createEntities(a);
-        Map<String, String> guidAssignments = result.getGuidMapping().getGuidAssignments();
-        String aGuid = a.getId()._getId();
-        String b1Guid = guidAssignments.get(b1.getId()._getId());
+        CreateUpdateEntitiesResult result          = repositoryService.createEntities(a);
+        Map<String, String>        guidAssignments = result.getGuidMapping().getGuidAssignments();
+        String                     aGuid           = a.getId()._getId();
+        String                     b1Guid          = guidAssignments.get(b1.getId()._getId());
 
         a = repositoryService.getEntityDefinition(aGuid);
         Object object = a.get("oneB");

http://git-wip-us.apache.org/repos/asf/atlas/blob/187730dd/repository/src/test/java/org/apache/atlas/service/DefaultMetadataServiceTest.java
----------------------------------------------------------------------
diff --git a/repository/src/test/java/org/apache/atlas/service/DefaultMetadataServiceTest.java b/repository/src/test/java/org/apache/atlas/service/DefaultMetadataServiceTest.java
index e93f08d..e885b8c 100644
--- a/repository/src/test/java/org/apache/atlas/service/DefaultMetadataServiceTest.java
+++ b/repository/src/test/java/org/apache/atlas/service/DefaultMetadataServiceTest.java
@@ -1304,8 +1304,8 @@ public class DefaultMetadataServiceTest {
     }
 
     private String createBasicEntity(final HierarchicalTypeDefinition<ClassType> refType) throws AtlasException {
-        String                     json = InstanceSerialization.toJson(new Referenceable(refType.typeName), false);
-        CreateUpdateEntitiesResult entities         = metadataService.createEntities("[" + json + "]");
+        String                     json     = InstanceSerialization.toJson(new Referenceable(refType.typeName), false);
+        CreateUpdateEntitiesResult entities = metadataService.createEntities("[" + json + "]");
         return entities.getCreatedEntities().get(0);
     }
 

http://git-wip-us.apache.org/repos/asf/atlas/blob/187730dd/server-api/pom.xml
----------------------------------------------------------------------
diff --git a/server-api/pom.xml b/server-api/pom.xml
index 05e5eec..6e99ca3 100644
--- a/server-api/pom.xml
+++ b/server-api/pom.xml
@@ -53,7 +53,7 @@
 
         <dependency>
             <groupId>org.apache.atlas</groupId>
-            <artifactId>atlas-client</artifactId>
+            <artifactId>atlas-client-v1</artifactId>
         </dependency>
     </dependencies>
 </project>

http://git-wip-us.apache.org/repos/asf/atlas/blob/187730dd/server-api/src/main/java/org/apache/atlas/services/MetadataService.java
----------------------------------------------------------------------
diff --git a/server-api/src/main/java/org/apache/atlas/services/MetadataService.java b/server-api/src/main/java/org/apache/atlas/services/MetadataService.java
index 7fb3d3f..d2aa457 100644
--- a/server-api/src/main/java/org/apache/atlas/services/MetadataService.java
+++ b/server-api/src/main/java/org/apache/atlas/services/MetadataService.java
@@ -24,11 +24,11 @@ import org.apache.atlas.EntityAuditEvent;
 import org.apache.atlas.listener.EntityChangeListener;
 import org.apache.atlas.model.legacy.EntityResult;
 import org.apache.atlas.typesystem.IReferenceableInstance;
+import org.apache.atlas.typesystem.IStruct;
 import org.apache.atlas.typesystem.ITypedReferenceableInstance;
 import org.apache.atlas.typesystem.ITypedStruct;
 import org.apache.atlas.typesystem.Referenceable;
 import org.apache.atlas.typesystem.Struct;
-import org.apache.atlas.typesystem.IStruct;
 import org.apache.atlas.typesystem.types.cache.TypeCache;
 import org.codehaus.jettison.json.JSONObject;
 

http://git-wip-us.apache.org/repos/asf/atlas/blob/187730dd/typesystem/src/test/resources/atlas-application.properties
----------------------------------------------------------------------
diff --git a/typesystem/src/test/resources/atlas-application.properties b/typesystem/src/test/resources/atlas-application.properties
index 65dd9a3..d7537a5 100644
--- a/typesystem/src/test/resources/atlas-application.properties
+++ b/typesystem/src/test/resources/atlas-application.properties
@@ -35,7 +35,7 @@ atlas.TypeSystem.impl=org.apache.atlas.typesystem.types.TypeSystem
 
 
 #########  Atlas Server Configs #########
-atlas.rest.address=http://localhost:31000
+atlas.rest.address=http://localhost:21000
 
 #########  Graph Database Configs  #########
 
@@ -82,8 +82,8 @@ atlas.lineage.schema.query.hive_table_v1=hive_table_v1 where __guid='%s'\, colum
 #########  Notification Configs  #########
 atlas.notification.embedded=true
 
-atlas.kafka.zookeeper.connect=localhost:19026
-atlas.kafka.bootstrap.servers=localhost:19027
+atlas.kafka.zookeeper.connect=localhost:9026
+atlas.kafka.bootstrap.servers=localhost:9027
 atlas.kafka.data=${sys:atlas.data}/kafka
 atlas.kafka.zookeeper.session.timeout.ms=4000
 atlas.kafka.zookeeper.sync.time.ms=20

http://git-wip-us.apache.org/repos/asf/atlas/blob/187730dd/webapp/pom.xml
----------------------------------------------------------------------
diff --git a/webapp/pom.xml b/webapp/pom.xml
index 8d03af7..bfa79e8 100755
--- a/webapp/pom.xml
+++ b/webapp/pom.xml
@@ -134,7 +134,12 @@
 
         <dependency>
             <groupId>org.apache.atlas</groupId>
-            <artifactId>atlas-client</artifactId>
+            <artifactId>atlas-client-v1</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.atlas</groupId>
+            <artifactId>atlas-client-v2</artifactId>
         </dependency>
 
         <dependency>

http://git-wip-us.apache.org/repos/asf/atlas/blob/187730dd/webapp/src/main/java/org/apache/atlas/notification/NotificationHookConsumer.java
----------------------------------------------------------------------
diff --git a/webapp/src/main/java/org/apache/atlas/notification/NotificationHookConsumer.java b/webapp/src/main/java/org/apache/atlas/notification/NotificationHookConsumer.java
index 858b320..5fd5087 100644
--- a/webapp/src/main/java/org/apache/atlas/notification/NotificationHookConsumer.java
+++ b/webapp/src/main/java/org/apache/atlas/notification/NotificationHookConsumer.java
@@ -21,6 +21,8 @@ import com.google.common.annotations.VisibleForTesting;
 import com.google.common.util.concurrent.ThreadFactoryBuilder;
 import kafka.utils.ShutdownableThread;
 import org.apache.atlas.ApplicationProperties;
+import org.apache.atlas.AtlasBaseClient;
+import org.apache.atlas.AtlasClient;
 import org.apache.atlas.AtlasException;
 import org.apache.atlas.AtlasServiceException;
 import org.apache.atlas.RequestContext;
@@ -64,7 +66,9 @@ import java.util.concurrent.Executors;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicBoolean;
 
-import static org.apache.atlas.AtlasClientV2.*;
+import static org.apache.atlas.AtlasClientV2.API_V2.DELETE_ENTITY_BY_ATTRIBUTE;
+import static org.apache.atlas.AtlasClientV2.API_V2.UPDATE_ENTITY;
+import static org.apache.atlas.AtlasClientV2.API_V2.UPDATE_ENTITY_BY_ATTRIBUTE;
 
 /**
  * Consumer of notifications from hooks e.g., hive hook etc.
@@ -350,7 +354,8 @@ public class NotificationHookConsumer implements Service, ActiveStateChangeHandl
                                 EntityCreateRequest createRequest = (EntityCreateRequest) message;
 
                                 if (numRetries == 0) { // audit only on the first attempt
-                                    audit(messageUser, CREATE_ENTITY.getMethod(), CREATE_ENTITY.getPath());
+                                    AtlasBaseClient.API api = AtlasClient.API_V1.CREATE_ENTITY;
+                                    audit(messageUser, api.getMethod(), api.getPath());
                                 }
 
                                 entities = instanceConverter.toAtlasEntities(createRequest.getEntities());
@@ -362,8 +367,9 @@ public class NotificationHookConsumer implements Service, ActiveStateChangeHandl
                                 final EntityPartialUpdateRequest partialUpdateRequest = (EntityPartialUpdateRequest) message;
 
                                 if (numRetries == 0) { // audit only on the first attempt
-                                    audit(messageUser, UPDATE_ENTITY_BY_ATTRIBUTE.getMethod(),
-                                            String.format(UPDATE_ENTITY_BY_ATTRIBUTE.getPath(), partialUpdateRequest.getTypeName()));
+                                    AtlasBaseClient.API api = UPDATE_ENTITY_BY_ATTRIBUTE;
+                                    audit(messageUser, api.getMethod(),
+                                          String.format(api.getPath(), partialUpdateRequest.getTypeName()));
                                 }
 
                                 Referenceable referenceable = partialUpdateRequest.getEntity();
@@ -386,8 +392,9 @@ public class NotificationHookConsumer implements Service, ActiveStateChangeHandl
                                 final EntityDeleteRequest deleteRequest = (EntityDeleteRequest) message;
 
                                 if (numRetries == 0) { // audit only on the first attempt
-                                    audit(messageUser, DELETE_ENTITY_BY_ATTRIBUTE.getMethod(),
-                                            String.format(DELETE_ENTITY_BY_ATTRIBUTE.getPath(), deleteRequest.getTypeName()));
+                                    AtlasBaseClient.API api = DELETE_ENTITY_BY_ATTRIBUTE;
+                                    audit(messageUser, api.getMethod(),
+                                          String.format(api.getPath(), deleteRequest.getTypeName()));
                                 }
 
                                 try {
@@ -405,7 +412,8 @@ public class NotificationHookConsumer implements Service, ActiveStateChangeHandl
                                 EntityUpdateRequest updateRequest = (EntityUpdateRequest) message;
 
                                 if (numRetries == 0) { // audit only on the first attempt
-                                    audit(messageUser, UPDATE_ENTITY.getMethod(), UPDATE_ENTITY.getPath());
+                                    AtlasBaseClient.API api = UPDATE_ENTITY;
+                                    audit(messageUser, api.getMethod(), api.getPath());
                                 }
 
                                 entities = instanceConverter.toAtlasEntities(updateRequest.getEntities());

http://git-wip-us.apache.org/repos/asf/atlas/blob/187730dd/webapp/src/main/java/org/apache/atlas/web/resources/EntityResource.java
----------------------------------------------------------------------
diff --git a/webapp/src/main/java/org/apache/atlas/web/resources/EntityResource.java b/webapp/src/main/java/org/apache/atlas/web/resources/EntityResource.java
index 711cc04..67c9b27 100755
--- a/webapp/src/main/java/org/apache/atlas/web/resources/EntityResource.java
+++ b/webapp/src/main/java/org/apache/atlas/web/resources/EntityResource.java
@@ -22,7 +22,6 @@ import com.google.common.annotations.VisibleForTesting;
 import com.google.common.base.Preconditions;
 import com.sun.jersey.api.core.ResourceContext;
 import org.apache.atlas.AtlasClient;
-import org.apache.atlas.model.legacy.EntityResult;
 import org.apache.atlas.AtlasConstants;
 import org.apache.atlas.AtlasErrorCode;
 import org.apache.atlas.AtlasException;
@@ -35,6 +34,7 @@ import org.apache.atlas.model.instance.AtlasEntity.AtlasEntitiesWithExtInfo;
 import org.apache.atlas.model.instance.AtlasEntity.AtlasEntityWithExtInfo;
 import org.apache.atlas.model.instance.EntityMutationResponse;
 import org.apache.atlas.model.instance.GuidMapping;
+import org.apache.atlas.model.legacy.EntityResult;
 import org.apache.atlas.repository.converters.AtlasInstanceConverter;
 import org.apache.atlas.repository.store.graph.AtlasEntityStore;
 import org.apache.atlas.repository.store.graph.v1.AtlasEntityStream;
@@ -215,7 +215,7 @@ public class EntityResource {
             UriBuilder ub = uriInfo.getAbsolutePathBuilder();
             locationURI = CollectionUtils.isEmpty(guids) ? null : ub.path(guids.get(0)).build();
         } else {
-            String uriPath = AtlasClient.API.GET_ENTITY.getPath();
+            String uriPath = AtlasClient.API_V1.GET_ENTITY.getPath();
             locationURI = guids.isEmpty() ? null : UriBuilder
                 .fromPath(AtlasConstants.DEFAULT_ATLAS_REST_ADDRESS)
                 .path(uriPath).path(guids.get(0)).build();

http://git-wip-us.apache.org/repos/asf/atlas/blob/187730dd/webapp/src/test/java/org/apache/atlas/web/integration/AdminJerseyResourceIT.java
----------------------------------------------------------------------
diff --git a/webapp/src/test/java/org/apache/atlas/web/integration/AdminJerseyResourceIT.java b/webapp/src/test/java/org/apache/atlas/web/integration/AdminJerseyResourceIT.java
index cfe09d6..7d045f3 100755
--- a/webapp/src/test/java/org/apache/atlas/web/integration/AdminJerseyResourceIT.java
+++ b/webapp/src/test/java/org/apache/atlas/web/integration/AdminJerseyResourceIT.java
@@ -37,7 +37,7 @@ public class AdminJerseyResourceIT extends BaseResourceIT {
 
     @Test
     public void testGetVersion() throws Exception {
-        JSONObject response = atlasClientV1.callAPIWithBodyAndParams(AtlasClient.API.VERSION, null, (String[]) null);
+        JSONObject response = atlasClientV1.callAPIWithBodyAndParams(AtlasClient.API_V1.VERSION, null, (String[]) null);
         Assert.assertNotNull(response);
 
         PropertiesConfiguration buildConfiguration = new PropertiesConfiguration("atlas-buildinfo.properties");

http://git-wip-us.apache.org/repos/asf/atlas/blob/187730dd/webapp/src/test/java/org/apache/atlas/web/integration/DataSetLineageJerseyResourceIT.java
----------------------------------------------------------------------
diff --git a/webapp/src/test/java/org/apache/atlas/web/integration/DataSetLineageJerseyResourceIT.java b/webapp/src/test/java/org/apache/atlas/web/integration/DataSetLineageJerseyResourceIT.java
index 8c6ba77..1a65dab 100644
--- a/webapp/src/test/java/org/apache/atlas/web/integration/DataSetLineageJerseyResourceIT.java
+++ b/webapp/src/test/java/org/apache/atlas/web/integration/DataSetLineageJerseyResourceIT.java
@@ -59,7 +59,7 @@ public class DataSetLineageJerseyResourceIT extends BaseResourceIT {
 
     @Test
     public void testInputsGraph() throws Exception {
-        JSONObject response = atlasClientV1.callAPIWithBodyAndParams(AtlasClient.API.NAME_LINEAGE_INPUTS_GRAPH, null, salesMonthlyTable, "inputs", "graph");
+        JSONObject response = atlasClientV1.callAPIWithBodyAndParams(AtlasClient.API_V1.NAME_LINEAGE_INPUTS_GRAPH, null, salesMonthlyTable, "inputs", "graph");
         Assert.assertNotNull(response);
         System.out.println("inputs graph = " + response);
 
@@ -95,7 +95,7 @@ public class DataSetLineageJerseyResourceIT extends BaseResourceIT {
 
     @Test
     public void testOutputsGraph() throws Exception {
-        JSONObject response = atlasClientV1.callAPIWithBodyAndParams(AtlasClient.API.NAME_LINEAGE_OUTPUTS_GRAPH, null, salesFactTable, "outputs", "graph");
+        JSONObject response = atlasClientV1.callAPIWithBodyAndParams(AtlasClient.API_V1.NAME_LINEAGE_OUTPUTS_GRAPH, null, salesFactTable, "outputs", "graph");
         Assert.assertNotNull(response);
         System.out.println("outputs graph= " + response);
 
@@ -131,7 +131,7 @@ public class DataSetLineageJerseyResourceIT extends BaseResourceIT {
 
     @Test
     public void testSchema() throws Exception {
-        JSONObject response = atlasClientV1.callAPIWithBodyAndParams(AtlasClient.API.NAME_LINEAGE_SCHEMA, null, salesFactTable, "schema");
+        JSONObject response = atlasClientV1.callAPIWithBodyAndParams(AtlasClient.API_V1.NAME_LINEAGE_SCHEMA, null, salesFactTable, "schema");
 
         Assert.assertNotNull(response);
         System.out.println("schema = " + response);
@@ -173,12 +173,12 @@ public class DataSetLineageJerseyResourceIT extends BaseResourceIT {
 
     @Test(expectedExceptions = AtlasServiceException.class)
     public void testSchemaForInvalidTable() throws Exception {
-        JSONObject response = atlasClientV1.callAPIWithBodyAndParams(AtlasClient.API.NAME_LINEAGE_SCHEMA, null, "blah", "schema");
+        JSONObject response = atlasClientV1.callAPIWithBodyAndParams(AtlasClient.API_V1.NAME_LINEAGE_SCHEMA, null, "blah", "schema");
     }
 
     @Test(expectedExceptions = AtlasServiceException.class)
     public void testSchemaForDB() throws Exception {
-        JSONObject response = atlasClientV1.callAPIWithBodyAndParams(AtlasClient.API.NAME_LINEAGE_SCHEMA, null, salesDBName, "schema");
+        JSONObject response = atlasClientV1.callAPIWithBodyAndParams(AtlasClient.API_V1.NAME_LINEAGE_SCHEMA, null, salesDBName, "schema");
     }
 
     private void setupInstances() throws Exception {