<?xml version="1.0" encoding="UTF-8"?>

<!-- SPDX-License-Identifier: Apache-2.0 -->
<!-- Copyright Contributors to the ODPi Egeria project. -->

<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">
    <parent>
        <artifactId>open-metadata-implementation</artifactId>
        <groupId>org.odpi.egeria</groupId>
        <version>1.1</version>
    </parent>

    <modelVersion>4.0.0</modelVersion>

    <name>Adapters</name>
    <description>
        The adapters provide components that either plug into the open metadata
        implementation to support one of its functions or
        plug open metadata capability into another technology.
    </description>

    <properties>
        <gaiandb.url>https://github.com/gaiandb/gaiandb/blob/master/build/GAIANDB_V2.1.8_20160523.zip?raw=true</gaiandb.url>
    </properties>

    <artifactId>adapters</artifactId>
    <packaging>pom</packaging>
    <modules>
        <module>open-connectors</module>
        <module>governance-engines-plugins</module>
        <module>authentication-plugins</module>
    </modules>

    <dependencies>

        <!-- File I/O processing -->

    </dependencies>

    <!-- The following steps obtain the required Gaian libraries by retrieving, unpacking the distribution and installing into the local maven repo -->
    <build>
        <plugins>
            <plugin>
                <groupId>com.googlecode.maven-download-plugin</groupId>
                <artifactId>download-maven-plugin</artifactId>
                <inherited>false</inherited>
                <executions>
                    <execution>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>wget</goal>
                        </goals>
                        <configuration>
                            <url>
                                ${gaiandb.url}
                            </url>
                            <outputFileName>GAIANDB_V2.1.8_20160523.zip</outputFileName>
                            <outputDirectory>${project.build.directory}</outputDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-antrun-plugin</artifactId>
                <inherited>false</inherited>
                <executions>
                    <execution>
                        <phase>generate-sources</phase>
                        <configuration>
                            <target>
                                <unzip src="${project.build.directory}/GAIANDB_V2.1.8_20160523.zip"
                                       dest="${project.build.directory}">
                                    <patternset>
                                        <include name="**/GAIANDB.jar"/>
                                        <include name="**/derby.jar"/>
                                    </patternset>
                                </unzip>
                            </target>
                        </configuration>
                        <goals>
                            <goal>run</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-install-plugin</artifactId>
                <inherited>false</inherited>
                <executions>
                    <execution>
                        <id>install-derby</id>
                        <configuration>
                            <groupId>org.apache.derby</groupId>
                            <artifactId>derby</artifactId>
                            <version>${derby.version}</version>
                            <packaging>jar</packaging>
                            <file>${project.build.directory}/lib/derby.jar</file>
                            <generatePom>true</generatePom>
                        </configuration>
                        <goals>
                            <goal>install-file</goal>
                        </goals>
                        <phase>generate-sources</phase>
                    </execution>
                    <execution>
                        <id>install-gaian</id>
                        <configuration>
                            <groupId>com.ibm.gaiandb</groupId>
                            <artifactId>gaian</artifactId>
                            <version>${gaian.version}</version>
                            <packaging>jar</packaging>
                            <file>${project.build.directory}/lib/GAIANDB.jar</file>
                            <generatePom>true</generatePom>
                        </configuration>
                        <goals>
                            <goal>install-file</goal>
                        </goals>
                        <phase>generate-sources</phase>
                    </execution>
                </executions>
            </plugin>

        </plugins>
    </build>

</project>
