improving project structure

This commit is contained in:
Luca Frosini 2024-05-27 11:35:08 +02:00
parent c475523ee1
commit e7813e378c
7 changed files with 1230 additions and 796 deletions

View File

@ -20,13 +20,11 @@
<php-xml-client disabled="true" />
<spring-webnt disabled="true" />
<docs docsDir="${project.build.directory}" docsSubdir="api-docs" />
<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
freemarkerTemplate="${project.basedir}${file.separator}src${file.separator}main${file.separator}resources${file.separator}META-INF${file.separator}enunciate${file.separator}d4science_docs.fmt">
<additional-css file="css${file.separator}d4science_enunciate_custom.css" />
</docs>
</modules>
</enunciate>

View File

@ -1,75 +0,0 @@
{
"id": "ff7036fd-e12d-4dd7-9d0f-816bb5a0f06a",
"name": "Hello World Env for devVRE",
"values": [
{
"key": "introspect_secret",
"value": "",
"type": "secret",
"enabled": true
},
{
"key": "password",
"value": "",
"type": "secret",
"enabled": true
},
{
"key": "service_client_secret",
"value": "",
"type": "secret",
"enabled": true
},
{
"key": "realm",
"value": "d4science",
"type": "any",
"enabled": true
},
{
"key": "username",
"value": "luca.frosini",
"type": "default",
"enabled": true
},
{
"key": "service_client_id",
"value": "id.d4science.org",
"type": "default",
"enabled": true
},
{
"key": "context",
"value": "/gcube/devsec/devVRE",
"type": "default",
"enabled": true
},
{
"key": "keycloak_url",
"value": "https://accounts.dev.d4science.org/auth",
"type": "any",
"enabled": true
},
{
"key": "encoded_context",
"value": "%2Fgcube%2Fdevsec%2FdevVRE",
"type": "any",
"enabled": true
},
{
"key": "client-id-user",
"value": "next.d4science.org",
"type": "default",
"enabled": true
},
{
"key": "introspect_client",
"value": "token-exchange-dedicated",
"type": "default",
"enabled": true
}
],
"_postman_variable_scope": "environment",
"_postman_exported_at": "2024-05-24T16:06:23.560Z",
"_postman_exported_using": "Postman/11.1.14"
}

View File

