<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Licensed to the Apache Software Foundation (ASF) under one or more
  ~ contributor license agreements.  See the NOTICE file distributed with
  ~ this work for additional information regarding copyright ownership.
  ~ The ASF licenses this file to You under the Apache License, Version 2.0
  ~ (the "License"); you may not use this file except in compliance with
  ~ the License.  You may obtain a copy of the License at
  ~
  ~      http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>org.apache.unomi</groupId>
        <artifactId>unomi-persistence-elasticsearch</artifactId>
        <version>1.5.4</version>
    </parent>

    <artifactId>unomi-persistence-elasticsearch-core</artifactId>
    <name>Apache Unomi :: Persistence :: ElasticSearch :: Core</name>
    <description>Core ElasticSearch persistence implementation for the Apache Unomi Context Server</description>
    <packaging>bundle</packaging>

    <dependencies>
        <dependency>
            <groupId>org.osgi</groupId>
            <artifactId>org.osgi.core</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.osgi</groupId>
            <artifactId>org.osgi.compendium</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.unomi</groupId>
            <artifactId>unomi-api</artifactId>
            <version>${project.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.unomi</groupId>
            <artifactId>unomi-common</artifactId>
            <version>${project.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.unomi</groupId>
            <artifactId>unomi-persistence-spi</artifactId>
            <version>${project.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <version>20.0</version>
        </dependency>
        <dependency>
            <groupId>org.elasticsearch.client</groupId>
            <artifactId>elasticsearch-rest-high-level-client</artifactId>
            <version>${elasticsearch.version}</version>
        </dependency>
        <!--
        <dependency>
            <groupId>org.elasticsearch</groupId>
            <artifactId>elasticsearch</artifactId>
            <version>${elasticsearch.version}</version>
        </dependency>
        <dependency>
            <groupId>org.elasticsearch</groupId>
            <artifactId>elasticsearch-core</artifactId>
            <version>${elasticsearch.version}</version>
        </dependency>
        <dependency>
            <groupId>org.elasticsearch</groupId>
            <artifactId>elasticsearch-secure-sm</artifactId>
            <version>${elasticsearch.version}</version>
        </dependency>
        <dependency>
            <groupId>org.elasticsearch</groupId>
            <artifactId>elasticsearch-x-content</artifactId>
            <version>${elasticsearch.version}</version>
        </dependency>
        <dependency>
            <groupId>org.elasticsearch</groupId>
            <artifactId>elasticsearch-geo</artifactId>
            <version>${elasticsearch.version}</version>
        </dependency>
        -->
        <dependency>
            <groupId>org.elasticsearch.test</groupId>
            <artifactId>framework</artifactId>
            <version>${elasticsearch.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.elasticsearch.plugin</groupId>
            <artifactId>transport-netty4-client</artifactId>
            <version>${elasticsearch.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.lucene</groupId>
            <artifactId>lucene-test-framework</artifactId>
            <version>8.2.0</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-core</artifactId>
            <version>2.12.1</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-api</artifactId>
            <version>2.12.1</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-slf4j-impl</artifactId>
            <version>2.12.1</version>
            <scope>test</scope>
        </dependency>

        <!-- The following are optional dependencies from the ElasticSearch that are made mandatory -->

        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-api</artifactId>
            <version>2.12.1</version>
            <scope>compile</scope>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-core</artifactId>
            <version>2.12.1</version>
            <scope>compile</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.apache.logging.log4j</groupId>
                    <artifactId>log4j-api</artifactId>
                </exclusion>
            </exclusions>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-1.2-api</artifactId>
            <version>2.12.1</version>
            <scope>compile</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.apache.logging.log4j</groupId>
                    <artifactId>log4j-api</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.apache.logging.log4j</groupId>
                    <artifactId>log4j-core</artifactId>
                </exclusion>
            </exclusions>
            <optional>true</optional>
        </dependency>

        <!-- End of optional ElasticSearch dependencies -->

        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
        </dependency>

        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
        </dependency>
        <dependency>
            <groupId>commons-collections</groupId>
            <artifactId>commons-collections</artifactId>
        </dependency>

        <dependency>
            <groupId>org.apache.unomi</groupId>
            <artifactId>unomi-metrics</artifactId>
            <version>${project.version}</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.hazelcast</groupId>
            <artifactId>hazelcast-all</artifactId>
            <version>3.12.8</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.unomi</groupId>
            <artifactId>unomi-scripting</artifactId>
            <version>${project.version}</version>
            <scope>provided</scope>
        </dependency>

    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <extensions>true</extensions>
                <configuration>
                    <instructions>
                        <Import-Package>
                            org.jctools.queues;resolution:=optional,
                            org.apache.logging.log4j.util.internal;resolution:=optional,
                            com.conversantmedia.util.concurrent;resolution:=optional,
                            com.carrotsearch.randomizedtesting;resolution:=optional,
                            com.fasterxml.jackson.*;resolution:=optional,
                            com.google.appengine.api;resolution:=optional,
                            com.google.apphosting.api;resolution:=optional,
                            com.google.common.geometry;resolution:=optional,
                            com.google.errorprone.annotations.concurrent;resolution:=optional,
                            com.hazelcast.core;version="[3.12,4)";resolution:=optional,
                            com.lmax.disruptor;resolution:=optional,
                            com.lmax.disruptor.dsl;resolution:=optional,
                            com.sun.management;resolution:=optional,
                            javax.activation;resolution:=optional,
                            javax.annotation;resolution:=optional,
                            javax.annotation.processing;resolution:=optional,
                            javax.crypto;resolution:=optional,
                            javax.crypto.spec;resolution:=optional,
                            javax.jms;resolution:=optional,
                            javax.lang.model;resolution:=optional,
                            javax.lang.model.element;resolution:=optional,
                            javax.lang.model.util;resolution:=optional,
                            javax.mail;resolution:=optional,
                            javax.mail.internet;resolution:=optional,
                            javax.mail.util;resolution:=optional,
                            javax.management;resolution:=optional,
                            javax.naming;resolution:=optional,
                            javax.naming.directory;resolution:=optional,
                            javax.naming.ldap;resolution:=optional,
                            javax.net;resolution:=optional,
                            javax.net.ssl;resolution:=optional,
                            javax.persistence;resolution:=optional,
                            javax.script;resolution:=optional,
                            javax.security.auth.x500;resolution:=optional,
                            javax.servlet;resolution:=optional,
                            javax.sql;resolution:=optional,
                            javax.tools;resolution:=optional,
                            javax.xml.bind;resolution:=optional,
                            javax.xml.parsers;resolution:=optional,
                            javax.xml.stream;resolution:=optional,
                            javax.xml.transform;resolution:=optional,
                            javax.xml.transform.sax;resolution:=optional,
                            javax.xml.transform.stream;resolution:=optional,
                            javax.xml.validation;resolution:=optional,
                            jdk.net;resolution:=optional,
                            org.apache.avalon.framework.logger;resolution:=optional,
                            org.apache.commons.compress.compressors;resolution:=optional,
                            org.apache.commons.compress.utils;resolution:=optional,
                            org.apache.commons.csv;resolution:=optional,
                            org.apache.kafka.clients.producer;resolution:=optional,
                            org.apache.log;resolution:=optional,
                            org.apache.unomi.api.conditions;version="[1.5,2)",
                            org.apache.unomi.api.query;version="[1.5,2)",
                            org.apache.unomi.api;version="[1.5,2)",
                            org.apache.unomi.metrics;version="[1.5,2)",
                            org.apache.unomi.persistence.spi.aggregate;version="[1.5,2)",
                            org.apache.unomi.persistence.spi;version="[1.5,2)",
                            org.codehaus.stax2;resolution:=optional,
                            org.elasticsearch.*;resolution:=optional,
                            org.ietf.jgss;resolution:=optional,
                            org.joda.convert;resolution:=optional,
                            org.locationtech.jts.geom;resolution:=optional,
                            org.locationtech.spatial4j.*;resolution:=optional,
                            org.osgi.framework.wiring;version="[1.0,2)",
                            org.osgi.framework;version="[1.6,2)",
                            org.osgi.service.blueprint;version="[1.0.0,2.0.0)",
                            org.slf4j;version="[1.7,2)",
                            org.w3c.dom;resolution:=optional,
                            org.xml.sax;resolution:=optional,
                            org.xml.sax.ext;resolution:=optional,
                            org.xml.sax.helpers;resolution:=optional,
                            org.zeromq;resolution:=optional,
                            sun.misc;resolution:=optional,
                            *
                        </Import-Package>
                        <Export-Package>
                            org.elasticsearch.*;version="${elasticsearch.version}",
                            org.elasticsearch.index.query.*;version="${elasticsearch.version}",
                            org.apache.unomi.persistence.elasticsearch.conditions;version="${project.version}"
                        </Export-Package>
                        <Embed-Dependency>*;scope=compile|runtime</Embed-Dependency>
                        <Embed-Transitive>true</Embed-Transitive>
                    </instructions>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>attach-artifacts</id>
                        <phase>package</phase>
                        <goals>
                            <goal>attach-artifact</goal>
                        </goals>
                        <configuration>
                            <artifacts>
                                <artifact>
                                    <file>
                                        src/main/resources/org.apache.unomi.persistence.elasticsearch.cfg
                                    </file>
                                    <type>cfg</type>
                                    <classifier>elasticsearchcfg</classifier>
                                </artifact>
                            </artifacts>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>

    </build>

</project>
