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

    Copyright 2021 OPS4J.

    Licensed 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">

    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>org.ops4j.pax.transx</groupId>
        <artifactId>pax-transx</artifactId>
        <version>0.5.0</version>
        <relativePath>../pom.xml</relativePath>
    </parent>

    <artifactId>pax-transx-tm-geronimo</artifactId>
    <packaging>bundle</packaging>

    <dependencies>

        <!-- pax-transx own artifacts -->

        <dependency>
            <groupId>org.ops4j.pax.transx</groupId>
            <artifactId>pax-transx-tm-core</artifactId>
        </dependency>

        <!-- OSGi -->

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

        <!-- Apache components -->

        <dependency>
            <groupId>org.apache.aries.transaction</groupId>
            <artifactId>org.apache.aries.transaction.manager</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.geronimo.components</groupId>
            <artifactId>geronimo-transaction</artifactId>
            <scope>provided</scope>
        </dependency>

        <!-- Spring -->

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-tx</artifactId>
            <optional>true</optional>
        </dependency>

        <!-- Test dependencies -->

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-all</artifactId>
            <scope>test</scope>
        </dependency>

        <!-- Logging dependencies -->

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-slf4j-impl</artifactId>
            <scope>test</scope>
        </dependency>

    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <configuration>
                    <instructions>
                        <Import-Package>
                            !org.apache.aries.util,
                            !org.apache.aries.util.internal,
                            <!--
                                In theory it works - it allows to run the bundle without a need for separate JCA API bundle
                                but it'd be better to remove the private-packaged XATerminator interface
                            -->
                            javax.resource.spi;version="[1.6,2)";resolution:=optional,
                            javax.transaction;version="[1.1,2)",
                            javax.transaction.xa;version=!,
                            *
                        </Import-Package>
                        <Export-Package>
                            org.apache.aries.transaction;version="1.0",
                            org.apache.geronimo.transaction;version="3.1",
                            org.apache.geronimo.transaction.manager;version="3.1",
                        </Export-Package>
                        <Private-Package>
                            org.ops4j.pax.transx.tm.impl,
                            org.ops4j.pax.transx.tm.impl.geronimo,
                            org.apache.aries.transaction.internal,
                            org.apache.aries.util.nls,
                            org.apache.geronimo.transaction.*;-split-package:=merge-first,
                            org.objectweb.howl.log.*
                        </Private-Package>
                        <Bundle-Activator>
                            org.ops4j.pax.transx.tm.impl.geronimo.Activator
                        </Bundle-Activator>
                        <Provide-Capability>
                            osgi.service;objectClass="javax.transaction.TransactionManager",
                            osgi.service;objectClass="javax.transaction.TransactionSynchronizationRegistry",
                            osgi.service;objectClass="javax.transaction.UserTransaction",
                            osgi.service;objectClass="org.ops4j.pax.transx.tm.TransactionManager",
                            osgi.service;objectClass="org.springframework.transaction.PlatformTransactionManager"
                        </Provide-Capability>
                        <Include-Resource>
                            {maven-resources},
                            javax/resource/spi/XATerminator.class=target/classes/javax/resource/spi/XATerminator.class
                        </Include-Resource>
                    </instructions>
                </configuration>
            </plugin>
        </plugins>
    </build>

</project>
