Compare commits

..

No commits in common. "idm" and "main" have entirely different histories.
idm ... main

75 changed files with 3527 additions and 6762 deletions

144
.gitignore vendored
View File

@ -1,16 +1,5 @@
#
ignore_me
tomcat
target
.classpath
.visual
.project
.settings
/**/.DS_Store
# Created by https://www.toptal.com/developers/gitignore/api/java,macos,linux,visualstudiocode,eclipse
# Edit at https://www.toptal.com/developers/gitignore?templates=java,macos,linux,visualstudiocode,eclipse
# Created by https://www.toptal.com/developers/gitignore/api/macos,intellij,eclipse,visualstudiocode,linux
# Edit at https://www.toptal.com/developers/gitignore?templates=macos,intellij,eclipse,visualstudiocode,linux
### Eclipse ###
.metadata
@ -78,31 +67,118 @@ local.properties
# Spring Boot Tooling
.sts4-cache/
### Java ###
# Compiled class file
*.class
### Intellij ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
# Log file
*.log
# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf
# BlueJ files
*.ctxt
# AWS User-specific
.idea/**/aws.xml
# Mobile Tools for Java (J2ME)
.mtj.tmp/
# Generated files
.idea/**/contentModel.xml
# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar
# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
replay_pid*
# Gradle
.idea/**/gradle.xml
.idea/**/libraries
# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/artifacts
# .idea/compiler.xml
# .idea/jarRepositories.xml
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr
# CMake
cmake-build-*/
# Mongo Explorer plugin
.idea/**/mongoSettings.xml
# File-based project format
*.iws
# IntelliJ
out/
# mpeltonen/sbt-idea plugin
.idea_modules/
# JIRA plugin
atlassian-ide-plugin.xml
# Cursive Clojure plugin
.idea/replstate.xml
# SonarLint plugin
.idea/sonarlint/
# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties
# Editor-based Rest Client
.idea/httpRequests
# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser
### Intellij Patch ###
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721
# *.iml
# modules.xml
# .idea/misc.xml
# *.ipr
# Sonarlint plugin
# https://plugins.jetbrains.com/plugin/7973-sonarlint
.idea/**/sonarlint/
# SonarQube Plugin
# https://plugins.jetbrains.com/plugin/7238-sonarqube-community-plugin
.idea/**/sonarIssues.xml
# Markdown Navigator plugin
# https://plugins.jetbrains.com/plugin/7896-markdown-navigator-enhanced
.idea/**/markdown-navigator.xml
.idea/**/markdown-navigator-enh.xml
.idea/**/markdown-navigator/
# Cache file creation bug
# See https://youtrack.jetbrains.com/issue/JBR-2257
.idea/$CACHE_FILE$
# CodeStream plugin
# https://plugins.jetbrains.com/plugin/12206-codestream
.idea/codestream.xml
# Azure Toolkit for IntelliJ plugin
# https://plugins.jetbrains.com/plugin/8053-azure-toolkit-for-intellij
.idea/**/azureSettings.xml
### Linux ###
*~
@ -171,4 +247,4 @@ Temporary Items
.history
.ionide
# End of https://www.toptal.com/developers/gitignore/api/java,macos,linux,visualstudiocode,eclipse
# End of https://www.toptal.com/developers/gitignore/api/macos,intellij,eclipse,visualstudiocode,linux

24
.vscode/launch.json vendored
View File

@ -1,24 +0,0 @@
{
// Usare IntelliSense per informazioni sui possibili attributi.
// Al passaggio del mouse vengono visualizzate le descrizioni degli attributi esistenti.
// Per altre informazioni, visitare: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "java",
"name": "Debug Service (Attach)",
"projectName": "social-service",
"request": "attach",
"hostName": "localhost",
"port": 5005
},
{
"type": "java",
"name": "Current File",
"request": "launch",
"mainClass": "${file}"
}
]
}

View File

@ -1,4 +0,0 @@
{
"java.configuration.updateBuildConfiguration": "automatic",
"java.compile.nullAnalysis.mode": "automatic"
}

View File

@ -3,7 +3,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
# Changelog for Hello World Service
## [v0.0.1-SNAPSHOT]
## [v1.0.0-SNAPSHOT]
- First Version

View File

@ -1,15 +0,0 @@
ARG JAVA_VERSION=11
ARG SMARTGEARS_VERSION=4.0.1-SNAPSHOT
#FROM d4science/smartgears-distribution:${SMARTGEARS_VERSION}-java${JAVA_VERSION}-tomcat10.1.19
FROM hub.dev.d4science.org/gcube/smartgears-distribution:${SMARTGEARS_VERSION}-java${JAVA_VERSION}-tomcat10.1.19
#FROM smartgears-distribution:${SMARTGEARS_VERSION}-java${JAVA_VERSION}-tomcat10.1.19
ARG CONTAINER_INI="./docker/container.ini"
COPY ./docker/logback.xml /etc/
COPY ./docker/*.gcubekey /tomcat/lib
COPY ./target/social-service.war /tomcat/webapps/
COPY ${CONTAINER_INI} /etc/container.ini
EXPOSE 8080

View File

@ -1,179 +0,0 @@
#!/bin/bash
# set -x # uncomment to debug script
BUILD_VERSION=0.0.1-SNAPSHOT
SMARTGEARS_VERSION=4.0.1-SNAPSHOT
ACCEPTED_JAVA_VERSIONs=(11 17)
PORT=8080
DEBUG_PORT=5005
DEBUG=false
EXECUTE=false
TEST=false
COMPILE=true
JAVA_VERSION=11
NAME=social-service
CONTAINER_INI="./docker/container.ini"
IMAGE_VERSION=${BUILD_VERSION}-java${JAVA_VERSION}-smartgears${SMARTGEARS_VERSION}
PUSH_DOCKER=false
PUSH_HARBOR=false
LOGIN_HARBOR=false
BUILD_NAME=$NAME:$IMAGE_VERSION
SMARTGEAR_IMAGE=hub.dev.d4science.org/gcube/smartgears-distribution:${SMARTGEARS_VERSION}-java${JAVA_VERSION}-tomcat10.1.19
DOCKER_IMAGE_NAME=d4science/$BUILD_NAME
HARBOR_IMAGE_NAME=hub.dev.d4science.org/gcube/$BUILD_NAME
echo "BUILD_NAME=$BUILD_NAME"
################################################################################
# Help #
################################################################################
Help() {
# Display Help
echo "build, create and run in docker the identity manager service"
echo
echo "Syntax: buildDistribution [-n arg] [-p arg] [-j arg] [-d arg?] [-h]"
echo "options:"
echo "-s skip maven package"
echo "-t exec also maven tests"
echo "-n arg specifies the docker image name (default is identity-manager)."
echo "-p arg specifies the port to be exposed for the docker container to access the service (default $PORT)"
echo "-j arg specify java version (default is $JAVA_VERSION)"
echo " accepted version are: ${ACCEPTED_JAVA_VERSIONs[@]}"
echo "-e execute the image"
echo "-d arg? enable java debug mode for execution"
echo " arg is the debug port (default is $DEBUG_PORT)"
echo "-r push image to d4science harbo[r] (with login already done, or -l to login)"
echo "-l [l]ogin to d4science harbor"
echo "-u p[u]sh image to dockerhub (with docker login already done)"
echo "-c arg path of the file to deploy as container.ini (default ./docker/container.ini)"
echo "-h Print this Help."
echo
echo "to compile and push to harbor registry with a custom container.ini file: "
echo " ./buildImageAndStart.sh -r -m -l -c \"./docker/container-XXX.ini\" "
echo
echo "to debug locally: "
echo " ./buildImageAndStart.sh -d "
}
################################################################################
################################################################################
# Main program #
################################################################################
################################################################################
set -e
#OPTSTRING=":sn:p:d:j:?h"
OPTSTRING=":c:n:p:d:?jsmulrteh"
while getopts $OPTSTRING opt; do
# echo "Option -${opt} was triggered, Argument: ${OPTARG}"
case "${opt}" in
s) COMPILE=false && echo "compile $COMPILE" ;;
c)
CONTAINER_INI=${OPTARG}
echo "CONTAINER_INI: $CONTAINER_INI"
;;
m) MULTI_PLATFORM=true ;;
n) NAME=${OPTARG} ;;
p) PORT=${OPTARG} ;;
u) PUSH_DOCKER=true ;;
l) LOGIN_HARBOR=true ;;
r) PUSH_HARBOR=true ;;
t) TEST=true ;;
e) EXECUTE=true ;;
d)
DEBUG=true
DEBUG_PORT=${OPTARG}
EXECUTE=true ;
echo "debug enabled, port $DEBUG_PORT, execute $EXECUTE"
;;
j)
if [[ ${ACCEPTED_JAVA_VERSIONs[@]} =~ ${OPTARG} ]]; then
JAVA_VERSION=${OPTARG}
else
echo "Invalid java version" && echo "accepted version are: ${ACCEPTED_JAVA_VERSIONs[@]}" && exit 1
fi
;;
h) Help && exit 0 ;;
:)
# matched when an option that is expected to have an argument is passed without one
if [ ${OPTARG} = "d" ]; then
DEBUG=true
EXECUTE=true
echo "debug enabled, not default debug port $DEBUG_PORT, execute $EXECUTE"
else
# matched when an option that is expected to have an argument is passed without one
echo "Option -${OPTARG} requires an argument."
exit 1
fi
;;
?) # match any invalid option that is passed
echo "Invalid option: -${OPTARG}."
exit 1
;;
esac
done
if [ $COMPILE = true ]; then
if [ $TEST = false ]; then
mvn clean package -Dmaven.test.skip
else
mvn clean package
fi
else
echo "skipping mvn package"
fi
docker pull $SMARTGEAR_IMAGE
if [ $MULTI_PLATFORM ]; then
echo "build multiplatform"
docker build -t $BUILD_NAME --build-arg="CONTAINER_INI=$CONTAINER_INI" --build-arg="JAVA_VERSION=${JAVA_VERSION}" --build-arg="SMARTGEARS_VERSION=${SMARTGEARS_VERSION}" --platform=linux/amd64,linux/arm64,linux/arm/v7 .
else
echo "build single platform"
docker build -t $BUILD_NAME --build-arg="CONTAINER_INI=$CONTAINER_INI" --build-arg="JAVA_VERSION=${JAVA_VERSION}" --build-arg="SMARTGEARS_VERSION=${SMARTGEARS_VERSION}" .
# docker manifest create hub.dev.d4science.org/gcube/$BUILD_NAME \
# hub.dev.d4science.org/gcube/$NAME-amd64-linux:$IMAGE_VERSION \
# hub.dev.d4science.org/gcube/$NAME-arm-linux:$IMAGE_VERSION \
# hub.dev.d4science.org/gcube/$NAME-arm-linux:$IMAGE_VERSION
fi
if [ ${PUSH_DOCKER} = true ]; then
docker tag $BUILD_NAME $DOCKER_IMAGE_NAME./
docker push $DOCKER_IMAGE_NAME
echo ">>> pushed on dockerhub the image $DOCKER_IMAGE_NAME"
fi
if [ ${LOGIN_HARBOR} = true ]; then
./loginHarborHub.sh
fi
if [ $PUSH_HARBOR = true ]; then
echo ">>> PUSHING on hub.dev.d4science.org the image $HARBOR_IMAGE_NAME"
docker tag $BUILD_NAME $HARBOR_IMAGE_NAME
echo ">>> docker push $HARBOR_IMAGE_NAME"
docker push $HARBOR_IMAGE_NAME
echo ">>> pushed on hub.dev.d4science.org the image $HARBOR_IMAGE_NAME"
fi
if [ ${EXECUTE} = true ]; then
if [ $DEBUG = true ]; then
docker run -p $PORT:8080 -p $DEBUG_PORT:5005 -e JAVA_TOOL_OPTIONS="-agentlib:jdwp=transport=dt_socket,address=*:5005,server=y,suspend=y" $BUILD_NAME
else
docker run -p $PORT:8080 $BUILD_NAME
fi
fi

View File

@ -1 +0,0 @@
mvn install:install-file -Dfile="social-service-model.jar" -DgroupId=org.gcube.social-networking -DartifactId=social-service-model -Dversion=2.0.0-SNAPSHOT -Dpackaging=jar

3
docker/.gitignore vendored
View File

@ -1,3 +0,0 @@
container*.ini
!container.default.ini
*.gcubekey

View File

@ -1,25 +0,0 @@
[node]
mode = offline
hostname = localhost
protocol= http
port = 8080
infrastructure = /gcube
authorizeChildrenContext = true
publicationFrequencyInSeconds = 60
[properties]
SmartGearsDistribution = 4.0.1-SNAPSHOT
SmartGearsDistributionBundle = UnBundled
[site]
country = it
location = pisa
[authorization]
factory = org.gcube.smartgears.security.defaults.DefaultAuthorizationProviderFactory
factory.endpoint = https://accounts.dev.d4science.org/auth/realms/d4science/protocol/openid-connect/token
credentials.class = org.gcube.smartgears.security.SimpleCredentials
credentials.clientID =
credentials.secret =

View File

@ -1,28 +0,0 @@
<configuration scan="true" debug="true">
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>Ï <pattern>%-5level %logger{36} - %msg%n</pattern>
</encoder>
</appender>
<logger name="org.gcube.service.idm" level="DEBUG" />
<logger name="org.gcube.service.rest" level="DEBUG" />
<logger name="org.gcube.smartgears" level="DEBUG" />
<!--
<logger name="org.gcube" level="DEBUG" />
<logger name="org.gcube.smartgears" level="TRACE" />
<logger name="org.gcube.smartgears.handlers" level="TRACE" />
<logger name="org.gcube.common.events" level="WARN" />
<logger name="org.gcube.data.publishing" level="ERROR" />
<logger name="org.gcube.documentstore" level="ERROR" />
<logger name="org.gcube.common.core.publisher.is.legacy" level="TRACE" />
<logger name="org.gcube.data.access" level="TRACE" />
<logger name="org.gcube.data.access.storagehub.handlers" level="DEBUG" />
-->
<root level="INFO">
<appender-ref ref="STDOUT" />
</root>
</configuration>

View File

@ -1,28 +0,0 @@
<configuration scan="true" debug="true">
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>Ï <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
</encoder>
</appender>
<logger name="org.gcube.service.idm" level="DEBUG" />
<logger name="org.gcube.service.rest" level="DEBUG" />
<logger name="org.gcube.smartgears" level="DEBUG" />
<!--
<logger name="org.gcube" level="DEBUG" />
<logger name="org.gcube.smartgears" level="TRACE" />
<logger name="org.gcube.smartgears.handlers" level="TRACE" />
<logger name="org.gcube.common.events" level="WARN" />
<logger name="org.gcube.data.publishing" level="ERROR" />
<logger name="org.gcube.documentstore" level="ERROR" />
<logger name="org.gcube.common.core.publisher.is.legacy" level="TRACE" />
<logger name="org.gcube.data.access" level="TRACE" />
<logger name="org.gcube.data.access.storagehub.handlers" level="DEBUG" />
-->
<root level="WARN">
<appender-ref ref="STDOUT" />
</root>
</configuration>

View File

@ -1,23 +0,0 @@
<configuration scan="true" debug="true">
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>Ï
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
</encoder>
</appender>
<logger name="org.gcube" level="TRACE" />
<logger name="org.gcube.smartgears" level="TRACE" />
<logger name="org.gcube.smartgears.handlers" level="TRACE"/>
<logger name="org.gcube.common.events" level="WARN" />
<logger name="org.gcube.data.publishing" level="ERROR" />
<logger name="org.gcube.documentstore" level="ERROR" />
<logger name="org.gcube.common.core.publisher.is.legacy" level="TRACE" />
<logger name="org.gcube.data.access" level="TRACE" />
<logger name="org.gcube.data.access.storagehub.handlers" level="ERROR"/>
<root level="ERROR">
<appender-ref ref="STDOUT" />
</root>
</configuration>

View File

@ -1,2 +0,0 @@
${{adminId}}=social
${{adminPwd}}=social

View File

@ -1,5 +0,0 @@
mvn clean package
docker build -t idm .
docker compose up -d --build --force-recreate
#docker run -it -d -p 9090:8080 --name idm idm

View File

@ -2,36 +2,22 @@
<enunciate
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://enunciate.webcohesion.com/schemas/enunciate-2.14.0.xsd">
<description package="org.gcube.acme.rest"/>
<api-classes>
<include
pattern="org.gcube.portal.social.networking.**"/>
<include
pattern="org.gcube.social_networking.socialnetworking.model.beans.**"/>
<exclude
pattern="org.gcube.portal.social.networking.ws.docs.DocsGenerator" />
<include pattern="org.gcube.acme.rest.*" />
<exclude pattern="org.gcube.acme.*" />
</api-classes>
<modules>
<jackson1 disabled="true" />
<gwt-json-overlay disabled="true" />
<php-json-client disabled="true" />
<ruby-json-client disabled="true" />
<java-json-client disabled="true" />
<!-- <java-json-client jarName="social-service-client.jar" -->
<!-- bundleSourcesWithClasses="true" groupId="org.gcube.social-networking" -->
<!-- artifactId="auto-social-client" javac-source="1.8" javac-target="1.8"> -->
<!-- <package-conversions> -->
<!-- <convert -->
<!-- from="org.gcube.portal.social.networking.ws" -->
<!-- to="org.gcube.social.client" /> -->
<!-- </package-conversions> -->
<!-- </java-json-client> -->
<javascript-client disabled="true" />
<docs docsDir="${project.build.directory}" docsSubdir="api-docs" />
<docs
freemarkerTemplate="${project.basedir}/src/main/resources/META-INF/enunciate/d4science_docs.fmt">
<swagger basePath="/${project.artifactId}" />
<docs freemarkerTemplate="${project.basedir}/src/main/resources/META-INF/enunciate/d4science_docs.fmt">
<additional-css
file="css/d4science_enunciate_custom.css" />
</docs>
<swagger basePath="/rest" />
</modules>
</enunciate>

View File

@ -1,8 +0,0 @@
name: ${artifactId}
group: ${groupId}
version: ${version}
description: ${description}
excludes:
- path: /docs.*
- path: /api-docs.*
- path: /guest

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xml>
<application mode='online'>
<name>${project.artifactId}</name>
<group>${project.groupId}</group>
<version>${project.version}</version>
<description>${project.description}</description>
<exclude>/api-docs.*</exclude>
<exclude>/docs.*</exclude>
</application>

View File

@ -1,28 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
version="4.0">
<display-name>Social Service</display-name>
<description>
Gcube Social Service
</description>
<servlet>
<servlet-name>social-service</servlet-name>
<servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>jersey.config.server.provider.packages</param-name>
<param-value>org.gcube.social_networking.rest</param-value>
</init-param>
<init-param>
<param-name>jersey.config.server.provider.packages</param-name>
<param-value>
org.gcube.social_networking.mappers
</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>social-service</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
</web-app>

View File

@ -1,13 +0,0 @@
#!/bin/bash
REGISTRY_URL="hub.dev.d4science.org"
#USERNAME="alfredo.oliviero"
echo "to obtain Harbor username and CLI secret:"
echo "https://hub.dev.d4science.org/ -> user profile -> CLI secret"
read -p "username:" USERNAME
echo ""
read -s -p "CLI secret:" ACCESS_TOKEN
echo "$ACCESS_TOKEN" | docker login $REGISTRY_URL -u $USERNAME --password-stdin
unset ACCESS_TOKEN

232
pom.xml
View File

@ -5,33 +5,21 @@
<parent>
<groupId>org.gcube.tools</groupId>
<artifactId>maven-parent</artifactId>
<version>1.2.0</version>
<version>1.1.0</version>
</parent>
<groupId>org.gcube.social_networking</groupId>
<artifactId>social-service</artifactId>
<version>0.0.1-SNAPSHOT</version>
<version>1.0.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>Social Service</name>
<description>This is the social service</description>
<properties>
<java.version>11</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<!-- OPTIONAL. for authorization-control-library -->
<aspectj-plugin.version>1.14.0</aspectj-plugin.version>
<webappDirectory>
${project.basedir}${file.separator}src${file.separator}main${file.separator}webapp${file.separator}WEB-INF</webappDirectory>
<enunciate.version>2.14.0</enunciate.version>
<cassandra.driver.oss.version>4.13.0</cassandra.driver.oss.version>
<!-- only for serializers in example folder -->
<!-- <jackson.version>2.15.3</jackson.version> -->
</properties>
<scm>
@ -47,7 +35,7 @@
<dependency>
<groupId>org.gcube.distribution</groupId>
<artifactId>gcube-smartgears-bom</artifactId>
<version>3.0.1-SNAPSHOT</version>
<version>2.5.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
@ -59,7 +47,6 @@
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
@ -67,44 +54,34 @@
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>org.gcube.common</groupId>
<artifactId>authorization-utils</artifactId>
<version>[2.2.0, 3.0.0-SNAPSHOT)</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-multipart</artifactId>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-servlet</artifactId>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-servlet-core</artifactId>
</dependency>
<dependency>
<groupId>org.gcube.core</groupId>
<artifactId>common-smartgears-app</artifactId>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
</dependency>
<dependency>
<groupId>org.gcube.core</groupId>
<artifactId>common-smartgears</artifactId>
<groupId>org.gcube.common.portal</groupId>
<artifactId>portal-manager</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.core</groupId>
<artifactId>common-scope</artifactId>
</dependency>
<dependency>
<groupId>org.gcube.core</groupId>
<artifactId>common-scope-maps</artifactId>
</dependency>
<dependency>
<groupId>org.gcube.common</groupId>
<artifactId>authorization-client</artifactId>
</dependency>
<!--must be provided -->
<dependency>
<groupId>org.gcube.social-networking</groupId>
<artifactId>social-service-model</artifactId>
<version>2.0.0-SNAPSHOT</version>
<version>[1.2.0-SNAPSHOT, 2.0.0)</version>
</dependency>
<dependency>
<groupId>com.datastax.oss</groupId>
<artifactId>java-driver-query-builder</artifactId>
@ -115,28 +92,41 @@
<artifactId>java-driver-mapper-runtime</artifactId>
<version>${cassandra.driver.oss.version}</version>
</dependency>
<dependency>
<groupId>com.sun.mail</groupId>
<artifactId>javax.mail</artifactId>
<version>1.5.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
<!-- <dependency>
<groupId>org.gcube.common</groupId>
<artifactId>common-authorization</artifactId>
</dependency> -->
<dependency>
<groupId>org.gcube.common</groupId>
<artifactId>authorization-control-library</artifactId>
<groupId>org.gcube.core</groupId>
<artifactId>common-smartgears-app</artifactId>
</dependency>
<!-- Added to support Java 11 JDK -->
<dependency>
<groupId>javax.xml.ws</groupId>
<artifactId>jaxws-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<scope>provided</scope>
</dependency>
<!-- END Added to support Java 11 JDK -->
<dependency>
<groupId>org.gcube.common.portal</groupId>
<artifactId>portal-manager</artifactId>
<groupId>org.gcube.core</groupId>
<artifactId>common-smartgears</artifactId>
</dependency>
<!-- Required for Enunciate plugin -->
<dependency>
<groupId>com.webcohesion.enunciate</groupId>
@ -150,23 +140,19 @@
<version>${enunciate.version}</version>
<scope>provided</scope>
</dependency>
<!-- only for serializers in example folder -->
<!-- <dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
<version>${jackson.version}</version>
</dependency> -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
<!-- END Required for Enunciate plugin -->
<!-- Test libraries -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
@ -174,74 +160,33 @@
<artifactId>logback-classic</artifactId>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/jakarta.mail/jakarta.mail-api -->
<dependency>
<groupId>jakarta.mail</groupId>
<artifactId>jakarta.mail-api</artifactId>
<version>1.6.7</version>
</dependency>
<dependency>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache</artifactId>
<version>2.10.0</version>
</dependency>
<dependency>
<groupId>org.gcube.dvos</groupId>
<artifactId>usermanagement-core</artifactId>
<version>[2.0.0-SNAPSHOT, 3.0.0-SNAPSHOT)</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.gcube.applicationsupportlayer</groupId>
<artifactId>aslsocial</artifactId>
<version>[1.8.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
<version>4.0.4</version>
</dependency>
<dependency>
<groupId>org.gcube.idm</groupId>
<artifactId>idm-common-library</artifactId>
<version>0.0.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.inject</groupId>
<artifactId>jersey-cdi2-se</artifactId>
</dependency>
<!-- idm client -->
<dependency>
<groupId>org.gcube.idm</groupId>
<artifactId>idm-common-library</artifactId>
<version>0.0.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.gcube.idm</groupId>
<artifactId>idm-client-library</artifactId>
<version>0.0.2-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<!-- Enunciate Maven plugin
<!-- Sphinx plugin' -->
<plugin>
<groupId>kr.motd.maven</groupId>
<artifactId>sphinx-maven-plugin</artifactId>
<version>2.10.0</version>
<configuration>
<outputDirectory>
${project.build.directory}/${project.artifactId}-${project.version}/docs</outputDirectory>
<builder>html</builder>
<configDirectory>${basedir}/docs</configDirectory>
<sourceDirectory>${basedir}/docs</sourceDirectory>
</configuration>
<executions>
<execution>
<phase>process-resources</phase>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- Enunciate Maven plugin -->
<plugin>
<groupId>com.webcohesion.enunciate</groupId>
<artifactId>enunciate-maven-plugin</artifactId>
@ -255,7 +200,8 @@
</execution>
</executions>
</plugin>
<!-- Copy Enunciate Documentation from your-application/api-docs
into your war -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
@ -281,7 +227,7 @@
</execution>
</executions>
</plugin>
-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
@ -291,34 +237,6 @@
</configuration>
</plugin>
<!-- OPTIONAL. authorization-control-library: add this plugin if you
want to use gcube
authorization control funzionalities -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>${aspectj-plugin.version}</version>
<configuration>
<complianceLevel>${java.version}</complianceLevel>
<source>${java.version}</source>
<target>${java.version}</target>
<aspectLibraries>
<aspectLibrary>
<groupId>org.gcube.common</groupId>
<artifactId>authorization-control-library</artifactId>
</aspectLibrary>
</aspectLibraries>
</configuration>
<executions>
<execution>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

View File

@ -0,0 +1,66 @@
package org.gcube.social_networking;
import org.gcube.common.authorization.utils.manager.SecretManagerProvider;
import org.gcube.smartgears.ApplicationManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* @author Luca Frosini (ISTI - CNR)
*/
public class HelloWorldInitializator implements ApplicationManager {
/**
* Logger
*/
private static Logger logger = LoggerFactory.getLogger(HelloWorldInitializator.class);
public static boolean initialised;
/**
* {@inheritDoc}
*/
@Override
public synchronized void onInit() {
String context = SecretManagerProvider.instance.get().getContext();
logger.trace(
"\n-------------------------------------------------------\n"
+ "Hello World Service is Starting on context {}\n"
+ "-------------------------------------------------------",
context);
// ApplicationContext applicationContext = ContextProvider.get();
// String helloWorldEServiceID = applicationContext.id();
logger.trace(
"\n-------------------------------------------------------\n"
+ "Hello World Service Started Successfully on context {}\n"
+ "-------------------------------------------------------",
context);
}
/**
* {@inheritDoc}
*/
@Override
public synchronized void onShutdown(){
String context = SecretManagerProvider.instance.get().getContext();
logger.trace(
"\n-------------------------------------------------------\n"
+ "Hello World Service is Stopping on context {}\n"
+ "-------------------------------------------------------",
context);
logger.trace(
"\n-------------------------------------------------------\n"
+ "Hello World Service Stopped Successfully on context {}\n"
+ "-------------------------------------------------------",
context);
}
}

