ATLAS-2860: Remove dependency on atlas-application.properties for AtlasClient.
Signed-off-by: Madhan Neethiraj <madhan@apache.org> (cherry picked from commit 6b953b59c4b1eb05ee4ddd2234b81cd98451ccc2)
This commit is contained in:
parent
eae9761871
commit
3176d1a1e4
|
|
@ -148,7 +148,7 @@ public class HBaseAtlasHookIT {
|
|||
private void createAtlasClient() {
|
||||
try {
|
||||
org.apache.commons.configuration.Configuration configuration = ApplicationProperties.get();
|
||||
String[] atlasEndPoint = configuration.getStringArray(HBaseAtlasHook.ATTR_ATLAS_ENDPOINT);
|
||||
String[] atlasEndPoint = configuration.getStringArray(HBaseAtlasHook.ATTR_ATLAS_ENDPOINT);
|
||||
|
||||
configuration.setProperty("atlas.cluster.name", CLUSTER_NAME);
|
||||
|
||||
|
|
@ -163,7 +163,7 @@ public class HBaseAtlasHookIT {
|
|||
}
|
||||
|
||||
if (AuthenticationUtil.isKerberosAuthenticationEnabled()) {
|
||||
atlasClient = new AtlasClientV2(configuration, atlasEndPoint, null);
|
||||
atlasClient = new AtlasClientV2(atlasEndPoint);
|
||||
} else {
|
||||
atlasClient = new AtlasClientV2(configuration, atlasEndPoint, new String[]{"admin", "admin"});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -258,7 +258,7 @@ public abstract class AtlasBaseClient {
|
|||
// to create a
|
||||
// configuration object, persist it, then subsequently pass in an empty configuration to SSLFactory
|
||||
try {
|
||||
SecureClientUtils.persistSSLClientConfiguration(configuration);
|
||||
SecureClientUtils.persistSSLClientConfiguration(configuration, System.getProperty("atlas.conf") );
|
||||
} catch (Exception e) {
|
||||
LOG.info("Error processing client configuration.", e);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -163,8 +163,7 @@ public class SecureClientUtils {
|
|||
connection.setReadTimeout(socketTimeout);
|
||||
}
|
||||
|
||||
private static File getSSLClientFile() throws AtlasException {
|
||||
String confLocation = System.getProperty("atlas.conf");
|
||||
private static File getSSLClientFile(String confLocation) throws AtlasException {
|
||||
File sslDir;
|
||||
try {
|
||||
if (confLocation == null) {
|
||||
|
|
@ -185,11 +184,11 @@ public class SecureClientUtils {
|
|||
return new File(sslDir, SecurityProperties.SSL_CLIENT_PROPERTIES);
|
||||
}
|
||||
|
||||
public static void persistSSLClientConfiguration(org.apache.commons.configuration.Configuration clientConfig)
|
||||
public static void persistSSLClientConfiguration(org.apache.commons.configuration.Configuration clientConfig, String confLocation)
|
||||
throws AtlasException, IOException {
|
||||
//trust settings
|
||||
Configuration configuration = new Configuration(false);
|
||||
File sslClientFile = getSSLClientFile();
|
||||
File sslClientFile = getSSLClientFile(confLocation);
|
||||
if (!sslClientFile.exists()) {
|
||||
configuration.set("ssl.client.truststore.type", "jks");
|
||||
configuration.set("ssl.client.truststore.location", clientConfig.getString(TRUSTSTORE_FILE_KEY));
|
||||
|
|
|
|||
|
|
@ -68,11 +68,21 @@ public final class ApplicationProperties extends PropertiesConfiguration {
|
|||
if (instance == null) {
|
||||
synchronized (ApplicationProperties.class) {
|
||||
if (instance == null) {
|
||||
instance = get(APPLICATION_PROPERTIES);
|
||||
InMemoryJAASConfiguration.init(instance);
|
||||
set(get(APPLICATION_PROPERTIES));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
public static Configuration set(Configuration configuration) throws AtlasException {
|
||||
synchronized (ApplicationProperties.class) {
|
||||
instance = configuration;
|
||||
|
||||
InMemoryJAASConfiguration.init(instance);
|
||||
}
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue