1 package org.opendaylight.mwtn.index.impl;
3 import org.opendaylight.mwtn.base.database.HtDatabaseClientAbstract;
4 import org.opendaylight.mwtn.base.database.HtDatabaseNode;
5 import org.opendaylight.mwtn.base.database.IndexClientBuilder;
6 import org.slf4j.Logger;
7 import org.slf4j.LoggerFactory;
10 * Setup index mwtn in the database
14 public class IndexConfigService implements AutoCloseable {
16 private static final Logger LOG = LoggerFactory.getLogger(IndexConfigService.class);
18 /** Index name to be used */
19 private static final String INDEX = "config";
20 /** Location of configuration data **/
21 private static final String MODELDATA = "/elasticsearch/index/config";
23 private HtDatabaseClientAbstract client;
25 // --- Construct and initialize
27 public IndexConfigService(HtDatabaseNode database) {
28 LOG.info("Create {} start", this.getClass().getSimpleName());
30 IndexClientBuilder clientBuilder = IndexClientBuilder.getBuilder(INDEX).setModelDataDirectory(MODELDATA);
31 client = clientBuilder.create(database);
32 LOG.info("Create {} finished. DB Service {} started.", this.getClass().getSimpleName(), client != null ? "sucessfully" : "not" );
36 public void close() throws Exception {