boscodurai commented on a change in pull request #42: DINF-1390 Added start of implementation for ElasticSearch write/searc… URL: https://github.com/apache/ranger/pull/42#discussion_r342403047
########## File path: security-admin/src/main/java/org/apache/ranger/elasticsearch/ElasticSearchMgr.java ########## @@ -0,0 +1,90 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.ranger.elasticsearch; + +import org.apache.http.HttpHost; +import org.apache.log4j.Logger; +import org.apache.ranger.audit.destination.ElasticSearchAuditDestination; +import org.apache.ranger.audit.provider.MiscUtil; +import org.apache.ranger.common.PropertiesUtil; +import org.elasticsearch.client.RestClient; +import org.elasticsearch.client.RestHighLevelClient; +import org.springframework.stereotype.Component; + +/** + * This class initializes Solr + * + */ +@Component +public class ElasticSearchMgr { + + private static final Logger logger = Logger.getLogger(ElasticSearchMgr.class); + + private String getProperty(String propName, String defaultValue) { + String value = PropertiesUtil.getProperty(propName); + if (null == value) return defaultValue; + return value; + } + + synchronized void connect() { + RestHighLevelClient me = client; + if (me == null) { + synchronized (ElasticSearchAuditDestination.class) { + me = client; + if (client == null) { + String urls = PropertiesUtil.getProperty("ranger.audit.solr.url"); Review comment: Should this be "elasticsearch"? ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
