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

     Copyright 2005-2016 Red Hat, Inc.

     Red Hat 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">
    <parent>
        <artifactId>gateway-project</artifactId>
        <groupId>io.fabric8</groupId>
        <version>1.2.0.redhat-630488</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>gateway-core</artifactId>
    <packaging>bundle</packaging>
    
    <name>Fabric8 :: Gateway :: Core</name>

    <properties>
        <fuse.osgi.export>
            io.fabric8.gateway*;version=${project.version};-noimport:=true
        </fuse.osgi.export>
        <fuse.osgi.import>
          META-INF.services.*,
          com.fasterxml*,
          !com.hazelcast*,
          !com.barchart.udt*,
          !com.google.protobuf*,
          !com.jcraft.jzlib*,
          !com.sun.nio.sctp*,
          !gnu.io*,
          !javassist*,
          !org.jboss.marshalling*,
          !sun.misc*,
          !sun.nio.ch*,
          !org.bouncycastle*,
          !org.fusesource.hawtdispatch*,
          *
        </fuse.osgi.import>
        <fuse.osgi.private.pkg>
          META-INF.services.*;-split-package:=first,
          org.apache.qpid.proton*,
          org.fusesource.mqtt*;-split-package:=first,
          io.fabric8.mqtt*;-split-package:=first,
          org.fusesource.hawtbuf*;-split-package:=first,
        </fuse.osgi.private.pkg>

        <apollo-version>1.7</apollo-version>
        <proton-version>0.6</proton-version>
        <stompjms-version>1.19</stompjms-version>
        <scala-version>2.10.4-redhat-1</scala-version>
        <mqtt-client-version>1.10</mqtt-client-version>
        <openwire-version>1</openwire-version>
        
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.apache.felix</groupId>
            <artifactId>org.apache.felix.scr.annotations</artifactId>
        </dependency>
        <dependency>
          <groupId>io.vertx</groupId>
          <artifactId>vertx-core</artifactId>
          <version>${vertx-version}</version>
        </dependency>

        <dependency>
            <groupId>io.fabric8</groupId>
            <artifactId>common-util</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>io.fabric8</groupId>
            <artifactId>gateway-model</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>io.fabric8</groupId>
            <artifactId>fabric-vertx</artifactId>
            <version>${project.version}</version>
        </dependency>

        <!-- for MQTT support -->
        <dependency>
          <groupId>org.fusesource.mqtt-client</groupId>
          <artifactId>mqtt-client</artifactId>
          <version>${mqtt-client-version}</version>
        </dependency>

        <!-- for AMQP support -->
        <dependency>
          <groupId>org.apache.qpid</groupId>
          <artifactId>proton-j-impl</artifactId>
          <version>${proton-version}</version>
        </dependency>
        <dependency>
            <groupId>org.bouncycastle</groupId>
            <artifactId>bcpkix-jdk15on</artifactId>
            <version>${bouncycastle-version}</version>
        </dependency>

        <!-- Lets use to Apollo to test the gateway against.   -->
        <dependency>
          <groupId>org.apache.activemq</groupId>
          <artifactId>apollo-broker</artifactId>
          <scope>test</scope>
          <version>${apollo-version}</version>
        </dependency>
        <dependency>
            <groupId>org.yaml</groupId>
            <artifactId>snakeyaml</artifactId>
            <version>1.11</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.fusesource.hawtbuf</groupId>
            <artifactId>hawtbuf-proto</artifactId>
            <version>${hawtbuf-version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
          <groupId>org.apache.activemq</groupId>
          <artifactId>apollo-stomp</artifactId>
          <scope>test</scope>
          <version>${apollo-version}</version>
        </dependency>
        <dependency>
          <groupId>org.apache.activemq</groupId>
          <artifactId>apollo-mqtt</artifactId>
          <scope>test</scope>
          <version>${apollo-version}</version>
        </dependency>
        <dependency>
          <groupId>org.apache.activemq</groupId>
          <artifactId>apollo-amqp</artifactId>
          <scope>test</scope>
          <version>${apollo-version}</version>
        </dependency>
        <dependency>
          <groupId>org.apache.activemq</groupId>
          <artifactId>apollo-openwire</artifactId>
          <scope>test</scope>
          <version>${apollo-version}</version>
        </dependency>
        <dependency>
            <groupId>org.scala-lang</groupId>
            <artifactId>scala-library</artifactId>
            <scope>test</scope>
            <version>${scala-version}</version>
        </dependency>

        <!-- STOMP test client -->
        <dependency>
          <groupId>org.fusesource.stompjms</groupId>
          <artifactId>stompjms-client</artifactId>
          <scope>test</scope>
          <version>${stompjms-version}</version>
        </dependency>

        <!-- AMQP test client -->
        <dependency>
          <groupId>org.apache.qpid</groupId>
          <artifactId>qpid-amqp-1-0-client-jms</artifactId>
          <version>${qpid-jms-version}</version>
          <scope>test</scope>
        </dependency>
        <dependency>
          <groupId>org.apache.geronimo.specs</groupId>
          <artifactId>geronimo-jms_1.1_spec</artifactId>
          <version>${geronimo-jms.version}</version>
        </dependency>

        <!-- ActiveMQ test client -->
        <dependency>
          <groupId>org.apache.activemq</groupId>
          <artifactId>activemq-client</artifactId>
          <version>${activemq-version}</version>
          <scope>test</scope>
        </dependency>
        <dependency>
          <groupId>org.apache.activemq</groupId>
          <artifactId>activemq-jaas</artifactId>
          <version>${activemq-version}</version>
          <scope>test</scope>
        </dependency>
        <dependency>
          <groupId>org.apache.activemq</groupId>
          <artifactId>activemq-openwire-legacy</artifactId>
          <version>${activemq-version}</version>
          <scope>test</scope>
        </dependency>

        <dependency>
          <groupId>org.slf4j</groupId>
          <artifactId>slf4j-log4j12</artifactId>
          <version>${slf4j-version}</version>
          <scope>test</scope>
        </dependency>

    </dependencies>

  <build>
    <plugins>

      <plugin>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
          <!-- this test causes maven-surefire to throw NPE -->
          <excludes>
            <exclude>**/DetectingGatewayTest.java</exclude>
          </excludes>
        </configuration>
      </plugin>

    </plugins>
  </build>

  <profiles>
      <!-- regenerate the openwire codecs with: mvn -P openwire-generate exec:java -->
      <profile>
        <id>openwire-generate</id>
        <dependencies>
          <dependency>
            <groupId>org.apache.activemq</groupId>
            <artifactId>apollo-openwire-generator</artifactId>
            <version>99-trunk-SNAPSHOT</version> 
            <scope>test</scope>
          </dependency>
        </dependencies>
        <build>
          <plugins>
            <plugin>
              <groupId>org.codehaus.mojo</groupId>
              <artifactId>exec-maven-plugin</artifactId>
              <version>1.2.1</version>
              <configuration>
                <mainClass>org.apache.activemq.apollo.openwire.generator.GeneratorTask</mainClass>
                <classpathScope>test</classpathScope>
                <arguments>
                  <argument>1</argument>
                  <argument>${basedir}/src/main/java</argument>
                  <argument>${basedir}/src/main/java</argument>
                  <argument>io.fabric8.gateway.handlers.detecting.protocol.openwire.codec</argument>
                  <argument>io.fabric8.gateway.handlers.detecting.protocol.openwire.command</argument>
                </arguments>
              </configuration>
            </plugin>
          </plugins>
        </build>
      </profile>
      <profile>
        <id>lib/tools.jar</id>
        <activation>
          <file>
            <exists>${java.home}/lib/tools.jar</exists>
          </file>
        </activation>
        <dependencies>
          <dependency>
            <groupId>com.sun</groupId>
            <artifactId>tools</artifactId>
            <version>1.6.0</version>
            <scope>system</scope>
            <optional>true</optional>
            <systemPath>${java.home}/lib/tools.jar</systemPath>
          </dependency>
        </dependencies>
      </profile>      
      <profile>
        <id>../lib/tools.jar</id>
        <activation>
          <file>
            <exists>${java.home}/../lib/tools.jar</exists>
          </file>
        </activation>
        <dependencies>
          <dependency>
            <groupId>com.sun</groupId>
            <artifactId>tools</artifactId>
            <version>1.6.0</version>
            <scope>system</scope>
            <optional>true</optional>
            <systemPath>${java.home}/../lib/tools.jar</systemPath>
          </dependency>
        </dependencies>
      </profile>
    </profiles>
      
</project>