@ -1,692 +0,0 @@
{
"info": {
"_postman_id": "e152bab3-7be5-4fe2-81bd-625fec76373d",
"name": "Hello World Service",
"description": "An example collection that can be used for communicating with gcube services\n\nget TOKEN and at UMA_TOKEN from url: [https://next.dev.d4science.org/group/gcube/home](https://next.dev.d4science.org/group/gcube/home)\n\nupdate the collection's variables gcube_token and uma_token",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
"_exporter_id": "3092110"
},
"item": [
{
"name": "LOGIN",
"item": [
{
"name": "Clear Env",
"event": [
{
"listen": "prerequest",
"script": {
"exec": [
"console.log(\"executing clear script\");",
"",
"variables = [",
" 'token',",
" 'access_token',",
" 'refresh_token',",
"",
" 'uma_token',",
" 'uma_refresh',",
"",
" 'profile_token',",
" 'gcube_token',",
" 'oidc_access_token',",
" 'oidc_refresh_token',",
" 'id_token',",
"",
" 'clientId',",
"",
" 'current_username',",
" 'current_password',",
" 'current_context',",
" 'current_url-encoded-context',",
" 'current_iam-url',",
" 'current_client-id',",
" 'current_uma-token',",
" 'current_access-token',",
"",
" 'oidc_token',",
" 'oidc_access_token',",
" 'oidc_refresh_token',",
" 'uma_token',",
" 'exchanged_token'",
"",
"]",
"",
"for (var v of variables) {",
" pm.environment.unset(v);",
" pm.globals.unset(v);",
"}",
"",
" ",
"",
"",
" ",
""
],
"type": "text/javascript",
"packages": {}
}
}
],
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "/",
"path": [
""
]
}
},
"response": []
},
{
"name": "Get User Token For Context",
"event": [
{
"listen": "test",
"script": {
"exec": [
"var jsonData = JSON.parse(responseBody);",
"postman.setEnvironmentVariable(\"oidc_access_token\", jsonData.access_token);",
"postman.setEnvironmentVariable(\"oidc_refresh_token\", jsonData.refresh_token);",
"",
"postman.setEnvironmentVariable(\"uma_token\", jsonData.access_token);",
"",
"postman.setEnvironmentVariable(\"access_token\", jsonData.access_token);",
"postman.setEnvironmentVariable(\"refresh_token\", jsonData.refresh_token);",
""
],
"type": "text/javascript",
"packages": {}
}
},
{
"listen": "prerequest",
"script": {
"exec": [
""
],
"type": "text/javascript",
"packages": {}
}
}
],
"request": {
"auth": {
"type": "noauth"
},
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/x-www-form-urlencoded"
},
{
"key": "X-D4Science-Context",
"value": "{{encoded_context}}"
}
],
"body": {
"mode": "urlencoded",
"urlencoded": [
{
"key": "client_id",
"value": "{{service_client_id}}",
"type": "text"
},
{
"key": "username",
"value": "{{username}}",
"type": "text"
},
{
"key": "password",
"value": "{{password}}",
"type": "text"
},
{
"key": "grant_type",
"value": "password",
"type": "text"
},
{
"key": "client_secret",
"value": "{{service_client_secret}}",
"type": "text"
}
]
},
"url": {
"raw": "{{keycloak_url}}/realms/{{realm}}/protocol/openid-connect/token",
"host": [
"{{keycloak_url}}"
],
"path": [
"realms",
"{{realm}}",
"protocol",
"openid-connect",
"token"
]
},
"description": "Obtain UAT = user access token from a user in realm"
},
"response": []
},
{
"name": "Get ClientId Token For Context",
"event": [
{
"listen": "test",
"script": {
"exec": [
"var jsonData = JSON.parse(responseBody);",
"",
"// postman.setEnvironmentVariable(\"refresh_token\", jsonData.refresh_token);",
"// postman.setEnvironmentVariable(\"id_token\", jsonData.id_token);",
"",
"postman.setEnvironmentVariable(\"oidc_access_token\", jsonData.access_token);",
"",
"postman.setEnvironmentVariable(\"access_token\", jsonData.access_token);",
"postman.setEnvironmentVariable(\"token\", jsonData.access_token);",
"",
""
],
"type": "text/javascript",
"packages": {}
}
}
],
"request": {
"auth": {
"type": "noauth"
},
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/x-www-form-urlencoded"
},
{
"key": "X-D4Science-Context",
"value": "{{encoded_context}}"
}
],
"body": {
"mode": "urlencoded",
"urlencoded": [
{
"key": "client_id",
"value": "{{service_client_id}}",
"type": "text"
},
{
"key": "client_secret",
"value": "{{service_client_secret}}",
"type": "text"
},
{
"key": "grant_type",
"value": "client_credentials",
"type": "text"
}
]
},
"url": {
"raw": "{{keycloak_url}}/realms/{{realm}}/protocol/openid-connect/token",
"host": [
"{{keycloak_url}}"
],
"path": [
"realms",
"{{realm}}",
"protocol",
"openid-connect",
"token"
]
},
"description": "Obtain SAT (service account token)"
},
"response": []
},
{
"name": "Validate Access Token",
"request": {
"auth": {
"type": "noauth"
},
"method": "POST",
"header": [
{
"key": "Authorization",
"value": "Basic YWxmcmVkby1pZG0tc2VydmljZS1kZXY6OTc5YmQzYmMtNWNjNC0xMWVjLWJmNjMtMDI0MmFjMTMwMDAy"
}
],
"body": {
"mode": "urlencoded",
"urlencoded": [
{
"key": "token",
"value": "{{access_token}}",
"type": "text"
},
{
"key": "username\n",
"value": "{{introspect_client}}",
"type": "text",
"disabled": true
},
{
"key": "password",
"value": "{{introspect_secret}}",
"type": "text",
"disabled": true
},
{
"key": "client_id",
"value": "{{introspect_client}}",
"type": "text"
},
{
"key": "client_secret",
"value": "{{introspect_secret}}",
"type": "text"
}
]
},
"url": {
"raw": "{{keycloak_url}}/realms/{{realm}}/protocol/openid-connect/token/introspect",
"host": [
"{{keycloak_url}}"
],
"path": [
"realms",
"{{realm}}",
"protocol",
"openid-connect",
"token",
"introspect"
]
}
},
"response": []
}
]
},
{
"name": "REST",
"item": [
{
"name": "authorized",
"item": [
{
"name": "legacy-token",
"item": [
{
"name": "hello TOKEN PARAM",
"request": {
"auth": {
"type": "noauth"
},
"method": "GET",
"header": [
{
"key": "",
"value": "{{token}}"
}
],
"url": {
"raw": "{{base_url}}/{{application}}/hello?gcube-token={{gcube_token}}",
"host": [
"{{base_url}}"
],
"path": [
"{{application}}",
"hello"
],
"query": [
{
"key": "gcube-token",
"value": "{{gcube_token}}"
}
]
}
},
"response": []
},
{
"name": "details TOKEN PARAM",
"request": {
"auth": {
"type": "noauth"
},
"method": "GET",
"header": [],
"url": {
"raw": "{{base_url}}/{{application}}/details?gcube-token={{gcube_token}}",
"host": [
"{{base_url}}"
],
"path": [
"{{application}}",
"details"
],
"query": [
{
"key": "gcube-token",
"value": "{{gcube_token}}"
}
]
}
},
"response": []
},
{
"name": "auth org member TOKEN PARAM",
"request": {
"auth": {
"type": "noauth"
},
"method": "GET",
"header": [],
"url": {
"raw": "{{base_url}}/{{application}}/auth/org_member?gcube-token={{gcube_token}}",
"host": [
"{{base_url}}"
],
"path": [
"{{application}}",
"auth",
"org_member"
],
"query": [
{
"key": "gcube-token",
"value": "{{gcube_token}}"
}
]
}
},
"response": []
},
{
"name": "auth member TOKEN PARAM",
"request": {
"auth": {
"type": "noauth"
},
"method": "GET",
"header": [],
"url": {
"raw": "{{base_url}}/{{application}}/auth/member?gcube-token={{gcube_token}}",
"host": [
"{{base_url}}"
],
"path": [
"{{application}}",
"auth",
"member"
],
"query": [
{
"key": "gcube-token",
"value": "{{gcube_token}}"
}
]
}
},
"response": []
}
]
},
{
"name": "hello",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{base_url}}/{{application}}/hello",
"host": [
"{{base_url}}"
],
"path": [
"{{application}}",
"hello"
]
}
},
"response": []
},
{
"name": "details",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{base_url}}/{{application}}/details",
"host": [
"{{base_url}}"
],
"path": [
"{{application}}",
"details"
]
}
},
"response": []
},
{
"name": "auth org member",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{uma_token}}",
"type": "string"
}
]
},
"method": "GET",
"header": [],
"url": {
"raw": "{{base_url}}/{{application}}/auth/org_member",
"host": [
"{{base_url}}"
],
"path": [
"{{application}}",
"auth",
"org_member"
]
}
},
"response": []
},
{
"name": "auth member",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{uma_token}}",
"type": "string"
}
]
},
"method": "GET",
"header": [],
"url": {
"raw": "{{base_url}}/{{application}}/auth/member",
"host": [
"{{base_url}}"
],
"path": [
"{{application}}",
"auth",
"member"
]
}
},
"response": []
}
]
},
{
"name": "No Auth Required",
"item": [
{
"name": "guest",
"request": {
"auth": {
"type": "noauth"
},
"method": "GET",
"header": [],
"url": {
"raw": "{{base_url}}/{{application}}/guest",
"host": [
"{{base_url}}"
],
"path": [
"{{application}}",
"guest"
]
}
},
"response": []
},
{
"name": "404 Not Found",
"request": {
"auth": {
"type": "noauth"
},
"method": "GET",
"header": [],
"url": {
"raw": "{{base_url}}/{{application}}/guest/not-found",
"host": [
"{{base_url}}"
],
"path": [
"{{application}}",
"guest",
"not-found"
]
}
},
"response": []
},
{
"name": "400 Bad Request",
"request": {
"auth": {
"type": "noauth"
},
"method": "GET",
"header": [],
"url": {
"raw": "{{base_url}}/{{application}}/guest/bad-request",
"host": [
"{{base_url}}"
],
"path": [
"{{application}}",
"guest",
"bad-request"
]
}
},
"response": []
},
{
"name": "PURGE with 204 No Content",
"request": {
"auth": {
"type": "noauth"
},
"method": "PURGE",
"header": [],
"url": {
"raw": "{{base_url}}/{{application}}/guest/test-purge",
"host": [
"{{base_url}}"
],
"path": [
"{{application}}",
"guest",
"test-purge"
]
}
},
"response": []
}
]
}
]
}
],
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{access_token}}",
"type": "string"
}
]
},
"event": [
{
"listen": "prerequest",
"script": {
"type": "text/javascript",
"packages": {},
"exec": [
""
]
}
},
{
"listen": "test",
"script": {
"type": "text/javascript",
"packages": {},
"exec": [
""
]
}
}
],
"variable": [
{
"key": "base_url",
"value": "http://localhost:8080",
"type": "string"
},
{
"key": "role_name",
"value": "Member"
},
{
"key": "application",
"value": "hello-world-service",
"type": "string"
},
{
"key": "base_url_marco",
"value": "http://146.48.85.179:9999",
"type": "string"
},
{
"key": "base_url_local",
"value": "http://localhost:8080",
"type": "string"
}
]
}