View File

@ -0,0 +1,20 @@
package org.gcube.social_networking;
import javax.ws.rs.ApplicationPath;
import org.gcube.acme.rest.HelloWorld;
import org.gcube.smartgears.annotations.ManagedBy;
import org.glassfish.jersey.server.ResourceConfig;
/**
* @author Luca Frosini (ISTI - CNR)
*/
@ApplicationPath("/")
@ManagedBy(HelloWorldInitializator.class)
public class ResourceInitializer extends ResourceConfig {
public ResourceInitializer() {
packages(HelloWorld.class.getPackage().toString());
}
}

View File

@ -1,62 +0,0 @@
package org.gcube.social_networking;
import org.gcube.common.security.providers.SecretManagerProvider;
import org.gcube.common.security.secrets.Secret;
import org.gcube.idm.client.IdmClientFactory;
import org.gcube.idm.common.is.IsServerConfig;
import org.gcube.smartgears.ApplicationManager;
import org.gcube.smartgears.ContextProvider;
import org.gcube.smartgears.configuration.Mode;
import org.gcube.social_networking.utils.InfrastructureUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* @author Ahmed Ibrahim
*/
public class SocialServiceApplicationManager implements ApplicationManager {
Logger logger = LoggerFactory.getLogger(SocialServiceApplicationManager.class);
/**
* {@inheritDoc}
*/
@Override
public void onInit() {
Secret isSecret = InfrastructureUtils.getSecretForInfrastructure();
IdmClientFactory factory = IdmClientFactory.getSingleton();
factory.setSecret(isSecret);
String baseurl = "http://146.48.85.179:9999/idm-service/";
IsServerConfig config = new IsServerConfig(baseurl);
factory.setConfig(config);
if (ContextProvider.get().container().configuration().mode() == Mode.offline) {
logger.debug("init called in offline mode");
} else {
Secret secret = SecretManagerProvider.get();
if (secret != null) {
logger.debug("init called in context {}", secret.getContext());
} else {
logger.debug("init called in null context");
}
}
}
/**
* {@inheritDoc}
*/
@Override
public void onShutdown() {
if (ContextProvider.get().container().configuration().mode() == Mode.offline) {
logger.debug("shutDown called in offline mode");
} else {
Secret secret = SecretManagerProvider.get();
if (secret != null) {
logger.debug("shutDown called in context {}", secret.getContext());
} else {
logger.debug("shutDown called in null context");
}
}
}
}

View File

@ -1,34 +0,0 @@
package org.gcube.social_networking.caches;
import net.sf.ehcache.CacheManager;
import net.sf.ehcache.Ehcache;
/**
* Handle caches via Ehcache
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
*/
public class CachesManager {
private static CacheManager cacheManager;
public static final CachesManager singleton = new CachesManager();
// the following caches are declared within the ehcache.xml (no default is available)
public static final String SOCIAL_NETWORKING_SITES_CACHE = "social_networking_site_cache";
public static final String USERS_CACHE = "users_cache";
public static final String GROUPS_CACHE = "groups_cache";
private CachesManager(){
cacheManager = CacheManager.newInstance();
}
public static Ehcache getCache(String name){
return cacheManager.getEhcache(name);
}
@Override
protected void finalize() throws Throwable {
super.finalize();
cacheManager.shutdown();
}
}

View File

@ -1,54 +0,0 @@
package org.gcube.social_networking.caches;
import net.sf.ehcache.Ehcache;
import net.sf.ehcache.Element;
import org.gcube.vomanagement.usermanagement.model.GCubeGroup;
import org.slf4j.LoggerFactory;
public class GroupsCache {
private static final org.slf4j.Logger logger = LoggerFactory.getLogger(GroupsCache.class);
private static GroupsCache singleton = new GroupsCache();
/**
* Private constructor: build the cache
* @return
*/
private GroupsCache(){
logger.debug("Building cache");
CachesManager.getCache(CachesManager.GROUPS_CACHE);
}
/**
* Get the singleton object
*/
public static GroupsCache getSingleton() {
return singleton;
}
/**
* Retrieve an entry
* @param groupId
* @return user associated to the user
*/
public GCubeGroup getGroup(long groupId){
Ehcache groupsCache = CachesManager.getCache(CachesManager.GROUPS_CACHE);
if(groupsCache.get(groupId) != null)
return (GCubeGroup) groupsCache.get(groupId).getObjectValue();
else
return null;
}
/**
* Save an entry into the cache
* @param id
* @param group
*/
public void pushEntry(long id, GCubeGroup group){
Ehcache groupsCache = CachesManager.getCache(CachesManager.GROUPS_CACHE);
groupsCache.put(new Element(id, group));
}
}

View File

@ -1,262 +0,0 @@
package org.gcube.social_networking.caches;
import java.io.InputStream;
import java.util.List;
import java.util.Properties;
import org.gcube.applicationsupportlayer.social.shared.SocialNetworkingSite;
import org.gcube.common.portal.GCubePortalConstants;
import org.gcube.common.resources.gcore.ServiceEndpoint;
import org.gcube.common.security.secrets.Secret;
import org.gcube.idm.common.is.InfrastrctureServiceClient;
import org.gcube.smartgears.ContextProvider;
import org.gcube.smartgears.context.application.ApplicationContext;
import org.gcube.social_networking.liferay.ws.GroupManagerWSBuilder;
import org.gcube.social_networking.utils.InfrastructureUtils;
import org.gcube.vomanagement.usermanagement.GroupManager;
import org.gcube.vomanagement.usermanagement.model.GCubeGroup;
import org.gcube.vomanagement.usermanagement.model.VirtualGroup;
import org.slf4j.LoggerFactory;
import net.sf.ehcache.Ehcache;
import net.sf.ehcache.Element;
/**
* When a notification needs to be sent, this class offers utility to discover (starting from the scope)
* the site information needed to build up the SocialNetworkingSite object (which, for instance, contains the
* portal email).
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
*/
public class SocialNetworkingSiteFinder {
// Logger
private static final org.slf4j.Logger logger = LoggerFactory.getLogger(SocialNetworkingSiteFinder.class);
private static final String EMAIL_SENDER_SITE_CUSTOM_FIELD = "Emailsender";
private static final String CATEGORY = "Portal";
// these properties could be overwritten by the ones read from config.properties
private static String PROD_FALLBACK_GATEWAY = "D4Science.org Gateway";
private static String DEV_FALLBACK_GATEWAY = "gCube Snapshot Gateway";
private static String PREPROD_FALLBACK_GATEWAY = "D4Science Preproduction Gateway";
/**
* Singleton object
*/
private static SocialNetworkingSiteFinder singleton = new SocialNetworkingSiteFinder();
/**
* Build the singleton instance
*/
private SocialNetworkingSiteFinder(){
// read fallback properties
try{
logger.debug("Trying to read config.properties");
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
InputStream input = classLoader.getResourceAsStream("config.properties");
Properties properties = new Properties();
properties.load(input);
PROD_FALLBACK_GATEWAY = properties.getProperty("PROD_FALLBACK_GATEWAY");
DEV_FALLBACK_GATEWAY = properties.getProperty("DEV_FALLBACK_GATEWAY");
PREPROD_FALLBACK_GATEWAY = properties.getProperty("PREPROD_FALLBACK_GATEWAY");
}catch(Exception e){
logger.warn("Failed to read config.properties...", e);
}
}
/**
* Retrieve the singleton instance
*/
public static SocialNetworkingSiteFinder getInstance(){
return singleton;
}
/**
* Retrieve the SocialNetworkingSite given the scope
* @param scope
* @return
*/
public static SocialNetworkingSite getSocialNetworkingSiteFromScope(String scope){
Ehcache socialSitesCache = CachesManager.getCache(CachesManager.SOCIAL_NETWORKING_SITES_CACHE);
if(scope == null || scope.isEmpty())
throw new IllegalArgumentException("Scope cannot be null/empty");
if(socialSitesCache != null && socialSitesCache.get(scope) != null)
return (SocialNetworkingSite) socialSitesCache.get(scope).getObjectValue();
else{
SocialNetworkingSite site = discoverSite(scope);
if(socialSitesCache != null && site != null)
socialSitesCache.put(new Element(scope, site));
return site;
}
}
/**
* Discover the site for this scope
* @param scope
* @return
*/
private static SocialNetworkingSite discoverSite(String scope) {
try{
logger.info("Requested site for scope " + scope);
GroupManager groupManager = GroupManagerWSBuilder.getInstance().getGroupManager();
long groupId = groupManager.getGroupIdFromInfrastructureScope(scope);
GCubeGroup matchingGateway = null;
if(groupManager.isVRE(groupId)){
// get the Virtual groups for the groupid related to the scope
List<VirtualGroup> virtualGroupsOfGroup = groupManager.getVirtualGroups(groupId);
if(virtualGroupsOfGroup == null || virtualGroupsOfGroup.isEmpty())
throw new Exception("It seems that the VRE is not linked to any VirtualGroups");
// get the gateways
List<GCubeGroup> gateways = groupManager.getGateways();
if(gateways == null || gateways.isEmpty())
throw new Exception("It seems there is no gateway here!");
logger.info("Retrieved Gateways are " + gateways);
// now, retrieve the virtual groups for each gateway and stop when a VG matches with one of the group
// then, it is the gateway of interest
ext_loop: for (GCubeGroup gateway : gateways) {
List<VirtualGroup> gatewayVirtualGroups = groupManager.getVirtualGroups(gateway.getGroupId());
if(gatewayVirtualGroups != null && !gatewayVirtualGroups.isEmpty()){
for (VirtualGroup gatewayVirtualGroup : gatewayVirtualGroups) {
if(virtualGroupsOfGroup.contains(gatewayVirtualGroup)){
logger.debug("Matching gateway for scope " + scope + " is " + gateway);
matchingGateway = gateway;
break ext_loop;
}
}
}
}
}else{
List<GCubeGroup> gateways = groupManager.getGateways();
// vo and root vo cases are treated separately: in production environment services.d4science.org is used, instead
// in dev next.d4science.org is used TODO better way...
ApplicationContext ctx = ContextProvider.get(); // get this info from SmartGears
String rootContext = "/"+ctx.container().configuration().infrastructure();
String matchingGatewayName = null;
if(isDevOrPreprod(rootContext)){
matchingGatewayName = DEV_FALLBACK_GATEWAY;
}else{
matchingGatewayName = PROD_FALLBACK_GATEWAY;
}
// find the matching one among the gateways
for (GCubeGroup gateway : gateways) {
if(gateway.getGroupName().equals(matchingGatewayName)){
matchingGateway = gateway;
break;
}
}
if(matchingGateway == null && isDevOrPreprod(rootContext)){
logger.warn("Checking if it is the preprod environment");
matchingGatewayName = PREPROD_FALLBACK_GATEWAY;
// find the matching one among the gateways
for (GCubeGroup gateway : gateways) {
if(gateway.getGroupName().equals(matchingGatewayName)){
matchingGateway = gateway;
break;
}
}
}
}
if(matchingGateway == null){
logger.warn("There is no gateway for such scope. Returning null");
return null;
}else{
String siteName = matchingGateway.getGroupName();
String emailSender = (String)groupManager.readCustomAttr(matchingGateway.getGroupId(), EMAIL_SENDER_SITE_CUSTOM_FIELD);
emailSender = emailSender.replace("\"", ""); //this is because otherwise it would contains double quotes and postfix would use it as first part before @ e.g. senderEmail="aginfra@d4science.org"@d4science.org
String siteLandingPagePath = GCubePortalConstants.PREFIX_GROUP_URL + matchingGateway.getFriendlyURL();
String siteUrl = discoverHostOfServiceEndpoint(siteName);
SocialNetworkingSite site = new SocialNetworkingSite(siteName, emailSender, siteUrl, siteLandingPagePath);
logger.info("Site is " + site);
return site;
}
}catch(Exception e){
logger.error("Failed to determine the SocialNetworkingSite for scope " + scope, e);
}
return null;
}
private static boolean isDevOrPreprod(String rootContext) {
return (rootContext.equals("/gcube") || rootContext.equals("/pred4s"));
}
/**
* Retrieve endpoint host from IS for this gateway
* @return the host for the gateway
* @throws Exception
*/
private static String discoverHostOfServiceEndpoint(String gatewayName){
// String RUNTIME_RESOURCE_NAME = "identity-manager";
// String CATEGORY = "org.gcube.auth";
// String END_POINT_NAME = "d4science";
// boolean IS_ROOT_SERVICE = true;
Secret secret = InfrastructureUtils.getSecretForInfrastructure();
List<ServiceEndpoint> resources = InfrastrctureServiceClient.getEndopintsFromIS(gatewayName, CATEGORY, true, secret);
ServiceEndpoint serviceEndpoint = resources.get(0);
String host = "https://" + serviceEndpoint.profile().runtime().hostedOn();
logger.info("Gateway host is " + host);
// IsServerConfig cfg = InfrastrctureServiceClient.serviceConfigFromIS(gatewayName, CATEGORY,
// END_POINT_NAME, IS_ROOT_SERVICE, current_secret);
// String currentScope = ScopeProvider.instance.get();
// ApplicationContext ctx = ContextProvider.get(); // get this info from SmartGears
// ScopeProvider.instance.set("/"+ctx.container().configuration().infrastructure());
// String host = null;
// try{
// SimpleQuery query = queryFor(ServiceEndpoint.class);
// query.addCondition("$resource/Profile/Name/text() eq '"+ gatewayName +"'");
// query.addCondition("$resource/Profile/Category/text() eq '"+ CATEGORY +"'");
// DiscoveryClient<ServiceEndpoint> client = clientFor(ServiceEndpoint.class);
// List<ServiceEndpoint> toReturn = client.submit(query);
// for (ServiceEndpoint serviceEndpoint : toReturn) {
// host = "https://" + serviceEndpoint.profile().runtime().hostedOn();
// logger.info("Gateway host is " + host);
// break;
// }
// }catch(Exception e){
// logger.error("Error while retrieving host for the gateway " + gatewayName);
// }finally{
// ScopeProvider.instance.set(currentScope);
// }
return host;
}
}

View File

@ -1,83 +0,0 @@
package org.gcube.social_networking.caches;
import java.util.List;
import net.sf.ehcache.Ehcache;
import net.sf.ehcache.Element;
import org.gcube.social_networking.liferay.ws.GroupManagerWSBuilder;
import org.gcube.social_networking.liferay.ws.UserManagerWSBuilder;
import org.gcube.smartgears.ContextProvider;
import org.gcube.smartgears.context.application.ApplicationContext;
import org.gcube.vomanagement.usermanagement.GroupManager;
import org.gcube.vomanagement.usermanagement.UserManager;
import org.gcube.vomanagement.usermanagement.model.GCubeUser;
import org.slf4j.LoggerFactory;
/**
* This cache will store GCubeUser of the users of the infrastructure as couples {user-id, user screename}
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
*/
public class UsersCache{
private static final org.slf4j.Logger logger = LoggerFactory.getLogger(UsersCache.class);
private static UsersCache singleton = new UsersCache();
/**
* Private constructor: build the cache
* @return
*/
private UsersCache(){
// create a thread to build the cache
new Thread(){
public void run() {
try{
logger.debug("Fetching users and putting them into cache");
Ehcache usersCache = CachesManager.getCache(CachesManager.USERS_CACHE);
GroupManager groupManager = GroupManagerWSBuilder.getInstance().getGroupManager();
UserManager userManager = UserManagerWSBuilder.getInstance().getUserManager();
ApplicationContext ctx = ContextProvider.get(); // get this info from SmartGears
List<GCubeUser> users = userManager.listUsersByGroup(groupManager.getGroupIdFromInfrastructureScope("/"+ctx.container().configuration().infrastructure()));
for (GCubeUser gCubeUser : users) {
usersCache.put(new Element(gCubeUser.getUserId(), gCubeUser));
}
}catch(Exception e){
logger.error("Unable to retrieve user's usernames. Other users will be discovered later on", e);
}
}
}.start();
}
/**
* Get the singleton object
*/
public static UsersCache getSingleton() {
return singleton;
}
/**
* Retrieve an entry
* @param userId
* @return user associated to the user
*/
public GCubeUser getUser(long userId){
Ehcache usersCache = CachesManager.getCache(CachesManager.USERS_CACHE);
if(usersCache.get(userId) != null)
return (GCubeUser) usersCache.get(userId).getObjectValue();
else
return null;
}
/**
* Save an entry into the cache
* @param id
* @param user
*/
public void pushEntry(long id, GCubeUser user){
Ehcache usersCache = CachesManager.getCache(CachesManager.USERS_CACHE);
usersCache.put(new Element(id, user));
}
}

View File

@ -1,50 +0,0 @@
package org.gcube.social_networking.liferay.ws;
import org.gcube.vomanagement.usermanagement.GroupManager;
import org.gcube.vomanagement.usermanagement.impl.ws.LiferayWSGroupManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Class that builds a (singleton) GroupManagerWS object.
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
*/
public class GroupManagerWSBuilder {
private static final Logger logger = LoggerFactory.getLogger(GroupManagerWSBuilder.class);
private static GroupManagerWSBuilder singleton = new GroupManagerWSBuilder();
private static GroupManager groupManagerWs;
private GroupManagerWSBuilder(){
logger.debug("Building GroupManager please wait");
try{
groupManagerWs = new LiferayWSGroupManager(
LiferayJSONWsCredentials.getSingleton().getUser(),
LiferayJSONWsCredentials.getSingleton().getPassword(),
LiferayJSONWsCredentials.getSingleton().getHost(),
LiferayJSONWsCredentials.getSingleton().getSchema(),
LiferayJSONWsCredentials.getSingleton().getPort());
}catch(Exception e){
logger.error("Failed to build the GroupManager. ", e);
return;
}
logger.debug("GroupManager instance built");
}
/**
* Get the user manager instance
* @return
*/
public GroupManager getGroupManager(){
return groupManagerWs;
}
public static GroupManagerWSBuilder getInstance(){
return singleton;
}
}

View File

@ -1,157 +0,0 @@
package org.gcube.social_networking.liferay.ws;
import static org.gcube.resources.discovery.icclient.ICFactory.clientFor;
import static org.gcube.resources.discovery.icclient.ICFactory.queryFor;
import java.rmi.ServerException;
import java.util.List;
import org.gcube.common.resources.gcore.ServiceEndpoint;
import org.gcube.common.security.secrets.Secret;
import org.gcube.idm.common.is.InfrastrctureServiceClient;
import org.gcube.idm.common.is.IsServerConfig;
import org.gcube.resources.discovery.client.api.DiscoveryClient;
import org.gcube.resources.discovery.client.queries.api.SimpleQuery;
import org.gcube.social_networking.utils.InfrastructureUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import jakarta.ws.rs.NotFoundException;
/**
* This is a singleton bean instantiated at service start up. It contains
* the credentials of the user who is allowed to perform calls to Liferay.
* Its credentials are looked up from the infrastructure.
*
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
*/
public class LiferayJSONWsCredentials {
private static final Logger logger = LoggerFactory.getLogger(LiferayJSONWsCredentials.class);
// the singleton obj
private static LiferayJSONWsCredentials singleton = new LiferayJSONWsCredentials();
// properties that it contains
private String host;
private String schema;
private String user;
private String password;
private int port;
// The token of the user used to send notifications/messages when an application
// token is provided. (will be read from web.xml)
private String notifierUserToken;
// Service endpoint properties
private final static String RUNTIME_RESOURCE_NAME = "D4Science Infrastructure Gateway";
private final static String CATEGORY = "Portal";
private final static String END_POINT_NAME = "JSONWSUser";
private final static boolean IS_ROOT_SERVICE = true;
/**
* Private constructor
*/
private LiferayJSONWsCredentials() {
logger.debug("Building LiferayJSONWsCredentials object");
loadNotifierToken();
lookupPropertiesFromIs();
logger.debug("LiferayJSONWsCredentials object built");
}
/**
* Load the token of the notifier user
*/
private void loadNotifierToken() {
try {
notifierUserToken = ServletContextClass.getNotifierToken();
logger.debug("Token read " + notifierUserToken.substring(0, 5) + "*********************");
} catch (Exception e) {
logger.error("Failed to read notifier user token!", e);
}
}
/**
* Read the properties from the infrastructure
*/
private void lookupPropertiesFromIs() {
Secret secret = InfrastructureUtils.getSecretForInfrastructure();
IsServerConfig cfg;
try {
cfg = InfrastrctureServiceClient.serviceConfigFromIS(RUNTIME_RESOURCE_NAME, CATEGORY,
END_POINT_NAME, IS_ROOT_SERVICE, secret);
} catch (NotFoundException | ServerException e) {
logger.error("Unable to retrieve such service endpoint information!", e);
e.printStackTrace();
return;
}
host = cfg.getServerUrl();
schema = cfg.getProperty("schema");
user = cfg.getProperty("username");
password = cfg.getProperty("password");
// TODO: check if needs to be decrypted
// password = StringEncrypter.getEncrypter().decrypt(passsword);
port = Integer.valueOf(cfg.getProperty("port"));
logger.debug("Bean built " + toString());
}
/**
* Retrieve endpoints information from IS for DB
*
* @return list of endpoints for ckan database
* @throws Exception
*/
private List<ServiceEndpoint> getConfigurationFromIS() throws Exception {
SimpleQuery query = queryFor(ServiceEndpoint.class);
query.addCondition("$resource/Profile/Name/text() eq '" + RUNTIME_RESOURCE_NAME + "'");
query.addCondition("$resource/Profile/Category/text() eq '" + CATEGORY + "'");
DiscoveryClient<ServiceEndpoint> client = clientFor(ServiceEndpoint.class);
List<ServiceEndpoint> toReturn = client.submit(query);
return toReturn;
}
public static LiferayJSONWsCredentials getSingleton() {
return singleton;
}
public String getHost() {
return host;
}
public String getSchema() {
return schema;
}
public String getUser() {
return user;
}
public String getPassword() {
return password;
}
public int getPort() {
return port;
}
public String getNotifierUserToken() {
return notifierUserToken;
}
@Override
public String toString() {
return "LiferayJSONWsCredentials [host=" + host + ", schema=" + schema
+ ", user=" + user + ", password=" + password + ", port="
+ port + ", notifierUserToken=" + notifierUserToken + "]";
}
}

View File

@ -1,50 +0,0 @@
package org.gcube.social_networking.liferay.ws;
import org.gcube.vomanagement.usermanagement.RoleManager;
import org.gcube.vomanagement.usermanagement.impl.ws.LiferayWSRoleManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Class that builds a (singleton) UserManagerWS object.
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
*/
public class RoleManagerWSBuilder {
private static final Logger logger = LoggerFactory.getLogger(UserManagerWSBuilder.class);
private static RoleManagerWSBuilder singleton = new RoleManagerWSBuilder();
private RoleManager roleManagerWs;
private RoleManagerWSBuilder(){
logger.debug("Building UserManager please wait");
try{
roleManagerWs = new LiferayWSRoleManager(
LiferayJSONWsCredentials.getSingleton().getUser(),
LiferayJSONWsCredentials.getSingleton().getPassword(),
LiferayJSONWsCredentials.getSingleton().getHost(),
LiferayJSONWsCredentials.getSingleton().getSchema(),
LiferayJSONWsCredentials.getSingleton().getPort());
}catch(Exception e){
logger.error("Failed to build the UserManager. ", e);
return;
}
logger.debug("UserManager instance built");
}
/**
* Get the role manager instance
* @return
*/
public RoleManager getRoleManager(){
return roleManagerWs;
}
public static RoleManagerWSBuilder getInstance(){
return singleton;
}
}

View File

@ -1,37 +0,0 @@
package org.gcube.social_networking.liferay.ws;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
/**
* Loaded at start up. This class performs some init - to be done once - operations.
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
*/
public class ServletContextClass implements ServletContextListener
{
private static String notifierToken;
public void contextInitialized(ServletContextEvent arg0) {
// get the token and save it
notifierToken = arg0.getServletContext().getInitParameter("NOTIFIER_TOKEN");
// start the thread to retrieve infrastructure users (which is, build up the singleton)
//UsersCache.getSingleton();
}
@Override
public void contextDestroyed(ServletContextEvent arg0){
// on shutdown
}
/**
* Returns the token of the Liferay's User.
* @return
*/
public static String getNotifierToken() {
return notifierToken;
}
}

View File

@ -1,50 +0,0 @@
package org.gcube.social_networking.liferay.ws;
import org.gcube.vomanagement.usermanagement.UserManager;
import org.gcube.vomanagement.usermanagement.impl.ws.LiferayWSUserManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Class that builds a (singleton) UserManagerWS object.
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
*/
public class UserManagerWSBuilder {
private static final Logger logger = LoggerFactory.getLogger(UserManagerWSBuilder.class);
private static UserManagerWSBuilder singleton = new UserManagerWSBuilder();
private UserManager userManagerWs;
private UserManagerWSBuilder(){
logger.debug("Building UserManager please wait");
try{
userManagerWs = new LiferayWSUserManager(
LiferayJSONWsCredentials.getSingleton().getUser(),
LiferayJSONWsCredentials.getSingleton().getPassword(),
LiferayJSONWsCredentials.getSingleton().getHost(),
LiferayJSONWsCredentials.getSingleton().getSchema(),
LiferayJSONWsCredentials.getSingleton().getPort());
}catch(Exception e){
logger.error("Failed to build the UserManager. ", e);
return;
}
logger.debug("UserManager instance built");
}
/**
* Get the user manager instance
* @return
*/
public UserManager getUserManager(){
return userManagerWs;
}
public static UserManagerWSBuilder getInstance(){
return singleton;
}
}

View File

@ -1,56 +0,0 @@
package org.gcube.social_networking.mappers;
import org.gcube.social_networking.utils.ResponseBean;
import jakarta.ws.rs.ForbiddenException;
import jakarta.ws.rs.WebApplicationException;
import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.core.Response;
import jakarta.ws.rs.core.Response.Status;
import jakarta.ws.rs.ext.ExceptionMapper;
import jakarta.ws.rs.ext.Provider;
/**
* @author Alfredo Oliviero (ISTI - CNR)
*/
@Provider
public class ForbiddenExceptionMapper implements ExceptionMapper<ForbiddenException> {
@Override
public Response toResponse(ForbiddenException exception) {
Status status = Status.INTERNAL_SERVER_ERROR;
String exceptionMessage = exception.getMessage();
ResponseBean responseBean = null;
try {
if (exception.getCause() != null) {
exceptionMessage = exception.getCause().getMessage();
}
} catch (Exception e) {
exceptionMessage = exception.getMessage();
}
MediaType mediaType = MediaType.TEXT_PLAIN_TYPE;
if (WebApplicationException.class.isAssignableFrom(exception.getClass())) {
Response gotResponse = ((WebApplicationException) exception).getResponse();
Object entity = gotResponse.getEntity();
if (entity != null && ResponseBean.class.isAssignableFrom(entity.getClass())) {
responseBean = (ResponseBean) entity;
}
status = Status.fromStatusCode(gotResponse.getStatusInfo().getStatusCode());
}
if (responseBean == null) {
responseBean = new ResponseBean();
}
responseBean.setSuccess(false);
responseBean.setMessage(exceptionMessage);
// responseBean.set
return Response.status(status).entity(responseBean).type(mediaType).build();
}
}

