<?xml version="1.0" encoding="UTF-8"?>
<!--
   Copyright (c) 2026, WSO2 LLC. (http://www.wso2.org) All Rights Reserved.
   WSO2 LLC. 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>

    <groupId>org.wso2.integration.inbound</groupId>
    <artifactId>mi-inbound-streaming</artifactId>
    <version>0.0.9</version>
    <name>WSO2 Carbon - Streaming File Inbound Endpoint</name>
    <description>File inbound endpoint that streams large CSV, JSON, JSONL and text files into
        WSO2 Micro Integrator 4.1.0 record by record or chunk by chunk, with checkpointing and
        parallel mediation</description>
    <parent>
        <groupId>org.wso2</groupId>
        <artifactId>wso2</artifactId>
        <version>1.4</version>
    </parent>

    <scm>
        <connection>scm:git:https://github.com/wso2-extensions/mi-inbound-streaming.git</connection>
        <url>https://github.com/wso2-extensions/mi-inbound-streaming</url>
        <developerConnection>scm:git:https://github.com/wso2-extensions/mi-inbound-streaming.git</developerConnection>
        <tag>v0.0.9</tag>
    </scm>

    <dependencies>
        <dependency>
            <groupId>org.wso2.ei</groupId>
            <artifactId>org.wso2.micro.integrator.inbound.endpoint</artifactId>
            <version>${carbon.mediation.version}</version>
        </dependency>

        <!-- The server provides commons-vfs. MI 4.1.0 ships it as the bundle
             wso2/components/plugins/commons-vfs2_2.2.0.wso2v13_<n>.jar, so these are provided and
             only used to compile. Two things differ from the 2.10.x fork used by MI 4.5+:
               1. it is NOT package relocated. Its classes live in org.apache.commons.vfs2, not
                  org.wso2.org.apache.commons.vfs2. Only the Maven groupId carries the wso2 prefix.
               2. the smb2 provider, including Smb2FileSystemConfigBuilder that Utils configures,
                  lives in commons-vfs2-sandbox on this line. The server has it from the .20 update.
             We compile against the public 2.2.0-wso2v30. The update builds the server runs
             (2.2.0-wso2v13.18, 2.2.0-wso2v13.20) are not on the public Nexus. The last public build
             with Java 8 class files, 2.2.0-wso2v26, has no SftpFileSystemConfigBuilder
             .setConnectTimeout. For every class this inbound uses, 2.2.0-wso2v30 has the same API as
             2.2.0-wso2v13.20, plus four FTPS key store type setters that we do not call. Its class
             files are Java 21, which only affects the build JDK (see maven-compiler-plugin).
             tools/check-runtime-api.sh checks our calls against the server's jar. -->
        <dependency>
            <groupId>org.wso2.org.apache.commons</groupId>
            <artifactId>commons-vfs2</artifactId>
            <version>${commons.vfs2.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.wso2.org.apache.commons</groupId>
            <artifactId>commons-vfs2-sandbox</artifactId>
            <version>${commons.vfs2.version}</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.synapse</groupId>
            <artifactId>synapse-commons</artifactId>
            <version>${synapse.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.synapse</groupId>
            <artifactId>synapse-core</artifactId>
            <version>${synapse.version}</version>
        </dependency>

        <!-- SMB2 support: Utils reads com.hierynomus.msdtyp.AccessMask for the disk-share
             access mask. Versions match the smbj/asn-one bundles shipped in MI 4.1.0. -->
        <dependency>
            <groupId>com.hierynomus.wso2</groupId>
            <artifactId>smbj</artifactId>
            <version>${com.hierynomus.smbj.version}</version>
        </dependency>
        <dependency>
            <groupId>com.hierynomus.wso2</groupId>
            <artifactId>asn-one</artifactId>
            <version>${com.hierynomus.asn1.version}</version>
        </dependency>

        <!-- CSV Streaming Support. Not shipped by MI 4.1.0, so it must be copied into the
             runtime alongside this inbound (see descriptor.yml). -->
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-csv</artifactId>
            <version>${commons.csv.version}</version>
        </dependency>

        <!-- Gson builds the streaming output payloads. Provided by the MI runtime; pinned to
             the version MI 4.1.0 ships, because JsonParser.parseString(String) (used by Utils)
             only exists from Gson 2.8.6 onward and the version pulled in transitively is older. -->
        <dependency>
            <groupId>com.google.code.gson</groupId>
            <artifactId>gson</artifactId>
            <version>${gson.version}</version>
            <scope>provided</scope>
        </dependency>

        <!-- JSON Streaming Support. Provided by the MI runtime, so scoped 'provided'
             (compile-only) to avoid bundling a second Jackson and risking classloader conflicts.
             jackson-core and jackson-annotations are declared explicitly, not left to transitive
             resolution: synapse/carbon drag in 2.13.1 of both, and Maven's nearest-wins would pair
             them with databind 2.21.5, whose static initialisation then fails
             (NoClassDefFoundError: Could not initialize class ObjectMapper) on the test classpath.
             The versions here are exactly the ones MI 4.1.0 ships. -->
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <version>${jackson.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-core</artifactId>
            <version>${jackson.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-annotations</artifactId>
            <version>${jackson.annotations.version}</version>
            <scope>provided</scope>
        </dependency>

        <!-- Testing -->
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>${junit.version}</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-release-plugin</artifactId>
                <configuration>
                    <tagNameFormat>@{project.version}</tagNameFormat>
                </configuration>
            </plugin>

            <!-- Build on JDK 21, because the commons-vfs jar we compile against has Java 21 class
                 files. release 8 makes javac check every JDK call against the Java 8 API and write
                 Java 8 class files, so the jar runs on a JDK 8 server. source and target 8 alone
                 would not stop calls that only exist in later JDKs. -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.11.0</version>
                <configuration>
                    <release>8</release>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>3.3.0</version>
                <configuration>
                    <filters>
                        <filter>${basedir}/src/main/assembly/filter.properties</filter>
                    </filters>
                    <descriptors>
                        <descriptor>src/main/assembly/zip-assembly.xml</descriptor>
                    </descriptors>
                    <appendAssemblyId>false</appendAssemblyId>
                </configuration>
                <executions>
                    <execution>
                        <id>make-assembly</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <version>5.1.8</version>
                <extensions>true</extensions>
                <configuration>
                    <instructions>
                        <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
                        <Export-Package>
                            org.wso2.carbon.inbound.streaming.*;version="${project.version}",
                        </Export-Package>
                        <Import-Package>
                            !javax.xml.namespace,
                            javax.xml.namespace;
                            version=0.0.0,
                            org.wso2.carbon.inbound.endpoint.protocol.generic;version="0.0.0",
                            *;resolution:=optional,
                        </Import-Package>
                    </instructions>
                </configuration>
            </plugin>

        </plugins>
    </build>

    <distributionManagement>
        <repository>
            <id>nexus-releases</id>
            <name>WSO2 Release Distribution Repository</name>
            <url>https://maven.wso2.org/nexus/content/repositories/releases/</url>
        </repository>
    </distributionManagement>
    <repositories>
        <repository>
            <id>wso2-nexus</id>
            <name>WSO2 internal Repository</name>
            <url>https://maven.wso2.org/nexus/content/groups/wso2-public/</url>
            <releases>
                <enabled>true</enabled>
                <updatePolicy>daily</updatePolicy>
                <checksumPolicy>ignore</checksumPolicy>
            </releases>
        </repository>
        <repository>
            <id>central</id>
            <name>Maven Central</name>
            <url>https://repo1.maven.org/maven2</url>
            <releases>
                <enabled>true</enabled>
            </releases>
        </repository>
    </repositories>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <!-- Pinned to what WSO2 MI 4.1.0 ships, except inbound-endpoint and commons-vfs. The server
             provides those two and we only compile against them. The update builds the server
             runs are not on the public Nexus. inbound-endpoint is the public 4.1.0, which has no
             GenericPollingConsumer.resume(). That method comes in a later update build, so
             VFSConsumer.resume() has no @Override. See the commons-vfs dependency for its version. -->
        <carbon.mediation.version>4.1.0</carbon.mediation.version>
        <synapse.version>2.1.7-wso2v271</synapse.version>
        <commons.vfs2.version>2.2.0-wso2v30</commons.vfs2.version>
        <com.hierynomus.smbj.version>0.11.3.wso2v1</com.hierynomus.smbj.version>
        <com.hierynomus.asn1.version>0.6.0.wso2v1</com.hierynomus.asn1.version>
        <jackson.version>2.21.5</jackson.version>
        <jackson.annotations.version>2.21</jackson.annotations.version>
        <gson.version>2.9.0</gson.version>
        <commons.csv.version>1.14.1</commons.csv.version>
        <junit.version>4.13.2</junit.version>
    </properties>
</project>
