<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
  ~
  ~ WSO2 Inc. 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/maven-v4_0_0.xsd">

    <parent>
        <groupId>org.wso2.carbon.messaging</groupId>
        <artifactId>andes-feature</artifactId>
        <version>3.3.16</version>
        <relativePath>../pom.xml</relativePath>
    </parent>

    <modelVersion>4.0.0</modelVersion>
    <artifactId>org.wso2.carbon.andes.server.feature</artifactId>
    <version>3.3.16</version>
    <packaging>pom</packaging>
    <name>WSO2 Carbon - Feature - Andes - Server</name>
    <url>http://wso2.org</url>
    <description>This feature provides Andes back-end functionality</description>

    <dependencies>
        <dependency>
            <groupId>org.wso2.carbon.messaging</groupId>
            <artifactId>org.wso2.carbon.andes</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon.messaging</groupId>
            <artifactId>org.wso2.carbon.andes.authentication</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon.messaging</groupId>
            <artifactId>org.wso2.carbon.andes.authorization</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon.messaging</groupId>
            <artifactId>org.wso2.carbon.andes.commons</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon.messaging</groupId>
            <artifactId>org.wso2.carbon.andes.cluster.mgt</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon.messaging</groupId>
            <artifactId>org.wso2.carbon.andes.core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon.messaging</groupId>
            <artifactId>org.wso2.carbon.andes.admin</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon.messaging</groupId>
            <artifactId>org.wso2.carbon.andes.admin.mqtt</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon.messaging</groupId>
            <artifactId>org.wso2.carbon.andes.event.core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon.messaging</groupId>
            <artifactId>org.wso2.carbon.andes.event.admin</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.andes.wso2</groupId>
            <artifactId>andes</artifactId>
        </dependency>
        <dependency>
            <groupId>commons-cli.wso2</groupId>
            <artifactId>commons-cli</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.orbit.com.lmax</groupId>
            <artifactId>disruptor</artifactId>
        </dependency>
        <dependency>
            <groupId>com.googlecode.cqengine</groupId>
            <artifactId>cqengine</artifactId>
        </dependency>
		<dependency>
		    <groupId>de.javakaffee</groupId>
		    <artifactId>kryo-serializers</artifactId>
		</dependency>
		<dependency>
		    <groupId>com.esotericsoftware</groupId>
		    <artifactId>kryo</artifactId>
		</dependency>
		<dependency>
		    <groupId>com.esotericsoftware</groupId>
		    <artifactId>minlog</artifactId>
		</dependency>
		<dependency>
		    <groupId>com.googlecode.concurrent-trees</groupId>
		    <artifactId>concurrent-trees</artifactId>
		</dependency>
		<dependency>
		    <groupId>org.objenesis</groupId>
		    <artifactId>objenesis</artifactId>
		</dependency>
		<dependency>
		    <groupId>com.esotericsoftware</groupId>
		    <artifactId>reflectasm</artifactId>
		</dependency>
		<dependency>
		    <groupId>org.ow2.asm</groupId>
		    <artifactId>asm</artifactId>
		</dependency>
		<dependency>
		    <groupId>org.javassist</groupId>
		    <artifactId>javassist</artifactId>
		</dependency>
		<dependency>
		    <groupId>org.antlr</groupId>
		    <artifactId>antlr4-runtime</artifactId>
		</dependency>
		<dependency>
		    <groupId>org.xerial</groupId>
		    <artifactId>sqlite-jdbc</artifactId>
		</dependency>
		<dependency>
		    <groupId>com.google.protobuf</groupId>
		    <artifactId>protobuf-java</artifactId>
		</dependency>
        <dependency>
            <groupId>commons-configuration</groupId>
            <artifactId>commons-configuration</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.geronimo.specs.wso2</groupId>
            <artifactId>geronimo-jms_1.1_spec</artifactId>
        </dependency>
        <dependency>
            <groupId>commons-digester.wso2</groupId>
            <artifactId>commons-digester</artifactId>
        </dependency>
        <dependency>
            <groupId>commons-beanutils.wso2</groupId>
            <artifactId>commons-beanutils</artifactId>
        </dependency>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
        </dependency>
        <dependency>
            <groupId>commons-dbcp.wso2</groupId>
            <artifactId>commons-dbcp</artifactId>
        </dependency>
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
        </dependency>

        <!--MQTT related dependencies-->
        <dependency>
            <groupId>io.netty.wso2</groupId>
            <artifactId>netty-all</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.orbit.com.h2database</groupId>
            <artifactId>h2</artifactId>
        </dependency>
        <dependency>
            <groupId>libthrift.wso2</groupId>
            <artifactId>libthrift</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.axis2.transport</groupId>
            <artifactId>axis2-transport-jms</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.axis2.transport</groupId>
            <artifactId>axis2-transport-rabbitmq-amqp</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon.identity.inbound.auth.oauth2</groupId>
            <artifactId>org.wso2.carbon.identity.oauth.stub</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-pool2</artifactId>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-antrun-plugin</artifactId>
                <version>1.1</version>
                <executions>
                    <execution>
                        <id>clean-mb-h2-database</id>
                        <phase>initialize</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <tasks>
                                <delete file="resources/databases/WSO2MB_DB.mv.db" />
                            </tasks>
                        </configuration>
                    </execution>
                    <execution>
                        <id>create-mb-h2-database</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <tasks>
                                <path id="h2.classpath">
                                    <path refid="maven.compile.classpath" />
                                </path>

                                <echo message="######### Create MB H2 Database #############" />

                                <sql driver="org.h2.Driver" url="jdbc:h2:${basedir}/resources/databases/WSO2MB_DB;create=true" userid="wso2carbon" password="wso2carbon" autocommit="true" onerror="continue">
                                    <classpath>
                                        <path refid="h2.classpath" />
                                    </classpath>
                                    <fileset file="${basedir}/resources/dbscripts/h2-mb.sql" />
                                </sql>
                                <echo message="################### END ######################" />
                                <echo message="********Version of H2: " />
                                <echo>${orbit.version.h2.engine}</echo>
                            </tasks>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-resources-plugin</artifactId>
                <version>2.3</version>
                <executions>
                    <execution>
                        <id>copy-resources</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>src/main/resources</outputDirectory>
                            <resources>
                                <resource>
                                    <directory>resources</directory>
                                    <includes>
                                        <include>conf/broker.xml</include>
                                        <include>conf/messaging-event-broker.xml</include>
                                        <include>conf/qpid-config.xml</include>
                                        <include>conf/qpid-virtualhosts.xml</include>
                                        <include>dbscripts/postgresql-mb.sql</include>
                                        <include>dbscripts/mssql-mb.sql</include>
                                        <include>dbscripts/mysql-mb.sql</include>
                                        <include>dbscripts/oracle-mb.sql</include>
                                        <include>dbscripts/oracle-rac-mb.sql</include>
                                        <include>dbscripts/h2-mb.sql</include>
                                        <include>dbscripts/migration-3.0.0_to_3.1.0/oracle-mb.sql</include>
                                        <include>dbscripts/migration-3.1.0_to_3.2.0/*</include>
                                        <include>databases/WSO2MB_DB.mv.db</include>
                                        <include>p2.inf</include>
                                        <include>build.properties</include>
                                    </includes>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.wso2.maven</groupId>
                <artifactId>carbon-p2-plugin</artifactId>
                <version>${carbon.p2.plugin.version}</version>
                <executions>
                    <execution>
                        <id>4-p2-feature-generation</id>
                        <phase>package</phase>
                        <goals>
                            <goal>p2-feature-gen</goal>
                        </goals>
                        <configuration>
                            <id>org.wso2.carbon.andes.server</id>
                            <propertiesFile>../etc/feature.properties</propertiesFile>
                            <adviceFile>
                                <properties>
                                    <propertyDef>org.wso2.carbon.p2.category.type:server
                                    </propertyDef>
                                    <propertyDef>org.eclipse.equinox.p2.type.group:false
                                    </propertyDef>
                                </properties>
                            </adviceFile>
                            <bundles>
                                <bundleDef>org.wso2.carbon.messaging:org.wso2.carbon.andes.authentication:${carbon.messaging.version}</bundleDef>
                                <bundleDef>org.wso2.carbon.messaging:org.wso2.carbon.andes.authorization:${carbon.messaging.version}</bundleDef>
                                <bundleDef>org.wso2.carbon.messaging:org.wso2.carbon.andes:${carbon.messaging.version}</bundleDef>
                                <bundleDef>org.wso2.carbon.messaging:org.wso2.carbon.andes.commons:${carbon.messaging.version}</bundleDef>
                                <bundleDef>org.wso2.carbon.messaging:org.wso2.carbon.andes.core:${carbon.messaging.version}</bundleDef>
                                <bundleDef>org.wso2.carbon.messaging:org.wso2.carbon.andes.admin:${carbon.messaging.version}</bundleDef>
                                <bundleDef>org.wso2.carbon.messaging:org.wso2.carbon.andes.admin.mqtt:${carbon.messaging.version}</bundleDef>
                                <bundleDef>org.wso2.carbon.messaging:org.wso2.carbon.andes.event.core:${carbon.messaging.version}</bundleDef>
                                <bundleDef>org.wso2.carbon.messaging:org.wso2.carbon.andes.event.admin:${carbon.messaging.version}</bundleDef>
                                <bundleDef>org.wso2.carbon.messaging:org.wso2.carbon.andes.cluster.mgt:${carbon.messaging.version}</bundleDef>
                                <bundleDef>org.wso2.andes.wso2:andes:${andes.dependency.version}</bundleDef>
                                <bundleDef>org.wso2.orbit.com.lmax:disruptor</bundleDef>
								<bundleDef>com.googlecode.cqengine:cqengine:${cqengine.version}</bundleDef>
								<bundleDef>de.javakaffee:kryo-serializers:${kryo-serializers.version}</bundleDef>
								<bundleDef>com.esotericsoftware:kryo:${kryo.version}</bundleDef>
								<bundleDef>com.esotericsoftware:minlog:${minlog.version}</bundleDef>
								<bundleDef>com.googlecode.concurrent-trees:concurrent-trees:${concurrent-trees.version}</bundleDef>
								<bundleDef>org.objenesis:objenesis:${objenesis.version}</bundleDef>
								<bundleDef>com.esotericsoftware:reflectasm:${reflectasm.version}</bundleDef>
								<bundleDef>org.ow2.asm:asm:${asm.version}</bundleDef>
								<bundleDef>org.javassist:javassist:${javassist.version}</bundleDef>
								<bundleDef>org.antlr:antlr4-runtime:${antlr4-runtime.version}</bundleDef>
								<bundleDef>org.xerial:sqlite-jdbc:${sqlite-jdbc.version}</bundleDef>
								<bundleDef>com.google.protobuf:protobuf-java:${protobuf-java.version}</bundleDef>
                                <bundleDef>commons-cli.wso2:commons-cli</bundleDef>
                                <bundleDef>commons-configuration:commons-configuration</bundleDef>
                                <bundleDef>commons-digester.wso2:commons-digester</bundleDef>
                                <bundleDef>commons-beanutils.wso2:commons-beanutils</bundleDef>
                                <bundleDef>com.google.guava:guava</bundleDef>
                                <bundleDef>io.netty.wso2:netty-all</bundleDef>
                                <bundleDef>libthrift.wso2:libthrift</bundleDef>
                                <bundleDef>org.apache.axis2.transport:axis2-transport-jms:${axis2.transport.version}</bundleDef>
                                <bundleDef>org.apache.axis2.transport:axis2-transport-rabbitmq-amqp:${axis2.transport.version}</bundleDef>
                                <bundleDef>org.wso2.carbon.identity.inbound.auth.oauth2:org.wso2.carbon.identity.oauth.stub:${carbon.identity.oauth.stub.version}</bundleDef>
                                <bundleDef>org.apache.commons:commons-pool2:${org.apache.commons.pool.version}</bundleDef>
                            </bundles>
                            <importFeatures>
                                <importFeatureDef>org.wso2.carbon.core.server:compatible:${carbon.kernel.feature.version}
                                </importFeatureDef>
                            </importFeatures>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-antrun-plugin</artifactId>
                <version>1.1</version>
                <executions>
                    <execution>
                        <id>clean-resources</id>
                        <phase>install</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <tasks>
                                <echo>remove generated h2 database file</echo>
                                <delete file="resources/databases/WSO2MB_DB.h2.db" />
                                <echo>clean up src directory</echo>
                                <delete dir="src" />
                            </tasks>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

</project>