View File

@ -31,7 +31,7 @@ release = getMvnVariable("version")
project = getMvnVariable("name")
copyright = '2024, %s' % getMvnVariable("organization.name")
author = 'Luca Frosini (ISTI-CNR)'
author = '%s (%s)' % (getMvnVariable("developers.developer[0].name"),getMvnVariable("developers.developer[0].organization"))
# -- General configuration ---------------------------------------------------

View File

@ -1,8 +1,8 @@
***********************************************************
Welcome to Hello World SG4 documentation
Welcome to Resource Manager documentation
***********************************************************
Hello World SG4 is a RESTful application that exposes operations via REST-API.
Resource Manager is a RESTful application that exposes operations via REST-API.
See the available `REST-API docs <../api-docs/index.html>`_.
@ -36,7 +36,6 @@ Any Background operation returns *202 Accepted*.
Any operation that does not provide any content returns *204 No Content*.
The most common error statuses a client can obtain are:
* **400 Bad Request** used to indicate a clients error `<https://tools.ietf.org/html/rfc7231#section-6.5.1>`_;
@ -123,7 +122,6 @@ The presented URL uses the following convention:
About Safety and Idempotency properties
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
* A method is *Safe* if it does not produce any side effects.
"This does not prevent an implementation from including behaviour that is potentially harmful, that is not entirely read-only, or that causes side effects while invoking a safe method"
`<https://tools.ietf.org/html/rfc7231#section-4.2.1>`_;
@ -186,10 +184,11 @@ We provide the following Java Client out-of-the-box.
.. code:: xml
<groupId>org.gcube.service</groupId>
<artifactId>helloworld-client</artifactId>
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
<groupId>org.gcube.resource-management</groupId>
<artifactId>resource-manager-client</artifactId>
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
**Methods Result**
The service exposes `its methods <../api-docs/index.html>`_ using a standard naming approach. Moreover, they accept (in the case of HTTP POST/PUT methods) JSON objects.
@ -216,17 +215,9 @@ The service exposes `its methods <../api-docs/index.html>`_ using a standard nam
Service Discovery on IS
=======================
The service can be discovered in the gCore IS as gCore Endpoint with the following parameter:
.. code:: xml
<ServiceClass>org.gcube.service</ServiceClass>
<ServiceName>helloworld</ServiceName>
The service can be discovered in the Facet-Based IS as EService with the following JSON query:
@ -239,20 +230,21 @@ The service can be discovered in the Facet-Based IS as EService with the followi
"@class": "IsIdentifiedBy",
"target": {
"@class": "SoftwareFacet",
"group": "org.gcube.service",
"name": "helloworld"
"group": "org.gcube.resource-management",
"name": "resource-manager"
}
}
]
}
Service Maven Coordinates
=========================
The maven coordinates of the Hello World SG4 service are:
The maven coordinates of the Resource Manager service are:
.. code:: xml
<groupId>org.gcube.service</groupId>
<artifactId>helloworld</artifactId>
<groupId>org.gcube.resource-management</groupId>
<artifactId>resource-manager</artifactId>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,26 @@
.d4science_intro {
top: 0;
z-index: 2000;
position: fixed;
display: block ruby;
padding: 10px;
background: white;
width: 100%;
height: 100px;
}
.navbar-fixed-top {
top: 100px !important;
}
.sidebar {
top: 160px !important;
}
.navbar {
margin-bottom: 40px !important;
}
.main {
top: 90px;
}