<?xml version="1.0" encoding="UTF-8"?>
<!--
 * The contents of this file are subject to the terms of the Common Development and
 * Distribution License (the License). You may not use this file except in compliance with the
 * License.
 *
 * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
 * specific language governing permission and limitations under the License.
 *
 * When distributing Covered Software, include this CDDL Header Notice in each file and include
 * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
 * Header, with the fields enclosed by brackets [] replaced by your own identifying
 * information: "Portions copyright [year] [name of copyright owner]".
 *
 * Copyright 2011-2016 ForgeRock AS.
 * Portions copyright 2025 3A Systems LLC.
-->
<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 Project -->
    <parent>
        <groupId>org.openidentityplatform.openam</groupId>
        <artifactId>openam-schema</artifactId>
        <version>16.1.0</version>
    </parent>

    <!-- Component Definition -->
    <name>OpenAM JAXRPC Schema</name>
    <description>OpenAM JAXRPC Schema Components</description>
    <artifactId>openam-jaxrpc-schema</artifactId>
    <packaging>jar</packaging>

    <!-- Build -->
    <build>
        <plugins>
            <!-- Generate jaxrpc WSDL -->
            <!-- see http://docs.oracle.com/cd/E17802_01/webservices/webservices/docs/1.5/jaxrpc/jaxrpc-tools.html
                 for Documentation on the wscompile tool. -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-antrun-plugin</artifactId>
                <executions>
                    <execution>
                        <id>generate-jaxrpc-wsdl</id>
                        <phase>generate-sources</phase>
                        <configuration>
                            <target name="jaxrpc">
                                <path id="wscompile.path">
                                    <path refid="maven.compile.classpath" />
                                    <pathelement path="${env.JAVA_HOME}/lib/tools.jar" />
                                </path>

                                <mkdir dir="${project.build.directory}/classes" />
                                <mkdir dir="${project.build.directory}/generated-sources/wscompile" />
                                <mkdir dir="${project.build.directory}/unwanted" />

                                <java classname="com.sun.xml.rpc.tools.wscompile.Main" fork="true" classpathref="wscompile.path" failonerror="true">
                                    <arg value="-g" />
                                    <arg value="-gen:server" />
                                    <arg value="-keep" />
                                    <arg value="-d" />
                                    <arg value="${project.build.directory}/unwanted" />
                                    <arg value="-s" />
                                    <arg value="${project.build.directory}/generated-sources/wscompile" />
                                    <arg value="${project.basedir}/src/main/resources/xml/jaxrpc/config.xml" />
                                </java>

                                <move file="${project.build.directory}/unwanted/IdentityManagementServices.wsdl" tofile="${project.build.directory}/classes/jaxrpc/IdentityManagementServices.wsdl" />

                                <!-- Clean-up duplicate generated WSDL and Classes -->
                                <delete file="${project.basedir}/IdentityManagementServices.wsdl" />
                            </target>
                        </configuration>
                        <goals>
                            <goal>run</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>add-source</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>add-source</goal>
                        </goals>
                        <configuration>
                            <sources>
                                <source>${project.build.directory}/generated-sources/wscompile</source>
                            </sources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <dependencies>
        <dependency>
            <groupId>org.openidentityplatform.openam</groupId>
            <artifactId>openam-federation-library</artifactId>
        </dependency>

        <dependency>
            <groupId>org.openidentityplatform.openam</groupId>
            <artifactId>openam-core</artifactId>
        </dependency>

		<dependency>
			<groupId>org.glassfish.metro</groupId>
			<artifactId>wsit-impl</artifactId>
		</dependency>
        <dependency>
            <groupId>org.openidentityplatform.openam.jakarta</groupId>
            <artifactId>jaxrpc-impl</artifactId>
        </dependency>
        <dependency>
            <groupId>javax.xml.ws</groupId>
            <artifactId>jaxws-api</artifactId>
            <version>2.3.1</version>
        </dependency>

    </dependencies>
</project>

