<?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">
	<parent>
		<groupId>org.gcube.tools</groupId>
		<artifactId>maven-parent</artifactId>
		<version>1.3.0</version>
	</parent>
	<modelVersion>4.0.0</modelVersion>
	<groupId>org.gcube.information-system</groupId>
	<artifactId>resource-registry</artifactId>
	<packaging>war</packaging>
	<version>5.0.0</version>
	<name>Resource Registry Service</name>
	<description>The Resource Registry is a web-service which represent the core component of the gCube Information System</description>
	<properties>
		<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>
		<microprofile.openapi.version>3.1.1</microprofile.openapi.version>
		<openapi.generator.version>7.0.1</openapi.generator.version>
		<smallrye.openapi.version>3.5.2</smallrye.openapi.version>
		<webappDirectory>
			${project.basedir}${file.separator}src${file.separator}main${file.separator}webapp${file.separator}WEB-INF</webappDirectory>
	</properties>
	<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>

	<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>
	<dependencyManagement>
		<dependencies>
			<dependency>
				<groupId>org.gcube.distribution</groupId>
				<artifactId>gcube-smartgears-bom</artifactId>
				<version>4.0.1</version>
				<type>pom</type>
				<scope>import</scope>
			</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>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>3.0.44</version>
			<exclusions>
				<exclusion>
					<groupId>org.graalvm.tools</groupId>
					<artifactId>chromeinspector</artifactId>
				</exclusion>
			</exclusions>
		</dependency>
		<dependency>
			<groupId>org.gcube.common</groupId>
			<artifactId>gx-http</artifactId>
		</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>jakarta.servlet</groupId>
			<artifactId>jakarta.servlet-api</artifactId>
		</dependency>
		<dependency>
			<groupId>jakarta.ws.rs</groupId>
			<artifactId>jakarta.ws.rs-api</artifactId>
		</dependency>
		<dependency>
			<groupId>jakarta.xml.ws</groupId>
			<artifactId>jakarta.xml.ws-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 -->
		<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>
			<version>${microprofile.openapi.version}</version>
		</dependency>

		<!-- SmallRye OpenAPI per la generazione del file OpenAPI -->
		<dependency>
			<groupId>io.smallrye</groupId>
			<artifactId>smallrye-open-api-core</artifactId>
			<version>${smallrye.openapi.version}</version>
		</dependency>

		<!-- SmallRye OpenAPI JAX-RS integration -->
		<dependency>
			<groupId>io.smallrye</groupId>
			<artifactId>smallrye-open-api-jaxrs</artifactId>
			<version>${smallrye.openapi.version}</version>
		</dependency>

		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>slf4j-api</artifactId>
			<scope>provided</scope>
		</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>
			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>exec-maven-plugin</artifactId>
				<version>3.1.0</version>
				<executions>
					<execution>
						<id>postprocess-openapi</id>
						<phase>prepare-package</phase>
						<goals>
							<goal>exec</goal>
						</goals>
						<configuration>
							<executable>python3</executable>
							<workingDirectory>${project.basedir}/documentation/openapi/</workingDirectory>
							<arguments>
								<argument>postprocess_openapi.py</argument>
								<argument>
									${project.build.directory}/generated-resources/openapi/openapi.json</argument>
							</arguments>
						</configuration>
					</execution>
				</executions>
			</plugin>

			<!-- Sphinx plugin' -->
			<plugin>
				<groupId>kr.motd.maven</groupId>
				<artifactId>sphinx-maven-plugin</artifactId>
				<version>2.10.0</version>
				<configuration>
					<outputDirectory>
						${project.build.directory}${file.separator}${project.build.finalName}${file.separator}docs</outputDirectory>
					<builder>html</builder>
					<configDirectory>
						${project.basedir}${file.separator}documentation${file.separator}sphinx</configDirectory>
					<sourceDirectory>
						${project.basedir}${file.separator}documentation${file.separator}sphinx</sourceDirectory>
					<!-- brew install sphinx-doc -->
					<!-- <binaryUrl>file:/opt/homebrew/opt/sphinx-doc/bin/sphinx-build</binaryUrl> -->
				</configuration>
				<executions>
					<execution>
						<phase>process-resources</phase>
						<goals>
							<goal>generate</goal>
						</goals>
					</execution>
				</executions>
			</plugin>

			<!-- SmallRye OpenAPI Plugin per generare il file OpenAPI -->
			<plugin>
				<groupId>io.smallrye</groupId>
				<artifactId>smallrye-open-api-maven-plugin</artifactId>
				<version>${smallrye.openapi.version}</version>
				<executions>
					<execution>
						<goals>
							<goal>generate-schema</goal>
						</goals>
						<configuration>
							<scanDependenciesDisable>false</scanDependenciesDisable>
							<outputFileTypeFilter>JSON</outputFileTypeFilter>
							<outputDirectory>${project.build.directory}/generated-resources/openapi</outputDirectory>
							<scanPackages>org.gcube.informationsystem.resourceregistry.rest</scanPackages>
							<infoTitle>${project.name}</infoTitle>
							<infoVersion>${project.version}</infoVersion>
							<infoDescription>${project.description}</infoDescription>
							<infoLicenseName>EUPL v.1.2</infoLicenseName>
							<infoLicenseUrl>
								https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12</infoLicenseUrl>
							<servers>../</servers>
						</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>
			-->

			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-resources-plugin</artifactId>
				<executions>
					<execution>
						<id>copy-openapi-yaml</id>
						<phase>prepare-package</phase>
						<goals>
							<goal>copy-resources</goal>
						</goals>
						<configuration>
							<outputDirectory>
								${project.build.directory}/${project.build.finalName}/api-docs</outputDirectory>
							<resources>
								<resource>
									<directory>
										${project.build.directory}/generated-resources/openapi</directory>
									<includes>
										<include>openapi.json</include>
									</includes>
									<filtering>false</filtering>
								</resource>
							</resources>
						</configuration>
					</execution>
				</executions>
			</plugin>

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