View File

@ -1,55 +0,0 @@
package org.gcube.social_networking.mappers;
import org.gcube.social_networking.utils.ResponseBean;
import jakarta.ws.rs.WebApplicationException;
import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.core.Response;
import jakarta.ws.rs.core.Response.Status;
import jakarta.ws.rs.ext.ExceptionMapper;
import jakarta.ws.rs.ext.Provider;
/**
* @author Luca Frosini (ISTI - CNR)
*/
@Provider
public class IDMExceptionMapper implements ExceptionMapper<Exception> {
@Override
public Response toResponse(Exception exception) {
Status status = Status.INTERNAL_SERVER_ERROR;
String exceptionMessage = exception.getMessage();
ResponseBean responseBean = null;
try {
if (exception.getCause() != null) {
exceptionMessage = exception.getCause().getMessage();
}
} catch (Exception e) {
exceptionMessage = exception.getMessage();
}
MediaType mediaType = MediaType.TEXT_PLAIN_TYPE;
if (WebApplicationException.class.isAssignableFrom(exception.getClass())) {
Response gotResponse = ((WebApplicationException) exception).getResponse();
Object entity = gotResponse.getEntity();
if (entity != null && ResponseBean.class.isAssignableFrom(entity.getClass())) {
responseBean = (ResponseBean) entity;
}
status = Status.fromStatusCode(gotResponse.getStatusInfo().getStatusCode());
}
if (responseBean == null) {
responseBean = new ResponseBean();
}
responseBean.setSuccess(false);
responseBean.setMessage(exceptionMessage);
// responseBean.set
return Response.status(status).entity(responseBean).type(mediaType).build();
}
}

View File

@ -0,0 +1,26 @@
package org.gcube.social_networking.rest;
import com.webcohesion.enunciate.metadata.rs.RequestHeader;
import com.webcohesion.enunciate.metadata.rs.RequestHeaders;
import com.webcohesion.enunciate.metadata.rs.ResourceGroup;
import com.webcohesion.enunciate.metadata.rs.ResourceLabel;
import org.gcube.social_networking.socialnetworking.model.shared.Attachment;
import org.gcube.social_networking.socialnetworking.model.shared.Like;
import javax.ws.rs.*;
@Path("attachments")
@ResourceGroup("Attachments APIs")
@ResourceLabel("Attachments APIs")
@RequestHeaders({
@RequestHeader( name = "Authorization", description = "Bearer token, see <a href=\"https://dev.d4science.org/how-to-access-resources\">https://dev.d4science.org/how-to-access-resources</a>")
})
public class Attachments {
@POST
@Path("/")
@Produces({"application/json;charset=UTF-8", "application/vnd.api+json"})
@Consumes({"application/json;charset=UTF-8", "application/vnd.api+json"})
public void saveAttachmentEntry(Attachment toSave) {
}
}

View File

@ -0,0 +1,66 @@
package org.gcube.social_networking.rest;
import com.webcohesion.enunciate.metadata.rs.RequestHeader;
import com.webcohesion.enunciate.metadata.rs.RequestHeaders;
import com.webcohesion.enunciate.metadata.rs.ResourceGroup;
import com.webcohesion.enunciate.metadata.rs.ResourceLabel;
import org.gcube.social_networking.socialnetworking.model.shared.Comment;
import javax.ws.rs.*;
import java.util.List;
@Path("comments")
@ResourceGroup("Comments APIs")
@ResourceLabel("Comments APIs")
@RequestHeaders({
@RequestHeader( name = "Authorization", description = "Bearer token, see <a href=\"https://dev.d4science.org/how-to-access-resources\">https://dev.d4science.org/how-to-access-resources</a>")
})
public class Comments {
@POST
@Path("/")
@Produces({"application/json;charset=UTF-8", "application/vnd.api+json"})
@Consumes({"application/json;charset=UTF-8", "application/vnd.api+json"})
public void addComment(Comment comment) {
}
@GET
@Path("/{id}")
@Produces({"application/json;charset=UTF-8", "application/vnd.api+json"})
public void readComment(@PathParam("id") String id) {
}
@PUT
@Path("/{id}")
@Consumes({"application/json;charset=UTF-8", "application/vnd.api+json"})
@Produces({"application/json;charset=UTF-8", "application/vnd.api+json"})
public void editComment(@PathParam("id") String id, Comment comment) {
}
@DELETE
@Path("/{id}")
@Produces({"application/json;charset=UTF-8", "application/vnd.api+json"})
public void deleteComment(@PathParam("id") String id) {
}
//the following two methods had vreid why?
@POST
@Path("/{id}/hashtags")
@Produces({"application/json;charset=UTF-8", "application/vnd.api+json"})
@Consumes({"application/json;charset=UTF-8", "application/vnd.api+json"})
public void saveHashTagsComment(@PathParam("id") String commentId, List<String> hashtags) {
}
@DELETE
@Path("/{id}/hashtags")
@Produces({"application/json;charset=UTF-8", "application/vnd.api+json"})
@Consumes({"application/json;charset=UTF-8", "application/vnd.api+json"})
public void deleteHashTagsComment(@PathParam("id") String commentId, List<String> hashtags) {
}
}

View File

