<?xml version="1.0" encoding="UTF-8"?>
<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>
	<parent>
		<groupId>org.gcube.tools</groupId>
		<artifactId>maven-parent</artifactId>
		<version>1.4.0-SNAPSHOT</version>
	</parent>
	<groupId>org.gcube.information-system</groupId>
	<artifactId>resource-registry</artifactId>
	<version>6.0.0-SNAPSHOT</version>
	<packaging>war</packaging>
	<name>Resource Registry Service</name>
	<description>The Resource Registry is a web-service which represent the core component of the gCube Information System</description>

	<developers>
		<developer>
			<id>luca.frosini</id>
			<name>Luca Frosini</name>
			<email>luca.frosini@isti.cnr.it</email>
			<url>https://orcid.org/0000-0003-3183-2291</url>
			<organization>D4Science Infrastructure, Pisa, Italy</organization>
			<organizationUrl>https://www.d4science.org/</organizationUrl>
			<roles>
				<role>researcher</role>
				<role>architect</role>
				<role>maintainer</role>
				<role>developer</role>
			</roles>
			<timezone>Europe/Rome</timezone>
		</developer>
	</developers>
	<scm>
		<connection>scm:git:https://code-repo.d4science.org/gCubeSystem/${project.artifactId}.git</connection>
		<developerConnection>scm:git:https://code-repo.d4science.org/gCubeSystem/${project.artifactId}.git</developerConnection>
		<url>https://code-repo.d4science.org/gCubeSystem/${project.artifactId}</url>
	</scm>
	<distributionManagement>
		<site>
			<url>https://url.d4science.org/resource-registry/docs/index.html</url>
		</site>
	</distributionManagement>
	<properties>
		<d4s.docs.source>${project.basedir}/documentation/reference</d4s.docs.source>
		<d4s.docs.openapi.scan.packages>org.gcube.informationsystem.resourceregistry.rest</d4s.docs.openapi.scan.packages>
		<d4s.docs.openapi.tag.order>Contexts,Types,Instances,Sharing,Query Templates,Access</d4s.docs.openapi.tag.order>
		<d4s.docs.menu.optional>model-docs,is-gui</d4s.docs.menu.optional>
		<d4s.docs.icon>information-system</d4s.docs.icon>
		<!-- The war carries the MkDocs layout (WEB-INF/d4science-service-docs/): the model
				 documentation is built with MkDocs at runtime, at every schema change. -->
		<d4s.docs.runtime>true</d4s.docs.runtime>
		<d4s.docs.author>Luca Frosini (D4Science Infrastructure)</d4s.docs.author>
		<d4s.docs.copyright>2016, Luca Frosini (D4Science Infrastructure)</d4s.docs.copyright>
		<java.version>17</java.version>
		<maven.compiler.source>${java.version}</maven.compiler.source>
		<maven.compiler.target>${java.version}</maven.compiler.target>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
		<wiki>https://wiki.gcube-system.org/gcube/Information_System_Resource_Registry</wiki>
		<openapi.generator.version>7.0.1</openapi.generator.version>
		<orientdb.version>3.0.44</orientdb.version>
		<!-- CVE-2025-12183 (HIGH) + CVE-2025-66566 (HIGH): lz4-java out-of-bounds and info leak, fixed in 1.10.1 -->
		<lz4.version>1.10.1</lz4.version>
		<webappDirectory>${project.basedir}${file.separator}src${file.separator}main${file.separator}webapp${file.separator}WEB-INF</webappDirectory>
	</properties>

	<dependencyManagement>
		<dependencies>
			<dependency>
				<groupId>org.gcube.distribution</groupId>
				<artifactId>gcube-smartgears-bom</artifactId>
				<version>4.1.0-SNAPSHOT</version>
				<type>pom</type>
				<scope>import</scope>
			</dependency>
			<!-- Override lz4-java (CVE-2025-12183, CVE-2025-66566): org.lz4 is archived,
					 fixed fork is at.yawk.lz4:lz4-java:1.10.1 (drop-in replacement, same classes) -->
			<dependency>
				<groupId>at.yawk.lz4</groupId>
				<artifactId>lz4-java</artifactId>
				<version>${lz4.version}</version>
			</dependency>
		</dependencies>
	</dependencyManagement>

	<dependencies>
		<dependency>
			<groupId>org.gcube.information-system</groupId>
			<artifactId>resource-registry-api</artifactId>
		</dependency>
		<dependency>
			<groupId>org.gcube.information-system</groupId>
			<artifactId>information-system-model</artifactId>
		</dependency>
		<dependency>
			<groupId>org.gcube.information-system</groupId>
			<artifactId>information-system-model-documentation-generator</artifactId>
			<version>1.0.0-SNAPSHOT</version>
		</dependency>
		<dependency>
			<groupId>com.orientechnologies</groupId>
			<!--
			To work with Thinkerpop® it is required to use this artifactId 
			<artifactId>orientdb-graphdb</artifactId>
			Giving that we just use OrientDB classes and not Thinkerpop® 
			implementation we use a lighter dependency
			-->
			<artifactId>orientdb-client</artifactId>
			<version>${orientdb.version}</version>
			<exclusions>
				<exclusion>
					<groupId>org.graalvm.tools</groupId>
					<artifactId>chromeinspector</artifactId>
				</exclusion>
			</exclusions>
		</dependency>
		<dependency>
			<groupId>com.orientechnologies</groupId>
			<artifactId>orientdb-core</artifactId>
			<version>${orientdb.version}</version>
			<exclusions>
				<!-- Exclude vulnerable org.lz4:lz4-java (CVE-2025-12183, CVE-2025-66566);
						 replaced by at.yawk.lz4:lz4-java:1.10.1 -->
				<exclusion>
					<groupId>org.lz4</groupId>
					<artifactId>lz4-java</artifactId>
				</exclusion>
			</exclusions>
		</dependency>
		<!-- Replaces excluded org.lz4:lz4-java (CVE-2025-12183, CVE-2025-66566 HIGH) -->
		<dependency>
			<groupId>at.yawk.lz4</groupId>
			<artifactId>lz4-java</artifactId>
			<version>${lz4.version}</version>
		</dependency>
		<dependency>
			<groupId>org.gcube.core</groupId>
			<artifactId>common-encryption</artifactId>
		</dependency>

		<dependency>
			<groupId>org.gcube.core</groupId>
			<artifactId>common-smartgears</artifactId>
		</dependency>
		<dependency>
			<groupId>org.gcube.common</groupId>
			<artifactId>common-security</artifactId>
		</dependency>
		<dependency>
			<groupId>org.gcube.core</groupId>
			<artifactId>common-smartgears-app</artifactId>
		</dependency>
		<dependency>
			<groupId>org.yaml</groupId>
			<artifactId>snakeyaml</artifactId>
		</dependency>

		<dependency>
			<groupId>io.lettuce</groupId>
			<artifactId>lettuce-core</artifactId>
			<version>7.5.1.RELEASE</version>
		</dependency>

		<dependency>
			<groupId>jakarta.ws.rs</groupId>
			<artifactId>jakarta.ws.rs-api</artifactId>
		</dependency>

		<!-- jersey -->
		<dependency>
			<groupId>org.glassfish.jersey.containers</groupId>
			<artifactId>jersey-container-servlet</artifactId>
		</dependency>

		<!-- One of jersey-hk2 or jersey-cdi2-se is needed to allow ResourceIntializer working -->
		<!-- jersey-hk2 is preferred over jersey-cdi2-se on Tomcat: jersey-cdi2-se starts a Weld SE
				 container with its own JVM shutdown hook which races with Tomcat's shutdown sequence and
				 causes an IllegalStateException in CdiSeInjectionManager.preDestroy() at undeploy time. -->
		<dependency>
			<groupId>org.glassfish.jersey.inject</groupId>
			<artifactId>jersey-hk2</artifactId>
		</dependency>
		<!-- 
		<dependency>
			<groupId>org.glassfish.jersey.inject</groupId>
			<artifactId>jersey-cdi2-se</artifactId>
		</dependency>
		-->

		<!-- MicroProfile OpenAPI dependencies (sostituiscono Swagger) -->
		<dependency>
			<groupId>org.eclipse.microprofile.openapi</groupId>
			<artifactId>microprofile-openapi-api</artifactId>
		</dependency>

		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>slf4j-api</artifactId>
		</dependency>
		<dependency>
			<groupId>org.glassfish.jersey.core</groupId>
			<artifactId>jersey-server</artifactId>
		</dependency>
		<dependency>
			<groupId>org.gcube.common</groupId>
			<artifactId>gcube-jackson-annotations</artifactId>
		</dependency>
		<dependency>
			<groupId>org.gcube.common</groupId>
			<artifactId>gcube-jackson-core</artifactId>
		</dependency>
		<dependency>
			<groupId>org.gcube.common</groupId>
			<artifactId>gcube-jackson-databind</artifactId>
		</dependency>
		<dependency>
			<groupId>jakarta.activation</groupId>
			<artifactId>jakarta.activation-api</artifactId>
		</dependency>
		<dependency>
			<groupId>org.gcube.common</groupId>
			<artifactId>health-api</artifactId>
		</dependency>
		<!-- Test Dependencies -->
		<dependency>
			<groupId>org.gcube.common</groupId>
			<artifactId>d4science-iam-client</artifactId>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.gcube.common.security</groupId>
			<artifactId>gcube-secrets</artifactId>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.gcube.resource-management</groupId>
			<artifactId>gcube-model</artifactId>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>ch.qos.logback</groupId>
			<artifactId>logback-classic</artifactId>
			<scope>test</scope>
		</dependency>
	</dependencies>
	<build>
		<plugins>
			<!-- Force sequential test execution to prevent concurrent OrientDB transaction conflicts -->
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-surefire-plugin</artifactId>
				<version>2.22.2</version>
				<configuration>
					<parallel>none</parallel>
					<threadCount>1</threadCount>
					<forkCount>1</forkCount>
					<reuseForks>true</reuseForks>
				</configuration>
			</plugin>
			<!-- The documentation comes from the d4science-service-docs profile of maven-parent;
					 what follows is only what the registry adds to it. -->
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-resources-plugin</artifactId>
				<executions>
					<!-- D4Science conventions, published under docs/conventions/. -->
					<execution>
						<id>copy-sphinx-conventions</id>
						<goals>
							<goal>copy-resources</goal>
						</goals>
						<phase>generate-resources</phase>
						<configuration>
							<outputDirectory>${d4s.docs.staging}/conventions</outputDirectory>
							<resources>
								<resource>
									<directory>${project.basedir}/documentation/conventions</directory>
								</resource>
							</resources>
						</configuration>
					</execution>
					<execution>
						<id>copy-model-docs-branding</id>
						<goals>
							<goal>copy-resources</goal>
						</goals>
						<phase>prepare-package</phase>
						<configuration>
							<outputDirectory>${d4s.docs.webapp}/branding</outputDirectory>
							<resources>
								<resource>
									<directory>${project.basedir}/documentation/model-docs</directory>
								</resource>
							</resources>
						</configuration>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<groupId>io.smallrye</groupId>
				<artifactId>smallrye-open-api-maven-plugin</artifactId>
				<executions>
					<execution>
						<id>d4s-docs-openapi</id>
						<configuration>
							<filter>org.gcube.informationsystem.resourceregistry.rest.providers.OpenApiQueryMethodFilter</filter>
						</configuration>
					</execution>
				</executions>
			</plugin>

			<!-- OpenAPI Generator Plugin (opzionale - per generare client/server da spec) -->
			<!--
			<plugin>
				<groupId>org.openapitools</groupId>
				<artifactId>openapi-generator-maven-plugin</artifactId>
				<version>${openapi.generator.version}</version>
				<executions>
					< !- - Client Python - - >
					<execution>
						<id>generate-python-client</id>
						<goals>
							<goal>generate</goal>
						</goals>
						<configuration>
							<inputSpec>${project.build.directory}/generated-resources/openapi/openapi.json</inputSpec>
							<generatorName>python</generatorName>
							<output>${project.build.directory}/generated-sources/openapi-client-python</output>
							<apiPackage>org.gcube.informationsystem.resourceregistry.client.api</apiPackage>
							<modelPackage>org.gcube.informationsystem.resourceregistry.client.model</modelPackage>
							<configOptions>
								<packageName>resource_registry_client</packageName>
								<packageVersion>1.0.0</packageVersion>
								<projectName>ResourceRegistryClient</projectName>
								<packageUrl>https://github.com/gcube-system/resource-registry</packageUrl>
								<library>urllib3</library>
							</configOptions>
						</configuration>
					</execution>

					< !- - Client JavaScript/TypeScript with Axios - - >
					<execution>
						<id>generate-typescript-client</id>
						<goals>
							<goal>generate</goal>
						</goals>
						<configuration>
							<inputSpec>${project.build.directory}/generated-resources/openapi/openapi.json</inputSpec>
							<generatorName>typescript-axios</generatorName>
							<output>${project.build.directory}/generated-sources/openapi-client-typescript</output>
							<apiPackage>org.gcube.informationsystem.resourceregistry.client.api</apiPackage>
							<modelPackage>org.gcube.informationsystem.resourceregistry.client.model</modelPackage>
							<configOptions>
								<npmName>@gcube/resource-registry-client</npmName>
								<npmVersion>1.0.0</npmVersion>
								<supportsES6>true</supportsES6>
								<withInterfaces>true</withInterfaces>
								<useSingleRequestParameter>true</useSingleRequestParameter>
							</configOptions>
						</configuration>
					</execution>

					< ! - - Client JavaScript/TypeScript Node.js - - >
					<execution>
						<id>generate-javascript-client</id>
						<goals>
							<goal>generate</goal>
						</goals>
						<configuration>
							<inputSpec>${project.build.directory}/generated-resources/openapi/openapi.json</inputSpec>
							<generatorName>typescript-node</generatorName>
							<output>${project.build.directory}/generated-sources/openapi-client-javascript</output>
							<apiPackage>org.gcube.informationsystem.resourceregistry.client.api</apiPackage>
							<modelPackage>org.gcube.informationsystem.resourceregistry.client.model</modelPackage>
							<configOptions>
								<projectName>ResourceRegistryClient</projectName>
								<projectVersion>1.0.0</projectVersion>
								<usePromises>true</usePromises>
								<emitModelMethods>true</emitModelMethods>
							</configOptions>
						</configuration>
					</execution>

					< ! - - Client JavaScript vanilla - - >
					<execution>
						<id>generate-javascript-client</id>
						<goals>
							<goal>generate</goal>
						</goals>
						<configuration>
							<inputSpec>${project.build.directory}/generated-resources/openapi/openapi.json</inputSpec>
							<generatorName>javascript</generatorName>
							<output>${project.build.directory}/generated-sources/openapi-client-javascript</output>
							<apiPackage>org.gcube.informationsystem.resourceregistry.client.api</apiPackage>
							<modelPackage>org.gcube.informationsystem.resourceregistry.client.model</modelPackage>
							<configOptions>
								<projectName>ResourceRegistryClient</projectName>
								<projectVersion>1.0.0</projectVersion>
								<usePromises>true</usePromises>
								<emitModelMethods>true</emitModelMethods>
							</configOptions>
						</configuration>
					</execution>

					

					< ! - - Client R - - >
					<execution>
						<id>generate-r-client</id>
						<goals>
							<goal>generate</goal>
						</goals>
						<configuration>
							<inputSpec>${project.build.directory}/generated-resources/openapi/openapi.json</inputSpec>
							<generatorName>r</generatorName>
							<output>${project.build.directory}/generated-sources/openapi-client-r</output>
							<apiPackage>org.gcube.informationsystem.resourceregistry.client.api</apiPackage>
							<modelPackage>org.gcube.informationsystem.resourceregistry.client.model</modelPackage>
							<configOptions>
								<packageName>ResourceRegistryClient</packageName>
								<packageVersion>1.0.0</packageVersion>
								<packageTitle>Resource Registry Client</packageTitle>
								<packageDescription>R client for Resource Registry API</packageDescription>
								<packageAuthor>Your Name</packageAuthor>
								<packageCompany>gCube</packageCompany>
								<packageUrl>https://github.com/gcube-system/resource-registry</packageUrl>
								<clientPackage>ResourceRegistryClient</clientPackage>
							</configOptions>
						</configuration>
					</execution>
				</executions>
			</plugin>
			-->

		</plugins>
	</build>
</project>