@ -1,26 +1,94 @@
package org.gcube.social_networking.rest;
import org.gcube.smartgears.annotations.ManagedBy;
import org.gcube.social_networking.SocialServiceApplicationManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.DefaultValue;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Response;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.core.MediaType;
import com.webcohesion.enunciate.metadata.rs.RequestHeader;
import com.webcohesion.enunciate.metadata.rs.RequestHeaders;
import com.webcohesion.enunciate.metadata.rs.ResourceGroup;
import com.webcohesion.enunciate.metadata.rs.ResourceLabel;
import com.webcohesion.enunciate.metadata.rs.ResponseCode;
import com.webcohesion.enunciate.metadata.rs.StatusCodes;
import org.gcube.social_networking.server.CassandraConnection;
import org.gcube.social_networking.socialnetworking.model.shared.Comment;
import org.gcube.social_networking.socialnetworking.model.shared.exceptions.CommentIDNotFoundException;
@Path("test")
@ManagedBy(SocialServiceApplicationManager.class)
@Path("comments")
@ResourceGroup("Comments APIs")
@ResourceLabel("Comments APIs")
@RequestHeaders ({
@RequestHeader( name = "Authorization", description = "Bearer token, see <a href=\"https://dev.d4science.org/how-to-access-resources\">https://dev.d4science.org/how-to-access-resources</a>")
})
public class HelloWorld {
private static Logger logger = LoggerFactory.getLogger(HelloWorld.class);
@GET
@Path("/")
@Produces(MediaType.APPLICATION_JSON)
public String test(){
logger.info("/social-service/test/ here");
return "{\"result\":\"funziona!!!\"}";
@POST
@Produces({"application/json;charset=UTF-8", "application/vnd.api+json"})
@Consumes({"application/json;charset=UTF-8", "application/vnd.api+json"})
public void addComment(Comment comment) {
}
@GET
@Path("/{id}")
@Produces({"application/json;charset=UTF-8", "application/vnd.api+json"})
public void readComment(@PathParam("id") String id) {
}
@PUT
@Path("/{id}")
@Consumes({"application/json;charset=UTF-8", "application/vnd.api+json"})
@Produces({"application/json;charset=UTF-8", "application/vnd.api+json"})
public void editComment(@PathParam("id") String id, Comment comment) {
}
@DELETE
@Path("/{id}")
@Produces({"application/json;charset=UTF-8", "application/vnd.api+json"})
public void deleteComment(@PathParam("id") String id) {
}
@POST
@Produces("application/json;charset=UTF-8")
@Consumes("application/json;charset=UTF-8")
public String create(String json) {
//Greeting g = new Greeting();
//return g.create(json);
return "{\"text\":\"hi\"}";
}
@PUT
@Path("/{greeting_name}")
@Consumes("application/json;charset=UTF-8")
@Produces("application/json;charset=UTF-8")
@StatusCodes ({
@ResponseCode ( code = 200, condition = "The greeting has been updated successfully.")
})
// @AuthorizationControl(allowedRoles={"boss"}, exception=NotAuthorizedException.class)
public String update(@PathParam("greeting_name") String name, String json) {
return "{}";
}
@DELETE
@Path("/{greeting_name}")
@StatusCodes ({
@ResponseCode ( code = 204, condition = "The item has been deleted successfully."),
@ResponseCode ( code = 404, condition = "The item was not found.")
})
public String delete(@PathParam("greeting_name") String name) {
return "{}";
}
}

View File

@ -1,11 +1,11 @@
package org.gcube.social_networking.rest;
import jakarta.ws.rs.WebApplicationException;
import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.core.Response;
import jakarta.ws.rs.core.Response.Status;
import jakarta.ws.rs.ext.ExceptionMapper;
import jakarta.ws.rs.ext.Provider;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
import javax.ws.rs.ext.ExceptionMapper;
import javax.ws.rs.ext.Provider;
/**
* @author Luca Frosini (ISTI - CNR)

View File

@ -1,168 +0,0 @@
package org.gcube.social_networking.rest;
import java.rmi.ServerException;
import java.util.HashMap;
import java.util.List;
import org.gcube.com.fasterxml.jackson.core.JsonProcessingException;
import org.gcube.com.fasterxml.jackson.databind.ObjectMapper;
import org.gcube.idm.client.IdmClientFactory;
import org.gcube.idm.client.IdmMeClient;
import org.gcube.idm.client.IdmUsersClient;
import org.gcube.idm.client.SearchUsersParams;
import org.gcube.idm.client.model.UserInfo;
import org.gcube.idm.common.models.IdmFullUser;
import org.gcube.idm.common.models.IdmUser;
import org.gcube.social_networking.utils.InfrastructureUtils;
import com.webcohesion.enunciate.metadata.rs.RequestHeader;
import com.webcohesion.enunciate.metadata.rs.RequestHeaders;
import jakarta.ws.rs.DefaultValue;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.PathParam;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.QueryParam;
import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.core.Response;
@Path("/idm")
@RequestHeaders({
@RequestHeader(name = "Authorization", description = "Bearer token, see <a href=\"https://dev.d4science.org/how-to-access-resources\">https://dev.d4science.org/how-to-access-resources</a>")
})
public class IdmRest {
@GET
@Path("/me")
@Produces({ MediaType.APPLICATION_JSON })
public Response test() throws ServerException {
IdmClientFactory factory = IdmClientFactory.getSingleton();
String token = InfrastructureUtils.getAccessToken();
IdmMeClient client = factory.meClient(token);
UserInfo user = client.getMe();
HashMap<String, Object> resp = new HashMap<String, Object>();
resp.put("result", user);
try {
String jsonData = new ObjectMapper().writeValueAsString(resp);
return Response.ok(jsonData).build();
} catch (JsonProcessingException e) {
e.printStackTrace();
return Response.serverError().build();
}
}
@GET
@Path("/{username}/")
@Produces({ MediaType.APPLICATION_JSON })
public Response getUser(
@PathParam("username") String username) throws ServerException {
IdmClientFactory factory = IdmClientFactory.getSingleton();
String token = InfrastructureUtils.getAccessToken();
IdmUsersClient client = factory.userClient(token);
UserInfo user = client.getUser(username);
HashMap<String, Object> resp = new HashMap<String, Object>();
resp.put("result", user);
try {
String jsonData = new ObjectMapper().writeValueAsString(resp);
return Response.ok(jsonData).build();
} catch (JsonProcessingException e) {
e.printStackTrace();
return Response.serverError().build();
}
}
@GET
@Path("/{search}/")
@Produces({ MediaType.APPLICATION_JSON })
public Response searchUsers(
@QueryParam("format") @DefaultValue("username") IdmUser.USERS_REPR format,
@QueryParam("exact") @DefaultValue("true") Boolean exact,
@QueryParam("username") String username,
@QueryParam("firstName") String firstName,
@QueryParam("lastName") String lastName,
@QueryParam("email") String email,
@QueryParam("first") @DefaultValue("0") int firstResult,
@QueryParam("max") @DefaultValue("100") int maxResults,
@QueryParam("enabled") @DefaultValue("true") Boolean enabled
) throws ServerException {
IdmClientFactory factory = IdmClientFactory.getSingleton();
String token = InfrastructureUtils.getAccessToken();
IdmUsersClient client = factory.userClient(token);
SearchUsersParams params = new SearchUsersParams();
if (exact != null)
params.exact = exact;
if (username != null)
params.username = username;
if (firstName != null)
params.firstName = firstName;
if (lastName != null)
params.lastName = lastName;
if (email != null)
params.email = email;
if (enabled != null)
params.enabled = enabled;
Object resp = null;
if (format.equals(IdmUser.USERS_REPR.compact)) {
List<IdmUser> users = client.searchUsers(firstResult, maxResults, params);
resp = users;
}
if (format.equals(IdmUser.USERS_REPR.full)) {
List<IdmFullUser> users = client.searchFullUsers(firstResult, maxResults, params);
resp = users;
}
if (format.equals(IdmUser.USERS_REPR.username)) {
List<String> users = client.searchUsernames(firstResult, maxResults, params);
resp = users;
}
if (format.equals(IdmUser.USERS_REPR.email)) {
List<String> users = client.searchEmails(firstResult, maxResults, params);
resp = users;
}
try
{
String jsonData = new ObjectMapper().writeValueAsString(resp);
return Response.ok(jsonData).build();
} catch (JsonProcessingException e) {
e.printStackTrace();
return Response.serverError().build();
}
}
}

View File

@ -0,0 +1,35 @@
package org.gcube.social_networking.rest;
import com.webcohesion.enunciate.metadata.rs.RequestHeader;
import com.webcohesion.enunciate.metadata.rs.RequestHeaders;
import com.webcohesion.enunciate.metadata.rs.ResourceGroup;
import com.webcohesion.enunciate.metadata.rs.ResourceLabel;
import org.gcube.social_networking.socialnetworking.model.shared.Invite;
import org.gcube.social_networking.socialnetworking.model.shared.Notification;
import javax.ws.rs.*;
@Path("invites")
@ResourceGroup("Invites APIs")
@ResourceLabel("Invites APIs")
@RequestHeaders({
@RequestHeader( name = "Authorization", description = "Bearer token, see <a href=\"https://dev.d4science.org/how-to-access-resources\">https://dev.d4science.org/how-to-access-resources</a>")
})
public class Invites {
@POST
@Path("/")
@Produces({"application/json;charset=UTF-8", "application/vnd.api+json"})
@Consumes({"application/json;charset=UTF-8", "application/vnd.api+json"})
public void saveInvite(Invite invite) {
}
@GET
@Path("/{id}")
@Produces({"application/json;charset=UTF-8", "application/vnd.api+json"})
public void readInvite(@PathParam("id") String inviteid) {
}
}

View File

@ -0,0 +1,35 @@
package org.gcube.social_networking.rest;
import com.webcohesion.enunciate.metadata.rs.RequestHeader;
import com.webcohesion.enunciate.metadata.rs.RequestHeaders;
import com.webcohesion.enunciate.metadata.rs.ResourceGroup;
import com.webcohesion.enunciate.metadata.rs.ResourceLabel;
import org.gcube.social_networking.socialnetworking.model.shared.Like;
import org.gcube.social_networking.socialnetworking.model.shared.Notification;
import javax.ws.rs.*;
@Path("likes")
@ResourceGroup("Likes APIs")
@ResourceLabel("Likes APIs")
@RequestHeaders({
@RequestHeader( name = "Authorization", description = "Bearer token, see <a href=\"https://dev.d4science.org/how-to-access-resources\">https://dev.d4science.org/how-to-access-resources</a>")
})
public class Likes {
@POST
@Path("/")
@Produces({"application/json;charset=UTF-8", "application/vnd.api+json"})
@Consumes({"application/json;charset=UTF-8", "application/vnd.api+json"})
public void like(Like like) {
}
//had other params why?
@DELETE
@Path("/{id}")
@Produces({"application/json;charset=UTF-8", "application/vnd.api+json"})
public void unlike(@PathParam("id") String likeid) {
}
}

View File

@ -0,0 +1,40 @@
package org.gcube.social_networking.rest;
import com.webcohesion.enunciate.metadata.rs.RequestHeader;
import com.webcohesion.enunciate.metadata.rs.RequestHeaders;
import com.webcohesion.enunciate.metadata.rs.ResourceGroup;
import com.webcohesion.enunciate.metadata.rs.ResourceLabel;
import org.gcube.social_networking.socialnetworking.model.shared.Notification;
import org.gcube.social_networking.socialnetworking.model.shared.Post;
import javax.ws.rs.*;
@Path("notifications")
@ResourceGroup("Notifications APIs")
@ResourceLabel("Notifications APIs")
@RequestHeaders({
@RequestHeader( name = "Authorization", description = "Bearer token, see <a href=\"https://dev.d4science.org/how-to-access-resources\">https://dev.d4science.org/how-to-access-resources</a>")
})
public class Notifications {
@POST
@Path("/")
@Produces({"application/json;charset=UTF-8", "application/vnd.api+json"})
@Consumes({"application/json;charset=UTF-8", "application/vnd.api+json"})
public void saveNotification(Notification notification) {
}
@PUT
@Path("/{id}")
@Produces({"application/json;charset=UTF-8", "application/vnd.api+json"})
public void setNotificationRead(@PathParam("id") String notid) {
}
@GET
@Path("/{id}")
@Produces({"application/json;charset=UTF-8", "application/vnd.api+json"})
public void readNotification(@PathParam("id") String notid) {
}
}

View File

@ -0,0 +1,113 @@
package org.gcube.social_networking.rest;
import com.webcohesion.enunciate.metadata.rs.RequestHeader;
import com.webcohesion.enunciate.metadata.rs.RequestHeaders;
import com.webcohesion.enunciate.metadata.rs.ResourceGroup;
import com.webcohesion.enunciate.metadata.rs.ResourceLabel;
import org.gcube.social_networking.socialnetworking.model.shared.Attachment;
import org.gcube.social_networking.socialnetworking.model.shared.Comment;
import org.gcube.social_networking.socialnetworking.model.shared.Post;
import javax.ws.rs.*;
import java.util.List;
@Path("posts")
@ResourceGroup("Posts APIs")
@ResourceLabel("Posts APIs")
@RequestHeaders({
@RequestHeader( name = "Authorization", description = "Bearer token, see <a href=\"https://dev.d4science.org/how-to-access-resources\">https://dev.d4science.org/how-to-access-resources</a>")
})
public class Posts {
@POST
@Path("/postuser")
@Produces({"application/json;charset=UTF-8", "application/vnd.api+json"})
@Consumes({"application/json;charset=UTF-8", "application/vnd.api+json"})
public void saveUserPost(Post post) {
}
@POST
@Path("/postuser")
@Produces({"application/json;charset=UTF-8", "application/vnd.api+json"})
@Consumes({"application/json;charset=UTF-8", "application/vnd.api+json"})
public void saveUserPost(Post post, List<Attachment> attachments){
}
@PUT
@Path("/{id}")
@Produces({"application/json;charset=UTF-8", "application/vnd.api+json"})
public void deletePost(@PathParam("id") String postid) {
}
@POST
@Path("/postapp")
@Produces({"application/json;charset=UTF-8", "application/vnd.api+json"})
@Consumes({"application/json;charset=UTF-8", "application/vnd.api+json"})
public void saveAppPost(Post post) {
}
@POST
@Path("/postapp/")
@Produces({"application/json;charset=UTF-8", "application/vnd.api+json"})
@Consumes({"application/json;charset=UTF-8", "application/vnd.api+json"})
public void saveAppPost(Post post, List<Attachment> attachments){
}
@GET
@Path("/{id}/")
@Produces({"application/json;charset=UTF-8", "application/vnd.api+json"})
public void readPost(@PathParam("id") String postid){
}
@GET
@Path("/portalprivacy")
@Produces({"application/json;charset=UTF-8", "application/vnd.api+json"})
public void getAllPortalPrivacyLevelPosts(){
}
@GET
@Path("/{id}/comments")
@Produces({"application/json;charset=UTF-8", "application/vnd.api+json"})
public void getAllCommentByPost(@PathParam("id") String postid){
}
@GET
@Path("/{id}/likes")
@Produces({"application/json;charset=UTF-8", "application/vnd.api+json"})
public void getAllLikesByPost(@PathParam("id") String postid){
}
//the following two methods had vreid why?
@POST
@Path("/{id}/hashtags")
@Produces({"application/json;charset=UTF-8", "application/vnd.api+json"})
@Consumes({"application/json;charset=UTF-8", "application/vnd.api+json"})
public void saveHashTags(@PathParam("id") String postid, List<String> hashtags) {
}
@DELETE
@Path("/{id}/hashtags")
@Produces({"application/json;charset=UTF-8", "application/vnd.api+json"})
@Consumes({"application/json;charset=UTF-8", "application/vnd.api+json"})
public void deleteHashTagsComment(@PathParam("id") String postid, List<String> hashtags) {
}
@GET
@Path("/{id}/attachments")
@Produces({"application/json;charset=UTF-8", "application/vnd.api+json"})
public void getAttachmentsByPostId(@PathParam("id") String postid) {
}
}

View File

@ -1,45 +0,0 @@
package org.gcube.social_networking.rest;
import java.util.HashMap;
import org.gcube.com.fasterxml.jackson.core.JsonProcessingException;
import org.gcube.com.fasterxml.jackson.databind.ObjectMapper;
import com.webcohesion.enunciate.metadata.rs.RequestHeader;
import com.webcohesion.enunciate.metadata.rs.RequestHeaders;
import com.webcohesion.enunciate.metadata.rs.ResourceGroup;
import com.webcohesion.enunciate.metadata.rs.ResourceLabel;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.core.Response;
@Path("/test")
@ResourceGroup("Comments APIs")
@ResourceLabel("Comments APIs")
@RequestHeaders({
@RequestHeader(name = "Authorization", description = "Bearer token, see <a href=\"https://dev.d4science.org/how-to-access-resources\">https://dev.d4science.org/how-to-access-resources</a>")
})
public class TestRest {
@GET
@Path("/test")
@Produces({ MediaType.APPLICATION_JSON })
public Response test() {
HashMap<String, Object> resp = new HashMap<String, Object>();
resp.put("result", "funziona");
try {
String jsonData = new ObjectMapper().writeValueAsString(resp);
return Response.ok(jsonData).build();
} catch (JsonProcessingException e) {
e.printStackTrace();
return Response.serverError().build();
}
}
}

View File

@ -0,0 +1,149 @@
package org.gcube.social_networking.rest;
import com.webcohesion.enunciate.metadata.rs.RequestHeader;
import com.webcohesion.enunciate.metadata.rs.RequestHeaders;
import com.webcohesion.enunciate.metadata.rs.ResourceGroup;
import com.webcohesion.enunciate.metadata.rs.ResourceLabel;
import org.gcube.social_networking.socialnetworking.model.shared.InviteStatus;
import org.gcube.social_networking.socialnetworking.model.shared.NotificationChannelType;
import org.gcube.social_networking.socialnetworking.model.shared.NotificationType;
import org.gcube.social_networking.socialnetworking.model.shared.Post;
import javax.ws.rs.*;
import java.util.Map;
@Path("entities")
@ResourceGroup("Users & Apps APIs")
@ResourceLabel("Users & Apps APIs")
@RequestHeaders({
@RequestHeader( name = "Authorization", description = "Bearer token, see <a href=\"https://dev.d4science.org/how-to-access-resources\">https://dev.d4science.org/how-to-access-resources</a>")
})
public class Users {
@GET
@Path("users/{id}/posts")
@Produces({"application/json;charset=UTF-8", "application/vnd.api+json"})
public void getAllPostsByUser(@PathParam("id") String userid) {
}
@GET
@Path("apps/{id}/posts")
@Produces({"application/json;charset=UTF-8", "application/vnd.api+json"})
public void getAllPostsByApp(@PathParam("id") String appid) {
}
@GET
@Path("users/{id}/posts/comments")
@Produces({"application/json;charset=UTF-8", "application/vnd.api+json"})
public void getRecentCommentedPostsByUserAndDate(@PathParam("id") String userid, @QueryParam("time") long timeInMillis) {
}
@GET
@Path("users/{id}/posts")
@Produces({"application/json;charset=UTF-8", "application/vnd.api+json"})
public void getRecentPostsByUser(@PathParam("id") String userid, @QueryParam("limit") int limit) {
}
@GET
@Path("users/{id}/posts")
@Produces({"application/json;charset=UTF-8", "application/vnd.api+json"})
public void getRecentPostsByUser(@PathParam("id") String userid, @QueryParam("time") long timeInMillis) {
}
@PUT
@Path("users/{id}/notifications")
@Produces({"application/json;charset=UTF-8", "application/vnd.api+json"})
public void setAllNotificationReadByUser(@PathParam("id") String userid) {
}
@GET
@Path("users/{id}/notifications")
@Produces({"application/json;charset=UTF-8", "application/vnd.api+json"})
public void getUnreadNotificationsByUser(@PathParam("id") String userid) {
}
@GET
@Path("users/{id}/notificationchannels")
@Produces({"application/json;charset=UTF-8", "application/vnd.api+json"})
public void getUserNotificationChannels(@PathParam("id") String userid, @QueryParam("type") NotificationType notificationType) {
}
@PUT
@Path("users/{id}/notificationpreferences")
@Produces({"application/json;charset=UTF-8", "application/vnd.api+json"})
@Consumes({"application/json;charset=UTF-8", "application/vnd.api+json"})
public void setUserNotificationPreferences(@PathParam("id") String userid, Map<NotificationType, NotificationChannelType[]> enabledChannels) {
}
@GET
@Path("users/{id}/notificationpreferences")
@Produces({"application/json;charset=UTF-8", "application/vnd.api+json"})
public void getUserNotificationPreferences(@PathParam("id") String userid) {
}
@GET
@Path("users/{id}/comments")
@Produces({"application/json;charset=UTF-8", "application/vnd.api+json"})
public void getRecentCommentsByUserAndDate(@PathParam("id") String userid, @QueryParam("time") long timeInMillis) {
}
@GET
@Path("users/{id}/likes")
@Produces({"application/json;charset=UTF-8", "application/vnd.api+json"})
public void getAllLikedPostIdsByUser(@PathParam("id") String userid) {
}
@GET
@Path("users/{id}/likes")
@Produces({"application/json;charset=UTF-8", "application/vnd.api+json"})
public void getAllLikedPostsByUser(@PathParam("id") String userid, @QueryParam("limit") int limit) {
}
@GET
@Path("users/{id}/posts/likes")
@Produces({"application/json;charset=UTF-8", "application/vnd.api+json"})
public void getRecentLikedPostsByUserAndDate(@PathParam("id") String userid, @QueryParam("time") long timeInMillis) {
}
@GET
@Path("users/{id}/notifications")
@Produces({"application/json;charset=UTF-8", "application/vnd.api+json"})
public void getAllNotificationByUser(@PathParam("id") String userid, @QueryParam("limit") int limit) {
}
@GET
@Path("users/{id}/notifications")
@Produces({"application/json;charset=UTF-8", "application/vnd.api+json"})
public void getRangeNotificationsByUser(@PathParam("id") String userid, @QueryParam("limit") int limit, @QueryParam("from") int from) {
}
@GET
@Path("users/{id}/notifications/unread")
@Produces({"application/json;charset=UTF-8", "application/vnd.api+json"})
public void checkUnreadNotifications(@PathParam("id") String userid) {
}
@GET
@Path("users/{id}/notifications/unread/messages")
@Produces({"application/json;charset=UTF-8", "application/vnd.api+json"})
public void checkUnreadMessagesNotifications(@PathParam("id") String userid) {
}
}

View File

@ -0,0 +1,98 @@
package org.gcube.social_networking.rest;
import com.webcohesion.enunciate.metadata.rs.RequestHeader;
import com.webcohesion.enunciate.metadata.rs.RequestHeaders;
import com.webcohesion.enunciate.metadata.rs.ResourceGroup;
import com.webcohesion.enunciate.metadata.rs.ResourceLabel;
import org.gcube.social_networking.socialnetworking.model.shared.InviteStatus;
import org.gcube.social_networking.socialnetworking.model.shared.Post;
import javax.ws.rs.*;
@Path("vres")
@ResourceGroup("VREs APIs")
@ResourceLabel("VREs APIs")
@RequestHeaders({
@RequestHeader( name = "Authorization", description = "Bearer token, see <a href=\"https://dev.d4science.org/how-to-access-resources\">https://dev.d4science.org/how-to-access-resources</a>")
})
public class Vres {
@POST
@Path("/{id}/posts")
@Produces({"application/json;charset=UTF-8", "application/vnd.api+json"})
@Consumes({"application/json;charset=UTF-8", "application/vnd.api+json"})
public void savePostToVRETimeline(@PathParam("id") String vreid, Post post) {
}
@GET
@Path("/{id}/posts")
@Produces({"application/json;charset=UTF-8", "application/vnd.api+json"})
public void getAllPostsByVRE(@PathParam("id") String vreid) {
}
@GET
@Path("/{id}/posts")
@Produces({"application/json;charset=UTF-8", "application/vnd.api+json"})
public void getRecentPostsByVRE(@PathParam("id") String vreid, @QueryParam("limit") int limit) {
}
@GET
@Path("/{id}/posts")
@Produces({"application/json;charset=UTF-8", "application/vnd.api+json"})
public void getRecentPostsByVREAndRange(@PathParam("id") String vreid, @QueryParam("limit") int limit, @QueryParam("from") int from) {
}
@GET
@Path("/{id}/hashtags")
@Produces({"application/json;charset=UTF-8", "application/vnd.api+json"})
public void getVREHashtagsWithOccurrence(@PathParam("id") String vreid) {
}
@GET
@Path("/{id}/hashtags")
@Produces({"application/json;charset=UTF-8", "application/vnd.api+json"})
public void getVREHashtagsWithOccurrenceFilteredByTime(@PathParam("id") String vreid, @QueryParam("time") long timestamp) {
}
@GET
@Path("/{id}/hashtags/{hashtag}/posts")
@Produces({"application/json;charset=UTF-8", "application/vnd.api+json"})
public void getVREPostsByHashtag(@PathParam("id") String vreid, @PathParam("hashtag") String hashtag) {
}
@GET
@Path("/{id}/email/{email}")
@Produces({"application/json;charset=UTF-8", "application/vnd.api+json"})
public void isExistingInvite(@PathParam("id") String vreid, @PathParam("email") String email) {
}
@PUT
@Path("/{id}/email/{email}")
@Produces({"application/json;charset=UTF-8", "application/vnd.api+json"})
@Consumes({"application/json;charset=UTF-8", "application/vnd.api+json"})
public void setInviteStatus(@PathParam("id") String vreid, @PathParam("email") String email, InviteStatus status) {
}
@GET
@Path("/{id}")
@Produces({"application/json;charset=UTF-8", "application/vnd.api+json"})
@Consumes({"application/json;charset=UTF-8", "application/vnd.api+json"})
public void getInvitedEmailsByVRE(@PathParam("id") String vreid, InviteStatus... status) {
}
@GET
@Path("/")
@Produces({"application/json;charset=UTF-8", "application/vnd.api+json"})
public void getAllVREIds() {
}
}

View File

@ -1,87 +0,0 @@
package org.gcube.social_networking.rest.collections;
import com.webcohesion.enunciate.metadata.rs.RequestHeader;
import com.webcohesion.enunciate.metadata.rs.RequestHeaders;
import com.webcohesion.enunciate.metadata.rs.ResourceGroup;
import com.webcohesion.enunciate.metadata.rs.ResourceLabel;
import org.gcube.social_networking.socialnetworking.model.shared.Attachment;
import org.gcube.social_networking.utils.ResourceNames;
import org.gcube.social_networking.utils.ResponseBean;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import jakarta.validation.constraints.NotNull;
import jakarta.ws.rs.*;
import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.core.Response;
@Path("attachments")
@ResourceGroup("Attachments APIs")
@ResourceLabel("Attachments APIs")
@RequestHeaders({
@RequestHeader(name = "Authorization", description = "Bearer token, see <a href=\"https://dev.d4science.org/how-to-access-resources\">https://dev.d4science.org/how-to-access-resources</a>")
})
public class Attachments extends Collection {
private static final Logger logger = LoggerFactory.getLogger(Attachments.class);
private Response ErrorHandler(Exception e, String action, String id) {
ResponseBean<Boolean> responseBean = new ResponseBean<>();
Response.Status status;
logger.info("Unable to " + action + " attachment {}.", id);
logger.info(e.getMessage());
responseBean.setMessage(e.getMessage());
responseBean.setSuccess(false);
status = Response.Status.INTERNAL_SERVER_ERROR;
return Response.status(status).entity(responseBean).build();
}
@POST
@Path("")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public Response createAttachment(Attachment attachment) {
try {
logger.info("Creating attachment with id {}.", attachment.getId());
return super.create(attachment);
} catch (Exception e) {
return ErrorHandler(e, "create", attachment.getId());
}
}
@GET
@Path("/{id}")
@Produces(MediaType.APPLICATION_JSON)
public Response readAttachment(@NotNull @PathParam("id") String id) {
try {
logger.info("Reading attachment with id {}.", id);
return super.read(id, ResourceNames.Attachment);
} catch (Exception e) {
return ErrorHandler(e, "fetch", id);
}
}
@DELETE
@Path("/{id}")
@Produces(MediaType.APPLICATION_JSON)
public Response deleteAttachment(@NotNull @PathParam("id") String id) {
try {
logger.info("Deleting attachment with id {}.", id);
return super.delete(id, ResourceNames.Attachment);
} catch (Exception e) {
return ErrorHandler(e, "delete", id);
}
}
@PUT
@Path("/{id}")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public Response updateAttachment(@NotNull @PathParam("id") String id, @NotNull Attachment attachment) {
try {
logger.info("Updating attachment with id {}", id);
return super.update(id, attachment);
} catch (Exception e) {
return ErrorHandler(e, "update", id);
}
}
}

View File

@ -1,329 +0,0 @@
package org.gcube.social_networking.rest.collections;
import org.gcube.social_networking.server.CassandraConnection;
import org.gcube.social_networking.socialnetworking.model.shared.Invite;
import org.gcube.social_networking.socialnetworking.model.shared.InviteOperationResult;
import org.gcube.social_networking.utils.ResourceNames;
import org.gcube.social_networking.utils.ResponseBean;
import org.gcube.social_networking.socialnetworking.model.shared.IdResource;
import jakarta.ws.rs.core.Response;
import java.rmi.ServerException;
import java.util.List;
public class Collection {
// Create
public Response create(IdResource resource) {
String resourceName = resource.getClass().getSimpleName();
if (resourceName.equals(ResourceNames.INVITE)) {
ResponseBean<InviteOperationResult> responseBean = new ResponseBean<>();
Response.Status status;
InviteOperationResult result;
try {
result = CassandraConnection.getInstance().getDatabookStore().saveInvite((Invite) resource);
} catch (ServerException e) {
throw new RuntimeException(e);
}
status = (result == InviteOperationResult.SUCCESS) ? Response.Status.CREATED
: (result == InviteOperationResult.ALREADY_INVITED) ? Response.Status.FOUND
: Response.Status.INTERNAL_SERVER_ERROR;
responseBean.setResult(result);
responseBean.setMessage((result == InviteOperationResult.SUCCESS)
? resourceName + " {" + resource.getId() + "} Created Successfully"
: (result == InviteOperationResult.ALREADY_INVITED)
? resourceName + " {" + resource.getId() + "} already exists"
: "Error");
responseBean.setSuccess(result == InviteOperationResult.SUCCESS);
return Response.status(status).entity(responseBean).build();
}
ResponseBean<Boolean> responseBean = new ResponseBean<>();
Response.Status status;
Boolean result = CassandraConnection.getInstance().getDatabookStore().create(resource);
status = result ? Response.Status.CREATED : Response.Status.FOUND;
responseBean.setResult(result);
responseBean.setMessage(result ? resourceName + " {" + resource.getId() + "} Created Successfully"
: resourceName + " {" + resource.getId() + "} already exists");
responseBean.setSuccess(result);
return Response.status(status).entity(responseBean).build();
}
public Response createChildOf(String parentid, IdResource childResource, String parentResourceName) {
ResponseBean<Boolean> responseBean = new ResponseBean<>();
String childResourceName = childResource.getClass().getSimpleName();
Response.Status status;
Boolean result = CassandraConnection.getInstance().getDatabookStore().createChildOf(parentid, childResource,
parentResourceName);
status = result ? Response.Status.CREATED : Response.Status.FOUND;
responseBean.setResult(result);
responseBean.setMessage(result
? childResourceName + " {" + childResource.getId() + "} Created Successfully for " + parentResourceName
+ "{" + parentid + "}."
: childResourceName + " {" + childResource.getId() + "} already exists");
responseBean.setSuccess(result);
return Response.status(status).entity(responseBean).build();
}
public Response BatchCreateChildOfWithParameter(String parentid, String parameterName, String parameterValue,
List<IdResource> childResource, String parentResourceName, String childResourceName) {
ResponseBean<Boolean> responseBean = new ResponseBean<>();
Response.Status status;
Boolean result = CassandraConnection.getInstance().getDatabookStore().BatchCreateChildOfWithParameter(parentid,
parameterName, parameterValue, childResource, parentResourceName, childResourceName);
status = result ? Response.Status.OK : Response.Status.NOT_FOUND;
responseBean.setMessage(
result ? childResourceName + " created Successfully" : childResourceName + " cannot be found");
responseBean.setResult(result);
responseBean.setSuccess(result);
return Response.status(status).entity(responseBean).build();
}
// Read
public Response read(String id, String resourceName) {
ResponseBean<IdResource> responseBean = new ResponseBean<>();
Response.Status status;
IdResource resource = CassandraConnection.getInstance().getDatabookStore().read(id, resourceName);
status = resource != null ? Response.Status.OK : Response.Status.NOT_FOUND;
responseBean.setMessage(resource != null ? resourceName + " {" + id + "} fetched Successfully"
: resourceName + " {" + id + "} cannot be found");
responseBean.setSuccess(resource != null);
responseBean.setResult(resource);
return Response.status(status).entity(responseBean).build();
}
public Response check(String id, String parameterName, String parameterValue, String resourceName) {
ResponseBean<Boolean> responseBean = new ResponseBean<>();
Response.Status status;
Boolean result = CassandraConnection.getInstance().getDatabookStore().check(id, parameterName, parameterValue,
resourceName);
status = result != null ? Response.Status.OK : Response.Status.NOT_FOUND;
responseBean.setMessage(result != null ? resourceName + " {" + id + "} checked Successfully"
: resourceName + " {" + id + "} cannot be found");
responseBean.setSuccess(result != null);
responseBean.setResult(result);
return Response.status(status).entity(responseBean).build();
}
public Response checkChildOf(String parentid, String parameterName, String parameterValue,
String parentResourceName, String childResourceName) {
ResponseBean<Boolean> responseBean = new ResponseBean<>();
Response.Status status;
Boolean result = CassandraConnection.getInstance().getDatabookStore().checkChildOf(parentid, parameterName,
parameterValue, parentResourceName, childResourceName);
status = result != null ? Response.Status.OK : Response.Status.NOT_FOUND;
responseBean.setMessage(result != null ? childResourceName + " {" + parentid + "} checked Successfully"
: childResourceName + " {" + parentid + "} cannot be found");
responseBean.setSuccess(result != null);
responseBean.setResult(result);
return Response.status(status).entity(responseBean).build();
}
public Response readAll(String resourceName) {
ResponseBean<List<IdResource>> responseBean = new ResponseBean<>();
Response.Status status;
List<IdResource> resources = CassandraConnection.getInstance().getDatabookStore().readAll(resourceName);
status = resources != null ? Response.Status.OK : Response.Status.NOT_FOUND;
responseBean.setMessage(resources != null ? resourceName + "s {" + "} fetched Successfully"
: resourceName + "s {" + "} cannot be found");
responseBean.setSuccess(resources != null);
responseBean.setResult(resources);
return Response.status(status).entity(responseBean).build();
}
public Response readChildOf(String parentid, String parentResourceName, String childResourceName) {
ResponseBean<List<IdResource>> responseBean = new ResponseBean<>();
Response.Status status;
List<IdResource> resources = CassandraConnection.getInstance().getDatabookStore().readChildOf(parentid,
parentResourceName, childResourceName);
status = resources != null ? Response.Status.OK : Response.Status.NOT_FOUND;
responseBean.setMessage(resources != null
? childResourceName + " of " + parentResourceName + " {" + parentid + "} fetched Successfully"
: parentResourceName + " {" + parentid + "} cannot be found");
responseBean.setSuccess(resources != null);
responseBean.setResult(resources);
return Response.status(status).entity(responseBean).build();
}
public Response readWithParameter(String parameterName, String parameterValue, String resourceName) {
ResponseBean<List<IdResource>> responseBean = new ResponseBean<>();
Response.Status status;
List<IdResource> resources = CassandraConnection.getInstance().getDatabookStore().readWithParameter(parameterName,
parameterValue, resourceName);
status = resources != null ? Response.Status.OK : Response.Status.NOT_FOUND;
responseBean.setMessage(resources != null
? resourceName + "with " + parameterName + "=" + parameterValue + " fetched Successfully"
: resourceName + "with " + parameterName + "=" + parameterValue + " cannot be found");
responseBean.setSuccess(resources != null);
responseBean.setResult(resources);
return Response.status(status).entity(responseBean).build();
}
public Response readChildOfWithParameter(String parentid, String parameterName, String parameterValue,
String parentResourceName, String childResourceName) {
ResponseBean<List<IdResource>> responseBean = new ResponseBean<>();
Response.Status status;
List<IdResource> resources = CassandraConnection.getInstance().getDatabookStore().readChildOfWithParameter(
parentid, parameterName, parameterValue, parentResourceName, childResourceName);
status = resources != null ? Response.Status.OK : Response.Status.NOT_FOUND;
responseBean.setMessage(resources != null
? childResourceName + " of " + parentResourceName + "{" + parentid + "}" + "with " + parameterName + "="
+ parameterValue + " fetched Successfully"
: childResourceName + " of " + parentResourceName + "{" + parentid + "}" + "with " + parameterName + "="
+ parameterValue + " cannot be found");
responseBean.setSuccess(resources != null);
responseBean.setResult(resources);
return Response.status(status).entity(responseBean).build();
}
// Update
public Response update(String id, IdResource resource) {
ResponseBean<Boolean> responseBean = new ResponseBean<>();
String resourceName = resource.getClass().getSimpleName();
Response.Status status;
Boolean result = CassandraConnection.getInstance().getDatabookStore().update(resource);
status = result ? Response.Status.OK : Response.Status.NOT_FOUND;
responseBean.setMessage(result ? resourceName + " {" + id + "} updated Successfully"
: resourceName + " {" + id + "} cannot be found");
responseBean.setResult(result);
responseBean.setSuccess(result);
return Response.status(status).entity(responseBean).build();
}
public Response updateChildOf(String parentid, String childid, IdResource childResource, String parentResourceName) {
ResponseBean<Boolean> responseBean = new ResponseBean<>();
String childResourceName = childResource.getClass().getSimpleName();
Response.Status status;
Boolean result = CassandraConnection.getInstance().getDatabookStore().updateChildOf(parentid, childid,
childResource, parentResourceName);
status = result ? Response.Status.OK : Response.Status.NOT_FOUND;
responseBean.setMessage(result ? childResourceName + " {" + childid + "} updated Successfully"
: childResourceName + " {" + childid + "} cannot be found");
responseBean.setResult(result);
responseBean.setSuccess(result);
return Response.status(status).entity(responseBean).build();
}
public Response BatchUpdateChildOf(String parentid, List<IdResource> childResource, String parentResourceName) {
ResponseBean<Boolean> responseBean = new ResponseBean<>();
String childResourceName = childResource.get(0).getClass().getSimpleName();
Response.Status status;
Boolean result = CassandraConnection.getInstance().getDatabookStore().BatchUpdateChildOf(parentid,
childResource, parentResourceName);
status = result ? Response.Status.OK : Response.Status.NOT_FOUND;
responseBean.setMessage(
result ? childResourceName + " updated Successfully" : childResourceName + " cannot be found");
responseBean.setResult(result);
responseBean.setSuccess(result);
return Response.status(status).entity(responseBean).build();
}
public Response updateWithParameter(String parameterName, String parameterValue, IdResource resource) {
ResponseBean<Boolean> responseBean = new ResponseBean<>();
String resourceName = resource.getClass().getSimpleName();
Response.Status status;
Boolean result = CassandraConnection.getInstance().getDatabookStore().updateWithParameter(parameterName,
parameterValue, resource);
status = result ? Response.Status.OK : Response.Status.NOT_FOUND;
responseBean.setMessage(
result ? resourceName + " with" + parameterName + "=" + parameterValue + " updated Successfully"
: resourceName + " with" + parameterName + "=" + parameterValue + " cannot be found");
responseBean.setResult(result);
responseBean.setSuccess(result);
return Response.status(status).entity(responseBean).build();
}
public Response updateChildOfWithParameter(String parentid, String parameterName, String parameterValue,
IdResource childResource, String parentResourceName) {
ResponseBean<Boolean> responseBean = new ResponseBean<>();
String childResourceName = childResource.getClass().getSimpleName();
Response.Status status;
Boolean result = CassandraConnection.getInstance().getDatabookStore().updateChildOfWithParameter(parentid,
parameterName, parameterValue, childResource, parentResourceName);
status = result ? Response.Status.OK : Response.Status.NOT_FOUND;
responseBean.setMessage(result
? childResourceName + " of " + parentResourceName + "{" + parentid + "}" + "with " + parameterName + "="
+ parameterValue + " updated Successfully"
: childResourceName + " of " + parentResourceName + "{" + parentid + "}" + "with " + parameterName + "="
+ parameterValue + " cannot be found");
responseBean.setResult(result);
responseBean.setSuccess(result);
return Response.status(status).entity(responseBean).build();
}
// Delete
public Response delete(String id, String resourceName) {
ResponseBean<Boolean> responseBean = new ResponseBean<>();
Response.Status status;
Boolean result = CassandraConnection.getInstance().getDatabookStore().delete(id, resourceName);
status = result ? Response.Status.OK : Response.Status.NOT_FOUND;
responseBean.setMessage(result ? resourceName + " {" + id + "} deleted Successfully"
: resourceName + " {" + id + "} cannot be found");
responseBean.setResult(result);
responseBean.setSuccess(result);
return Response.status(status).entity(responseBean).build();
}
public Response deleteChildOf(String parentid, String childid, String parentResourceName,
String childResourceName) {
ResponseBean<Boolean> responseBean = new ResponseBean<>();
Response.Status status;
Boolean result = CassandraConnection.getInstance().getDatabookStore().deleteChildOf(parentid, childid,
childResourceName);
status = result ? Response.Status.OK : Response.Status.NOT_FOUND;
responseBean.setMessage(result
? childResourceName + " {" + childid + "} deleted Successfully for " + parentResourceName + "{"
+ parentid + "}."
: childResourceName + " {" + childid + "} cannot be found");
responseBean.setResult(result);
responseBean.setSuccess(result);
return Response.status(status).entity(responseBean).build();
}
public Response deleteWithParameter(String parameterName, String parameterValue, String resourceName) {
ResponseBean<Boolean> responseBean = new ResponseBean<>();
Response.Status status;
Boolean result = CassandraConnection.getInstance().getDatabookStore().deleteWithParameter(parameterName,
parameterValue, resourceName);
status = result ? Response.Status.OK : Response.Status.NOT_FOUND;
responseBean.setMessage(
result ? resourceName + " with" + parameterName + "=" + parameterValue + " deleted Successfully"
: resourceName + " with" + parameterName + "=" + parameterValue + " cannot be found");
responseBean.setResult(result);
responseBean.setSuccess(result);
return Response.status(status).entity(responseBean).build();
}
public Response deleteChildOfWithParameter(String parentid, String childid, String parameterName,
String parameterValue, String parentResourceName, String childResourceName) {
ResponseBean<Boolean> responseBean = new ResponseBean<>();
Response.Status status;
Boolean result = CassandraConnection.getInstance().getDatabookStore().deleteChildOfWithParameter(parentid,
childid, parameterName, parameterValue, parentResourceName, childResourceName);
status = result ? Response.Status.OK : Response.Status.NOT_FOUND;
responseBean.setMessage(result
? childResourceName + " of " + parentResourceName + "{" + parentid + "}" + "with " + parameterName + "="
+ parameterValue + " deleted Successfully"
: childResourceName + " of " + parentResourceName + "{" + parentid + "}" + "with " + parameterName + "="
+ parameterValue + " cannot be found");
responseBean.setResult(result);
responseBean.setSuccess(result);
return Response.status(status).entity(responseBean).build();
}
public Response BatchDeleteChildOfWithParameter(String parentid, String parameterName, String parameterValue,
List<IdResource> childResource, String parentResourceName, String childResourceName) {
ResponseBean<Boolean> responseBean = new ResponseBean<>();
Response.Status status;
Boolean result = CassandraConnection.getInstance().getDatabookStore().BatchDeleteChildOfWithParameter(parentid,
parameterName, parameterValue, childResource, parentResourceName, childResourceName);
status = result ? Response.Status.OK : Response.Status.NOT_FOUND;
responseBean.setMessage(
result ? childResourceName + " deleted Successfully" : childResourceName + " cannot be found");
responseBean.setResult(result);
responseBean.setSuccess(result);
return Response.status(status).entity(responseBean).build();
}
}

View File

@ -1,63 +0,0 @@
package org.gcube.social_networking.rest.collections;
import com.webcohesion.enunciate.metadata.rs.RequestHeader;
import com.webcohesion.enunciate.metadata.rs.RequestHeaders;
import com.webcohesion.enunciate.metadata.rs.ResourceGroup;
import com.webcohesion.enunciate.metadata.rs.ResourceLabel;
import org.gcube.social_networking.socialnetworking.model.shared.Comment;
import org.gcube.social_networking.utils.ResourceNames;
import org.gcube.social_networking.utils.ResponseBean;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import jakarta.validation.constraints.NotNull;
import jakarta.ws.rs.*;
import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.core.Response;
@Path("comments")
@ResourceGroup("Comments APIs")
@ResourceLabel("Comments APIs")
@RequestHeaders({
@RequestHeader( name = "Authorization", description = "Bearer token, see <a href=\"https://dev.d4science.org/how-to-access-resources\">https://dev.d4science.org/how-to-access-resources</a>")
})
public class Comments extends Collection {
private static final Logger logger = LoggerFactory.getLogger(Comments.class);
private Response ErrorHandler(Exception e, String action, String id){
ResponseBean<Boolean> responseBean = new ResponseBean<>();
Response.Status status;
logger.info("Unable to "+action+" comment {}.", id);
logger.info(e.getMessage());
responseBean.setMessage(e.getMessage());
responseBean.setSuccess(false);
status = Response.Status.INTERNAL_SERVER_ERROR;
return Response.status(status).entity(responseBean).build();
}
@GET
@Path("/{id}")
@Produces(MediaType.APPLICATION_JSON)
public Response readComment(@NotNull @PathParam("id") String id) {
try{
logger.info("Reading comment with id {}.", id);
return super.read(id, ResourceNames.COMMENT);
}catch(Exception e){
return ErrorHandler(e, "fetch",id);
}
}
@PUT
@Path("/{id}")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public Response updateComment(@NotNull @PathParam("id") String id, @NotNull Comment comment) {
try{
logger.info("Updating comment with id {}", id);
return super.update(id, comment);
}catch(Exception e){
return ErrorHandler(e, "update",id);
}
}
}

View File

@ -1,211 +0,0 @@
package org.gcube.social_networking.rest.collections;
import com.webcohesion.enunciate.metadata.rs.RequestHeader;
import com.webcohesion.enunciate.metadata.rs.RequestHeaders;
import com.webcohesion.enunciate.metadata.rs.ResourceGroup;
import com.webcohesion.enunciate.metadata.rs.ResourceLabel;
import org.gcube.social_networking.socialnetworking.model.shared.*;
import org.gcube.social_networking.utils.ParameterNames;
import org.gcube.social_networking.utils.ResourceNames;
import org.gcube.social_networking.utils.ResponseBean;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import jakarta.validation.constraints.NotNull;
import jakarta.ws.rs.*;
import jakarta.ws.rs.core.Response;
import java.util.ArrayList;
import java.util.List;
@Path("entities")
@ResourceGroup("Entities APIs")
@ResourceLabel("Entities APIs")
@RequestHeaders({
@RequestHeader( name = "Authorization", description = "Bearer token, see <a href=\"https://dev.d4science.org/how-to-access-resources\">https://dev.d4science.org/how-to-access-resources</a>")
})
public class Entities extends Collection {
private static final Logger logger = LoggerFactory.getLogger(Entities.class);
private Response ErrorHandler(Exception e, String entity, String action, String id){
ResponseBean<Boolean> responseBean = new ResponseBean<>();
Response.Status status;
logger.info("Unable to "+action+ " " + entity + " {}.", id);
logger.info(e.getMessage());
responseBean.setMessage(e.getMessage());
responseBean.setSuccess(false);
status = Response.Status.INTERNAL_SERVER_ERROR;
return Response.status(status).entity(responseBean).build();
}
// TODO: unificare con getRecentPosts
@GET
@Path("users/{id}/allposts")
@Produces({"application/json;charset=UTF-8", "application/vnd.api+json"})
public Response getAllPostsByUser(@NotNull @PathParam("id") String id,
@QueryParam("liked") boolean liked,
@QueryParam("limit") int limit){
String action = "fetch posts of";
try{
if(liked){
action = "fetch liked posts of";
logger.info("Getting all liked posts of user: "+id);
return super.readChildOfWithParameter(id, ParameterNames.ALL_LIKE, String.valueOf(limit),ResourceNames.USER, ResourceNames.POST);
}
logger.info("Getting all posts of user: " + id);
return super.readChildOf(id, ResourceNames.USER, ResourceNames.POST);
}catch(Exception e){
return ErrorHandler(e, "user", action,id);
}
}
@GET
@Path("apps/{id}/posts")
@Produces({"application/json;charset=UTF-8", "application/vnd.api+json"})
public Response getAllPostsByApp(@NotNull @PathParam("id") String id){
try{
logger.info("Getting all posts of app: " + id);
return super.readChildOf(id, ResourceNames.APP, ResourceNames.POST);
}catch(Exception e){
return ErrorHandler(e, "app", "fetch posts of",id);
}
}
@GET
@Path("users/{id}/posts/")
@Produces({"application/json;charset=UTF-8", "application/vnd.api+json"})
public Response getRecentPosts(@NotNull @PathParam("id") String id,
@NotNull @QueryParam("recent_comment") boolean recent_comment,
@NotNull @QueryParam("recent_like") boolean recent_like,
@NotNull @QueryParam("recent_limit") boolean recent_limit,
@QueryParam("time") long time,
@QueryParam("limit") int limit){
String action = "fetch recent posts of";
try{
if (recent_comment){
action = "fetch recently commented posts of";
logger.info("Getting recently commented posts of user: " + id);
return super.readChildOfWithParameter(id, ParameterNames.RECENT_COMMENT, String.valueOf(time), ResourceNames.USER, ResourceNames.POST);
} else if (recent_like){
action = "fetch recently liked posts of";
logger.info("Getting recently liked posts of user: " + id);
return super.readChildOfWithParameter(id, ParameterNames.RECENT_LIKE, String.valueOf(time), ResourceNames.USER, ResourceNames.POST);
}else{
if(recent_limit){
action = "fetch n recent posts of";
logger.info("Getting recent {} posts of user {}", limit, id);
return super.readChildOfWithParameter(id, ParameterNames.RECENT_LIMIT, String.valueOf(limit), ResourceNames.USER, ResourceNames.POST);
} else{
action = "fetch filtered_recent posts of";
logger.info("Getting recent posts of user {}", id);
return super.readChildOfWithParameter(id, ParameterNames.TIME, String.valueOf(time), ResourceNames.USER, ResourceNames.POST);
}
}
}catch(Exception e){
return ErrorHandler(e, "user", action,id);
}
}
@GET
@Path("users/{id}/comments/")
@Produces({"application/json;charset=UTF-8", "application/vnd.api+json"})
public Response getRecentComments(@NotNull @PathParam("id") String id,
@QueryParam("time") long time){
String action = "fetch recent comments of";
try{
logger.info("Getting recent comments of user {}", id);
return super.readChildOfWithParameter(id, ParameterNames.TIME, String.valueOf(time), ResourceNames.USER, ResourceNames.COMMENT);
}catch(Exception e){
return ErrorHandler(e, "user", action,id);
}
}
@GET
@Path("users/{id}/notifications")
@Produces({"application/json;charset=UTF-8", "application/vnd.api+json"})
public Response getAllNotificationByUser(@NotNull @PathParam("id") String id,
@QueryParam("limit") @DefaultValue("10") int limit,
@QueryParam("unread") boolean unread,
@QueryParam("check") boolean check,
@QueryParam("message") boolean message){
String action = "fetch notifications of";
try{
if(unread){
if(check){
if(message){
action = "check unread message notifications of";
logger.info("Checking unread message notifications of user: "+id);
return super.checkChildOf(id, ParameterNames.UNREAD_MESSAGE, String.valueOf(true), ResourceNames.USER, ResourceNames.NOTIFICATION);
}
action = "check unread notifications of";
logger.info("Checking unread notifications of user: " + id);
return super.checkChildOf(id, ParameterNames.UNREAD, String.valueOf(true),ResourceNames.USER, ResourceNames.NOTIFICATION);
}
action = "fetch unread notifications of";
logger.info("Getting all unread notifications of user: " + id);
return super.readChildOfWithParameter(id, ParameterNames.UNREAD, "", ResourceNames.USER, ResourceNames.NOTIFICATION);
}
logger.info("Getting all notifications of user: " + id);
return super.readChildOfWithParameter(id, ParameterNames.RECENT_LIMIT, String.valueOf(limit), ResourceNames.USER, ResourceNames.NOTIFICATION);
}catch(Exception e){
return ErrorHandler(e, "user", action,id);
}
}
@PUT
@Path("users/{id}/notifications")
@Produces({"application/json;charset=UTF-8", "application/vnd.api+json"})
public Response setAllNotificationReadByUser(@NotNull @PathParam("id") String id){
try{
logger.info("Setting all notifications to read of user: " + id);
Notification notification = new Notification();
notification.setRead(true);
return super.updateChildOf(id, "", notification, ResourceNames.USER);
}catch(Exception e){
return ErrorHandler(e, "user", "mark notifications read of",id);
}
}
@GET
@Path("users/{id}/notifications/channels")
@Produces({"application/json;charset=UTF-8", "application/vnd.api+json"})
public Response getUserNotificationChannels(@NotNull @PathParam("id") String id,
@NotNull NotificationType notificationType){
try{
logger.info("Getting notification channels of user {} with type {} ", id, notificationType.toString());
return super.readChildOfWithParameter(id, ParameterNames.NOTIFICATION_TYPE, String.valueOf(notificationType), ResourceNames.USER, ResourceNames.NOTIFICATION);
}catch(Exception e){
return ErrorHandler(e, "user", "read notification channels of",id);
}
}
@GET
@Path("users/{id}/notifications/preferences")
@Produces({"application/json;charset=UTF-8", "application/vnd.api+json"})
public Response getUserNotificationPreferences(@NotNull @PathParam("id") String id){
try{
logger.info("Getting notification preferences of user {}", id);
return super.readChildOf(id, ResourceNames.USER, ResourceNames.NOTIFICATION_PREFERENCES);
}catch(Exception e){
return ErrorHandler(e, "user", "read notification preferences of",id);
}
}
@PUT
@Path("users/{id}/notifications/preferences")
@Produces({"application/json;charset=UTF-8", "application/vnd.api+json"})
@Consumes({"application/json;charset=UTF-8", "application/vnd.api+json"})
public Response setUserNotificationPreferences(@NotNull @PathParam("id") String id, @NotNull List<NotificationPreference> notificationPreferences){
try{
logger.info("Setting notification preferences of user {}", id);
return super.BatchUpdateChildOf(id, new ArrayList<>(notificationPreferences), ResourceNames.USER);
}catch(Exception e){
return ErrorHandler(e, "user", "set notification preferences of",id);
}
}
}

View File

@ -1,63 +0,0 @@
package org.gcube.social_networking.rest.collections;
import com.webcohesion.enunciate.metadata.rs.RequestHeader;
import com.webcohesion.enunciate.metadata.rs.RequestHeaders;
import com.webcohesion.enunciate.metadata.rs.ResourceGroup;
import com.webcohesion.enunciate.metadata.rs.ResourceLabel;
import org.gcube.social_networking.socialnetworking.model.shared.Invite;
import org.gcube.social_networking.utils.ResourceNames;
import org.gcube.social_networking.utils.ResponseBean;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import jakarta.validation.constraints.NotNull;
import jakarta.ws.rs.*;
import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.core.Response;
@Path("invites")
@ResourceGroup("Invites APIs")
@ResourceLabel("Invites APIs")
@RequestHeaders({
@RequestHeader( name = "Authorization", description = "Bearer token, see <a href=\"https://dev.d4science.org/how-to-access-resources\">https://dev.d4science.org/how-to-access-resources</a>")
})
public class Invites extends Collection {
private static final Logger logger = LoggerFactory.getLogger(Invites.class);
private Response ErrorHandler(Exception e, String action, String id){
ResponseBean<Boolean> responseBean = new ResponseBean<>();
Response.Status status;
logger.info("Unable to "+action+" invite {}.", id);
logger.info(e.getMessage());
responseBean.setMessage(e.getMessage());
responseBean.setSuccess(false);
status = Response.Status.INTERNAL_SERVER_ERROR;
return Response.status(status).entity(responseBean).build();
}
@GET
@Path("/{id}")
@Produces(MediaType.APPLICATION_JSON)
public Response readInvite(@NotNull @PathParam("id") String id) {
try{
logger.info("Reading invite with id {}.", id);
return super.read(id, ResourceNames.INVITE);
}catch(Exception e){
return ErrorHandler(e, "fetch",id);
}
}
@POST
@Path("/")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public Response saveInvite(@NotNull Invite invite) {
try{
logger.info("Saving invite with id {}.", invite.getId());
return super.create(invite);
}catch(Exception e){
return ErrorHandler(e, "create",invite.getId());
}
}
}

View File

@ -1,87 +0,0 @@
package org.gcube.social_networking.rest.collections;
import com.webcohesion.enunciate.metadata.rs.RequestHeader;
import com.webcohesion.enunciate.metadata.rs.RequestHeaders;
import com.webcohesion.enunciate.metadata.rs.ResourceGroup;
import com.webcohesion.enunciate.metadata.rs.ResourceLabel;
import org.gcube.social_networking.socialnetworking.model.shared.Like;
import org.gcube.social_networking.utils.ResourceNames;
import org.gcube.social_networking.utils.ResponseBean;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import jakarta.validation.constraints.NotNull;
import jakarta.ws.rs.*;
import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.core.Response;
@Path("likes")
@ResourceGroup("Likes APIs")
@ResourceLabel("Likes APIs")
@RequestHeaders({
@RequestHeader( name = "Authorization", description = "Bearer token, see <a href=\"https://dev.d4science.org/how-to-access-resources\">https://dev.d4science.org/how-to-access-resources</a>")
})
public class Likes extends Collection {
private static final Logger logger = LoggerFactory.getLogger(Likes.class);
private Response ErrorHandler(Exception e, String action, String id){
ResponseBean<Boolean> responseBean = new ResponseBean<>();
Response.Status status;
logger.info("Unable to "+action+" like {}.", id);
logger.info(e.getMessage());
responseBean.setMessage(e.getMessage());
responseBean.setSuccess(false);
status = Response.Status.INTERNAL_SERVER_ERROR;
return Response.status(status).entity(responseBean).build();
}
@POST
@Path("/")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public Response createLike(Like like) {
try{
logger.info("Creating like with id {}.", like.getKey());
return super.create(like);
}catch(Exception e){
return ErrorHandler(e, "create",like.getKey());
}
}
@GET
@Path("/{id}")
@Produces(MediaType.APPLICATION_JSON)
public Response readLike(@NotNull @PathParam("id") String id) {
try{
logger.info("Reading like with id {}.", id);
return super.read(id, ResourceNames.LIKE);
}catch(Exception e){
return ErrorHandler(e, "fetch",id);
}
}
@DELETE
@Path("/{id}")
@Produces(MediaType.APPLICATION_JSON)
public Response deleteLike(@NotNull @PathParam("id") String id) {
try{
logger.info("Deleting like with id {}.", id);
return super.delete(id,ResourceNames.LIKE);
}catch(Exception e){
return ErrorHandler(e, "delete",id);
}
}
@PUT
@Path("/{id}")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public Response updateLike(@NotNull @PathParam("id") String id, @NotNull Like like) {
try{
logger.info("Updating like with id {}", id);
return super.update(id, like);
}catch(Exception e){
return ErrorHandler(e, "update",id);
}
}
}

View File

@ -1,77 +0,0 @@
package org.gcube.social_networking.rest.collections;
import com.webcohesion.enunciate.metadata.rs.RequestHeader;
import com.webcohesion.enunciate.metadata.rs.RequestHeaders;
import com.webcohesion.enunciate.metadata.rs.ResourceGroup;
import com.webcohesion.enunciate.metadata.rs.ResourceLabel;
import org.gcube.social_networking.socialnetworking.model.shared.Notification;
import org.gcube.social_networking.utils.ResourceNames;
import org.gcube.social_networking.utils.ResponseBean;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import jakarta.validation.constraints.NotNull;
import jakarta.ws.rs.*;
import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.core.Response;
@Path("notifications")
@ResourceGroup("Notifications APIs")
@ResourceLabel("Notifications APIs")
@RequestHeaders({
@RequestHeader( name = "Authorization", description = "Bearer token, see <a href=\"https://dev.d4science.org/how-to-access-resources\">https://dev.d4science.org/how-to-access-resources</a>")
})
public class Notifications extends Collection {
private static final Logger logger = LoggerFactory.getLogger(Notifications.class);
private Response ErrorHandler(Exception e, String action, String id){
ResponseBean<Boolean> responseBean = new ResponseBean<>();
Response.Status status;
logger.info("Unable to "+action+" notification {}.", id);
logger.info(e.getMessage());
responseBean.setMessage(e.getMessage());
responseBean.setSuccess(false);
status = Response.Status.INTERNAL_SERVER_ERROR;
return Response.status(status).entity(responseBean).build();
}
@POST
@Path("/")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public Response createNotification(Notification notification) {
try{
logger.info("Creating notification with id {}.", notification.getId());
return super.create(notification);
}catch(Exception e){
return ErrorHandler(e, "create",notification.getId());
}
}
@PUT
@Path("/{id}")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public Response setNotificationToRead(@NotNull @PathParam("id") String id) {
try{
logger.info("Setting notification with id {} to read.", id);
Notification notification = new Notification();
notification.setKey(id);
return super.update(id, notification);
}catch(Exception e){
return ErrorHandler(e, "update",id);
}
}
@GET
@Path("/{id}")
@Produces(MediaType.APPLICATION_JSON)
public Response readNotification(@NotNull @PathParam("id") String id) {
try{
logger.info("Reading notification with id {}.", id);
return super.read(id, ResourceNames.NOTIFICATION);
}catch(Exception e){
return ErrorHandler(e, "fetch",id);
}
}
}

View File

@ -1,199 +0,0 @@
package org.gcube.social_networking.rest.collections;
import com.webcohesion.enunciate.metadata.rs.RequestHeader;
import com.webcohesion.enunciate.metadata.rs.RequestHeaders;
import com.webcohesion.enunciate.metadata.rs.ResourceGroup;
import com.webcohesion.enunciate.metadata.rs.ResourceLabel;
import org.gcube.social_networking.socialnetworking.model.shared.*;
import org.gcube.social_networking.utils.ResourceNames;
import org.gcube.social_networking.utils.ResponseBean;
import org.gcube.social_networking.utils.Schema;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import jakarta.validation.constraints.NotNull;
import jakarta.ws.rs.*;
import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.core.Response;
@Path("posts")
@ResourceGroup("Posts APIs")
@ResourceLabel("Posts APIs")
@RequestHeaders({
@RequestHeader( name = "Authorization", description = "Bearer token, see <a href=\"https://dev.d4science.org/how-to-access-resources\">https://dev.d4science.org/how-to-access-resources</a>")
})
public class Posts extends Collection {
private static final Logger logger = LoggerFactory.getLogger(Posts.class);
private Response ErrorHandler(Exception e, String action, String id){
ResponseBean<Boolean> responseBean = new ResponseBean<>();
Response.Status status;
logger.info("Unable to "+action+" post {}.", id);
logger.info(e.getMessage());
responseBean.setMessage(e.getMessage());
responseBean.setSuccess(false);
status = Response.Status.INTERNAL_SERVER_ERROR;
return Response.status(status).entity(responseBean).build();
}
//Posts
@POST
@Path("/")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public Response createPost(PostWithAttachment postWithAttachment) {
try{
logger.info("Creating post with id {}.", postWithAttachment.getId());
return super.create(postWithAttachment);
}catch(Exception e){
return ErrorHandler(e, "create",postWithAttachment.getId());
}
}
@GET
@Path("/{id}")
@Produces(MediaType.APPLICATION_JSON)
public Response readPost(@NotNull @PathParam("id") String id) {
try{
logger.info("Reading post with id {}.", id);
return super.read(id, ResourceNames.POST);
}catch(Exception e){
return ErrorHandler(e, "fetch",id);
}
}
@GET
@Path("")
@Produces({"application/json;charset=UTF-8", "application/vnd.api+json"})
public Response readPostsWithPrivacyLevel(@QueryParam("privacy") String privacyLevel){
try{
if (privacyLevel == null || privacyLevel.isEmpty()){
privacyLevel = PrivacyLevel.PORTAL.toString();
}
logger.info("Reading post with privacy level = " + privacyLevel );
return super.readWithParameter(Schema.PRIVACY, privacyLevel, ResourceNames.POST);
}catch(Exception e){
return ErrorHandler(e, "fetch","portal privacy level");
}
}
@DELETE
@Path("/{id}")
@Produces(MediaType.APPLICATION_JSON)
public Response deletePost(@NotNull @PathParam("id") String id) {
try{
logger.info("Deleting post with id {}.", id);
return super.delete(id,ResourceNames.POST);
}catch(Exception e){
return ErrorHandler(e, "delete",id);
}
}
//comments
@POST
@Path("/{id}/comments")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public Response createComment(@NotNull @PathParam("id") String id, @NotNull Comment comment) {
try{
logger.info("Creating comment with id {}.", comment.getId());
return super.createChildOf(id, comment, ResourceNames.POST);
}catch(Exception e){
return ErrorHandler(e, "create comment to post",id);
}
}
@GET
@Path("/{id}/comments")
@Produces({"application/json;charset=UTF-8", "application/vnd.api+json"})
public Response getCommentsOfPost(@NotNull @PathParam("id") String id){
try{
logger.info("Reading comments of post with id " + id);
return super.readChildOf(id, ResourceNames.POST, ResourceNames.COMMENT);
}catch(Exception e){
return ErrorHandler(e, "fetch comments of",id);
}
}
@DELETE
@Path("/{id}/comments/{commentid}")
@Produces(MediaType.APPLICATION_JSON)
public Response deleteCommentOfPost(@NotNull @PathParam("id") String id, @NotNull @PathParam("commentid") String commentid) {
try{
logger.info("Deleting comment of post with id {}.", id);
return super.deleteChildOf(id, commentid, ResourceNames.POST, ResourceNames.COMMENT);
}catch(Exception e){
return ErrorHandler(e, "delete comment of",id);
}
}
//Likes
@POST
@Path("/{id}/likes")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public Response createLike(@NotNull @PathParam("id") String id, @NotNull Like like) {
try{
logger.info("Creating like with id {}.", like.getId());
return super.createChildOf(id, like, ResourceNames.POST);
}catch(Exception e){
return ErrorHandler(e, "create like to post",id);
}
}
@GET
@Path("/{id}/likes")
@Produces({"application/json;charset=UTF-8", "application/vnd.api+json"})
public Response getLikesOfPost(@NotNull @PathParam("id") String id){
try{
logger.info("Reading likes of post with id " + id);
return super.readChildOf(id, ResourceNames.POST, ResourceNames.LIKE);
}catch(Exception e){
return ErrorHandler(e, "fetch likes of",id);
}
}
@GET
@Path("/{id}/attachments")
@Produces({"application/json;charset=UTF-8", "application/vnd.api+json"})
public Response getAttachmentsOfPost(@NotNull @PathParam("id") String id){
try{
logger.info("Reading attachments of post with id " + id);
return super.readChildOf(id, ResourceNames.POST, ResourceNames.Attachment);
}catch(Exception e){
return ErrorHandler(e, "fetch attachments of",id);
}
}
@PUT
@Path("/{id}")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public Response updatePost(@NotNull @PathParam("id") String id, @NotNull Post post) {
try{
logger.info("Updating post with id {}", id);
return super.update(id, post);
}catch(Exception e){
return ErrorHandler(e, "update",id);
}
}
@DELETE
@Path("/{id}/likes/{likeid}")
@Produces(MediaType.APPLICATION_JSON)
public Response unlikePost(@NotNull @PathParam("id") String id, @NotNull @PathParam("likeid") String likeid) {
try{
String username = ""; //get username somehow
logger.info("Unliking post with id {}", id);
return super.deleteChildOfWithParameter(id, likeid, ResourceNames.USER, username, ResourceNames.POST, ResourceNames.LIKE);
}catch(Exception e){
return ErrorHandler(e, "unlike",id);
}
}
}

View File

@ -1,256 +0,0 @@
package org.gcube.social_networking.rest.collections;
import com.webcohesion.enunciate.metadata.rs.RequestHeader;
import com.webcohesion.enunciate.metadata.rs.RequestHeaders;
import com.webcohesion.enunciate.metadata.rs.ResourceGroup;
import com.webcohesion.enunciate.metadata.rs.ResourceLabel;
import org.gcube.social_networking.socialnetworking.model.shared.*;
import org.gcube.social_networking.utils.ParameterNames;
import org.gcube.social_networking.utils.ResourceNames;
import org.gcube.social_networking.utils.ResponseBean;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import jakarta.validation.constraints.NotNull;
import jakarta.ws.rs.*;
import jakarta.ws.rs.core.GenericType;
import jakarta.ws.rs.core.Response;
import java.util.*;
@Path("vres")
@ResourceGroup("Vres APIs")
@ResourceLabel("Vres APIs")
@RequestHeaders({
@RequestHeader(name = "Authorization", description = "Bearer token, see <a href=\"https://dev.d4science.org/how-to-access-resources\">https://dev.d4science.org/how-to-access-resources</a>")
})
public class Vres extends Collection {
private static final Logger logger = LoggerFactory.getLogger(Vres.class);
private Response ErrorHandler(Exception e, String action, String id) {
ResponseBean<Boolean> responseBean = new ResponseBean<>();
Response.Status status;
logger.info("Unable to " + action + " vre {}.", id);
logger.info(e.getMessage());
responseBean.setMessage(e.getMessage());
responseBean.setSuccess(false);
status = Response.Status.INTERNAL_SERVER_ERROR;
return Response.status(status).entity(responseBean).build();
}
// @GET
// @Path("/{id}/posts")
// @Produces({ "application/json;charset=UTF-8", "application/vnd.api+json" })
// public Response getAllPostsByVre(@NotNull @PathParam("id") String id) {
// try {
// logger.info("Getting all posts of VRE: " + id);
// return super.readChildOf(id, ResourceNames.VRE, ResourceNames.POST);
// } catch (Exception e) {
// return ErrorHandler(e, "fetch posts of", id);
// }
// }
@GET
@Path("/")
@Produces({ "application/json;charset=UTF-8", "application/vnd.api+json" })
public Response getAllVreIds() {
try {
logger.info("Getting all VRE IDs");
List<String> ids = new ArrayList<>();
List<Vre> vres = super.readAll(ResourceNames.VRE).readEntity(new GenericType<ResponseBean<List<Vre>>>() {
}).getResult();
for (Vre vre : vres) {
ids.add(vre.getId());
}
Response.Status status = Response.Status.OK;
ResponseBean<List<String>> responseBean = new ResponseBean<>();
responseBean.setMessage("vre ids fetched Successfully");
responseBean.setSuccess(true);
responseBean.setResult(ids);
return Response.status(status).entity(responseBean).build();
} catch (Exception e) {
return ErrorHandler(e, "fetch ids of", "");
}
}
// TODO: verificare limit null
@GET
@Path("/{id}/posts")
@Produces({ "application/json;charset=UTF-8", "application/vnd.api+json" })
public Response getRecentPostsByVre(@NotNull @PathParam("id") String id,
@QueryParam("limit") Integer limit) {
try {
logger.info("Getting most recent {} posts of VRE {} ", limit, id);
if (limit != null)
return super.readChildOfWithParameter(id, ParameterNames.RECENT_LIMIT, String.valueOf(limit),
ResourceNames.VRE, ResourceNames.POST);
else
return super.readChildOf(id, ResourceNames.VRE, ResourceNames.POST);
} catch (Exception e) {
return ErrorHandler(e, "fetch recent posts of", id);
}
}
@POST
@Path("/{id}/posts")
@Produces({ "application/json;charset=UTF-8", "application/vnd.api+json" })
@Consumes({ "application/json;charset=UTF-8", "application/vnd.api+json" })
public Response savePostToVRETimeline(@NotNull @PathParam("id") String id, @NotNull Post post) {
try {
logger.info("saving post {} to VRE {} ", post.getKey(), id);
return super.createChildOf(id, post, ResourceNames.VRE);
} catch (Exception e) {
return ErrorHandler(e, "save post to", id);
}
}
// @GET
// @Path("/{id}/hashtags")
// @Produces({"application/json;charset=UTF-8", "application/vnd.api+json"})
// public Response getVREHashtagsWithOccurrence(@NotNull @PathParam("id") String
// id){
// try{
// logger.info("getting hashtags of VRE {} " , id);
// return super.readChildOf(id, ResourceNames.VRE, ResourceNames.HASHTAG);
// }catch(Exception e){
// return ErrorHandler(e, "get hashtags of",id);
// }
// }
// TODO: verificare implementazione con timestamp null
@GET
@Path("/{id}/hashtags")
@Produces({ "application/json;charset=UTF-8", "application/vnd.api+json" })
public Response getVREHashtagsWithOccurrenceFilteredByTime(@NotNull @PathParam("id") String id,
@QueryParam("time") Long timestamp) {
try {
logger.info("getting hashtags of VRE {} starting {} ", id, timestamp);
if (timestamp == null) {
return super.readChildOf(id, ResourceNames.VRE, ResourceNames.HASHTAG);
}
return super.readChildOfWithParameter(id, ParameterNames.TIME, String.valueOf(timestamp), ResourceNames.VRE,
ResourceNames.HASHTAG);
} catch (Exception e) {
return ErrorHandler(e, "get time_filtered hashtags of", id);
}
}
@GET
@Path("/{id}/hashtags/{hashtag}/posts")
@Produces({ "application/json;charset=UTF-8", "application/vnd.api+json" })
public Response getVREPostsByHashtag(@NotNull @PathParam("id") String id,
@NotNull @PathParam("hashtag") String hashtag) {
try {
logger.info("getting posts containing hashtags in VRE {}", id);
return super.readChildOfWithParameter(id, ParameterNames.HASHTAG, hashtag, ResourceNames.VRE,
ResourceNames.POST);
} catch (Exception e) {
return ErrorHandler(e, "get posts containing hashtag in", id);
}
}
@GET
@Path("/{id}/invites/")
@Produces({ "application/json;charset=UTF-8", "application/vnd.api+json" })
@Consumes({ "application/json;charset=UTF-8", "application/vnd.api+json" })
public Response getInvitedEmailsByVRE(@NotNull @PathParam("id") String id, @NotNull InviteStatus... status) {
try {
logger.info("getting invites in VRE {}", id);
return super.readChildOfWithParameter(id, ParameterNames.STATUS, Arrays.toString(status), ResourceNames.VRE,
ResourceNames.INVITE);
} catch (Exception e) {
return ErrorHandler(e, "get invites in", id);
}
}
@GET
@Path("/{id}/invites/{email}")
@Produces({ "application/json;charset=UTF-8", "application/vnd.api+json" })
public Response isExistingInvite(@NotNull @PathParam("id") String id, @NotNull @PathParam("email") String email) {
try {
logger.info("checking if invite {} exists in VRE {}", email, id);
return super.readChildOfWithParameter(id, ParameterNames.EMAIL, email, ResourceNames.VRE,
ResourceNames.INVITE);
} catch (Exception e) {
return ErrorHandler(e, "check invite in", id);
}
}
@PUT
@Path("/{id}/invites/{email}")
@Produces({ "application/json;charset=UTF-8", "application/vnd.api+json" })
@Consumes({ "application/json;charset=UTF-8", "application/vnd.api+json" })
public Response setInviteStatus(@NotNull @PathParam("id") String id, @NotNull @PathParam("email") String email,
@NotNull InviteStatus inviteStatus) {
try {
logger.info("setting invite {} status in VRE {}", email, id);
Invite invite = new Invite();
invite.setStatus(inviteStatus);
return super.updateChildOfWithParameter(id, ParameterNames.EMAIL, email, invite, ResourceNames.VRE);
} catch (Exception e) {
return ErrorHandler(e, "set invite status in", id);
}
}
@POST
@Path("/{id}/posts/{postid}/hashtags")
@Produces({ "application/json;charset=UTF-8", "application/vnd.api+json" })
@Consumes({ "application/json;charset=UTF-8", "application/vnd.api+json" })
public Response saveHashTags(@NotNull @PathParam("id") String id, @NotNull @PathParam("postid") String postid,
@NotNull List<Hashtag> hashtags) {
try {
logger.info("saving post hashtags to VRE {} ", id);
return super.BatchCreateChildOfWithParameter(id, ResourceNames.POST, postid, new ArrayList<>(hashtags),
ResourceNames.VRE, ResourceNames.HASHTAG);
} catch (Exception e) {
return ErrorHandler(e, "save post hashtags to", id);
}
}
@DELETE
@Path("/{id}/posts/{postid}/hashtags")
@Produces({ "application/json;charset=UTF-8", "application/vnd.api+json" })
@Consumes({ "application/json;charset=UTF-8", "application/vnd.api+json" })
public Response deleteHashTags(@NotNull @PathParam("id") String id, @NotNull @PathParam("postid") String postid,
@NotNull List<Hashtag> hashtags) {
try {
logger.info("deleting post hashtags from VRE {} ", id);
return super.BatchDeleteChildOfWithParameter(id, ResourceNames.POST, postid, new ArrayList<>(hashtags),
ResourceNames.VRE, ResourceNames.HASHTAG);
} catch (Exception e) {
return ErrorHandler(e, "delete post hashtags from", id);
}
}
@POST
@Path("/{id}/comments/{commentid}/hashtags")
@Produces({ "application/json;charset=UTF-8", "application/vnd.api+json" })
@Consumes({ "application/json;charset=UTF-8", "application/vnd.api+json" })
public Response saveHashTagsComment(@NotNull @PathParam("id") String id,
@NotNull @PathParam("commentid") String commentid, @NotNull List<Hashtag> hashtags) {
try {
logger.info("saving comment hashtags to VRE {} ", id);
return super.BatchCreateChildOfWithParameter(id, ResourceNames.COMMENT, commentid,
new ArrayList<>(hashtags), ResourceNames.VRE, ResourceNames.HASHTAG);
} catch (Exception e) {
return ErrorHandler(e, "save comment hashtags to", id);
}
}
@DELETE
@Path("/{id}/comments/{commentid}/hashtags")
@Produces({ "application/json;charset=UTF-8", "application/vnd.api+json" })
@Consumes({ "application/json;charset=UTF-8", "application/vnd.api+json" })
public Response deleteHashTagsComment(@NotNull @PathParam("id") String id,
@NotNull @PathParam("commentid") String commentid, @NotNull List<Hashtag> hashtags) {
try {
logger.info("deleting comment hashtags from VRE {} ", id);
return super.BatchDeleteChildOfWithParameter(id, ResourceNames.COMMENT, commentid,
new ArrayList<>(hashtags), ResourceNames.VRE, ResourceNames.HASHTAG);
} catch (Exception e) {
return ErrorHandler(e, "delete comment hashtags from", id);
}
}
}

View File

@ -1,67 +0,0 @@
package org.gcube.social_networking.rest.examples;
import org.gcube.common.authorization.control.annotations.AuthorizationControl;
import org.gcube.common.security.providers.SecretManagerProvider;
import org.gcube.common.security.secrets.Secret;
import org.gcube.smartgears.utils.InnerMethodName;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.core.MediaType;
/**
* @author Lucio Lelii (ISTI - CNR)
* @author Alfredo Oliviero (ISTI - CNR)
*/
@Path("auth")
public class AuthenticatedService {
private static final String ALLOWED_ROLE = "myRole";
private static final String ALLOWED_ROLE_ORG = "OrganizationMember";
private static final String ALLOWED_ROLE_MEMBER = "Member";
@AuthorizationControl(allowedRoles = { ALLOWED_ROLE_ORG })
@GET
@Path("org_member")
@Produces(MediaType.TEXT_PLAIN)
public String authorizedOrg() {
InnerMethodName.set("auth");
Secret secret = SecretManagerProvider.get();
String userId = secret.getOwner().getId();
String context = secret.getContext();
return String.format(
"User %s in context %s is authorized to execute this method because he has the role %s", userId,
context, ALLOWED_ROLE_ORG);
}
@AuthorizationControl(allowedRoles = { ALLOWED_ROLE_MEMBER })
@GET
@Path("member")
@Produces(MediaType.TEXT_PLAIN)
public String authorizedMember() {
InnerMethodName.set("auth");
Secret secret = SecretManagerProvider.get();
String userId = secret.getOwner().getId();
String context = secret.getContext();
return String.format(
"User %s in context %s is authorized to execute this method because he has the role %s", userId,
context, ALLOWED_ROLE_MEMBER);
}
@AuthorizationControl(allowedRoles = { ALLOWED_ROLE })
@GET
@Path("")
@Produces(MediaType.TEXT_PLAIN)
public String authorized() {
InnerMethodName.set("auth");
Secret secret = SecretManagerProvider.get();
String userId = secret.getOwner().getId();
String context = secret.getContext();
return String.format(
"User %s in context %s is authorized to execute this method because he has the role %s", userId,
context, ALLOWED_ROLE);
}
}

View File

@ -1,31 +0,0 @@
package org.gcube.social_networking.rest.examples;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@Path("guest")
public class ExcludeAuthorizationService {
private final Logger logger = LoggerFactory.getLogger(ExcludeAuthorizationService.class);
/**
* this method doesn't need authorization and the SecretManagerProvider is null
* see to implement this behavior add to excludes section in your
* application.yaml
*
* - path: /{path-to-your-method-path}
*
* example for this method
*
* - path: /excluded
*
*/
@GET
public String exludedMethod() {
logger.info("executed whithout any authorization");
return "executed whithout any authorization";
}
}

View File

@ -1,81 +0,0 @@
package org.gcube.social_networking.rest.examples;
import java.util.HashMap;
import java.util.Map;
import org.gcube.com.fasterxml.jackson.core.JsonProcessingException;
import org.gcube.com.fasterxml.jackson.databind.ObjectMapper;
import org.gcube.common.security.Owner;
import org.gcube.common.security.providers.SecretManagerProvider;
import org.gcube.common.security.secrets.Secret;
import org.gcube.smartgears.ContextProvider;
import org.gcube.smartgears.utils.InnerMethodName;
import org.gcube.social_networking.rest.examples.serializers.IdmObjectSerializator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.core.Response;
/**
*
* @author Lucio Lelii (ISTI-CNR)
* @author Alfredo Oliviero (ISTI-CNR)
*/
@Path("")
public class HelloService {
private final Logger logger = LoggerFactory.getLogger(HelloService.class);
@GET
@Path("hello")
@Produces(MediaType.TEXT_PLAIN)
public String hello() {
InnerMethodName.set("hello");
Secret secret = SecretManagerProvider.get();
String userId = secret.getOwner().getId();
String context = secret.getContext();
String infrastructureName = ContextProvider.get().container().configuration().infrastructure();
logger.info("caller id is {}", userId);
return String.format("Hello %s in context %s in infastructure %s -roles %s", userId, context,
infrastructureName, secret.getOwner().getRoles());
}
@GET
@Path("details")
@Produces({ MediaType.APPLICATION_JSON })
public Response details() {
InnerMethodName.set("details");
Map<String, Object> data = new HashMap<>();
Secret secret = SecretManagerProvider.get();
String context = secret.getContext();
data.put("context", context);
Owner owner = secret.getOwner();
data.put("owner", owner);
// ContainerContext container = ContextProvider.get().container();
// data.put("container", container);
ObjectMapper objectMapper = IdmObjectSerializator.getSerializer();
try {
String jsonData = objectMapper.writeValueAsString(data);
return Response.ok(jsonData).build();
} catch (JsonProcessingException e) {
e.printStackTrace();
return Response.serverError().build();
}
}
}

View File

@ -1,45 +0,0 @@
package org.gcube.social_networking.rest.examples.serializers;
import java.io.IOException;
import org.gcube.smartgears.configuration.container.ContainerConfiguration;
import org.gcube.com.fasterxml.jackson.core.JsonGenerator;
import org.gcube.com.fasterxml.jackson.databind.SerializerProvider;
import org.gcube.com.fasterxml.jackson.databind.ser.std.StdSerializer;
/**
* Jackson serializer for ContainerConfiguration
*
* @author Alfredo Oliviero (ISTI-CNR)
*
*/
public class ContainerConfigurationSerializer extends StdSerializer<ContainerConfiguration> {
protected ContainerConfigurationSerializer(Class<ContainerConfiguration> t) {
super(t);
}
public ContainerConfigurationSerializer() {
super(ContainerConfiguration.class, true);
}
@Override
public void serialize(ContainerConfiguration configuration, JsonGenerator jgen, SerializerProvider provider)
throws IOException {
jgen.writeStartObject();
jgen.writeObjectField("mode", configuration.mode());
jgen.writeObjectField("app", configuration.apps());
jgen.writeObjectField("site", configuration.site());
jgen.writeObjectField("infrastructure", configuration.infrastructure());
jgen.writeObjectField("hostname", configuration.hostname());
jgen.writeObjectField("port", configuration.port());
jgen.writeObjectField("protocol", configuration.protocol());
jgen.writeObjectField("authorizeChildrenContext", configuration.authorizeChildrenContext());
jgen.writeObjectField("proxy", configuration.proxy());
jgen.writeObjectField("desc", configuration.toString());
jgen.writeEndObject();
}
}

View File

@ -1,42 +0,0 @@
package org.gcube.social_networking.rest.examples.serializers;
import java.io.IOException;
import org.gcube.smartgears.context.container.ContainerContext;
import org.gcube.com.fasterxml.jackson.core.JsonGenerator;
import org.gcube.com.fasterxml.jackson.databind.SerializerProvider;
import org.gcube.com.fasterxml.jackson.databind.ser.std.StdSerializer;
/**
* Jackson serializer for ContainerContext
*
* @author Alfredo Oliviero (ISTI-CNR)
*
*/
public class ContainerContextSerializer extends StdSerializer<ContainerContext> {
protected ContainerContextSerializer(Class<ContainerContext> t) {
super(t);
}
public ContainerContextSerializer() {
super(ContainerContext.class, true);
}
@Override
public void serialize(ContainerContext ccontext, JsonGenerator jgen, SerializerProvider provider)
throws IOException {
jgen.writeStartObject();
jgen.writeStringField("id", ccontext.id());
// jgen.writeObjectField("configuration.site", ccontext.configuration().site());
// jgen.writeObjectField("configuration", ccontext.configuration());
jgen.writeObjectField("properties", ccontext.properties());
jgen.writeObjectField("authorizationProvider", ccontext.authorizationProvider());
jgen.writeObjectField("configuration", ccontext.configuration());
jgen.writeObjectField("desc", ccontext.toString());
jgen.writeEndObject();
}
}

View File

@ -1,54 +0,0 @@
package org.gcube.social_networking.rest.examples.serializers;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.Base64;
import java.util.HashMap;
import org.gcube.com.fasterxml.jackson.core.type.TypeReference;
import org.gcube.com.fasterxml.jackson.databind.ObjectMapper;
import org.gcube.com.fasterxml.jackson.databind.module.SimpleModule;
import org.gcube.smartgears.configuration.container.ContainerConfiguration;
import org.gcube.smartgears.context.container.ContainerContext;
import org.gcube.smartgears.security.SimpleCredentials;
/**
* Jackson Serialization utils for Smartgear Context classes
*
* @author Alfredo Oliviero (ISTI-CNR)
*
*/
public class IdmObjectSerializator {
private static ObjectMapper serializer = null;
protected static TypeReference<HashMap<String, Object>> typeRefHashmap = new TypeReference<HashMap<String, Object>>() {
};
public static String decodeBase64String(String encodedString) {
return new String(Base64.getUrlDecoder().decode(encodedString), StandardCharsets.UTF_8);
}
public static HashMap<String, Object> jsonStringToHasmap(String jsonString)
throws IOException {
return getSerializer().readValue(jsonString, typeRefHashmap);
}
public static ObjectMapper getSerializer() {
if (serializer == null) {
ObjectMapper om = new ObjectMapper();
SimpleModule module = new SimpleModule();
// module.addSerializer(Owner.class, new OwnerSerializer());
module.addSerializer(ContainerConfiguration.class, new ContainerConfigurationSerializer());
module.addSerializer(ContainerContext.class, new ContainerContextSerializer());
module.addSerializer(SimpleCredentials.class, new SimpleCredentialsSerializer());
// DecodedJWT serialization
//om.registerModule(new JavaTimeModule());
serializer = om;
}
return serializer;
}
}

View File

@ -1,47 +0,0 @@
package org.gcube.social_networking.rest.examples.serializers;
import java.io.IOException;
import org.gcube.common.security.Owner;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.ser.std.StdSerializer;
/**
* Jackson serializer for Owner
*
* @author Alfredo Oliviero (ISTI-CNR)
*
*/
public class OwnerSerializer extends StdSerializer<Owner> {
protected OwnerSerializer(Class<Owner> t) {
super(t);
}
public OwnerSerializer() {
super(Owner.class, true);
}
@Override
public void serialize(Owner owner, JsonGenerator jgen, SerializerProvider provider) throws IOException {
jgen.writeStartObject();
jgen.writeStringField("ownerId", owner.getId());
jgen.writeStringField("clientName", owner.getClientName());
jgen.writeArrayFieldStart("roles");
for (String role : owner.getRoles()) {
jgen.writeString(role);
}
jgen.writeEndArray();
jgen.writeStringField("email", owner.getEmail());
jgen.writeStringField("firstName", owner.getFirstName());
jgen.writeStringField("lastName", owner.getLastName());
jgen.writeBooleanField("externalClient", owner.isExternalClient());
jgen.writeStringField("contactPerson", owner.getClientName());
jgen.writeStringField("contactOrganisation", owner.getContactOrganisation());
jgen.writeEndObject();
}
}

View File

@ -1,64 +0,0 @@
package org.gcube.social_networking.rest.examples.serializers;
import java.io.IOException;
import org.gcube.common.encryption.encrypter.StringEncrypter;
import org.gcube.common.resources.gcore.ServiceEndpoint;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.ser.std.StdSerializer;
/**
* Jackson serializer for ServiceEndpoint.AccessPoint
*
* @author Alfredo Oliviero (ISTI-CNR)
*
*/
public class ServiceEndpointAccessPointSerializer extends StdSerializer<ServiceEndpoint.AccessPoint> {
protected ServiceEndpointAccessPointSerializer(Class<ServiceEndpoint.AccessPoint> t) {
super(t);
}
public ServiceEndpointAccessPointSerializer() {
super(ServiceEndpoint.AccessPoint.class, true);
}
@Override
public void serialize(ServiceEndpoint.AccessPoint accessPoint, JsonGenerator jgen, SerializerProvider provider)
throws IOException {
jgen.writeStartObject();
String error = null;
String clientSecret = null;
try {
clientSecret = StringEncrypter.getEncrypter().decrypt(accessPoint.password());
} catch (Exception e) {
error = e.getMessage();
}
jgen.writeStringField("address", accessPoint.address());
jgen.writeStringField("name", accessPoint.name());
jgen.writeStringField("description", accessPoint.description());
try {
jgen.writeStringField("username", accessPoint.username());
} catch (Exception e) {
jgen.writeStringField("username", null);
}
try {
jgen.writeStringField("tostring", accessPoint.toString());
} catch (Exception e) {
jgen.writeStringField("tostring", null);
}
if (error != null) {
jgen.writeStringField("key_error", error);
jgen.writeBooleanField("key_decoded", false);
} else {
jgen.writeBooleanField("key_decoded", true);
}
jgen.writeEndObject();
}
}

View File

@ -1,36 +0,0 @@
package org.gcube.social_networking.rest.examples.serializers;
import java.io.IOException;
import org.gcube.smartgears.security.SimpleCredentials;
import org.gcube.com.fasterxml.jackson.core.JsonGenerator;
import org.gcube.com.fasterxml.jackson.databind.SerializerProvider;
import org.gcube.com.fasterxml.jackson.databind.ser.std.StdSerializer;
/**
* Jackson serializer for SimpleCredentials
*
* @author Alfredo Oliviero (ISTI-CNR)
*
*/
public class SimpleCredentialsSerializer extends StdSerializer<SimpleCredentials> {
protected SimpleCredentialsSerializer(Class<SimpleCredentials> t) {
super(t);
}
public SimpleCredentialsSerializer() {
super(SimpleCredentials.class, true);
}
@Override
public void serialize(SimpleCredentials credentials, JsonGenerator jgen, SerializerProvider provider)
throws IOException {
jgen.writeStartObject();
jgen.writeStringField("clientId", credentials.getClientID());
jgen.writeStringField("secret", "[*****]");
jgen.writeEndObject();
}
}

View File

@ -16,7 +16,7 @@ import org.gcube.common.portal.GCubePortalConstants;
import org.gcube.common.portal.PortalContext;
import org.gcube.common.resources.gcore.ServiceEndpoint;
import org.gcube.common.resources.gcore.ServiceEndpoint.AccessPoint;
//import org.gcube.common.scope.api.ScopeProvider;
import org.gcube.common.scope.api.ScopeProvider;
import org.gcube.social_networking.socialnetworking.model.shared.exceptions.TooManyRunningClustersException;
import org.gcube.resources.discovery.client.api.DiscoveryClient;
import org.gcube.resources.discovery.client.queries.api.SimpleQuery;
@ -122,15 +122,15 @@ class CassandraCluster implements Serializable {
scope += readInfrastructureName();
_log.debug("infrastrucute name is null, setting root scope=" + scope);
}
/*String currScope = ScopeProvider.instance.get();
String currScope = ScopeProvider.instance.get();
ScopeProvider.instance.set(scope);
SimpleQuery query = queryFor(ServiceEndpoint.class);
query.addCondition("$resource/Profile/Name/text() eq '"+ RUNTIME_RESOURCE_NAME +"'");
query.addCondition("$resource/Profile/Platform/Name/text() eq '"+ PLATFORM_NAME +"'");
DiscoveryClient<ServiceEndpoint> client = clientFor(ServiceEndpoint.class);
List<ServiceEndpoint> toReturn = client.submit(query);
ScopeProvider.instance.set(currScope);*/
return null;
ScopeProvider.instance.set(currScope);
return toReturn;
}
private String readInfrastructureName() {

View File

@ -1,12 +1,32 @@
package org.gcube.social_networking.server;
import java.rmi.ServerException;
import java.util.List;
import java.util.Map;
import org.gcube.social_networking.socialnetworking.model.shared.IdResource;
import javax.mail.internet.AddressException;
import org.gcube.social_networking.socialnetworking.model.shared.Attachment;
import org.gcube.social_networking.socialnetworking.model.shared.Comment;
import org.gcube.social_networking.socialnetworking.model.shared.Invite;
import org.gcube.social_networking.socialnetworking.model.shared.InviteOperationResult;
import org.gcube.social_networking.socialnetworking.model.shared.InviteStatus;
import org.gcube.social_networking.socialnetworking.model.shared.Like;
import org.gcube.social_networking.socialnetworking.model.shared.Notification;
import org.gcube.social_networking.socialnetworking.model.shared.NotificationChannelType;
import org.gcube.social_networking.socialnetworking.model.shared.NotificationType;
import org.gcube.social_networking.socialnetworking.model.shared.Post;
import org.gcube.social_networking.socialnetworking.model.shared.RangePosts;
import org.gcube.social_networking.socialnetworking.model.shared.exceptions.ColumnNameNotFoundException;
import org.gcube.social_networking.socialnetworking.model.shared.exceptions.CommentIDNotFoundException;
import org.gcube.social_networking.socialnetworking.model.shared.exceptions.PostIDNotFoundException;
import org.gcube.social_networking.socialnetworking.model.shared.exceptions.PostTypeNotFoundException;
import org.gcube.social_networking.socialnetworking.model.shared.exceptions.InviteIDNotFoundException;
import org.gcube.social_networking.socialnetworking.model.shared.exceptions.InviteStatusNotFoundException;
import org.gcube.social_networking.socialnetworking.model.shared.exceptions.LikeIDNotFoundException;
import org.gcube.social_networking.socialnetworking.model.shared.exceptions.NotificationChannelTypeNotFoundException;
import org.gcube.social_networking.socialnetworking.model.shared.exceptions.NotificationIDNotFoundException;
import org.gcube.social_networking.socialnetworking.model.shared.exceptions.NotificationTypeNotFoundException;
import org.gcube.social_networking.socialnetworking.model.shared.exceptions.PrivacyLevelTypeNotFoundException;
/**
* @author Massimiliano Assante ISTI-CNR
@ -15,104 +35,415 @@ import org.gcube.social_networking.socialnetworking.model.shared.InviteOperation
*/
public interface SocialDBDriver {
/**
* create a resource in the DB
* save a Post instance in the store
* @return true if everything went fine
*/
Boolean create(IdResource resource);
boolean saveUserPost(Post post);
/**
* create a child resource given its parent id in the DB
* Save a Post instance in the store having more than one attachment
* Use this if you need to attach more than one file to the post
*
* @param attachments a list of attachments starting from the second
* @return true if everything went fine
*/
Boolean createChildOf(String parentid, IdResource childResource, String parentResourceName);
boolean saveUserPost(Post post, List<Attachment> attachments);
/**
* batch create a child resource given its parent id in the DB
* delete a post from the store
* @throws PostIDNotFoundException
* @return true if everything went fine
*/
Boolean BatchCreateChildOfWithParameter(String parentid, String parameterName, String parameterValue, List<IdResource> childResource, String parentResourceName, String childResourceName);
boolean deletePost(String postid) throws PostIDNotFoundException, PrivacyLevelTypeNotFoundException, PostTypeNotFoundException, ColumnNameNotFoundException;
/**
* save a post in the VRES TimeLine in the store
* @param postKey the post id
* @param vreid vre identifier
* @throws PostIDNotFoundException
*/
boolean savePostToVRETimeline(String postKey, String vreid) throws PostIDNotFoundException;
/**
* save a Post instance in the store
* @return true if everything went fine
*/
boolean saveAppPost(Post post);
/**
* Save a Post instance in the store
* Use this if your app needs to attach more than one file to the post
*
* @param attachments a list of attachments starting from the second
* @return true if everything went fine
*/
boolean saveAppPost(Post post, List<Attachment> attachments);
/**
* read a post from a given id
* @throws PrivacyLevelTypeNotFoundException
* @throws PostTypeNotFoundException
* @throws ColumnNameNotFoundException
*/
Post readPost(String postid) throws PrivacyLevelTypeNotFoundException, PostTypeNotFoundException, PostIDNotFoundException, ColumnNameNotFoundException;
/**
* @param userid user identifier
* return all the posts belonging to the userid
* @throws PostTypeNotFoundException
* @throws PrivacyLevelTypeNotFoundException
* @throws ColumnNameNotFoundException
*/
List<Post> getAllPostsByUser(String userid) throws PrivacyLevelTypeNotFoundException, PostTypeNotFoundException, PostIDNotFoundException, ColumnNameNotFoundException;
/**
* @param appid application identifier
* return all the posts belonging to the appid
* @throws PostTypeNotFoundException
* @throws PrivacyLevelTypeNotFoundException
* @throws ColumnNameNotFoundException
*/
List<Post> getAllPostsByApp(String appid) throws PrivacyLevelTypeNotFoundException, PostTypeNotFoundException, PostIDNotFoundException, ColumnNameNotFoundException;
/**
* @param userid the user identifier like andrea.rossi
* @param timeInMillis the initial time in millis to be considered
* @return a list of posts commented by userid starting from timeInMillis
* @throws Exception
*/
List<Post> getRecentCommentedPostsByUserAndDate(String userid, long timeInMillis) throws Exception;
/**
* return all the posts whose Level is PORTAL
* @throws PrivacyLevelTypeNotFoundException
* @throws ColumnNameNotFoundException
* @throws PrivacyLevelTypeNotFoundException
*/
List<Post> getAllPortalPrivacyLevelPosts() throws PostTypeNotFoundException, ColumnNameNotFoundException, PrivacyLevelTypeNotFoundException;
/**
* return the most recent posts for this user up to quantity param
* @param userid user identifier
* @param quantity the number of most recent posts for this user
* @return a <class>List</class> of most recent posts for this user
* @throws PostTypeNotFoundException
* @throws PrivacyLevelTypeNotFoundException
* @throws ColumnNameNotFoundException
*/
List<Post> getRecentPostsByUser(String userid, int quantity) throws PrivacyLevelTypeNotFoundException, PostTypeNotFoundException, ColumnNameNotFoundException, PostIDNotFoundException;
/**
* @param vreid vre identifier
* return all the posts belonging to the userid
* @throws PostTypeNotFoundException
* @throws PrivacyLevelTypeNotFoundException
* @throws ColumnNameNotFoundException
*/
List<Post> getAllPostsByVRE(String vreid) throws PrivacyLevelTypeNotFoundException, PostTypeNotFoundException, ColumnNameNotFoundException, PostIDNotFoundException;
/**
* return the most recent posts for this vre up to quantity param
* @param vreid VRES identifier
* @param quantity the number of most recent posts for this vre
* @return a <class>List</class> of most recent posts for this vre
* @throws PostTypeNotFoundException
* @throws PrivacyLevelTypeNotFoundException
* @throws ColumnNameNotFoundException
*/
List<Post> getRecentPostsByVRE(String vreid, int quantity) throws IllegalArgumentException, PrivacyLevelTypeNotFoundException, PostTypeNotFoundException, ColumnNameNotFoundException, PostIDNotFoundException;
/**
* return the most recent posts for this vre up to quantity param and the last index of the posts in the timeline
* lastReturnedPostTimelineIndex is useful to know from where to start the range the next time you ask, because there are deletions
*
* @param vreid VRES identifier
* @param from the range start (most recent posts for this vre) has to be greater than 0
* @param quantity the number of most recent posts for this vre starting from "from" param
* @return a <class>RangePosts</class> containing of most recent posts for this vre
* @throws PostTypeNotFoundException
* @throws PrivacyLevelTypeNotFoundException
* @throws ColumnNameNotFoundException
*/
RangePosts getRecentPostsByVREAndRange(String vreid, int from, int quantity) throws PrivacyLevelTypeNotFoundException, PostTypeNotFoundException, ColumnNameNotFoundException, PostIDNotFoundException;
/**
* @param userid user identifier
* @param timeInMillis time in milliseconds from which you want to start retrieve the posts
* @return the number of posts in the range from: today to: timeInMillis
*/
List<Post> getRecentPostsByUserAndDate(String userid, long timeInMillis) throws IllegalArgumentException;
/**
* save a Notification instance in the store
* @return true if everything went fine
*/
boolean saveNotification(Notification notification);
/**
* set an existing Notification instance in the to read
* @return true if everything went fine
*/
boolean setNotificationRead(String notificationidToSet) throws NotificationIDNotFoundException, NotificationTypeNotFoundException, ColumnNameNotFoundException;
/**
* read a notification from a given id
* @throws {@link ColumnNameNotFoundException}
* @throws {@link NotificationIDNotFoundException}
* @throws {@link NotificationTypeNotFoundException}
*/
Notification readNotification(String notificationid) throws NotificationIDNotFoundException, NotificationTypeNotFoundException, ColumnNameNotFoundException;
/**
* read a resource given its id from the DB
* @param userid user identifier
* @param limit set 0 to get everything, an int to get the most recent -limit- notifications
* return all the notifications belonging to the userid up to limit, set 0 to get everything
* @throws NotificationTypeNotFoundException
* @throws ColumnNameNotFoundException
*/
IdResource read(String id, String resourceName);
List<Notification> getAllNotificationByUser(String userid, int limit) throws NotificationTypeNotFoundException, ColumnNameNotFoundException, NotificationIDNotFoundException;
/**
* check attribute value of a resource given its id from the DB
*
* @param userid user identifier
* @param from the range start has to be greater than 0
* @param quantity the number of most recent notifications for this user starting from "from" param
* @return all the notifications for the userid in the range requested
* @throws NotificationTypeNotFoundException
* @throws ColumnNameNotFoundException
* @throws NotificationIDNotFoundException
*/
Boolean check(String id, String parameterName, String parameterValue, String resourceName);
List<Notification> getRangeNotificationsByUser(String userid, int from, int quantity) throws NotificationTypeNotFoundException, ColumnNameNotFoundException, NotificationIDNotFoundException;
/**
* check attribute value of a child resource given its parent id from the DB
* This is a fast way to set all notification to read quickly
* @param userid
* @return true if everything went fine
* @throws {@link ColumnNameNotFoundException}
* @throws {@link NotificationIDNotFoundException}
* @throws {@link NotificationTypeNotFoundException}
*/
Boolean checkChildOf(String parentid, String parameterName, String parameterValue, String parentResourceName, String childResourceName);
boolean setAllNotificationReadByUser(String userid) throws NotificationIDNotFoundException, NotificationTypeNotFoundException, ColumnNameNotFoundException;
/**
* list all instances of a resource in the DB
* return the not yet read notifications (not including messages)
* @param userid user identifier
* @return a <class>List</class> of not yet read notifications for this user
* @throws NotificationTypeNotFoundException
* @throws ColumnNameNotFoundException
*/
List<IdResource> readAll(String resourceName);
List<Notification> getUnreadNotificationsByUser(String userid) throws NotificationTypeNotFoundException, ColumnNameNotFoundException, NotificationIDNotFoundException;
/**
* read a list of the children of a resource given its id from the DB
*
* @param userid user identifier
* @throws ColumnNameNotFoundException
* @throws NotificationTypeNotFoundException
* @throws NotificationIDNotFoundException
* @return true if there are unread notifications (not including messages), false if they are all read
*/
List<IdResource>readChildOf(String parentid, String parentResourceName, String childResourceName);
boolean checkUnreadNotifications(String userid) throws NotificationIDNotFoundException, NotificationTypeNotFoundException, ColumnNameNotFoundException;
/**
* read a list of resources with a specific attribute value
*
* @param userid user identifier
* @throws ColumnNameNotFoundException
* @throws NotificationTypeNotFoundException self explaining
* @throws NotificationChannelTypeNotFoundException self explaining
* @throws NotificationIDNotFoundException
* @return true if there are unread messages notifications (including messages), false if they are all read
*/
List<IdResource> readWithParameter(String parameterName, String parameterValue, String resourceName);
/**
* read a list of the children of a resource with a specific attribute value
*/
List<IdResource> readChildOfWithParameter(String parentid, String parameterName, String parameterValue, String parentResourceName, String childResourceName);
/**
* update a resource given its id in the DB
*/
Boolean update(IdResource resource);
/**
* update a child resource given its id and its parent id in the DB
*/
Boolean updateChildOf(String parentid, String childid, IdResource childResource, String parentResourceName);
/**
* Batch update a child resource given its id and its parent id in the DB
*/
Boolean BatchUpdateChildOf(String parentid, List<IdResource> childResource, String parentResourceName);
/**
* update a resource with a certain attribute value
*/
Boolean updateWithParameter(String parameterName, String parameterValue, IdResource resource);
/**
* update a child resource with a certain attribute value given its parent id
*/
Boolean updateChildOfWithParameter(String parentid, String parameterName, String parameterValue, IdResource childResource,String parentResourceName);
boolean checkUnreadMessagesNotifications(String userid) throws NotificationIDNotFoundException, NotificationTypeNotFoundException, ColumnNameNotFoundException;
/**
* delete a resource given its id in the DB
* return the channels a user chose for being notified for a given notification type
* @param userid user identifier
* @param notificationType the type of the notification
* @return a list of <class>NotificationChannelType</class> that represents the channels this user wants to be notified
*/
Boolean delete(String id, String resourceName);
List<NotificationChannelType> getUserNotificationChannels(String userid, NotificationType notificationType) throws NotificationChannelTypeNotFoundException, NotificationTypeNotFoundException;
/**
* delete a child resource given its id and its parent id in the DB
* set the notification preferences map (enable or disable the channels to be used for notifying the user)
* @param userid user identifier
* @param enabledChannels a map of the channels to which reach the user per notification, empty array or null values to set the key notification type off
* @return true if everything was fine
*/
Boolean deleteChildOf(String parentid, String childid, String childResourceName);
boolean setUserNotificationPreferences(String userid, Map<NotificationType, NotificationChannelType[]> enabledChannels);
/**
* delete resources with a certain attribute value
* get the notification preferences map (enableor disable the channels to be used for notifying the user)
* @param userid user identifier
* @return the map
* @throws NotificationTypeNotFoundException self explaining
* @throws NotificationChannelTypeNotFoundException self explaining
*/
Boolean deleteWithParameter(String parameterName, String parameterValue, String resourceName);
Map<NotificationType, NotificationChannelType[]> getUserNotificationPreferences(String userid) throws NotificationTypeNotFoundException, NotificationChannelTypeNotFoundException;
/**
* delete a child resource with a certain attribute value given its parent id
* @param commentId comment unique identifier
* @return the comment belonging to the commentId
* @throws CommentIDNotFoundException
*/
Boolean deleteChildOfWithParameter(String parentid, String childid, String parameterName, String parameterValue, String parentResourceName, String childResourceName);
Comment readCommentById(String commentId) throws CommentIDNotFoundException;
/**
* batch delete a child resource with a certain attribute value given its parent id
* add a comment to a post
* @param comment the Comment instance to add
*/
Boolean BatchDeleteChildOfWithParameter(String parentid, String parameterName, String parameterValue, List<IdResource> childResource, String parentResourceName, String childResourceName);
boolean addComment(Comment comment) throws PostIDNotFoundException;
/**
* @param postid the post identifier
* return all the comments belonging to the postid
*/
List<Comment> getAllCommentByPost(String postid);
/**
* @param userid user identifier
* @param timeInMillis time in milliseconds from which you want to start retrieve the posts
* @return a list of comments (sorted starting from the most recent one) made by the user since timeInMillis up to now
*/
List<Comment> getRecentCommentsByUserAndDate(String userid, long timeInMillis) throws Exception;
/**
* edit a comment
* @param comment the comment to edit
* @return true if success, false otherwise
*/
boolean editComment(Comment comment) throws PrivacyLevelTypeNotFoundException, PostTypeNotFoundException, ColumnNameNotFoundException, CommentIDNotFoundException, PostIDNotFoundException;
/**
* deletes a comment
* @param commentid the comment identifier to delete
* @param postid the postid to which the comment is associated
* @return true if success, false otherwise
*/
boolean deleteComment(String commentid, String postid) throws PrivacyLevelTypeNotFoundException, PostTypeNotFoundException, ColumnNameNotFoundException, CommentIDNotFoundException, PostIDNotFoundException;
/**
* add a like to a post
* @param like instance
* @throws PostIDNotFoundException
*/
boolean like(Like like) throws PostIDNotFoundException;
/**
* unlike a post
* @param userid user identifier
* @param likeid the like identifier to delete
* @param postid the postid to which the comment is associated
* @return true if success, false otherwise
*/
boolean unlike(String userid, String likeid, String postid) throws PrivacyLevelTypeNotFoundException, PostTypeNotFoundException, ColumnNameNotFoundException, LikeIDNotFoundException, PostIDNotFoundException;
/**
* @param userid user identifier
* return all the postids a user has liked
*/
List<String> getAllLikedPostIdsByUser(String userid);
/**
* @param userid user identifier
* @param limit set 0 to get everything, an int to get the most recent -limit- liked posts
* @throws ColumnNameNotFoundException .
* @throws PostIDNotFoundException .
* @throws PostTypeNotFoundException .
* @throws PrivacyLevelTypeNotFoundException
* return all the posts a user has liked
*/
List<Post> getAllLikedPostsByUser(String userid, int limit) throws PrivacyLevelTypeNotFoundException, PostTypeNotFoundException, PostIDNotFoundException, ColumnNameNotFoundException;
/**
* @param userid user identifier
* @param timeInMillis time in milliseconds from which you want to start retrieve the posts
* @return the likes made to posts in the range from: today to: timeInMillis
*/
List<Post> getRecentLikedPostsByUserAndDate(String userid, long timeInMillis) throws IllegalArgumentException;
/**
* @param postid postid identifier
* return all the likes belonging to the postid
*/
List<Like> getAllLikesByPost(String postid);
/**
*
* @param hashtags the hashtag including the '#'
* @param postid the postid to which the hashtag is associated
* @param vreid VRE identifier
* @return true if success, false otherwise
* @throws PostIDNotFoundException
*/
boolean saveHashTags(String postid, String vreid, List<String> hashtags) throws PostIDNotFoundException;
/**
*
* @param hashtags the hashtag including the '#'
* @param commentId the commentId to which the hashtag is associated
* @param vreid VRE identifier
* @return true if success, false otherwise
* @throws CommentIDNotFoundException
*/
boolean saveHashTagsComment(String commentId, String vreid, List<String> hashtags) throws CommentIDNotFoundException;
/**
*
* @param hashtags the hashtag including the '#'
* @param postid the postid to which the hashtag is associated
* @param vreid VRE identifier
* @return true if success, false otherwise
* @throws PostIDNotFoundException
*/
boolean deleteHashTags(String postid, String vreid, List<String> hashtags) throws PostIDNotFoundException;
/**
*
* @param hashtags the hashtag including the '#'
* @param commentId the commentId to which the hashtag is associated
* @param vreid VRE identifier
* @return true if success, false otherwise
* @throws CommentIDNotFoundException
*/
boolean deleteHashTagsComment(String commentId, String vreid, List<String> hashtags) throws CommentIDNotFoundException;
/**
* get a map of vre hashtags where the key is the hashtag and the value is the occurrence of the hashtag in the VRE
* @param vreid vre identifier (scope)
* @return a HashMap<String, Integer> of vre Hashtags associated with their occurrence
*/
Map<String, Integer> getVREHashtagsWithOccurrence(String vreid);
/**
* get a map of vre hashtags where the key is the hashtag and the value is the occurrence of the hashtag in the VRE
* @param vreid vre identifier (scope)
* @param timestamp do not consider hashtags used before timestamp
* @return a HashMap<String, Integer> of vre Hashtags associated with their occurrence
*/
Map<String, Integer> getVREHashtagsWithOccurrenceFilteredByTime(String vreid, long timestamp);
/**
*
* @param vreid VRE identifier
* @param hashtag the hashtag to look for including the '#', it is case sensitive
* @throws ColumnNameNotFoundException .
* @throws PostIDNotFoundException .
* @throws PostTypeNotFoundException .
* @throws PrivacyLevelTypeNotFoundException
* @return all the posts having the hashtag passed as parameter
*/
List<Post> getVREPostsByHashtag(String vreid, String hashtag) throws PrivacyLevelTypeNotFoundException, PostTypeNotFoundException, PostIDNotFoundException, ColumnNameNotFoundException;
/**
* Save the invite for a given email into a given vre
* @param invite the invite object instanc to save
* @return {@link InviteOperationResult} SUCCESS, FAILED or ALREADY_INVITED (if an invite is sent to en existing email in the same environment more than once)
*/
InviteOperationResult saveInvite(Invite invite) throws AddressException;
/**
*
* @param vreid the environment where you want to check the invite
* @param email the email of the invite to check in the environmnet
* @return the InviteId if present, null otherwise
*/
String isExistingInvite(String vreid, String email);
/**
* read an invite from a given id
* @throws InviteIDNotFoundException
* @throws InviteStatusNotFoundException
*/
Invite readInvite(String inviteid) throws InviteIDNotFoundException, InviteStatusNotFoundException;
/**
* set the status of an invite, see {@link InviteStatus}
* @throws InviteIDNotFoundException
*/
boolean setInviteStatus(String vreid, String email, InviteStatus status) throws InviteIDNotFoundException, InviteStatusNotFoundException;
/**
* Use to get the list of invites per VRE
* @param vreid the vre id
* @param status optional, if you want to restict on the status, e.g. all pending invites
* @return return the list of invites
* @throws InviteIDNotFoundException
* @throws InviteStatusNotFoundException
*/
List<Invite> getInvitedEmailsByVRE(String vreid, InviteStatus... status) throws InviteIDNotFoundException, InviteStatusNotFoundException;
/**
*
* @param postId
* @return the list of attachments of the post postId, starting from the second one (first attachment is included in post instance already)
*/
List<Attachment> getAttachmentsByPostId(String postId) throws PostIDNotFoundException;
/**
* save an attachment
*/
boolean saveAttachmentEntry(String postId, Attachment toSave);
//RangePosts getRecentPostsByVREAndRange(String vreid, int from, int quantity) throws PrivacyLevelTypeNotFoundException, PostTypeNotFoundException, ColumnNameNotFoundException, PostIDNotFoundException;
//List<Notification> getRangeNotificationsByUser(String userid, int from, int quantity) throws NotificationTypeNotFoundException, ColumnNameNotFoundException, NotificationIDNotFoundException;
InviteOperationResult saveInvite(Invite invite) throws ServerException;
/**
* Retrieve all the ids of the vre
* @return the set of ids of the vre available or empty list in case of errors.
*/
public List<String> getAllVREIds();
/**
* close the connection to the underlying database
*/
void closeConnection();
}

View File

@ -1,36 +0,0 @@
package org.gcube.social_networking.utils;
import java.util.Map;
import org.gcube.common.security.providers.SecretManagerProvider;
import org.gcube.common.security.secrets.Secret;
import org.gcube.smartgears.ContextProvider;
import org.gcube.smartgears.configuration.container.ContainerConfiguration;
import org.gcube.smartgears.context.application.ApplicationContext;
import org.gcube.smartgears.context.container.ContainerContext;
public class InfrastructureUtils {
/**
* Retrieve the secret from smartgear configuration
*
* @return Secret
*/
public static Secret getSecretForInfrastructure() {
ApplicationContext ctx = ContextProvider.get();
ContainerContext container = ctx.container();
ContainerConfiguration configuration = container.configuration();
String infra_context = configuration.infrastructure();
Secret secret = ctx.container().authorizationProvider().getSecretForContext(infra_context);
return secret;
}
public static String getAccessToken() {
Map<String, String> authorizations = SecretManagerProvider.get().getHTTPAuthorizationHeaders();
String access_token = authorizations.get("Authorization").replace("Bearer", "").trim();
return access_token;
}
}

View File

@ -1,15 +0,0 @@
package org.gcube.social_networking.utils;
public class ParameterNames {
public static final String RECENT_LIMIT = "recent_limit";
public static final String RECENT_COMMENT = "recent_comment";
public static final String UNREAD = "unread";
public static final String UNREAD_MESSAGE = "unread_message";
public static final String RECENT_LIKE = "recent_like";
public static final String ALL_LIKE = "all_like";
public static final String TIME = "time";
public static final String HASHTAG = "hashtag";
public static final String STATUS = "status";
public static final String EMAIL = "email";
public static final String NOTIFICATION_TYPE = "notification_type";
}

View File

@ -1,19 +0,0 @@
package org.gcube.social_networking.utils;
import org.gcube.social_networking.socialnetworking.model.shared.*;
public class ResourceNames {
public static final String NOTIFICATION = Notification.class.getSimpleName();
public static final String POST = Post.class.getSimpleName();
public static final String COMMENT = Comment.class.getSimpleName();
public static final String LIKE = Like.class.getSimpleName();
public static final String INVITE = Invite.class.getSimpleName();
public static final String HASHTAG = Hashtag.class.getSimpleName();
public static final String Attachment = Attachment.class.getSimpleName();
public static final String VRE = Vre.class.getSimpleName();
public static final String USER = "User";
public static final String APP = "App";
public static final String NOTIFICATION_PREFERENCES = NotificationPreference.class.getSimpleName();
}

View File

@ -1,77 +0,0 @@
package org.gcube.social_networking.utils;
import java.io.Serializable;
/**
* Response bean
*
*/
public class ResponseBean <T> implements Serializable {
private static final long serialVersionUID = -2725238162673879658L;
/**
* The result of the request: true if it succeeded, false otherwise
*/
private boolean success;
/**
* An error message if something wrong happened, null/empty otherwise
*/
private String message;
/**
* The result object of the request
*/
private T result;
public ResponseBean() {
super();
}
/**
* @param success
* @param message
* @param result
*/
public ResponseBean(boolean success, String message, T result) {
super();
this.success = success;
this.message = message;
this.result = result;
}
public boolean isSuccess() {
return success;
}
public void setSuccess(boolean success) {
this.success = success;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public T getResult() {
return result;
}
public void setResult(T result) {
this.result = result;
}
@Override
public String toString() {
return "ResponseBean [success=" + success
+ ", message=" + message + ", result=" + result + "]";
}
}

View File

@ -1,19 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xml>
<web-app>
<context-param>
<param-name>admin-username</param-name>
<param-value>{{adminId}}</param-value>
</context-param>
<context-param>
<param-name>admin-pwd</param-name>
<param-value>{{adminPwd}}</param-value>
</context-param>
<servlet>
<servlet-name>org.gcube.social_networking.SocialService</servlet-name>
<servlet-name>org.gcube.acme.ResourceInitializer</servlet-name>
</servlet>
<servlet-mapping>
<servlet-name>org.gcube.social_networking.SocialService</servlet-name>
<url-pattern>/social-service/*</url-pattern>
<servlet-name>default</servlet-name>
<url-pattern>/docs/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>/api-docs/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>org.gcube.acme.ResourceInitializer</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
</web-app>

139
tree.txt
View File

@ -1,139 +0,0 @@
[INFO] Scanning for projects...
[INFO]
[INFO] -------------< org.gcube.social_networking:social-service >-------------
[INFO] Building Social Service 1.0.0-SNAPSHOT
[INFO] from pom.xml
[INFO] --------------------------------[ war ]---------------------------------
[INFO]
[INFO] --- dependency:3.6.1:tree (default-cli) @ social-service ---
[INFO] org.gcube.social_networking:social-service:war:1.0.0-SNAPSHOT
[INFO] +- org.slf4j:slf4j-api:jar:2.0.12:provided
[INFO] +- org.glassfish.jersey.containers:jersey-container-servlet:jar:3.1.5:compile
[INFO] | +- org.glassfish.jersey.core:jersey-common:jar:3.1.5:compile
[INFO] | | +- jakarta.annotation:jakarta.annotation-api:jar:2.1.1:compile
[INFO] | | \- org.glassfish.hk2:osgi-resource-locator:jar:1.0.3:compile
[INFO] | +- org.glassfish.jersey.core:jersey-server:jar:3.1.5:compile
[INFO] | | +- org.glassfish.jersey.core:jersey-client:jar:3.1.5:compile
[INFO] | | \- jakarta.validation:jakarta.validation-api:jar:3.0.2:compile
[INFO] | \- jakarta.ws.rs:jakarta.ws.rs-api:jar:3.1.0:compile
[INFO] +- org.glassfish.jersey.containers:jersey-container-servlet-core:jar:3.1.5:compile
[INFO] | \- jakarta.inject:jakarta.inject-api:jar:2.0.1:compile
[INFO] +- org.gcube.core:common-smartgears-app:jar:3.0.1-SNAPSHOT:compile
[INFO] | +- org.javassist:javassist:jar:3.20.0-GA:compile
[INFO] | \- com.google.guava:guava:jar:18.0:provided
[INFO] +- org.gcube.core:common-smartgears:jar:4.0.0-SNAPSHOT:provided
[INFO] | +- org.reflections:reflections:jar:0.9.12:provided
[INFO] | +- org.yaml:snakeyaml:jar:2.2:provided
[INFO] | +- io.github.classgraph:classgraph:jar:4.8.28:provided
[INFO] | +- org.gcube.common:health-api:jar:1.0.0-SNAPSHOT:provided
[INFO] | +- org.gcube.common:gcube-jackson-databind:jar:2.8.11:provided
[INFO] | +- org.gcube.common:gcube-jackson-annotations:jar:2.8.11:provided
[INFO] | +- org.gcube.common:gcube-jackson-core:jar:2.8.11:provided
[INFO] | +- org.gcube.common:common-security:jar:1.0.1-SNAPSHOT:provided
[INFO] | +- org.gcube.data.publishing:document-store-lib:jar:3.0.1-SNAPSHOT:provided
[INFO] | +- org.gcube.accounting:accounting-lib:jar:5.0.0-SNAPSHOT:provided
[INFO] | | +- org.gcube.resources.discovery:ic-client:jar:2.0.0-SNAPSHOT:provided
[INFO] | | | +- org.gcube.resources.discovery:discovery-client:jar:2.0.0-SNAPSHOT:provided
[INFO] | | | \- org.gcube.core:common-gcore-stubs:jar:2.0.0-SNAPSHOT:provided
[INFO] | | +- org.gcube.core:common-encryption:jar:2.0.0-SNAPSHOT:provided
[INFO] | | \- org.gcube.common:common-utility-sg4:jar:1.0.1-SNAPSHOT:provided
[INFO] | | \- org.gcube.common:gxHTTP:jar:2.0.0-SNAPSHOT:provided
[INFO] | +- org.ini4j:ini4j:jar:0.5.4:provided
[INFO] | +- org.gcube.core:common-validator:jar:1.1.0:provided
[INFO] | +- org.gcube.core:common-events:jar:1.0.2:provided
[INFO] | +- org.gcube.common.security:gcube-secrets:jar:1.0.1:provided
[INFO] | | +- org.gcube.common:keycloak-client:jar:2.1.0-SNAPSHOT:provided
[INFO] | | | +- org.gcube.common:gxJRS:jar:2.0.0-SNAPSHOT:provided
[INFO] | | | | \- javax.ws.rs:javax.ws.rs-api:jar:2.0.1:provided
[INFO] | | | +- io.jsonwebtoken:jjwt-api:jar:0.12.5:provided
[INFO] | | | \- io.jsonwebtoken:jjwt-impl:jar:0.12.5:provided
[INFO] | | \- com.auth0:java-jwt:jar:4.4.0:provided
[INFO] | +- io.micrometer:micrometer-core:jar:1.9.0:provided
[INFO] | | +- org.hdrhistogram:HdrHistogram:jar:2.1.12:compile
[INFO] | | \- org.latencyutils:LatencyUtils:jar:2.0.3:provided
[INFO] | +- io.micrometer:micrometer-registry-prometheus:jar:1.9.0:provided
[INFO] | | \- io.prometheus:simpleclient_common:jar:0.15.0:provided
[INFO] | | \- io.prometheus:simpleclient:jar:0.15.0:provided
[INFO] | | +- io.prometheus:simpleclient_tracer_otel:jar:0.15.0:provided
[INFO] | | | \- io.prometheus:simpleclient_tracer_common:jar:0.15.0:provided
[INFO] | | \- io.prometheus:simpleclient_tracer_otel_agent:jar:0.15.0:provided
[INFO] | \- org.gcube.resources:common-gcore-resources:jar:2.0.0-SNAPSHOT:provided
[INFO] | +- jakarta.xml.ws:jakarta.xml.ws-api:jar:4.0.1:provided
[INFO] | | \- jakarta.xml.soap:jakarta.xml.soap-api:jar:3.0.1:provided
[INFO] | \- com.sun.xml.ws:jaxws-rt:jar:4.0.2:provided
[INFO] | +- org.glassfish.ha:ha-api:jar:3.1.13:provided
[INFO] | +- org.glassfish.external:management-api:jar:3.2.3:provided
[INFO] | +- org.glassfish.gmbal:gmbal-api-only:jar:4.0.3:provided
[INFO] | +- org.jvnet.staxex:stax-ex:jar:2.1.0:provided
[INFO] | +- com.sun.xml.stream.buffer:streambuffer:jar:2.1.0:provided
[INFO] | +- org.jvnet.mimepull:mimepull:jar:1.10.0:provided
[INFO] | +- com.sun.xml.fastinfoset:FastInfoset:jar:2.1.0:provided
[INFO] | +- org.eclipse.angus:angus-activation:jar:2.0.1:provided
[INFO] | +- org.eclipse.angus:angus-mail:jar:2.0.2:provided
[INFO] | +- com.sun.xml.messaging.saaj:saaj-impl:jar:3.0.3:provided
[INFO] | +- com.fasterxml.woodstox:woodstox-core:jar:6.5.1:provided
[INFO] | \- org.codehaus.woodstox:stax2-api:jar:4.2.2:provided
[INFO] +- org.gcube.core:common-scope:jar:2.0.0-SNAPSHOT:provided
[INFO] | +- jakarta.xml.bind:jakarta.xml.bind-api:jar:4.0.1:compile
[INFO] | | \- jakarta.activation:jakarta.activation-api:jar:2.1.3:compile
[INFO] | \- com.sun.xml.bind:jaxb-impl:jar:4.0.4:provided
[INFO] | \- com.sun.xml.bind:jaxb-core:jar:4.0.4:provided
[INFO] +- org.gcube.core:common-scope-maps:jar:1.1.1:provided
[INFO] +- org.gcube.common:authorization-client:jar:3.0.1-SNAPSHOT:compile
[INFO] | \- org.gcube.common:common-authorization:jar:3.0.1-SNAPSHOT:compile
[INFO] +- org.gcube.social-networking:social-service-model:jar:2.0.0-SNAPSHOT:compile
[INFO] | +- org.gcube.common:storagehub-model:jar:2.0.0-SNAPSHOT:compile
[INFO] | +- com.fasterxml.jackson.core:jackson-annotations:jar:2.8.11:compile
[INFO] | +- com.googlecode.json-simple:json-simple:jar:1.1.1:compile
[INFO] | \- com.google:gwt-jsonmaker:jar:1.2.1:provided
[INFO] +- com.datastax.oss:java-driver-query-builder:jar:4.13.0:compile
[INFO] | +- com.datastax.oss:java-driver-core:jar:4.13.0:compile
[INFO] | | +- com.datastax.oss:native-protocol:jar:1.5.0:compile
[INFO] | | +- io.netty:netty-handler:jar:4.1.60.Final:compile
[INFO] | | | +- io.netty:netty-common:jar:4.1.60.Final:compile
[INFO] | | | +- io.netty:netty-resolver:jar:4.1.60.Final:compile
[INFO] | | | +- io.netty:netty-buffer:jar:4.1.60.Final:compile
[INFO] | | | +- io.netty:netty-transport:jar:4.1.60.Final:compile
[INFO] | | | \- io.netty:netty-codec:jar:4.1.60.Final:compile
[INFO] | | +- com.typesafe:config:jar:1.4.1:compile
[INFO] | | +- com.github.jnr:jnr-posix:jar:3.1.5:compile
[INFO] | | | +- com.github.jnr:jnr-ffi:jar:2.2.2:compile
[INFO] | | | | +- com.github.jnr:jffi:jar:1.3.1:compile
[INFO] | | | | +- com.github.jnr:jffi:jar:native:1.3.1:runtime
[INFO] | | | | +- org.ow2.asm:asm:jar:9.1:compile
[INFO] | | | | +- org.ow2.asm:asm-commons:jar:9.1:compile
[INFO] | | | | +- org.ow2.asm:asm-analysis:jar:9.1:compile
[INFO] | | | | +- org.ow2.asm:asm-tree:jar:9.1:compile
[INFO] | | | | +- org.ow2.asm:asm-util:jar:9.1:compile
[INFO] | | | | +- com.github.jnr:jnr-a64asm:jar:1.0.0:compile
[INFO] | | | | \- com.github.jnr:jnr-x86asm:jar:1.0.2:compile
[INFO] | | | \- com.github.jnr:jnr-constants:jar:0.10.1:compile
[INFO] | | +- io.dropwizard.metrics:metrics-core:jar:4.1.18:compile
[INFO] | | +- com.esri.geometry:esri-geometry-api:jar:1.2.1:compile
[INFO] | | | +- org.json:json:jar:20090211:compile
[INFO] | | | \- org.codehaus.jackson:jackson-core-asl:jar:1.9.2:provided
[INFO] | | +- com.fasterxml.jackson.core:jackson-core:jar:2.12.2:compile
[INFO] | | +- com.fasterxml.jackson.core:jackson-databind:jar:2.12.2:compile
[INFO] | | \- org.reactivestreams:reactive-streams:jar:1.0.3:compile
[INFO] | +- com.datastax.oss:java-driver-shaded-guava:jar:25.1-jre-graal-sub-1:compile
[INFO] | +- com.github.stephenc.jcip:jcip-annotations:jar:1.0-1:compile
[INFO] | \- com.github.spotbugs:spotbugs-annotations:jar:3.1.12:compile
[INFO] | \- com.google.code.findbugs:jsr305:jar:3.0.2:compile
[INFO] +- com.datastax.oss:java-driver-mapper-runtime:jar:4.13.0:compile
[INFO] +- commons-lang:commons-lang:jar:2.6:provided
[INFO] +- org.gcube.common.portal:portal-manager:jar:2.4.2:provided
[INFO] +- com.webcohesion.enunciate:enunciate-core-annotations:jar:2.14.0:provided
[INFO] +- com.webcohesion.enunciate:enunciate-rt-util:jar:2.14.0:provided
[INFO] +- jakarta.servlet:jakarta.servlet-api:jar:4.0.4:provided
[INFO] +- junit:junit:jar:4.13.2:test
[INFO] | \- org.hamcrest:hamcrest-core:jar:1.3:test
[INFO] +- ch.qos.logback:logback-classic:jar:1.5.0:test
[INFO] | \- ch.qos.logback:logback-core:jar:1.5.0:test
[INFO] +- jakarta.mail:jakarta.mail-api:jar:1.6.7:compile
[INFO] \- net.sf.ehcache:ehcache:jar:2.10.0:compile
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.875 s
[INFO] Finished at: 2024-05-16T15:44:20+02:00
[INFO] ------------------------------------------------------------------------

View File

@ -1,138 +0,0 @@
[INFO] Scanning for projects...
[INFO]
[INFO] -------------< org.gcube.social_networking:social-service >-------------
[INFO] Building Social Service 1.0.0-SNAPSHOT
[INFO] from pom.xml
[INFO] --------------------------------[ war ]---------------------------------
[INFO]
[INFO] --- dependency:3.6.1:tree (default-cli) @ social-service ---
[INFO] org.gcube.social_networking:social-service:war:1.0.0-SNAPSHOT
[INFO] +- org.slf4j:slf4j-api:jar:2.0.12:provided
[INFO] +- org.glassfish.jersey.containers:jersey-container-servlet:jar:3.1.5:compile
[INFO] | +- org.glassfish.jersey.core:jersey-common:jar:3.1.5:compile
[INFO] | | +- jakarta.annotation:jakarta.annotation-api:jar:2.1.1:compile
[INFO] | | \- org.glassfish.hk2:osgi-resource-locator:jar:1.0.3:compile
[INFO] | +- org.glassfish.jersey.core:jersey-server:jar:3.1.5:compile
[INFO] | | +- org.glassfish.jersey.core:jersey-client:jar:3.1.5:compile
[INFO] | | \- jakarta.validation:jakarta.validation-api:jar:3.0.2:compile
[INFO] | \- jakarta.ws.rs:jakarta.ws.rs-api:jar:3.1.0:compile
[INFO] +- org.glassfish.jersey.containers:jersey-container-servlet-core:jar:3.1.5:compile
[INFO] | \- jakarta.inject:jakarta.inject-api:jar:2.0.1:compile
[INFO] +- org.gcube.core:common-smartgears-app:jar:3.0.1-SNAPSHOT:compile
[INFO] | +- org.javassist:javassist:jar:3.20.0-GA:compile
[INFO] | \- com.google.guava:guava:jar:18.0:provided
[INFO] +- org.gcube.core:common-smartgears:jar:4.0.0-SNAPSHOT:provided
[INFO] | +- org.reflections:reflections:jar:0.9.12:provided
[INFO] | +- org.yaml:snakeyaml:jar:2.2:provided
[INFO] | +- io.github.classgraph:classgraph:jar:4.8.28:provided
[INFO] | +- org.gcube.common:health-api:jar:1.0.0-SNAPSHOT:provided
[INFO] | +- org.gcube.common:gcube-jackson-databind:jar:2.8.11:provided
[INFO] | +- org.gcube.common:gcube-jackson-annotations:jar:2.8.11:provided
[INFO] | +- org.gcube.common:gcube-jackson-core:jar:2.8.11:provided
[INFO] | +- org.gcube.common:common-security:jar:1.0.1-SNAPSHOT:provided
[INFO] | +- org.gcube.data.publishing:document-store-lib:jar:3.0.1-SNAPSHOT:provided
[INFO] | +- org.gcube.accounting:accounting-lib:jar:5.0.0-SNAPSHOT:provided
[INFO] | | +- org.gcube.resources.discovery:ic-client:jar:2.0.0-SNAPSHOT:provided
[INFO] | | | +- org.gcube.resources.discovery:discovery-client:jar:2.0.0-SNAPSHOT:provided
[INFO] | | | \- org.gcube.core:common-gcore-stubs:jar:2.0.0-SNAPSHOT:provided
[INFO] | | +- org.gcube.core:common-encryption:jar:2.0.0-SNAPSHOT:provided
[INFO] | | \- org.gcube.common:common-utility-sg4:jar:1.0.1-SNAPSHOT:provided
[INFO] | | \- org.gcube.common:gxHTTP:jar:2.0.0-SNAPSHOT:provided
[INFO] | +- org.ini4j:ini4j:jar:0.5.4:provided
[INFO] | +- org.gcube.core:common-validator:jar:1.1.0:provided
[INFO] | +- org.gcube.core:common-events:jar:1.0.2:provided
[INFO] | +- org.gcube.common.security:gcube-secrets:jar:1.0.1:provided
[INFO] | | +- org.gcube.common:keycloak-client:jar:2.1.0-SNAPSHOT:provided
[INFO] | | | +- org.gcube.common:gxJRS:jar:2.0.0-SNAPSHOT:provided
[INFO] | | | | \- javax.ws.rs:javax.ws.rs-api:jar:2.0.1:provided
[INFO] | | | +- io.jsonwebtoken:jjwt-api:jar:0.12.5:provided
[INFO] | | | \- io.jsonwebtoken:jjwt-impl:jar:0.12.5:provided
[INFO] | | \- com.auth0:java-jwt:jar:4.4.0:provided
[INFO] | +- io.micrometer:micrometer-core:jar:1.9.0:provided
[INFO] | | +- org.hdrhistogram:HdrHistogram:jar:2.1.12:compile
[INFO] | | \- org.latencyutils:LatencyUtils:jar:2.0.3:provided
[INFO] | +- io.micrometer:micrometer-registry-prometheus:jar:1.9.0:provided
[INFO] | | \- io.prometheus:simpleclient_common:jar:0.15.0:provided
[INFO] | | \- io.prometheus:simpleclient:jar:0.15.0:provided
[INFO] | | +- io.prometheus:simpleclient_tracer_otel:jar:0.15.0:provided
[INFO] | | | \- io.prometheus:simpleclient_tracer_common:jar:0.15.0:provided
[INFO] | | \- io.prometheus:simpleclient_tracer_otel_agent:jar:0.15.0:provided
[INFO] | \- org.gcube.resources:common-gcore-resources:jar:2.0.0-SNAPSHOT:provided
[INFO] | +- jakarta.xml.ws:jakarta.xml.ws-api:jar:4.0.1:provided
[INFO] | | \- jakarta.xml.soap:jakarta.xml.soap-api:jar:3.0.1:provided
[INFO] | \- com.sun.xml.ws:jaxws-rt:jar:4.0.2:provided
[INFO] | +- org.glassfish.ha:ha-api:jar:3.1.13:provided
[INFO] | +- org.glassfish.external:management-api:jar:3.2.3:provided
[INFO] | +- org.glassfish.gmbal:gmbal-api-only:jar:4.0.3:provided
[INFO] | +- org.jvnet.staxex:stax-ex:jar:2.1.0:provided
[INFO] | +- com.sun.xml.stream.buffer:streambuffer:jar:2.1.0:provided
[INFO] | +- org.jvnet.mimepull:mimepull:jar:1.10.0:provided
[INFO] | +- com.sun.xml.fastinfoset:FastInfoset:jar:2.1.0:provided
[INFO] | +- org.eclipse.angus:angus-activation:jar:2.0.1:provided
[INFO] | +- org.eclipse.angus:angus-mail:jar:2.0.2:provided
[INFO] | +- com.sun.xml.messaging.saaj:saaj-impl:jar:3.0.3:provided
[INFO] | +- com.fasterxml.woodstox:woodstox-core:jar:6.5.1:provided
[INFO] | \- org.codehaus.woodstox:stax2-api:jar:4.2.2:provided
[INFO] +- org.gcube.core:common-scope:jar:2.0.0-SNAPSHOT:provided
[INFO] | +- jakarta.xml.bind:jakarta.xml.bind-api:jar:4.0.1:compile
[INFO] | | \- jakarta.activation:jakarta.activation-api:jar:2.1.3:compile
[INFO] | \- com.sun.xml.bind:jaxb-impl:jar:4.0.4:provided
[INFO] | \- com.sun.xml.bind:jaxb-core:jar:4.0.4:provided
[INFO] +- org.gcube.core:common-scope-maps:jar:1.1.1:provided
[INFO] +- org.gcube.common:authorization-client:jar:3.0.1-SNAPSHOT:compile
[INFO] | \- org.gcube.common:common-authorization:jar:3.0.1-SNAPSHOT:compile
[INFO] +- org.gcube.social-networking:social-service-model:jar:2.0.0-SNAPSHOT:compile
[INFO] | +- org.gcube.common:storagehub-model:jar:2.0.0-SNAPSHOT:compile
[INFO] | +- com.fasterxml.jackson.core:jackson-annotations:jar:2.8.11:compile
[INFO] | +- com.googlecode.json-simple:json-simple:jar:1.1.1:compile
[INFO] | \- com.google:gwt-jsonmaker:jar:1.2.1:provided
[INFO] +- com.datastax.oss:java-driver-query-builder:jar:4.13.0:compile
[INFO] | +- com.datastax.oss:java-driver-core:jar:4.13.0:compile
[INFO] | | +- com.datastax.oss:native-protocol:jar:1.5.0:compile
[INFO] | | +- io.netty:netty-handler:jar:4.1.60.Final:compile
[INFO] | | | +- io.netty:netty-common:jar:4.1.60.Final:compile
[INFO] | | | +- io.netty:netty-resolver:jar:4.1.60.Final:compile
[INFO] | | | +- io.netty:netty-buffer:jar:4.1.60.Final:compile
[INFO] | | | +- io.netty:netty-transport:jar:4.1.60.Final:compile
[INFO] | | | \- io.netty:netty-codec:jar:4.1.60.Final:compile
[INFO] | | +- com.typesafe:config:jar:1.4.1:compile
[INFO] | | +- com.github.jnr:jnr-posix:jar:3.1.5:compile
[INFO] | | | +- com.github.jnr:jnr-ffi:jar:2.2.2:compile
[INFO] | | | | +- com.github.jnr:jffi:jar:1.3.1:compile
[INFO] | | | | +- com.github.jnr:jffi:jar:native:1.3.1:runtime
[INFO] | | | | +- org.ow2.asm:asm:jar:9.1:compile
[INFO] | | | | +- org.ow2.asm:asm-commons:jar:9.1:compile
[INFO] | | | | +- org.ow2.asm:asm-analysis:jar:9.1:compile
[INFO] | | | | +- org.ow2.asm:asm-tree:jar:9.1:compile
[INFO] | | | | +- org.ow2.asm:asm-util:jar:9.1:compile
[INFO] | | | | +- com.github.jnr:jnr-a64asm:jar:1.0.0:compile
[INFO] | | | | \- com.github.jnr:jnr-x86asm:jar:1.0.2:compile
[INFO] | | | \- com.github.jnr:jnr-constants:jar:0.10.1:compile
[INFO] | | +- io.dropwizard.metrics:metrics-core:jar:4.1.18:compile
[INFO] | | +- com.esri.geometry:esri-geometry-api:jar:1.2.1:compile
[INFO] | | | +- org.json:json:jar:20090211:compile
[INFO] | | | \- org.codehaus.jackson:jackson-core-asl:jar:1.9.2:provided
[INFO] | | +- com.fasterxml.jackson.core:jackson-core:jar:2.12.2:compile
[INFO] | | +- com.fasterxml.jackson.core:jackson-databind:jar:2.12.2:compile
[INFO] | | \- org.reactivestreams:reactive-streams:jar:1.0.3:compile
[INFO] | +- com.datastax.oss:java-driver-shaded-guava:jar:25.1-jre-graal-sub-1:compile
[INFO] | +- com.github.stephenc.jcip:jcip-annotations:jar:1.0-1:compile
[INFO] | \- com.github.spotbugs:spotbugs-annotations:jar:3.1.12:compile
[INFO] | \- com.google.code.findbugs:jsr305:jar:3.0.2:compile
[INFO] +- com.datastax.oss:java-driver-mapper-runtime:jar:4.13.0:compile
[INFO] +- commons-lang:commons-lang:jar:2.6:provided
[INFO] +- org.gcube.common.portal:portal-manager:jar:2.4.2:provided
[INFO] +- com.webcohesion.enunciate:enunciate-core-annotations:jar:2.14.0:provided
[INFO] +- com.webcohesion.enunciate:enunciate-rt-util:jar:2.14.0:provided
[INFO] +- javax.servlet:javax.servlet-api:jar:3.1.0:provided
[INFO] +- junit:junit:jar:4.13.2:test
[INFO] | \- org.hamcrest:hamcrest-core:jar:1.3:test
[INFO] +- ch.qos.logback:logback-classic:jar:1.5.0:test
[INFO] | \- ch.qos.logback:logback-core:jar:1.5.0:test
[INFO] \- jakarta.mail:jakarta.mail-api:jar:1.6.7:compile
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.917 s
[INFO] Finished at: 2024-05-16T15:21:58+02:00
[INFO] ------------------------------------------------------------------------

View File

@ -1,146 +0,0 @@
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for org.gcube.social_networking:social-service:war:1.0.0-SNAPSHOT
[WARNING] 'parent.relativePath' of POM org.gcube.social_networking:social-service:1.0.0-SNAPSHOT (/Users/Alfredo/works/gCubeSystem/social-service/pom.xml) points at org.gcube.idm:idm-client-library instead of org.gcube.tools:maven-parent, please verify your project structure @ line 5, column 10
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]
[INFO] -------------< org.gcube.social_networking:social-service >-------------
[INFO] Building Social Service 1.0.0-SNAPSHOT
[INFO] from pom.xml
[INFO] --------------------------------[ war ]---------------------------------
[WARNING] The POM for org.gcube.social-networking:social-service-model:jar:2.0.0-SNAPSHOT is missing, no dependency information available
[INFO]
[INFO] --- dependency:3.6.1:tree (default-cli) @ social-service ---
[INFO] org.gcube.social_networking:social-service:war:1.0.0-SNAPSHOT
[INFO] +- org.slf4j:slf4j-api:jar:2.0.12:provided
[INFO] +- org.glassfish.jersey.containers:jersey-container-servlet:jar:3.1.5:compile
[INFO] | +- org.glassfish.jersey.core:jersey-common:jar:3.1.5:compile
[INFO] | | +- jakarta.annotation:jakarta.annotation-api:jar:2.1.1:compile
[INFO] | | \- org.glassfish.hk2:osgi-resource-locator:jar:1.0.3:compile
[INFO] | +- org.glassfish.jersey.core:jersey-server:jar:3.1.5:compile
[INFO] | | +- org.glassfish.jersey.core:jersey-client:jar:3.1.5:compile
[INFO] | | \- jakarta.validation:jakarta.validation-api:jar:3.0.2:compile
[INFO] | \- jakarta.ws.rs:jakarta.ws.rs-api:jar:3.1.0:compile
[INFO] +- org.glassfish.jersey.containers:jersey-container-servlet-core:jar:3.1.5:compile
[INFO] | \- jakarta.inject:jakarta.inject-api:jar:2.0.1:compile
[INFO] +- org.gcube.core:common-smartgears-app:jar:3.0.1-SNAPSHOT:compile
[INFO] | +- org.javassist:javassist:jar:3.20.0-GA:compile
[INFO] | \- com.google.guava:guava:jar:18.0:provided
[INFO] +- org.gcube.core:common-smartgears:jar:4.0.0-SNAPSHOT:provided
[INFO] | +- org.reflections:reflections:jar:0.9.12:provided
[INFO] | +- org.yaml:snakeyaml:jar:2.2:provided
[INFO] | +- io.github.classgraph:classgraph:jar:4.8.28:provided
[INFO] | +- org.gcube.common:health-api:jar:1.0.0-SNAPSHOT:provided
[INFO] | +- org.gcube.common:gcube-jackson-databind:jar:2.8.11:provided
[INFO] | +- org.gcube.common:gcube-jackson-annotations:jar:2.8.11:provided
[INFO] | +- org.gcube.common:gcube-jackson-core:jar:2.8.11:provided
[INFO] | +- org.gcube.common:common-security:jar:1.0.1-SNAPSHOT:provided
[INFO] | +- org.gcube.data.publishing:document-store-lib:jar:3.0.1-SNAPSHOT:provided
[INFO] | +- org.gcube.accounting:accounting-lib:jar:5.0.0-SNAPSHOT:provided
[INFO] | | +- org.gcube.resources.discovery:ic-client:jar:2.0.0-SNAPSHOT:provided
[INFO] | | | +- org.gcube.resources.discovery:discovery-client:jar:2.0.0-SNAPSHOT:provided
[INFO] | | | \- org.gcube.core:common-gcore-stubs:jar:2.0.0-SNAPSHOT:provided
[INFO] | | +- org.gcube.core:common-encryption:jar:2.0.0-SNAPSHOT:provided
[INFO] | | \- org.gcube.common:common-utility-sg4:jar:1.0.1-SNAPSHOT:provided
[INFO] | | \- org.gcube.common:gxHTTP:jar:2.0.0-SNAPSHOT:provided
[INFO] | +- org.ini4j:ini4j:jar:0.5.4:provided
[INFO] | +- org.gcube.core:common-validator:jar:1.1.0:provided
[INFO] | +- org.gcube.core:common-events:jar:1.0.2:provided
[INFO] | +- org.gcube.common.security:gcube-secrets:jar:1.0.1:provided
[INFO] | | +- org.gcube.common:keycloak-client:jar:2.1.0-SNAPSHOT:provided
[INFO] | | | +- org.gcube.common:gxJRS:jar:2.0.0-SNAPSHOT:provided
[INFO] | | | | \- javax.ws.rs:javax.ws.rs-api:jar:2.0.1:provided
[INFO] | | | +- io.jsonwebtoken:jjwt-api:jar:0.12.5:provided
[INFO] | | | \- io.jsonwebtoken:jjwt-impl:jar:0.12.5:provided
[INFO] | | \- com.auth0:java-jwt:jar:4.4.0:provided
[INFO] | +- io.micrometer:micrometer-core:jar:1.9.0:provided
[INFO] | | +- org.hdrhistogram:HdrHistogram:jar:2.1.12:compile
[INFO] | | \- org.latencyutils:LatencyUtils:jar:2.0.3:provided
[INFO] | +- io.micrometer:micrometer-registry-prometheus:jar:1.9.0:provided
[INFO] | | \- io.prometheus:simpleclient_common:jar:0.15.0:provided
[INFO] | | \- io.prometheus:simpleclient:jar:0.15.0:provided
[INFO] | | +- io.prometheus:simpleclient_tracer_otel:jar:0.15.0:provided
[INFO] | | | \- io.prometheus:simpleclient_tracer_common:jar:0.15.0:provided
[INFO] | | \- io.prometheus:simpleclient_tracer_otel_agent:jar:0.15.0:provided
[INFO] | \- org.gcube.resources:common-gcore-resources:jar:2.0.0-SNAPSHOT:provided
[INFO] | +- jakarta.xml.ws:jakarta.xml.ws-api:jar:4.0.1:provided
[INFO] | | \- jakarta.xml.soap:jakarta.xml.soap-api:jar:3.0.1:provided
[INFO] | \- com.sun.xml.ws:jaxws-rt:jar:4.0.2:provided
[INFO] | +- org.glassfish.ha:ha-api:jar:3.1.13:provided
[INFO] | +- org.glassfish.external:management-api:jar:3.2.3:provided
[INFO] | +- org.glassfish.gmbal:gmbal-api-only:jar:4.0.3:provided
[INFO] | +- org.jvnet.staxex:stax-ex:jar:2.1.0:provided
[INFO] | +- com.sun.xml.stream.buffer:streambuffer:jar:2.1.0:provided
[INFO] | +- org.jvnet.mimepull:mimepull:jar:1.10.0:provided
[INFO] | +- com.sun.xml.fastinfoset:FastInfoset:jar:2.1.0:provided
[INFO] | +- jakarta.mail:jakarta.mail-api:jar:2.1.2:provided
[INFO] | +- org.eclipse.angus:angus-activation:jar:2.0.1:provided
[INFO] | +- org.eclipse.angus:angus-mail:jar:2.0.2:provided
[INFO] | +- com.sun.xml.messaging.saaj:saaj-impl:jar:3.0.3:provided
[INFO] | +- com.fasterxml.woodstox:woodstox-core:jar:6.5.1:provided
[INFO] | \- org.codehaus.woodstox:stax2-api:jar:4.2.2:provided
[INFO] +- org.gcube.core:common-scope:jar:2.0.0-SNAPSHOT:provided
[INFO] | +- jakarta.xml.bind:jakarta.xml.bind-api:jar:4.0.1:compile
[INFO] | | \- jakarta.activation:jakarta.activation-api:jar:2.1.3:compile
[INFO] | \- com.sun.xml.bind:jaxb-impl:jar:4.0.4:provided
[INFO] | \- com.sun.xml.bind:jaxb-core:jar:4.0.4:provided
[INFO] +- org.gcube.core:common-scope-maps:jar:1.1.1:provided
[INFO] +- org.gcube.common:authorization-client:jar:3.0.1-SNAPSHOT:compile
[INFO] | \- org.gcube.common:common-authorization:jar:3.0.1-SNAPSHOT:compile
[INFO] +- org.gcube.social-networking:social-service-model:jar:2.0.0-SNAPSHOT:compile
[INFO] +- com.datastax.oss:java-driver-query-builder:jar:4.13.0:compile
[INFO] | +- com.datastax.oss:java-driver-core:jar:4.13.0:compile
[INFO] | | +- com.datastax.oss:native-protocol:jar:1.5.0:compile
[INFO] | | +- io.netty:netty-handler:jar:4.1.60.Final:compile
[INFO] | | | +- io.netty:netty-common:jar:4.1.60.Final:compile
[INFO] | | | +- io.netty:netty-resolver:jar:4.1.60.Final:compile
[INFO] | | | +- io.netty:netty-buffer:jar:4.1.60.Final:compile
[INFO] | | | +- io.netty:netty-transport:jar:4.1.60.Final:compile
[INFO] | | | \- io.netty:netty-codec:jar:4.1.60.Final:compile
[INFO] | | +- com.typesafe:config:jar:1.4.1:compile
[INFO] | | +- com.github.jnr:jnr-posix:jar:3.1.5:compile
[INFO] | | | +- com.github.jnr:jnr-ffi:jar:2.2.2:compile
[INFO] | | | | +- com.github.jnr:jffi:jar:1.3.1:compile
[INFO] | | | | +- com.github.jnr:jffi:jar:native:1.3.1:runtime
[INFO] | | | | +- org.ow2.asm:asm:jar:9.1:compile
[INFO] | | | | +- org.ow2.asm:asm-commons:jar:9.1:compile
[INFO] | | | | +- org.ow2.asm:asm-analysis:jar:9.1:compile
[INFO] | | | | +- org.ow2.asm:asm-tree:jar:9.1:compile
[INFO] | | | | +- org.ow2.asm:asm-util:jar:9.1:compile
[INFO] | | | | +- com.github.jnr:jnr-a64asm:jar:1.0.0:compile
[INFO] | | | | \- com.github.jnr:jnr-x86asm:jar:1.0.2:compile
[INFO] | | | \- com.github.jnr:jnr-constants:jar:0.10.1:compile
[INFO] | | +- io.dropwizard.metrics:metrics-core:jar:4.1.18:compile
[INFO] | | +- com.esri.geometry:esri-geometry-api:jar:1.2.1:compile
[INFO] | | | +- org.json:json:jar:20090211:compile
[INFO] | | | \- org.codehaus.jackson:jackson-core-asl:jar:1.9.2:provided
[INFO] | | +- com.fasterxml.jackson.core:jackson-core:jar:2.12.2:compile
[INFO] | | +- com.fasterxml.jackson.core:jackson-databind:jar:2.12.2:compile
[INFO] | | | \- com.fasterxml.jackson.core:jackson-annotations:jar:2.12.2:compile
[INFO] | | \- org.reactivestreams:reactive-streams:jar:1.0.3:compile
[INFO] | +- com.datastax.oss:java-driver-shaded-guava:jar:25.1-jre-graal-sub-1:compile
[INFO] | +- com.github.stephenc.jcip:jcip-annotations:jar:1.0-1:compile
[INFO] | \- com.github.spotbugs:spotbugs-annotations:jar:3.1.12:compile
[INFO] | \- com.google.code.findbugs:jsr305:jar:3.0.2:compile
[INFO] +- com.datastax.oss:java-driver-mapper-runtime:jar:4.13.0:compile
[INFO] +- commons-lang:commons-lang:jar:2.6:provided
[INFO] +- com.sun.mail:javax.mail:jar:1.5.2:compile
[INFO] | \- javax.activation:activation:jar:1.1:compile
[INFO] +- org.gcube.common.portal:portal-manager:jar:2.4.2:provided
[INFO] +- com.webcohesion.enunciate:enunciate-core-annotations:jar:2.14.0:provided
[INFO] +- com.webcohesion.enunciate:enunciate-rt-util:jar:2.14.0:provided
[INFO] +- javax.servlet:javax.servlet-api:jar:3.1.0:provided
[INFO] +- junit:junit:jar:4.13.2:test
[INFO] | \- org.hamcrest:hamcrest-core:jar:1.3:test
[INFO] \- ch.qos.logback:logback-classic:jar:1.5.0:test
[INFO] \- ch.qos.logback:logback-core:jar:1.5.0:test
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.697 s
[INFO] Finished at: 2024-05-16T15:11:57+02:00
[INFO] ------------------------------------------------------------------------