diff --git a/README.md b/README.md index 4251beb0..97a77e41 100644 --- a/README.md +++ b/README.md @@ -31,13 +31,13 @@ cd server-rm/ mvn clean jetty:run-exploded cd ../server-cm/ -mvn clean jetty:run-exploded +mvn clean jetty:run-war cd ../server-qm/ -mvn clean jetty:run-exploded +mvn clean jetty:run-war cd ../server-am/ -mvn clean jetty:run-exploded +mvn clean jetty:run-war ``` After following these steps, proceed to the steps listed in the next section _Navigating OSLC servers_. diff --git a/model/representations.aird b/model/representations.aird index 4a00f143..220867d0 100644 --- a/model/representations.aird +++ b/model/representations.aird @@ -6,7 +6,7 @@ platform:/resource/org.eclipse.lyo.tools.domainmodels/vocabulary.xml - + @@ -18,19 +18,19 @@ - + - + - + - + @@ -817,7 +817,7 @@ - + @@ -960,14 +960,14 @@ - - - - + + + + @@ -1073,14 +1073,14 @@ - - - - + + + + @@ -1309,22 +1309,6 @@ - - - - - - - - - - - - - - - - @@ -1597,14 +1581,6 @@ - - - - - - - - @@ -1613,6 +1589,14 @@ + + + + + + + + @@ -1816,14 +1800,6 @@ - - - - - - - - @@ -1832,6 +1808,14 @@ + + + + + + + + @@ -2145,54 +2129,54 @@ - - - + + + - - - + + + + + + + + + + + - - - + + + - - - + + + - - - + + + - - - - - - - - @@ -2820,10 +2804,10 @@ - - - - + + + + @@ -2836,10 +2820,18 @@ - - - - + + + + + + + + + + + + @@ -2852,6 +2844,14 @@ + + + + + + + + @@ -2860,10 +2860,10 @@ - - - - + + + + @@ -2876,18 +2876,18 @@ - - - - + + + + - - - - + + + + @@ -2900,22 +2900,6 @@ - - - - - - - - - - - - - - - - @@ -3111,61 +3095,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -3191,61 +3120,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -3351,6 +3225,432 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -3448,165 +3748,165 @@ - - - + + + - - + + - - + + - - - - - + + + + + - - - + + + - - + + - - + + - - - - - + + + + + - - - + + + - - + + - - + + - - - - - + + + + + - - - + + + - - + + - - + + - - - - - + + + + + - - - + + + - - + + - - + + - - - - - + + + + + - - - + + + - - + + - - + + - - - - - + + + + + - - - + + + - - + + - - + + - - - - - + + + + + - - - + + + - - + + - - + + - - - - - + + + + + - - - + + + - - + + - - + + - - - - - + + + + + - - - + + + - - + + - - + + - - - - - + + + + + @@ -3651,61 +3951,6 @@ - - - - KEEP_LOCATION - KEEP_SIZE - KEEP_RATIO - - - - - - - - - KEEP_LOCATION - KEEP_SIZE - KEEP_RATIO - - - - - - - - - KEEP_LOCATION - KEEP_SIZE - KEEP_RATIO - - - - - - - - - KEEP_LOCATION - KEEP_SIZE - KEEP_RATIO - - - - - - - - - KEEP_LOCATION - KEEP_SIZE - KEEP_RATIO - - - - - @@ -3751,64 +3996,9 @@ - - - - KEEP_LOCATION - KEEP_SIZE - KEEP_RATIO - - - - - - - - - KEEP_LOCATION - KEEP_SIZE - KEEP_RATIO - - - - - - - - - KEEP_LOCATION - KEEP_SIZE - KEEP_RATIO - - - - - - - - - KEEP_LOCATION - KEEP_SIZE - KEEP_RATIO - - - - - - - - - KEEP_LOCATION - KEEP_SIZE - KEEP_RATIO - - - - - - - - + + + KEEP_LOCATION KEEP_SIZE KEEP_RATIO @@ -3841,7 +4031,7 @@ - + KEEP_LOCATION @@ -3876,7 +4066,7 @@ - + KEEP_LOCATION @@ -3911,7 +4101,7 @@ - + KEEP_LOCATION @@ -3946,7 +4136,7 @@ - + KEEP_LOCATION @@ -4021,88 +4211,870 @@ - + + + + KEEP_LOCATION + KEEP_SIZE + KEEP_RATIO + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + KEEP_LOCATION + KEEP_SIZE + KEEP_RATIO + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + KEEP_LOCATION + KEEP_SIZE + KEEP_RATIO + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + KEEP_LOCATION + KEEP_SIZE + KEEP_RATIO + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + KEEP_LOCATION + KEEP_SIZE + KEEP_RATIO + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + KEEP_LOCATION + KEEP_SIZE + KEEP_RATIO + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + KEEP_LOCATION + KEEP_SIZE + KEEP_RATIO + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + KEEP_LOCATION + KEEP_SIZE + KEEP_RATIO + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + KEEP_LOCATION + KEEP_SIZE + KEEP_RATIO + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + KEEP_LOCATION + KEEP_SIZE + KEEP_RATIO + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -4126,7 +5098,7 @@ - + @@ -4137,7 +5109,7 @@ - + @@ -4148,28 +5120,6 @@ - - - - - - - - - - - - - - - - - - - - - - @@ -4195,28 +5145,6 @@ - - - - - - - - - - - - - - - - - - - - - - @@ -4236,7 +5164,7 @@ - + @@ -4257,7 +5185,175 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -4281,14 +5377,14 @@ - + - + - + @@ -4308,69 +5404,69 @@ - - - + + + - - + + - - + + - - - - - + + + + + - - - + + + - - + + - - + + - - - - - + + + + + - - - + + + - - + + - - + + - - - - - + + + + + - - - + + + - - + + - - + + - - - - - + + + + + @@ -4412,28 +5508,6 @@ - - - - KEEP_LOCATION - KEEP_SIZE - KEEP_RATIO - - - - - - - - - KEEP_LOCATION - KEEP_SIZE - KEEP_RATIO - - - - - @@ -4479,26 +5553,7 @@ - - - - - - - - - - - - KEEP_LOCATION - KEEP_SIZE - KEEP_RATIO - - - - - - + KEEP_LOCATION @@ -4533,7 +5588,7 @@ - + KEEP_LOCATION @@ -4584,37 +5639,345 @@ - + + + + KEEP_LOCATION + KEEP_SIZE + KEEP_RATIO + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + KEEP_LOCATION + KEEP_SIZE + KEEP_RATIO + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + KEEP_LOCATION + KEEP_SIZE + KEEP_RATIO + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + KEEP_LOCATION + KEEP_SIZE + KEEP_RATIO + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + diff --git a/model/toolchain.xml b/model/toolchain.xml index a28ceaed..9cf85338 100644 --- a/model/toolchain.xml +++ b/model/toolchain.xml @@ -1,266 +1,266 @@ - - - - - - - - - - - - - - - - - - - - requirements - - - - - - - - - - - - - requirement_collections - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - change_requests - - - - - - - - - - - - - - - - - - - - - - - - - - - - - cases - - - - - - - - - - - - - plans - - - - - - - - - - - - - scripts - - - - - - - - - - - - - results - - - - - - - - - - - - - execution_records - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - resources - - - - - - - - - - - - - links - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + requirements + + + + + + + + + + + + + requirement_collections + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + change_requests + + + + + + + + + + + + + + + + + + + + + + + + + + + + + cases + + + + + + + + + + + + + plans + + + + + + + + + + + + + scripts + + + + + + + + + + + + + results + + + + + + + + + + + + + execution_records + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + resources + + + + + + + + + + + + + links + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/client-toolchain/pom.xml b/src/client-toolchain/pom.xml index 8f1f8b11..554ef601 100644 --- a/src/client-toolchain/pom.xml +++ b/src/client-toolchain/pom.xml @@ -11,27 +11,67 @@ client-toolchain - 1.5.32 + UTF-8 + UTF-8 + 1.8 + 11 + + 1.6.10 + 5.0.0-SNAPSHOT + + 2.25.1 + 1.6.0 + + + lyo-snapshots + Eclipse Lyo Snapshots + https://repo.eclipse.org/content/repositories/lyo-snapshots/ + + false + + + + com.github.javafaker javafaker 1.0.2 + + org.apache.commons + commons-lang3 + 3.12.0 + + + com.xenomachina + kotlin-argparser + 2.0.7 + + org.eclipse.lyo.clients oslc-client + ${v.lyo} org.eclipse.lyo oslc-domains + ${v.lyo} + + + + org.slf4j + slf4j-simple + 1.7.32 + runtime org.glassfish.jersey.core jersey-client - 2.25.1 + ${v.jersey} @@ -43,42 +83,31 @@ org.glassfish.jersey.connectors jersey-apache-connector - 2.25.1 - - - - org.apache.commons - commons-lang3 - 3.12.0 - - - - - org.slf4j - slf4j-simple - runtime + ${v.jersey} org.jetbrains.kotlin - kotlin-stdlib-jdk8 - ${kotlin.version} + kotlin-stdlib + ${v.kotlin} org.jetbrains.kotlinx kotlinx-coroutines-core - 1.5.2 + ${v.kotlin.coroutines} + + + org.jetbrains.kotlinx + kotlinx-coroutines-core-jvm + ${v.kotlin.coroutines} + + org.jetbrains.kotlin kotlin-test - ${kotlin.version} + ${v.kotlin} test - - com.xenomachina - kotlin-argparser - 2.0.7 - @@ -129,8 +158,7 @@ org.jetbrains.kotlin kotlin-maven-plugin - ${kotlin.version} - + ${v.kotlin} compile @@ -139,7 +167,6 @@ compile - test-compile test-compile diff --git a/src/lib-common/pom.xml b/src/lib-common/pom.xml index 242cf5b3..18a23ff4 100644 --- a/src/lib-common/pom.xml +++ b/src/lib-common/pom.xml @@ -12,12 +12,31 @@ jar + UTF-8 + UTF-8 + 11 + 11 + + 5.0.0-SNAPSHOT + 2.25.1 + + + lyo-snapshots + Eclipse Lyo Snapshots + https://repo.eclipse.org/content/repositories/lyo-snapshots/ + + false + + + + org.slf4j slf4j-simple + 1.7.32 runtime @@ -25,28 +44,34 @@ org.eclipse.lyo.oslc4j.core oslc4j-core + ${version.lyo} org.eclipse.lyo oslc-domains + ${version.lyo} org.eclipse.lyo.oslc4j.core oslc4j-jena-provider + ${version.lyo} org.eclipse.lyo.oslc4j.core oslc4j-json4j-provider + ${version.lyo} org.eclipse.lyo.clients oslc-client + ${version.lyo} org.glassfish.jersey.core jersey-server + ${version.jersey} javax.ws.rs @@ -57,6 +82,7 @@ org.glassfish.jersey.containers jersey-container-servlet + ${version.jersey} javax.ws.rs @@ -67,11 +93,13 @@ javax.servlet javax.servlet-api + 3.1.0 provided - javax.servlet.jsp.jstl - javax.servlet.jsp.jstl-api + jakarta.servlet.jsp.jstl + jakarta.servlet.jsp.jstl-api + 1.2.7 provided @@ -86,12 +114,8 @@ junit junit + 4.13.2 test - - - - - diff --git a/src/pom.xml b/src/pom.xml index 1f4a81d1..951bed69 100644 --- a/src/pom.xml +++ b/src/pom.xml @@ -1,7 +1,7 @@ 4.0.0 - OSLC 2020 RefImpl (parent) + OSLC 2020 RefImpl (aggregator) co.oslc.refimpl parent 0.0.1-SNAPSHOT @@ -11,11 +11,7 @@ UTF-8 UTF-8 1.8 - 1.8 - - 5.0.0.alpha2 - ${version.lyo} - 2.25.1 + 11 @@ -39,113 +35,6 @@ - - - - co.oslc.refimpl - lib-common - 0.0.1-SNAPSHOT - - - - org.slf4j - slf4j-simple - 1.7.32 - - - - - org.eclipse.lyo.server - oslc-ui-model - ${version.lyo.oslc-ui} - - - org.eclipse.lyo.oslc4j.core - oslc4j-core - ${version.lyo} - - - org.eclipse.lyo.oslc4j.core - oslc4j-jena-provider - ${version.lyo} - - - org.eclipse.lyo.oslc4j.core - oslc4j-json4j-provider - ${version.lyo} - - - org.eclipse.lyo - oslc-domains - ${version.lyo} - - - - org.eclipse.lyo.clients - oslc-client - ${version.lyo} - - - - - - org.eclipse.lyo.server - oauth-core - ${version.lyo} - - - org.eclipse.lyo.server - oauth-consumer-store - ${version.lyo} - - - org.eclipse.lyo.server - oauth-webapp - ${version.lyo} - war - - - - - - org.glassfish.jersey.core - jersey-server - ${version.jersey} - - - org.glassfish.jersey.containers - jersey-container-servlet - ${version.jersey} - - - javax.servlet - javax.servlet-api - 3.1.0 - - - - javax.servlet.jsp.jstl - javax.servlet.jsp.jstl-api - 1.2.2 - - - - - io.swagger - swagger-jersey2-jaxrs - 1.5.22 - - - - - - junit - junit - 4.13.1 - test - - - @@ -158,58 +47,5 @@ - - - - - org.apache.maven.plugins - maven-dependency-plugin - 3.1.2 - - - prepare-package - - unpack - - - - - org.webjars - swagger-ui - 3.25.0 - - - ${project.build.directory}/swagger-ui - - - - - - - org.apache.maven.plugins - maven-war-plugin - 3.2.3 - - - - - - - lyo-snapshots - Eclipse Lyo Snapshots - https://repo.eclipse.org/content/repositories/lyo-snapshots/ - - false - - - - diff --git a/src/server-am/pom.xml b/src/server-am/pom.xml index f723a795..0fd6f8f3 100644 --- a/src/server-am/pom.xml +++ b/src/server-am/pom.xml @@ -1,148 +1,221 @@ - - 4.0.0 - + + + 4.0.0 + + + co.oslc.refimpl - parent - 0.0.1-SNAPSHOT - - OSLC Architecture Management Server (2020 RefImpl) - server-am - war + server-am + 0.2.0-SNAPSHOT + war + OSLC Architecture Management Server (2020 RefImpl) + + UTF-8 + UTF-8 + 1.8 + 1.8 + 5.0.0-SNAPSHOT + 2.25.1 + 2.1.2 + 3.52.3 + + + + + + + + + + lyo-releases + Eclipse Lyo Releases + https://repo.eclipse.org/content/repositories/lyo-releases/ + + false + + + + lyo-snapshots + Eclipse Lyo Snapshots + https://repo.eclipse.org/content/repositories/lyo-snapshots/ + + false + + + + + + + + + + co.oslc.refimpl + lib-common + 0.0.1-SNAPSHOT + + + + + org.slf4j + slf4j-simple + 1.7.21 + runtime + + + + javax.servlet + javax.servlet-api + 3.1.0 + provided + + + javax.servlet + jstl + 1.2 + + + org.glassfish.jersey.core + jersey-server + ${jersey.version} + + + org.glassfish.jersey.containers + jersey-container-servlet + ${jersey.version} + + + + org.eclipse.lyo.oslc4j.core + oslc4j-core + ${version.lyo} + + + org.eclipse.lyo.oslc4j.core + oslc4j-jena-provider + ${version.lyo} + + + org.eclipse.lyo.oslc4j.core + oslc4j-json4j-provider + ${version.lyo} + + + org.eclipse.lyo.clients + oslc-client + ${version.lyo} + + + org.eclipse.lyo.server + oauth-core + ${version.lyo} + + + org.eclipse.lyo.server + oauth-consumer-store + ${version.lyo} + + + org.eclipse.lyo.server + oauth-webapp + ${version.lyo} + war + - - - - - co.oslc.refimpl - lib-common - - - - org.slf4j - slf4j-simple - runtime - - - io.swagger - swagger-jersey2-jaxrs - - - - - org.eclipse.lyo.oslc4j.core - oslc4j-core - - - org.eclipse.lyo - oslc-domains - - - org.eclipse.lyo.oslc4j.core - oslc4j-jena-provider - - - org.eclipse.lyo.oslc4j.core - oslc4j-json4j-provider - - - org.eclipse.lyo.clients - oslc-client - - - - - - org.eclipse.lyo.server - oauth-core - - - org.eclipse.lyo.server - oauth-consumer-store - - - org.eclipse.lyo.server - oauth-webapp - war - - - - - org.glassfish.jersey.core - jersey-server - - - org.glassfish.jersey.containers - jersey-container-servlet - - - javax.servlet - javax.servlet-api - provided - - - javax.servlet.jsp.jstl - javax.servlet.jsp.jstl-api - provided - - - - - - junit - junit - test - - - - - - - - org.apache.maven.plugins - maven-dependency-plugin - - - - org.apache.maven.plugins - maven-war-plugin - - - - ${project.build.directory}/swagger-ui/META-INF/resources/webjars/swagger-ui/3.25.0 - - **/*.* - - /swagger-ui/dist - - - - - - org.eclipse.jetty - jetty-maven-plugin - 9.4.19.v20190610 - - - / - - manual - 5 - - - jetty.port - 8803 - - - co.oslc.refimpl.am.gen.servlet.baseurl - ${lyo.baseurl} - - - - - - - - + + + io.swagger.core.v3 + swagger-jaxrs2 + ${swagger.version} + + + io.swagger.core.v3 + swagger-jaxrs2-servlet-initializer-v2 + ${swagger.version} + + + + + + + + + + + org.eclipse.jetty + jetty-maven-plugin + 10.0.7 + + + / + + + 8803 + + 5 + + + + + + org.apache.maven.plugins + maven-dependency-plugin + 3.1.2 + + + prepare-package + + unpack + + + + + org.webjars + swagger-ui + ${swagger-ui.version} + + + ${project.build.directory}/swagger-ui + + + + + + + org.apache.maven.plugins + maven-war-plugin + 3.2.3 + + + + ${project.build.directory}/swagger-ui/META-INF/resources/webjars/swagger-ui/${swagger-ui.version} + + **/*.* + + /swagger-ui/dist + + + + + + + + diff --git a/src/server-am/src/main/java/co/oslc/refimpl/am/gen/AMManager.java b/src/server-am/src/main/java/co/oslc/refimpl/am/gen/AMManager.java index d0939b92..0759938f 100644 --- a/src/server-am/src/main/java/co/oslc/refimpl/am/gen/AMManager.java +++ b/src/server-am/src/main/java/co/oslc/refimpl/am/gen/AMManager.java @@ -5,13 +5,13 @@ * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * and Eclipse Distribution License v. 1.0 which accompanies this distribution. - * + * * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html * and the Eclipse Distribution License is available at * http://www.eclipse.org/org/documents/edl-v10.php. - * + * * Contributors: - * + * * Sam Padgett - initial API and implementation * Michael Fiedler - adapted for OSLC4J * Jad El-khoury - initial implementation of code generator (https://bugs.eclipse.org/bugs/show_bug.cgi?id=422448) @@ -26,8 +26,6 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.ServletContextEvent; -import javax.ws.rs.WebApplicationException; -import javax.ws.rs.core.Response; import java.util.List; import java.util.ArrayList; import org.slf4j.Logger; @@ -48,6 +46,9 @@ import java.util.Date; import java.util.UUID; +import javax.ws.rs.WebApplicationException; +import javax.ws.rs.core.Response; + import co.oslc.refimpl.lib.MemResourceRepository; import co.oslc.refimpl.lib.ResourceRepository; // End of user code @@ -59,30 +60,30 @@ public class AMManager { private static final Logger log = LoggerFactory.getLogger(AMManager.class); - + // Start of user code class_attributes public static final String SP_DEFAULT = "sp_single"; private static final ResourceRepository resourceRepository = new MemResourceRepository<>(); private static final ResourceRepository linkRepository = new MemResourceRepository<>(); // End of user code - - + + // Start of user code class_methods // End of user code public static void contextInitializeServletListener(final ServletContextEvent servletContextEvent) { - + // Start of user code contextInitializeServletListener // TODO Implement code to establish connection to data backbone etc ... // End of user code - + } - public static void contextDestroyServletListener(ServletContextEvent servletContextEvent) + public static void contextDestroyServletListener(ServletContextEvent servletContextEvent) { - + // Start of user code contextDestroyed // TODO Implement code to shutdown connections to data backbone etc... // End of user code @@ -91,7 +92,7 @@ public static void contextDestroyServletListener(ServletContextEvent servletCont public static ServiceProviderInfo[] getServiceProviderInfos(HttpServletRequest httpServletRequest) { ServiceProviderInfo[] serviceProviderInfos = {}; - + // Start of user code "ServiceProviderInfo[] getServiceProviderInfos(...)" ServiceProviderInfo spInfo = new ServiceProviderInfo(); spInfo.serviceProviderId = SP_DEFAULT; @@ -101,31 +102,31 @@ public static ServiceProviderInfo[] getServiceProviderInfos(HttpServletRequest h return serviceProviderInfos; } - public static List queryResources(HttpServletRequest httpServletRequest, String where, String prefix, int page, int limit) + public static List queryResources(HttpServletRequest httpServletRequest, String where, String prefix, boolean paging, int page, int limit) { List resources = null; - - + + // Start of user code queryResources resources = resourceRepository.fetchResourcePageForSP(SP_DEFAULT, 1, limit); // End of user code return resources; } - public static List ResourceSelector(HttpServletRequest httpServletRequest, String terms) + public static List ResourceSelector(HttpServletRequest httpServletRequest, String terms) { List resources = null; - - + + // Start of user code ResourceSelector - // TODO Implement code to return a set of resources, based on search criteria + // TODO Implement code to return a set of resources, based on search criteria // End of user code return resources; } public static Resource createResource(HttpServletRequest httpServletRequest, final Resource aResource) { Resource newResource = null; - - + + // Start of user code createResource String id = aResource.getIdentifier(); if(id == null) { @@ -143,31 +144,31 @@ public static Resource createResource(HttpServletRequest httpServletRequest, fin - public static List queryLinkTypes(HttpServletRequest httpServletRequest, String where, String prefix, int page, int limit) + public static List queryLinkTypes(HttpServletRequest httpServletRequest, String where, String prefix, boolean paging, int page, int limit) { List resources = null; - - + + // Start of user code queryLinkTypes resources = linkRepository.fetchResourcePageForSP(SP_DEFAULT, 1, limit); // End of user code return resources; } - public static List LinkTypeSelector(HttpServletRequest httpServletRequest, String terms) + public static List LinkTypeSelector(HttpServletRequest httpServletRequest, String terms) { List resources = null; - - + + // Start of user code LinkTypeSelector - // TODO Implement code to return a set of resources, based on search criteria + // TODO Implement code to return a set of resources, based on search criteria // End of user code return resources; } public static LinkType createLinkType(HttpServletRequest httpServletRequest, final LinkType aResource) { LinkType newResource = null; - - + + // Start of user code createLinkType String id = aResource.getIdentifier(); if(id == null) { @@ -189,8 +190,8 @@ public static LinkType createLinkType(HttpServletRequest httpServletRequest, fin public static Resource getResource(HttpServletRequest httpServletRequest, final String id) { Resource aResource = null; - - + + // Start of user code getResource if(resourceRepository.hasResource(SP_DEFAULT, id)) { aResource = resourceRepository.getResource(SP_DEFAULT, id); @@ -202,7 +203,7 @@ public static Resource getResource(HttpServletRequest httpServletRequest, final public static Boolean deleteResource(HttpServletRequest httpServletRequest, final String id) { Boolean deleted = false; - + // Start of user code deleteResource resourceRepository.deleteResource(SP_DEFAULT, id); deleted = true; @@ -213,7 +214,7 @@ public static Boolean deleteResource(HttpServletRequest httpServletRequest, fina public static Resource updateResource(HttpServletRequest httpServletRequest, final Resource aResource, final String id) { Resource updatedResource = null; - + // Start of user code updateResource if(!AMResourcesFactory.constructURIForResource(id).equals(aResource.getAbout())) { throw new WebApplicationException("Subject URI shall match the endpoint", Response.Status.BAD_REQUEST); @@ -227,8 +228,8 @@ public static Resource updateResource(HttpServletRequest httpServletRequest, fin public static LinkType getLinkType(HttpServletRequest httpServletRequest, final String id) { LinkType aResource = null; - - + + // Start of user code getLinkType if(linkRepository.hasResource(SP_DEFAULT, id)) { aResource = linkRepository.getResource(SP_DEFAULT, id); @@ -239,7 +240,7 @@ public static LinkType getLinkType(HttpServletRequest httpServletRequest, final public static Boolean deleteLinkType(HttpServletRequest httpServletRequest, final String id) { Boolean deleted = false; - + // Start of user code deleteLinkType linkRepository.deleteResource(SP_DEFAULT, id); deleted = true; @@ -250,7 +251,7 @@ public static Boolean deleteLinkType(HttpServletRequest httpServletRequest, fina public static LinkType updateLinkType(HttpServletRequest httpServletRequest, final LinkType aResource, final String id) { LinkType updatedResource = null; - + // Start of user code updateLinkType if(!AMResourcesFactory.constructURIForLinkType(id).equals(aResource.getAbout())) { throw new WebApplicationException("Subject URI shall match the endpoint", Response.Status.BAD_REQUEST); diff --git a/src/server-am/src/main/java/co/oslc/refimpl/am/gen/auth/AuthenticationApplication.java b/src/server-am/src/main/java/co/oslc/refimpl/am/gen/auth/AuthenticationApplication.java index 05d32f0b..7e87ef11 100644 --- a/src/server-am/src/main/java/co/oslc/refimpl/am/gen/auth/AuthenticationApplication.java +++ b/src/server-am/src/main/java/co/oslc/refimpl/am/gen/auth/AuthenticationApplication.java @@ -25,6 +25,8 @@ import org.eclipse.lyo.server.oauth.core.Application; import org.eclipse.lyo.server.oauth.core.token.LRUCache; import org.eclipse.lyo.server.oauth.core.AuthenticationException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; // Start of user code imports // End of user code @@ -34,6 +36,7 @@ public class AuthenticationApplication implements Application { // Start of user code class_attributes + private final static Logger log = LoggerFactory.getLogger(AuthenticationApplication.class); // End of user code // Start of user code class_methods @@ -96,7 +99,7 @@ public String getRealm(HttpServletRequest request) { public void login(HttpServletRequest request, String username, String password) throws AuthenticationException { // Start of user code login //TODO: replace with code with real logic to login. You should also decide whether the login is admin or not. - System.out.println("Warning! You are using fake login checks, which ought to be changed!"); + log.warn("CAUTION! You are using fake login checks, which ought to be changed!"); if ((username.equals("user") && password.equals("user")) || (username.equals("admin") && password.equals("admin"))) { bindApplicationConnectorToSession(request, username); } @@ -115,7 +118,7 @@ public void login(HttpServletRequest request, String username, String password) /** * Login based on the credentials in the Authorization request header - * if successful, bind the credentials to the request session. + * if successful, bind the credentials to the request session. * @throws UnauthorizedException * if the request did not contain an Authorization header * or, on problems reading the credentials from the Authorization request header @@ -125,11 +128,11 @@ public void loginWithBasicAuthentication(HttpServletRequest request) throws Auth if (authorizationHeader == null || "".equals(authorizationHeader)) { throw new AuthenticationException("No basic authentication header identified in request."); } - + if (!authorizationHeader.startsWith(BASIC_AUTHORIZATION_PREFIX)) { throw new AuthenticationException("Only basic access authentication is supported."); } - + String encodedString = authorizationHeader.substring(BASIC_AUTHORIZATION_PREFIX.length()); try { String unencodedString = new String(Base64.getDecoder().decode(encodedString), "UTF-8"); @@ -168,6 +171,10 @@ public String getApplicationConnectorFromSession(HttpServletRequest request) { return (String) request.getSession().getAttribute(APPLICATION_CONNECTOR_SESSION_ATTRIBUTE); } + public void removeApplicationConnectorFromSession(HttpServletRequest request) { + request.getSession().removeAttribute(APPLICATION_CONNECTOR_SESSION_ATTRIBUTE); + } + public String getApplicationConnector(String oauth1Token) { return oauth1TokenToApplicationConnector.get(oauth1Token); } @@ -187,7 +194,7 @@ public void removeForOauth1Token(String oauth1Token) { /** * Send error response when the request was not authorized - * + * * @param response an error response * @param e Exception with error message * @param authChallenge OAuth challenge diff --git a/src/server-am/src/main/java/co/oslc/refimpl/am/gen/services/LinksService.java b/src/server-am/src/main/java/co/oslc/refimpl/am/gen/services/LinksService.java index 27a7d2cf..fcf67d7a 100644 --- a/src/server-am/src/main/java/co/oslc/refimpl/am/gen/services/LinksService.java +++ b/src/server-am/src/main/java/co/oslc/refimpl/am/gen/services/LinksService.java @@ -62,6 +62,7 @@ import org.apache.wink.json4j.JSONException; import org.apache.wink.json4j.JSONObject; +import org.apache.wink.json4j.JSONArray; import org.eclipse.lyo.oslc4j.provider.json4j.JsonHelper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -87,8 +88,9 @@ import co.oslc.refimpl.am.gen.servlet.ServiceProviderCatalogSingleton; import org.eclipse.lyo.oslc.domains.am.LinkType; import org.eclipse.lyo.oslc.domains.Person; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.responses.ApiResponse; // Start of user code imports // End of user code @@ -97,7 +99,6 @@ // End of user code @OslcService(Oslc_amDomainConstants.ARCHITECTURE_MANAGEMENT_DOMAIN) @Path("service2/linkTypes") -@Api(value = "OSLC Service for {" + Oslc_amDomainConstants.LINKTYPE_LOCALNAME + "}") public class LinksService { @Context private HttpServletRequest httpServletRequest; @@ -137,21 +138,28 @@ private void addCORSHeaders (final HttpServletResponse httpServletResponse) { @GET @Path("query") @Produces({OslcMediaType.APPLICATION_RDF_XML, OslcMediaType.APPLICATION_JSON_LD, OslcMediaType.TEXT_TURTLE, OslcMediaType.APPLICATION_XML, OslcMediaType.APPLICATION_JSON}) - @ApiOperation( - value = "Query capability for resources of type {" + Oslc_amDomainConstants.LINKTYPE_LOCALNAME + "}", - notes = "Query capability for resources of type {" + "" + Oslc_amDomainConstants.LINKTYPE_LOCALNAME + "" + "}" + + @Operation( + summary = "Query capability for resources of type {" + Oslc_amDomainConstants.LINKTYPE_LOCALNAME + "}", + description = "Query capability for resources of type {" + "" + Oslc_amDomainConstants.LINKTYPE_LOCALNAME + "" + "}" + ", with respective resource shapes {" + "" + Oslc_amDomainConstants.LINKTYPE_LOCALNAME + "" + "}", - produces = OslcMediaType.APPLICATION_RDF_XML + ", " + OslcMediaType.APPLICATION_XML + ", " + OslcMediaType.APPLICATION_JSON + ", " + OslcMediaType.TEXT_TURTLE + ", " + MediaType.TEXT_HTML + responses = { + @ApiResponse(description = "default response", content = {@Content(mediaType = OslcMediaType.APPLICATION_RDF_XML), @Content(mediaType = OslcMediaType.APPLICATION_XML), @Content(mediaType = OslcMediaType.APPLICATION_JSON), @Content(mediaType = OslcMediaType.TEXT_TURTLE), @Content(mediaType = MediaType.TEXT_HTML)}) + } ) public LinkType[] queryLinkTypes( @QueryParam("oslc.where") final String where, @QueryParam("oslc.prefix") final String prefix, + @QueryParam("oslc.paging") final String pagingString, @QueryParam("page") final String pageString, - @QueryParam("oslc.pageSize") final String pageSizeString) throws IOException, ServletException + @QueryParam("oslc.pageSize") final String pageSizeString) throws IOException, ServletException { + boolean paging=false; int page=0; int pageSize=20; + if (null != pagingString) { + paging = Boolean.parseBoolean(pagingString); + } if (null != pageString) { page = Integer.parseInt(pageString); } @@ -163,13 +171,22 @@ public LinkType[] queryLinkTypes( // Here additional logic can be implemented that complements main action taken in AMManager // End of user code - final List resources = AMManager.queryLinkTypes(httpServletRequest, where, prefix, page, pageSize); - httpServletRequest.setAttribute("queryUri", - uriInfo.getAbsolutePath().toString() + "?oslc.paging=true"); + final List resources = AMManager.queryLinkTypes(httpServletRequest, where, prefix, paging, page, pageSize); + UriBuilder uriBuilder = UriBuilder.fromUri(uriInfo.getAbsolutePath()) + .queryParam("oslc.paging", "true") + .queryParam("oslc.pageSize", pageSize) + .queryParam("page", page); + if (null != where) { + uriBuilder.queryParam("oslc.where", where); + } + if (null != prefix) { + uriBuilder.queryParam("oslc.prefix", prefix); + } + httpServletRequest.setAttribute("queryUri", uriBuilder.build().toString()); if (resources.size() > pageSize) { resources.remove(resources.size() - 1); - httpServletRequest.setAttribute(OSLC4JConstants.OSLC4J_NEXT_PAGE, - uriInfo.getAbsolutePath().toString() + "?oslc.paging=true&oslc.pageSize=" + pageSize + "&page=" + (page + 1)); + uriBuilder.replaceQueryParam("page", page + 1); + httpServletRequest.setAttribute(OSLC4JConstants.OSLC4J_NEXT_PAGE, uriBuilder.build().toString()); } return resources.toArray(new LinkType [resources.size()]); } @@ -177,21 +194,28 @@ public LinkType[] queryLinkTypes( @GET @Path("query") @Produces({ MediaType.TEXT_HTML }) - @ApiOperation( - value = "Query capability for resources of type {" + Oslc_amDomainConstants.LINKTYPE_LOCALNAME + "}", - notes = "Query capability for resources of type {" + "" + Oslc_amDomainConstants.LINKTYPE_LOCALNAME + "" + "}" + + @Operation( + summary = "Query capability for resources of type {" + Oslc_amDomainConstants.LINKTYPE_LOCALNAME + "}", + description = "Query capability for resources of type {" + "" + Oslc_amDomainConstants.LINKTYPE_LOCALNAME + "" + "}" + ", with respective resource shapes {" + "" + Oslc_amDomainConstants.LINKTYPE_LOCALNAME + "" + "}", - produces = OslcMediaType.APPLICATION_RDF_XML + ", " + OslcMediaType.APPLICATION_XML + ", " + OslcMediaType.APPLICATION_JSON + ", " + OslcMediaType.TEXT_TURTLE + ", " + MediaType.TEXT_HTML + responses = { + @ApiResponse(description = "default response", content = {@Content(mediaType = OslcMediaType.APPLICATION_RDF_XML), @Content(mediaType = OslcMediaType.APPLICATION_XML), @Content(mediaType = OslcMediaType.APPLICATION_JSON), @Content(mediaType = OslcMediaType.TEXT_TURTLE), @Content(mediaType = MediaType.TEXT_HTML)}) + } ) public void queryLinkTypesAsHtml( @QueryParam("oslc.where") final String where, @QueryParam("oslc.prefix") final String prefix, + @QueryParam("oslc.paging") final String pagingString, @QueryParam("page") final String pageString, - @QueryParam("oslc.pageSize") final String pageSizeString) throws ServletException, IOException + @QueryParam("oslc.pageSize") final String pageSizeString) throws ServletException, IOException { + boolean paging=false; int page=0; int pageSize=20; + if (null != pagingString) { + paging = Boolean.parseBoolean(pagingString); + } if (null != pageString) { page = Integer.parseInt(pageString); } @@ -202,25 +226,34 @@ public void queryLinkTypesAsHtml( // Start of user code queryLinkTypesAsHtml // End of user code - final List resources = AMManager.queryLinkTypes(httpServletRequest, where, prefix, page, pageSize); + final List resources = AMManager.queryLinkTypes(httpServletRequest, where, prefix, paging, page, pageSize); if (resources!= null) { httpServletRequest.setAttribute("resources", resources); // Start of user code queryLinkTypesAsHtml_setAttributes // End of user code - httpServletRequest.setAttribute("queryUri", - uriInfo.getAbsolutePath().toString() + "?oslc.paging=true"); + UriBuilder uriBuilder = UriBuilder.fromUri(uriInfo.getAbsolutePath()) + .queryParam("oslc.paging", "true") + .queryParam("oslc.pageSize", pageSize) + .queryParam("page", page); + if (null != where) { + uriBuilder.queryParam("oslc.where", where); + } + if (null != prefix) { + uriBuilder.queryParam("oslc.prefix", prefix); + } + httpServletRequest.setAttribute("queryUri", uriBuilder.build().toString()); if (resources.size() > pageSize) { resources.remove(resources.size() - 1); - httpServletRequest.setAttribute(OSLC4JConstants.OSLC4J_NEXT_PAGE, - uriInfo.getAbsolutePath().toString() + "?oslc.paging=true&oslc.pageSize=" + pageSize + "&page=" + (page + 1)); + + uriBuilder.replaceQueryParam("page", page + 1); + httpServletRequest.setAttribute(OSLC4JConstants.OSLC4J_NEXT_PAGE, uriBuilder.build().toString()); } RequestDispatcher rd = httpServletRequest.getRequestDispatcher("/co/oslc/refimpl/am/gen/linktypescollection.jsp"); rd.forward(httpServletRequest,httpServletResponse); return; } - throw new WebApplicationException(Status.NOT_FOUND); } @@ -237,10 +270,10 @@ public void queryLinkTypesAsHtml( @GET @Path("selector") @Consumes({ MediaType.TEXT_HTML, MediaType.WILDCARD }) - public void LinkTypeSelector( + public Response LinkTypeSelector( @QueryParam("terms") final String terms - ) throws ServletException, IOException + ) throws ServletException, IOException, JSONException { // Start of user code LinkTypeSelector_init // End of user code @@ -253,10 +286,20 @@ public void LinkTypeSelector( httpServletRequest.setAttribute("terms", terms); final List resources = AMManager.LinkTypeSelector(httpServletRequest, terms); if (resources!= null) { - httpServletRequest.setAttribute("resources", resources); - RequestDispatcher rd = httpServletRequest.getRequestDispatcher("/co/oslc/refimpl/am/gen/linktypeselectorresults.jsp"); - rd.forward(httpServletRequest, httpServletResponse); - return; + JSONArray resourceArray = new JSONArray(); + for (LinkType resource : resources) { + JSONObject r = new JSONObject(); + r.put("oslc:label", resource.toString()); + r.put("rdf:resource", resource.getAbout().toString()); + r.put("Label", resource.toString()); + // Start of user code LinkTypeSelector_setResponse + //TODO: Add any other attributes that are to be displayed in the search result + // End of user code + resourceArray.add(r); + } + JSONObject response = new JSONObject(); + response.put("oslc:results", resourceArray); + return Response.ok(response.write()).build(); } log.error("A empty search should return an empty list and not NULL!"); throw new WebApplicationException(Status.INTERNAL_SERVER_ERROR); @@ -264,7 +307,7 @@ public void LinkTypeSelector( } else { RequestDispatcher rd = httpServletRequest.getRequestDispatcher("/co/oslc/refimpl/am/gen/linktypeselector.jsp"); rd.forward(httpServletRequest, httpServletResponse); - return; + return null; } } @@ -286,11 +329,13 @@ public void LinkTypeSelector( @Path("create") @Consumes({OslcMediaType.APPLICATION_RDF_XML, OslcMediaType.APPLICATION_JSON_LD, OslcMediaType.TEXT_TURTLE, OslcMediaType.APPLICATION_XML, OslcMediaType.APPLICATION_JSON }) @Produces({OslcMediaType.APPLICATION_RDF_XML, OslcMediaType.APPLICATION_JSON_LD, OslcMediaType.TEXT_TURTLE, OslcMediaType.APPLICATION_XML, OslcMediaType.APPLICATION_JSON}) - @ApiOperation( - value = "Creation factory for resources of type {" + Oslc_amDomainConstants.LINKTYPE_LOCALNAME + "}", - notes = "Creation factory for resources of type {" + "" + Oslc_amDomainConstants.LINKTYPE_LOCALNAME + "" + "}" + + @Operation( + summary = "Creation factory for resources of type {" + Oslc_amDomainConstants.LINKTYPE_LOCALNAME + "}", + description = "Creation factory for resources of type {" + "" + Oslc_amDomainConstants.LINKTYPE_LOCALNAME + "" + "}" + ", with respective resource shapes {" + "" + Oslc_amDomainConstants.LINKTYPE_LOCALNAME + "" + "}", - produces = OslcMediaType.APPLICATION_RDF_XML + ", " + OslcMediaType.APPLICATION_XML + ", " + OslcMediaType.APPLICATION_JSON + ", " + OslcMediaType.TEXT_TURTLE + responses = { + @ApiResponse(description = "default response", content = {@Content(mediaType = OslcMediaType.APPLICATION_RDF_XML), @Content(mediaType = OslcMediaType.APPLICATION_XML), @Content(mediaType = OslcMediaType.APPLICATION_JSON), @Content(mediaType = OslcMediaType.TEXT_TURTLE)}) + } ) public Response createLinkType( diff --git a/src/server-am/src/main/java/co/oslc/refimpl/am/gen/services/ResourcesService.java b/src/server-am/src/main/java/co/oslc/refimpl/am/gen/services/ResourcesService.java index 6c53c779..4b62c748 100644 --- a/src/server-am/src/main/java/co/oslc/refimpl/am/gen/services/ResourcesService.java +++ b/src/server-am/src/main/java/co/oslc/refimpl/am/gen/services/ResourcesService.java @@ -62,6 +62,7 @@ import org.apache.wink.json4j.JSONException; import org.apache.wink.json4j.JSONObject; +import org.apache.wink.json4j.JSONArray; import org.eclipse.lyo.oslc4j.provider.json4j.JsonHelper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -87,8 +88,9 @@ import co.oslc.refimpl.am.gen.servlet.ServiceProviderCatalogSingleton; import org.eclipse.lyo.oslc.domains.Person; import org.eclipse.lyo.oslc.domains.am.Resource; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.responses.ApiResponse; // Start of user code imports // End of user code @@ -97,7 +99,6 @@ // End of user code @OslcService(Oslc_amDomainConstants.ARCHITECTURE_MANAGEMENT_DOMAIN) @Path("service1/resources") -@Api(value = "OSLC Service for {" + Oslc_amDomainConstants.RESOURCE_LOCALNAME + "}") public class ResourcesService { @Context private HttpServletRequest httpServletRequest; @@ -137,21 +138,28 @@ private void addCORSHeaders (final HttpServletResponse httpServletResponse) { @GET @Path("query") @Produces({OslcMediaType.APPLICATION_RDF_XML, OslcMediaType.APPLICATION_JSON_LD, OslcMediaType.TEXT_TURTLE, OslcMediaType.APPLICATION_XML, OslcMediaType.APPLICATION_JSON}) - @ApiOperation( - value = "Query capability for resources of type {" + Oslc_amDomainConstants.RESOURCE_LOCALNAME + "}", - notes = "Query capability for resources of type {" + "" + Oslc_amDomainConstants.RESOURCE_LOCALNAME + "" + "}" + + @Operation( + summary = "Query capability for resources of type {" + Oslc_amDomainConstants.RESOURCE_LOCALNAME + "}", + description = "Query capability for resources of type {" + "" + Oslc_amDomainConstants.RESOURCE_LOCALNAME + "" + "}" + ", with respective resource shapes {" + "" + Oslc_amDomainConstants.RESOURCE_LOCALNAME + "" + "}", - produces = OslcMediaType.APPLICATION_RDF_XML + ", " + OslcMediaType.APPLICATION_XML + ", " + OslcMediaType.APPLICATION_JSON + ", " + OslcMediaType.TEXT_TURTLE + ", " + MediaType.TEXT_HTML + responses = { + @ApiResponse(description = "default response", content = {@Content(mediaType = OslcMediaType.APPLICATION_RDF_XML), @Content(mediaType = OslcMediaType.APPLICATION_XML), @Content(mediaType = OslcMediaType.APPLICATION_JSON), @Content(mediaType = OslcMediaType.TEXT_TURTLE), @Content(mediaType = MediaType.TEXT_HTML)}) + } ) public Resource[] queryResources( @QueryParam("oslc.where") final String where, @QueryParam("oslc.prefix") final String prefix, + @QueryParam("oslc.paging") final String pagingString, @QueryParam("page") final String pageString, - @QueryParam("oslc.pageSize") final String pageSizeString) throws IOException, ServletException + @QueryParam("oslc.pageSize") final String pageSizeString) throws IOException, ServletException { + boolean paging=false; int page=0; int pageSize=20; + if (null != pagingString) { + paging = Boolean.parseBoolean(pagingString); + } if (null != pageString) { page = Integer.parseInt(pageString); } @@ -163,13 +171,22 @@ public Resource[] queryResources( // Here additional logic can be implemented that complements main action taken in AMManager // End of user code - final List resources = AMManager.queryResources(httpServletRequest, where, prefix, page, pageSize); - httpServletRequest.setAttribute("queryUri", - uriInfo.getAbsolutePath().toString() + "?oslc.paging=true"); + final List resources = AMManager.queryResources(httpServletRequest, where, prefix, paging, page, pageSize); + UriBuilder uriBuilder = UriBuilder.fromUri(uriInfo.getAbsolutePath()) + .queryParam("oslc.paging", "true") + .queryParam("oslc.pageSize", pageSize) + .queryParam("page", page); + if (null != where) { + uriBuilder.queryParam("oslc.where", where); + } + if (null != prefix) { + uriBuilder.queryParam("oslc.prefix", prefix); + } + httpServletRequest.setAttribute("queryUri", uriBuilder.build().toString()); if (resources.size() > pageSize) { resources.remove(resources.size() - 1); - httpServletRequest.setAttribute(OSLC4JConstants.OSLC4J_NEXT_PAGE, - uriInfo.getAbsolutePath().toString() + "?oslc.paging=true&oslc.pageSize=" + pageSize + "&page=" + (page + 1)); + uriBuilder.replaceQueryParam("page", page + 1); + httpServletRequest.setAttribute(OSLC4JConstants.OSLC4J_NEXT_PAGE, uriBuilder.build().toString()); } return resources.toArray(new Resource [resources.size()]); } @@ -177,21 +194,28 @@ public Resource[] queryResources( @GET @Path("query") @Produces({ MediaType.TEXT_HTML }) - @ApiOperation( - value = "Query capability for resources of type {" + Oslc_amDomainConstants.RESOURCE_LOCALNAME + "}", - notes = "Query capability for resources of type {" + "" + Oslc_amDomainConstants.RESOURCE_LOCALNAME + "" + "}" + + @Operation( + summary = "Query capability for resources of type {" + Oslc_amDomainConstants.RESOURCE_LOCALNAME + "}", + description = "Query capability for resources of type {" + "" + Oslc_amDomainConstants.RESOURCE_LOCALNAME + "" + "}" + ", with respective resource shapes {" + "" + Oslc_amDomainConstants.RESOURCE_LOCALNAME + "" + "}", - produces = OslcMediaType.APPLICATION_RDF_XML + ", " + OslcMediaType.APPLICATION_XML + ", " + OslcMediaType.APPLICATION_JSON + ", " + OslcMediaType.TEXT_TURTLE + ", " + MediaType.TEXT_HTML + responses = { + @ApiResponse(description = "default response", content = {@Content(mediaType = OslcMediaType.APPLICATION_RDF_XML), @Content(mediaType = OslcMediaType.APPLICATION_XML), @Content(mediaType = OslcMediaType.APPLICATION_JSON), @Content(mediaType = OslcMediaType.TEXT_TURTLE), @Content(mediaType = MediaType.TEXT_HTML)}) + } ) public void queryResourcesAsHtml( @QueryParam("oslc.where") final String where, @QueryParam("oslc.prefix") final String prefix, + @QueryParam("oslc.paging") final String pagingString, @QueryParam("page") final String pageString, - @QueryParam("oslc.pageSize") final String pageSizeString) throws ServletException, IOException + @QueryParam("oslc.pageSize") final String pageSizeString) throws ServletException, IOException { + boolean paging=false; int page=0; int pageSize=20; + if (null != pagingString) { + paging = Boolean.parseBoolean(pagingString); + } if (null != pageString) { page = Integer.parseInt(pageString); } @@ -202,25 +226,34 @@ public void queryResourcesAsHtml( // Start of user code queryResourcesAsHtml // End of user code - final List resources = AMManager.queryResources(httpServletRequest, where, prefix, page, pageSize); + final List resources = AMManager.queryResources(httpServletRequest, where, prefix, paging, page, pageSize); if (resources!= null) { httpServletRequest.setAttribute("resources", resources); // Start of user code queryResourcesAsHtml_setAttributes // End of user code - httpServletRequest.setAttribute("queryUri", - uriInfo.getAbsolutePath().toString() + "?oslc.paging=true"); + UriBuilder uriBuilder = UriBuilder.fromUri(uriInfo.getAbsolutePath()) + .queryParam("oslc.paging", "true") + .queryParam("oslc.pageSize", pageSize) + .queryParam("page", page); + if (null != where) { + uriBuilder.queryParam("oslc.where", where); + } + if (null != prefix) { + uriBuilder.queryParam("oslc.prefix", prefix); + } + httpServletRequest.setAttribute("queryUri", uriBuilder.build().toString()); if (resources.size() > pageSize) { resources.remove(resources.size() - 1); - httpServletRequest.setAttribute(OSLC4JConstants.OSLC4J_NEXT_PAGE, - uriInfo.getAbsolutePath().toString() + "?oslc.paging=true&oslc.pageSize=" + pageSize + "&page=" + (page + 1)); + + uriBuilder.replaceQueryParam("page", page + 1); + httpServletRequest.setAttribute(OSLC4JConstants.OSLC4J_NEXT_PAGE, uriBuilder.build().toString()); } RequestDispatcher rd = httpServletRequest.getRequestDispatcher("/co/oslc/refimpl/am/gen/resourcescollection.jsp"); rd.forward(httpServletRequest,httpServletResponse); return; } - throw new WebApplicationException(Status.NOT_FOUND); } @@ -237,10 +270,10 @@ public void queryResourcesAsHtml( @GET @Path("selector") @Consumes({ MediaType.TEXT_HTML, MediaType.WILDCARD }) - public void ResourceSelector( + public Response ResourceSelector( @QueryParam("terms") final String terms - ) throws ServletException, IOException + ) throws ServletException, IOException, JSONException { // Start of user code ResourceSelector_init // End of user code @@ -253,10 +286,20 @@ public void ResourceSelector( httpServletRequest.setAttribute("terms", terms); final List resources = AMManager.ResourceSelector(httpServletRequest, terms); if (resources!= null) { - httpServletRequest.setAttribute("resources", resources); - RequestDispatcher rd = httpServletRequest.getRequestDispatcher("/co/oslc/refimpl/am/gen/resourceselectorresults.jsp"); - rd.forward(httpServletRequest, httpServletResponse); - return; + JSONArray resourceArray = new JSONArray(); + for (Resource resource : resources) { + JSONObject r = new JSONObject(); + r.put("oslc:label", resource.toString()); + r.put("rdf:resource", resource.getAbout().toString()); + r.put("Label", resource.toString()); + // Start of user code ResourceSelector_setResponse + //TODO: Add any other attributes that are to be displayed in the search result + // End of user code + resourceArray.add(r); + } + JSONObject response = new JSONObject(); + response.put("oslc:results", resourceArray); + return Response.ok(response.write()).build(); } log.error("A empty search should return an empty list and not NULL!"); throw new WebApplicationException(Status.INTERNAL_SERVER_ERROR); @@ -264,7 +307,7 @@ public void ResourceSelector( } else { RequestDispatcher rd = httpServletRequest.getRequestDispatcher("/co/oslc/refimpl/am/gen/resourceselector.jsp"); rd.forward(httpServletRequest, httpServletResponse); - return; + return null; } } @@ -286,11 +329,13 @@ public void ResourceSelector( @Path("create") @Consumes({OslcMediaType.APPLICATION_RDF_XML, OslcMediaType.APPLICATION_JSON_LD, OslcMediaType.TEXT_TURTLE, OslcMediaType.APPLICATION_XML, OslcMediaType.APPLICATION_JSON }) @Produces({OslcMediaType.APPLICATION_RDF_XML, OslcMediaType.APPLICATION_JSON_LD, OslcMediaType.TEXT_TURTLE, OslcMediaType.APPLICATION_XML, OslcMediaType.APPLICATION_JSON}) - @ApiOperation( - value = "Creation factory for resources of type {" + Oslc_amDomainConstants.RESOURCE_LOCALNAME + "}", - notes = "Creation factory for resources of type {" + "" + Oslc_amDomainConstants.RESOURCE_LOCALNAME + "" + "}" + + @Operation( + summary = "Creation factory for resources of type {" + Oslc_amDomainConstants.RESOURCE_LOCALNAME + "}", + description = "Creation factory for resources of type {" + "" + Oslc_amDomainConstants.RESOURCE_LOCALNAME + "" + "}" + ", with respective resource shapes {" + "" + Oslc_amDomainConstants.RESOURCE_LOCALNAME + "" + "}", - produces = OslcMediaType.APPLICATION_RDF_XML + ", " + OslcMediaType.APPLICATION_XML + ", " + OslcMediaType.APPLICATION_JSON + ", " + OslcMediaType.TEXT_TURTLE + responses = { + @ApiResponse(description = "default response", content = {@Content(mediaType = OslcMediaType.APPLICATION_RDF_XML), @Content(mediaType = OslcMediaType.APPLICATION_XML), @Content(mediaType = OslcMediaType.APPLICATION_JSON), @Content(mediaType = OslcMediaType.TEXT_TURTLE)}) + } ) public Response createResource( diff --git a/src/server-am/src/main/java/co/oslc/refimpl/am/gen/services/ServiceProviderCatalogService.java b/src/server-am/src/main/java/co/oslc/refimpl/am/gen/services/ServiceProviderCatalogService.java index d711af05..bb5cfb8f 100644 --- a/src/server-am/src/main/java/co/oslc/refimpl/am/gen/services/ServiceProviderCatalogService.java +++ b/src/server-am/src/main/java/co/oslc/refimpl/am/gen/services/ServiceProviderCatalogService.java @@ -111,7 +111,7 @@ public Response getServiceProviderCatalogs() throws IOException, URISyntaxExcept @GET @Path("{serviceProviderCatalogId}") // Required to distinguish from array result. But, ignored. @Produces({OslcMediaType.APPLICATION_RDF_XML, OslcMediaType.APPLICATION_JSON_LD, OslcMediaType.TEXT_TURTLE, OslcMediaType.APPLICATION_XML, OslcMediaType.APPLICATION_JSON}) - public ServiceProviderCatalog getServiceProviderCatalog() + public ServiceProviderCatalog getServiceProviderCatalog(@PathParam("serviceProviderCatalogId") final String serviceProviderCatalogId) { ServiceProviderCatalog catalog = ServiceProviderCatalogSingleton.getServiceProviderCatalog(httpServletRequest); diff --git a/src/server-am/src/main/java/co/oslc/refimpl/am/gen/services/WsLinkType.java b/src/server-am/src/main/java/co/oslc/refimpl/am/gen/services/WsLinkType.java index 1d3a7d7f..2949c353 100644 --- a/src/server-am/src/main/java/co/oslc/refimpl/am/gen/services/WsLinkType.java +++ b/src/server-am/src/main/java/co/oslc/refimpl/am/gen/services/WsLinkType.java @@ -84,8 +84,9 @@ import org.eclipse.lyo.oslc.domains.am.Oslc_amDomainConstants; import co.oslc.refimpl.am.gen.servlet.ServiceProviderCatalogSingleton; import org.eclipse.lyo.oslc.domains.am.LinkType; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.responses.ApiResponse; // Start of user code imports // End of user code @@ -93,7 +94,6 @@ // Start of user code pre_class_code // End of user code @Path("lt") -@Api(value = "Web Service for {" + Oslc_amDomainConstants.LINKTYPE_LOCALNAME + "}") public class WsLinkType { @Context private HttpServletRequest httpServletRequest; @@ -125,11 +125,13 @@ private void addCORSHeaders (final HttpServletResponse httpServletResponse) { @GET @Path("{id}") @Produces({OslcMediaType.APPLICATION_RDF_XML, OslcMediaType.APPLICATION_JSON_LD, OslcMediaType.TEXT_TURTLE, OslcMediaType.APPLICATION_XML, OslcMediaType.APPLICATION_JSON}) - @ApiOperation( - value = "GET for resources of type {'" + Oslc_amDomainConstants.LINKTYPE_LOCALNAME + "'}", - notes = "GET for resources of type {'" + "" + Oslc_amDomainConstants.LINKTYPE_LOCALNAME + "" + "'}" + + @Operation( + summary = "GET for resources of type {'" + Oslc_amDomainConstants.LINKTYPE_LOCALNAME + "'}", + description = "GET for resources of type {'" + "" + Oslc_amDomainConstants.LINKTYPE_LOCALNAME + "" + "'}" + ", with respective resource shapes {'" + "" + Oslc_amDomainConstants.LINKTYPE_LOCALNAME + "" + "'}", - produces = OslcMediaType.APPLICATION_RDF_XML + ", " + OslcMediaType.APPLICATION_XML + ", " + OslcMediaType.APPLICATION_JSON + ", " + OslcMediaType.TEXT_TURTLE + ", " + MediaType.TEXT_HTML + ", " + OslcMediaType.APPLICATION_X_OSLC_COMPACT_XML + responses = { + @ApiResponse(description = "default response", content = {@Content(mediaType = OslcMediaType.APPLICATION_RDF_XML), @Content(mediaType = OslcMediaType.APPLICATION_XML), @Content(mediaType = OslcMediaType.APPLICATION_JSON), @Content(mediaType = OslcMediaType.TEXT_TURTLE), @Content(mediaType = MediaType.TEXT_HTML), @Content(mediaType = OslcMediaType.APPLICATION_X_OSLC_COMPACT_XML)}) + } ) public LinkType getLinkType( @PathParam("id") final String id @@ -154,11 +156,13 @@ public LinkType getLinkType( @GET @Path("{id}") @Produces({ MediaType.TEXT_HTML }) - @ApiOperation( - value = "GET for resources of type {'" + Oslc_amDomainConstants.LINKTYPE_LOCALNAME + "'}", - notes = "GET for resources of type {'" + "" + Oslc_amDomainConstants.LINKTYPE_LOCALNAME + "" + "'}" + + @Operation( + summary = "GET for resources of type {'" + Oslc_amDomainConstants.LINKTYPE_LOCALNAME + "'}", + description = "GET for resources of type {'" + "" + Oslc_amDomainConstants.LINKTYPE_LOCALNAME + "" + "'}" + ", with respective resource shapes {'" + "" + Oslc_amDomainConstants.LINKTYPE_LOCALNAME + "" + "'}", - produces = OslcMediaType.APPLICATION_RDF_XML + ", " + OslcMediaType.APPLICATION_XML + ", " + OslcMediaType.APPLICATION_JSON + ", " + OslcMediaType.TEXT_TURTLE + ", " + MediaType.TEXT_HTML + ", " + OslcMediaType.APPLICATION_X_OSLC_COMPACT_XML + responses = { + @ApiResponse(description = "default response", content = {@Content(mediaType = OslcMediaType.APPLICATION_RDF_XML), @Content(mediaType = OslcMediaType.APPLICATION_XML), @Content(mediaType = OslcMediaType.APPLICATION_JSON), @Content(mediaType = OslcMediaType.TEXT_TURTLE), @Content(mediaType = MediaType.TEXT_HTML), @Content(mediaType = OslcMediaType.APPLICATION_X_OSLC_COMPACT_XML)}) + } ) public void getLinkTypeAsHtml( @PathParam("id") final String id @@ -185,21 +189,23 @@ public void getLinkTypeAsHtml( @GET @Path("{id}") @Produces({OslcMediaType.APPLICATION_X_OSLC_COMPACT_XML}) - @ApiOperation( - value = "GET for resources of type {'" + Oslc_amDomainConstants.LINKTYPE_LOCALNAME + "'}", - notes = "GET for resources of type {'" + "" + Oslc_amDomainConstants.LINKTYPE_LOCALNAME + "" + "'}" + + @Operation( + summary = "GET for resources of type {'" + Oslc_amDomainConstants.LINKTYPE_LOCALNAME + "'}", + description = "GET for resources of type {'" + "" + Oslc_amDomainConstants.LINKTYPE_LOCALNAME + "" + "'}" + ", with respective resource shapes {'" + "" + Oslc_amDomainConstants.LINKTYPE_LOCALNAME + "" + "'}", - produces = OslcMediaType.APPLICATION_RDF_XML + ", " + OslcMediaType.APPLICATION_XML + ", " + OslcMediaType.APPLICATION_JSON + ", " + OslcMediaType.TEXT_TURTLE + ", " + MediaType.TEXT_HTML + ", " + OslcMediaType.APPLICATION_X_OSLC_COMPACT_XML + responses = { + @ApiResponse(description = "default response", content = {@Content(mediaType = OslcMediaType.APPLICATION_RDF_XML), @Content(mediaType = OslcMediaType.APPLICATION_XML), @Content(mediaType = OslcMediaType.APPLICATION_JSON), @Content(mediaType = OslcMediaType.TEXT_TURTLE), @Content(mediaType = MediaType.TEXT_HTML), @Content(mediaType = OslcMediaType.APPLICATION_X_OSLC_COMPACT_XML)}) + } ) public Compact getLinkTypeCompact( @PathParam("id") final String id ) throws ServletException, IOException, URISyntaxException { String iconUri = OSLC4JUtils.getPublicURI() + "/images/ui_preview_icon.gif"; - String smallPreviewHintHeight = "10em"; - String smallPreviewHintWidth = "45em"; - String largePreviewHintHeight = "20em"; - String largePreviewHintWidth = "45em"; + String smallPreviewHintHeight = "200px"; + String smallPreviewHintWidth = "300px"; + String largePreviewHintHeight = "400px"; + String largePreviewHintWidth = "600px"; // Start of user code getLinkTypeCompact_init //TODO: adjust the preview height & width values from the default values provided above. @@ -290,11 +296,13 @@ public void getLinkTypeAsHtmlLargePreview( } @DELETE @Path("{id}") - @ApiOperation( - value = "DELETE for resources of type {'" + Oslc_amDomainConstants.LINKTYPE_LOCALNAME + "'}", - notes = "DELETE for resources of type {'" + "" + Oslc_amDomainConstants.LINKTYPE_LOCALNAME + "" + "'}" + + @Operation( + summary = "DELETE for resources of type {'" + Oslc_amDomainConstants.LINKTYPE_LOCALNAME + "'}", + description = "DELETE for resources of type {'" + "" + Oslc_amDomainConstants.LINKTYPE_LOCALNAME + "" + "'}" + ", with respective resource shapes {'" + "" + Oslc_amDomainConstants.LINKTYPE_LOCALNAME + "" + "'}", - produces = OslcMediaType.APPLICATION_RDF_XML + ", " + OslcMediaType.APPLICATION_XML + ", " + OslcMediaType.APPLICATION_JSON + ", " + OslcMediaType.TEXT_TURTLE + ", " + MediaType.TEXT_HTML + ", " + OslcMediaType.APPLICATION_X_OSLC_COMPACT_XML + responses = { + @ApiResponse(description = "default response", content = {@Content(mediaType = OslcMediaType.APPLICATION_RDF_XML), @Content(mediaType = OslcMediaType.APPLICATION_XML), @Content(mediaType = OslcMediaType.APPLICATION_JSON), @Content(mediaType = OslcMediaType.TEXT_TURTLE), @Content(mediaType = MediaType.TEXT_HTML), @Content(mediaType = OslcMediaType.APPLICATION_X_OSLC_COMPACT_XML)}) + } ) public Response deleteLinkType( @PathParam("id") final String id @@ -319,11 +327,13 @@ public Response deleteLinkType( @PUT @Path("{id}") @Consumes({OslcMediaType.APPLICATION_RDF_XML, OslcMediaType.APPLICATION_JSON_LD, OslcMediaType.TEXT_TURTLE, OslcMediaType.APPLICATION_XML, OslcMediaType.APPLICATION_JSON }) - @ApiOperation( - value = "PUT for resources of type {'" + Oslc_amDomainConstants.LINKTYPE_LOCALNAME + "'}", - notes = "PUT for resources of type {'" + "" + Oslc_amDomainConstants.LINKTYPE_LOCALNAME + "" + "'}" + + @Operation( + summary = "PUT for resources of type {'" + Oslc_amDomainConstants.LINKTYPE_LOCALNAME + "'}", + description = "PUT for resources of type {'" + "" + Oslc_amDomainConstants.LINKTYPE_LOCALNAME + "" + "'}" + ", with respective resource shapes {'" + "" + Oslc_amDomainConstants.LINKTYPE_LOCALNAME + "" + "'}", - produces = OslcMediaType.APPLICATION_RDF_XML + ", " + OslcMediaType.APPLICATION_XML + ", " + OslcMediaType.APPLICATION_JSON + ", " + OslcMediaType.TEXT_TURTLE + ", " + MediaType.TEXT_HTML + ", " + OslcMediaType.APPLICATION_X_OSLC_COMPACT_XML + responses = { + @ApiResponse(description = "default response", content = {@Content(mediaType = OslcMediaType.APPLICATION_RDF_XML), @Content(mediaType = OslcMediaType.APPLICATION_XML), @Content(mediaType = OslcMediaType.APPLICATION_JSON), @Content(mediaType = OslcMediaType.TEXT_TURTLE), @Content(mediaType = MediaType.TEXT_HTML), @Content(mediaType = OslcMediaType.APPLICATION_X_OSLC_COMPACT_XML)}) + } ) public Response updateLinkType( @HeaderParam("If-Match") final String eTagHeader, diff --git a/src/server-am/src/main/java/co/oslc/refimpl/am/gen/services/WsResource.java b/src/server-am/src/main/java/co/oslc/refimpl/am/gen/services/WsResource.java index da76676e..47f7a494 100644 --- a/src/server-am/src/main/java/co/oslc/refimpl/am/gen/services/WsResource.java +++ b/src/server-am/src/main/java/co/oslc/refimpl/am/gen/services/WsResource.java @@ -84,8 +84,9 @@ import org.eclipse.lyo.oslc.domains.am.Oslc_amDomainConstants; import co.oslc.refimpl.am.gen.servlet.ServiceProviderCatalogSingleton; import org.eclipse.lyo.oslc.domains.am.Resource; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.responses.ApiResponse; // Start of user code imports // End of user code @@ -93,7 +94,6 @@ // Start of user code pre_class_code // End of user code @Path("resource") -@Api(value = "Web Service for {" + Oslc_amDomainConstants.RESOURCE_LOCALNAME + "}") public class WsResource { @Context private HttpServletRequest httpServletRequest; @@ -125,11 +125,13 @@ private void addCORSHeaders (final HttpServletResponse httpServletResponse) { @GET @Path("{id}") @Produces({OslcMediaType.APPLICATION_RDF_XML, OslcMediaType.APPLICATION_JSON_LD, OslcMediaType.TEXT_TURTLE, OslcMediaType.APPLICATION_XML, OslcMediaType.APPLICATION_JSON}) - @ApiOperation( - value = "GET for resources of type {'" + Oslc_amDomainConstants.RESOURCE_LOCALNAME + "'}", - notes = "GET for resources of type {'" + "" + Oslc_amDomainConstants.RESOURCE_LOCALNAME + "" + "'}" + + @Operation( + summary = "GET for resources of type {'" + Oslc_amDomainConstants.RESOURCE_LOCALNAME + "'}", + description = "GET for resources of type {'" + "" + Oslc_amDomainConstants.RESOURCE_LOCALNAME + "" + "'}" + ", with respective resource shapes {'" + "" + Oslc_amDomainConstants.RESOURCE_LOCALNAME + "" + "'}", - produces = OslcMediaType.APPLICATION_RDF_XML + ", " + OslcMediaType.APPLICATION_XML + ", " + OslcMediaType.APPLICATION_JSON + ", " + OslcMediaType.TEXT_TURTLE + ", " + MediaType.TEXT_HTML + ", " + OslcMediaType.APPLICATION_X_OSLC_COMPACT_XML + responses = { + @ApiResponse(description = "default response", content = {@Content(mediaType = OslcMediaType.APPLICATION_RDF_XML), @Content(mediaType = OslcMediaType.APPLICATION_XML), @Content(mediaType = OslcMediaType.APPLICATION_JSON), @Content(mediaType = OslcMediaType.TEXT_TURTLE), @Content(mediaType = MediaType.TEXT_HTML), @Content(mediaType = OslcMediaType.APPLICATION_X_OSLC_COMPACT_XML)}) + } ) public Resource getResource( @PathParam("id") final String id @@ -154,11 +156,13 @@ public Resource getResource( @GET @Path("{id}") @Produces({ MediaType.TEXT_HTML }) - @ApiOperation( - value = "GET for resources of type {'" + Oslc_amDomainConstants.RESOURCE_LOCALNAME + "'}", - notes = "GET for resources of type {'" + "" + Oslc_amDomainConstants.RESOURCE_LOCALNAME + "" + "'}" + + @Operation( + summary = "GET for resources of type {'" + Oslc_amDomainConstants.RESOURCE_LOCALNAME + "'}", + description = "GET for resources of type {'" + "" + Oslc_amDomainConstants.RESOURCE_LOCALNAME + "" + "'}" + ", with respective resource shapes {'" + "" + Oslc_amDomainConstants.RESOURCE_LOCALNAME + "" + "'}", - produces = OslcMediaType.APPLICATION_RDF_XML + ", " + OslcMediaType.APPLICATION_XML + ", " + OslcMediaType.APPLICATION_JSON + ", " + OslcMediaType.TEXT_TURTLE + ", " + MediaType.TEXT_HTML + ", " + OslcMediaType.APPLICATION_X_OSLC_COMPACT_XML + responses = { + @ApiResponse(description = "default response", content = {@Content(mediaType = OslcMediaType.APPLICATION_RDF_XML), @Content(mediaType = OslcMediaType.APPLICATION_XML), @Content(mediaType = OslcMediaType.APPLICATION_JSON), @Content(mediaType = OslcMediaType.TEXT_TURTLE), @Content(mediaType = MediaType.TEXT_HTML), @Content(mediaType = OslcMediaType.APPLICATION_X_OSLC_COMPACT_XML)}) + } ) public void getResourceAsHtml( @PathParam("id") final String id @@ -185,21 +189,23 @@ public void getResourceAsHtml( @GET @Path("{id}") @Produces({OslcMediaType.APPLICATION_X_OSLC_COMPACT_XML}) - @ApiOperation( - value = "GET for resources of type {'" + Oslc_amDomainConstants.RESOURCE_LOCALNAME + "'}", - notes = "GET for resources of type {'" + "" + Oslc_amDomainConstants.RESOURCE_LOCALNAME + "" + "'}" + + @Operation( + summary = "GET for resources of type {'" + Oslc_amDomainConstants.RESOURCE_LOCALNAME + "'}", + description = "GET for resources of type {'" + "" + Oslc_amDomainConstants.RESOURCE_LOCALNAME + "" + "'}" + ", with respective resource shapes {'" + "" + Oslc_amDomainConstants.RESOURCE_LOCALNAME + "" + "'}", - produces = OslcMediaType.APPLICATION_RDF_XML + ", " + OslcMediaType.APPLICATION_XML + ", " + OslcMediaType.APPLICATION_JSON + ", " + OslcMediaType.TEXT_TURTLE + ", " + MediaType.TEXT_HTML + ", " + OslcMediaType.APPLICATION_X_OSLC_COMPACT_XML + responses = { + @ApiResponse(description = "default response", content = {@Content(mediaType = OslcMediaType.APPLICATION_RDF_XML), @Content(mediaType = OslcMediaType.APPLICATION_XML), @Content(mediaType = OslcMediaType.APPLICATION_JSON), @Content(mediaType = OslcMediaType.TEXT_TURTLE), @Content(mediaType = MediaType.TEXT_HTML), @Content(mediaType = OslcMediaType.APPLICATION_X_OSLC_COMPACT_XML)}) + } ) public Compact getResourceCompact( @PathParam("id") final String id ) throws ServletException, IOException, URISyntaxException { String iconUri = OSLC4JUtils.getPublicURI() + "/images/ui_preview_icon.gif"; - String smallPreviewHintHeight = "10em"; - String smallPreviewHintWidth = "45em"; - String largePreviewHintHeight = "20em"; - String largePreviewHintWidth = "45em"; + String smallPreviewHintHeight = "200px"; + String smallPreviewHintWidth = "300px"; + String largePreviewHintHeight = "400px"; + String largePreviewHintWidth = "600px"; // Start of user code getResourceCompact_init //TODO: adjust the preview height & width values from the default values provided above. @@ -290,11 +296,13 @@ public void getResourceAsHtmlLargePreview( } @DELETE @Path("{id}") - @ApiOperation( - value = "DELETE for resources of type {'" + Oslc_amDomainConstants.RESOURCE_LOCALNAME + "'}", - notes = "DELETE for resources of type {'" + "" + Oslc_amDomainConstants.RESOURCE_LOCALNAME + "" + "'}" + + @Operation( + summary = "DELETE for resources of type {'" + Oslc_amDomainConstants.RESOURCE_LOCALNAME + "'}", + description = "DELETE for resources of type {'" + "" + Oslc_amDomainConstants.RESOURCE_LOCALNAME + "" + "'}" + ", with respective resource shapes {'" + "" + Oslc_amDomainConstants.RESOURCE_LOCALNAME + "" + "'}", - produces = OslcMediaType.APPLICATION_RDF_XML + ", " + OslcMediaType.APPLICATION_XML + ", " + OslcMediaType.APPLICATION_JSON + ", " + OslcMediaType.TEXT_TURTLE + ", " + MediaType.TEXT_HTML + ", " + OslcMediaType.APPLICATION_X_OSLC_COMPACT_XML + responses = { + @ApiResponse(description = "default response", content = {@Content(mediaType = OslcMediaType.APPLICATION_RDF_XML), @Content(mediaType = OslcMediaType.APPLICATION_XML), @Content(mediaType = OslcMediaType.APPLICATION_JSON), @Content(mediaType = OslcMediaType.TEXT_TURTLE), @Content(mediaType = MediaType.TEXT_HTML), @Content(mediaType = OslcMediaType.APPLICATION_X_OSLC_COMPACT_XML)}) + } ) public Response deleteResource( @PathParam("id") final String id @@ -319,11 +327,13 @@ public Response deleteResource( @PUT @Path("{id}") @Consumes({OslcMediaType.APPLICATION_RDF_XML, OslcMediaType.APPLICATION_JSON_LD, OslcMediaType.TEXT_TURTLE, OslcMediaType.APPLICATION_XML, OslcMediaType.APPLICATION_JSON }) - @ApiOperation( - value = "PUT for resources of type {'" + Oslc_amDomainConstants.RESOURCE_LOCALNAME + "'}", - notes = "PUT for resources of type {'" + "" + Oslc_amDomainConstants.RESOURCE_LOCALNAME + "" + "'}" + + @Operation( + summary = "PUT for resources of type {'" + Oslc_amDomainConstants.RESOURCE_LOCALNAME + "'}", + description = "PUT for resources of type {'" + "" + Oslc_amDomainConstants.RESOURCE_LOCALNAME + "" + "'}" + ", with respective resource shapes {'" + "" + Oslc_amDomainConstants.RESOURCE_LOCALNAME + "" + "'}", - produces = OslcMediaType.APPLICATION_RDF_XML + ", " + OslcMediaType.APPLICATION_XML + ", " + OslcMediaType.APPLICATION_JSON + ", " + OslcMediaType.TEXT_TURTLE + ", " + MediaType.TEXT_HTML + ", " + OslcMediaType.APPLICATION_X_OSLC_COMPACT_XML + responses = { + @ApiResponse(description = "default response", content = {@Content(mediaType = OslcMediaType.APPLICATION_RDF_XML), @Content(mediaType = OslcMediaType.APPLICATION_XML), @Content(mediaType = OslcMediaType.APPLICATION_JSON), @Content(mediaType = OslcMediaType.TEXT_TURTLE), @Content(mediaType = MediaType.TEXT_HTML), @Content(mediaType = OslcMediaType.APPLICATION_X_OSLC_COMPACT_XML)}) + } ) public Response updateResource( @HeaderParam("If-Match") final String eTagHeader, diff --git a/src/server-am/src/main/java/co/oslc/refimpl/am/gen/servlet/Application.java b/src/server-am/src/main/java/co/oslc/refimpl/am/gen/servlet/Application.java index 892a0c2b..4e8af8e8 100644 --- a/src/server-am/src/main/java/co/oslc/refimpl/am/gen/servlet/Application.java +++ b/src/server-am/src/main/java/co/oslc/refimpl/am/gen/servlet/Application.java @@ -24,6 +24,7 @@ package co.oslc.refimpl.am.gen.servlet; import java.net.URISyntaxException; +import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.Map; @@ -51,6 +52,11 @@ import org.eclipse.lyo.oslc4j.provider.jena.JenaProvidersRegistry; import org.eclipse.lyo.oslc4j.provider.json4j.Json4JProvidersRegistry; +import io.swagger.v3.jaxrs2.integration.resources.AcceptHeaderOpenApiResource; +import io.swagger.v3.jaxrs2.integration.resources.OpenApiResource; +import io.swagger.v3.oas.annotations.OpenAPIDefinition; +import io.swagger.v3.oas.annotations.info.Info; +import io.swagger.v3.oas.annotations.servers.Server; import co.oslc.refimpl.am.gen.services.RootServicesService; import co.oslc.refimpl.am.gen.services.ServiceProviderCatalogService; import co.oslc.refimpl.am.gen.services.ServiceProviderService; @@ -77,8 +83,10 @@ // End of user code /** - * Generated by Lyo Designer 4.0.0.202010272105 + * Generated by Lyo Designer 4.2.0.202112291732 */ + +@OpenAPIDefinition(info = @Info(title = "AM", version = "1.0.0"), servers = @Server(url = "services/")) public class Application extends javax.ws.rs.core.Application { private static final Set> RESOURCE_CLASSES = new HashSet>(); @@ -90,6 +98,10 @@ public class Application extends javax.ws.rs.core.Application { // Start of user code class_methods // End of user code + @Override + public Set getSingletons() { + return Collections.singleton(new ApplicationBinder()); + } static { RESOURCE_CLASSES.addAll(JenaProvidersRegistry.getProviders()); @@ -105,8 +117,9 @@ public class Application extends javax.ws.rs.core.Application { RESOURCE_CLASSES.add(ResourceShapeService.class); // Swagger resources - RESOURCE_CLASSES.add(io.swagger.jaxrs.listing.ApiListingResource.class); - RESOURCE_CLASSES.add(io.swagger.jaxrs.listing.SwaggerSerializers.class); + RESOURCE_CLASSES.add(OpenApiResource.class); + RESOURCE_CLASSES.add(AcceptHeaderOpenApiResource.class); + // OAuth resources RESOURCE_CLASSES.add(RootServicesService.class); try { @@ -116,7 +129,7 @@ public class Application extends javax.ws.rs.core.Application { // Start of user code OAuthServiceClasses_notFound // End of user code } - + // Start of user code Custom Resource Classes // End of user code diff --git a/src/server-am/src/main/java/co/oslc/refimpl/am/gen/servlet/ApplicationBinder.java b/src/server-am/src/main/java/co/oslc/refimpl/am/gen/servlet/ApplicationBinder.java new file mode 100644 index 00000000..830efa6c --- /dev/null +++ b/src/server-am/src/main/java/co/oslc/refimpl/am/gen/servlet/ApplicationBinder.java @@ -0,0 +1,54 @@ +// Start of user code Copyright +/* + * Copyright (c) 2020 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: BSD-3-Simple + * + * This file is generated by Lyo Designer (https://www.eclipse.org/lyo/) + */ +// End of user code + +package co.oslc.refimpl.am.gen.servlet; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.glassfish.hk2.api.Factory; +import org.glassfish.hk2.utilities.binding.AbstractBinder; + + +// Start of user code imports +// End of user code + +// Start of user code pre_class_code +// End of user code + +public class ApplicationBinder extends AbstractBinder { + + private static final Logger log = LoggerFactory.getLogger(ApplicationBinder.class); + + // Start of user code class_attributes + // End of user code + + // Start of user code class_methods + // End of user code + + public ApplicationBinder() + { + log.info("HK2 contract binding init"); + } + + @Override + protected void configure() { + log.info("HK2 contract binding start"); + + } + + +} diff --git a/src/server-am/src/main/java/co/oslc/refimpl/am/gen/servlet/CredentialsFilter.java.lost b/src/server-am/src/main/java/co/oslc/refimpl/am/gen/servlet/CredentialsFilter.java.lost deleted file mode 100644 index dcb76228..00000000 --- a/src/server-am/src/main/java/co/oslc/refimpl/am/gen/servlet/CredentialsFilter.java.lost +++ /dev/null @@ -1,10 +0,0 @@ - -Wed Nov 04 00:05:01 CET 2020 -================================================================================ -Start of user code override_ignoreResourceProtection - // End of user code - -Wed Nov 04 00:28:03 CET 2020 -================================================================================ -Start of user code override_ignoreResourceProtection - // End of user code diff --git a/src/server-am/src/main/java/co/oslc/refimpl/am/gen/servlet/ServletListener.java b/src/server-am/src/main/java/co/oslc/refimpl/am/gen/servlet/ServletListener.java index 927fe8eb..337f9ce0 100644 --- a/src/server-am/src/main/java/co/oslc/refimpl/am/gen/servlet/ServletListener.java +++ b/src/server-am/src/main/java/co/oslc/refimpl/am/gen/servlet/ServletListener.java @@ -25,6 +25,7 @@ import java.net.MalformedURLException; import java.util.NoSuchElementException; +import java.util.Locale; import java.util.Map; import java.util.Optional; import org.slf4j.Logger; @@ -46,12 +47,7 @@ /** * During the initialization of this ServletListener, the base URI for the OSLC resources produced by this server is configured through the OSLC4J method setPublicURI(). *

- * A number of approaches can be used to set this base URI: - *

    - *
  1. Set a system environment property of name "LYO_BASE".
  2. - *
  3. In the web.xml file, set a {@code context-param} property, with name "co.oslc.refimpl.am.gen.servlet.baseurl}
  4. - *
  5. Override the value of the DEFAULT_BASE constant.
  6. - *
+ * See getConfigurationProperty() for the different alternatives to set this base URI. */ public class ServletListener implements ServletContextListener { private static final Logger logger = LoggerFactory.getLogger(ServletListener.class); @@ -67,15 +63,17 @@ public ServletListener() { public void contextInitialized(final ServletContextEvent servletContextEvent) { //These are default values. You can modify any of them early in this method. - String basePathEnvKey = "LYO_BASE"; - String basePathContextPropertyKey = String.format("%s.%s", ServletListener.class.getPackage().getName(), "baseurl"); + String basePathKey = "baseurl"; String fallbackBase = "http://localhost:8080"; String servletName = "JAX-RS Servlet"; // Start of user code contextInitialized_init // End of user code - String baseUrl = generateBasePath(servletContextEvent, basePathEnvKey, basePathContextPropertyKey, fallbackBase); + ServletContext servletContext = servletContextEvent.getServletContext(); + String basePathProperty = getConfigurationProperty(basePathKey, fallbackBase, servletContext, ServletListener.class); + UriBuilder builder = UriBuilder.fromUri(basePathProperty); + String baseUrl = builder.path(servletContext.getContextPath()).build().toString(); String servletUrlPattern = "services/"; try { servletUrlPattern = getServletUrlPattern(servletContextEvent, servletName); @@ -97,7 +95,7 @@ public void contextInitialized(final ServletContextEvent servletContextEvent) // Establish connection to data backbone etc ... AMManager.contextInitializeServletListener(servletContextEvent); - + // Start of user code contextInitialized_final // End of user code } @@ -125,32 +123,69 @@ private static Optional getBasePathFromSystemProperties(String basePathC } // End of user code - private static String generateBasePath(final ServletContextEvent servletContextEvent, String basePathEnvKey, String basePathContextPropertyKey, String fallbackBase) { - String base = getBasePathFromEnvironment(basePathEnvKey) - .orElseGet(() -> getBasePathFromSystemProperties(basePathContextPropertyKey) - .orElseGet(() -> getBasePathFromContext(servletContextEvent, basePathContextPropertyKey) - .orElse(fallbackBase))); - UriBuilder builder = UriBuilder.fromUri(base); - return builder.path(servletContextEvent.getServletContext().getContextPath()).build().toString(); + /** + * For a property 'scheme', this is the lookup priority: + *

+ *

    + *
  1. LYO_SCHEME env variable
  2. + *
  3. %pkg_name%.scheme JVM property, e.g. org.eclipse.lyo.oslc4j.core.servlet.scheme
  4. + *
  5. %pkg_name%.scheme Servlet Context parameter, e.g. org.eclipse.lyo.oslc4j.core.servlet.scheme
  6. + *
+ * @param key property key name + * @param defaultValue default String value + * @param klass Class of the ServletListener + * @return value, if found, from ENV, JVM, or Servlet Context (in this order) + */ + private static String getConfigurationProperty(String key, String defaultValue, final ServletContext servletContext, Class klass) { + String value = getConfigurationPropertyFromEnvironment(generateEnvironmentKey(key)) + .orElseGet(() -> getConfigurationPropertyFromSystemProperties(generateFullyQualifiedKey(klass, key)) + .orElseGet(() -> getConfigurationPropertyFromContext(servletContext, generateFullyQualifiedKey(klass, key)) + .orElse(defaultValue))); + return value; + } + + /** + * property name 'scheme' would become "org.eclipse.lyo.oslc4j.core.servlet.scheme" + */ + private static String generateFullyQualifiedKey(Class klass, String key) { + return klass.getPackage().getName() + '.' + key; } + /** + * web.xml property ending in '.scheme' would become "LYO_SCHEME" + */ + private static String generateEnvironmentKey(String key) { + return "LYO_" + key.toUpperCase(Locale.ROOT).replace('.', '_'); + } - private static Optional getBasePathFromEnvironment(String basePathEnvKey) { + private static Optional getConfigurationPropertyFromEnvironment(String basePathEnvKey) { final Map env = System.getenv(); - if(env.containsKey(basePathEnvKey)) { - logger.info("Found {} env variable", basePathEnvKey); - return Optional.of(env.get(basePathEnvKey)); + if (!env.containsKey(basePathEnvKey)) { + logger.debug("ENV variable '{}' not defined", basePathEnvKey); + return Optional.empty(); } - return Optional.empty(); + logger.info("Found {} env variable", basePathEnvKey); + return Optional.of(env.get(basePathEnvKey)); } - private static Optional getBasePathFromContext(final ServletContextEvent servletContextEvent, String basePathContextPropertyKey) { - final ServletContext servletContext = servletContextEvent.getServletContext(); - String base = servletContext.getInitParameter(basePathContextPropertyKey); - if (base == null || base.trim().isEmpty()) { + private static Optional getConfigurationPropertyFromSystemProperties(String basePathContextPropertyKey) { + String value = System.getProperty(basePathContextPropertyKey); + if (value == null || value.trim().isEmpty()) { + logger.debug("System (JVM) property '{}' not defined", basePathContextPropertyKey); return Optional.empty(); } - return Optional.of(base); + logger.info("Found {} System (JVM) property", basePathContextPropertyKey); + return Optional.of(value); + } + + private static Optional getConfigurationPropertyFromContext(final ServletContext servletContext, String basePathContextPropertyKey) { + String value = servletContext.getInitParameter(basePathContextPropertyKey); + if (value == null || value.trim().isEmpty()) { + logger.debug("Servlet Context parameter '{}' not defined", basePathContextPropertyKey); + return Optional.empty(); + } + logger.info("Found {} context parameter", basePathContextPropertyKey); + return Optional.of(value); } private static String getServletUrlPattern(final ServletContextEvent servletContextEvent, String servletName) throws Exception { diff --git a/src/server-am/src/main/webapp/WEB-INF/web.xml b/src/server-am/src/main/webapp/WEB-INF/web.xml index 8a718338..9c9996f3 100644 --- a/src/server-am/src/main/webapp/WEB-INF/web.xml +++ b/src/server-am/src/main/webapp/WEB-INF/web.xml @@ -1,73 +1,63 @@ - OSLC Architecture Management Server (2020 RefImpl) - - Base URI for the adaptor. - co.oslc.refimpl.am.gen.servlet.baseurl - http://localhost:8803/ - - + + + + - - Listener for ServletContext lifecycle changes - co.oslc.refimpl.am.gen.servlet.ServletListener - - + + Listener for ServletContext lifecycle changes + co.oslc.refimpl.am.gen.servlet.ServletListener + + - - JAX-RS Servlet - org.glassfish.jersey.servlet.ServletContainer - - javax.ws.rs.Application - co.oslc.refimpl.am.gen.servlet.Application - - 1 - - + + JAX-RS Servlet + org.glassfish.jersey.servlet.ServletContainer + + javax.ws.rs.Application + co.oslc.refimpl.am.gen.servlet.Application + + 1 + + - - JAX-RS Servlet - /services/* - - - - DefaultJaxrsConfig - io.swagger.jaxrs.config.DefaultJaxrsConfig - - api.version - 1.0.0 - - - swagger.api.basepath - http://localhost:8803/services/ - - 2 - - + + JAX-RS Servlet + /services/* + + + CredentialsFilter + CredentialsFilter + co.oslc.refimpl.am.gen.servlet.CredentialsFilter + + + CredentialsFilter + /services/* + + + --> diff --git a/src/server-am/src/main/webapp/co/oslc/refimpl/am/gen/creationdialogsampleclient.jsp b/src/server-am/src/main/webapp/co/oslc/refimpl/am/gen/creationdialogsampleclient.jsp index 59cc0541..ae5c24f3 100644 --- a/src/server-am/src/main/webapp/co/oslc/refimpl/am/gen/creationdialogsampleclient.jsp +++ b/src/server-am/src/main/webapp/co/oslc/refimpl/am/gen/creationdialogsampleclient.jsp @@ -2,28 +2,28 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <%-- - Copyright (c) 2011, 2012 IBM Corporation and others. - - All rights reserved. This program and the accompanying materials - are made available under the terms of the Eclipse Public License v1.0 - and Eclipse Distribution License v. 1.0 which accompanies this distribution. - - The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html - and the Eclipse Distribution License is available at + Copyright (c) 2020 Contributors to the Eclipse Foundation + + See the NOTICE file(s) distributed with this work for additional + information regarding copyright ownership. + + This program and the accompanying materials are made available under the + terms of the Eclipse Distribution License 1.0 which is available at http://www.eclipse.org/org/documents/edl-v10.php. + + SPDX-License-Identifier: BSD-3-Simple - Contributors: - - Andrii Berezovskyi - initial implementation of a sample delegated UI client - - This file is generated by org.eclipse.lyo.oslc4j.codegenerator + This file is generated by Lyo Designer (https://www.eclipse.org/lyo/) --%> +<%@page import="javax.ws.rs.core.UriBuilder"%> +<%@page import="org.eclipse.lyo.oslc4j.core.OSLC4JUtils"%> <%@page import="org.eclipse.lyo.oslc4j.core.model.ServiceProvider" %> <%@ page contentType="text/html" language="java" pageEncoding="UTF-8" %> <% String creationDialogUri = request.getParameter("creationUri"); creationDialogUri += "#oslc-core-postMessage-1.0"; + String catalogUrl = UriBuilder.fromUri(OSLC4JUtils.getServletURI()).path("/catalog/singleton").build().toString(); %> @@ -44,7 +44,7 @@ diff --git a/src/server-am/src/main/webapp/co/oslc/refimpl/am/gen/linktype.jsp b/src/server-am/src/main/webapp/co/oslc/refimpl/am/gen/linktype.jsp index aa08c6a5..3357435b 100644 --- a/src/server-am/src/main/webapp/co/oslc/refimpl/am/gen/linktype.jsp +++ b/src/server-am/src/main/webapp/co/oslc/refimpl/am/gen/linktype.jsp @@ -1,26 +1,18 @@ <%--To avoid the overriding of any manual code changes upon subsequent code generations, disable "Generate JSP Files" option in the Adaptor model.--%> <%-- - Copyright (c) 2011, 2012, 2017 IBM Corporation and others. - - All rights reserved. This program and the accompanying materials - are made available under the terms of the Eclipse Public License v1.0 - and Eclipse Distribution License v. 1.0 which accompanies this distribution. - - The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html - and the Eclipse Distribution License is available at + Copyright (c) 2020 Contributors to the Eclipse Foundation + + See the NOTICE file(s) distributed with this work for additional + information regarding copyright ownership. + + This program and the accompanying materials are made available under the + terms of the Eclipse Distribution License 1.0 which is available at http://www.eclipse.org/org/documents/edl-v10.php. + + SPDX-License-Identifier: BSD-3-Simple - Contributors: - - Sam Padgett - initial API and implementation - Michael Fiedler - adapted for OSLC4J - Jad El-khoury - initial implementation of code generator (422448) - Frédéric Loiret - Switch the template to Bootstrap (519699) - Frédéric Loiret - Support for UI Preview (494303) - Andrii Berezovskyi - Support for UI Preview (494303) - - This file is generated by org.eclipse.lyo.oslc4j.codegenerator + This file is generated by Lyo Designer (https://www.eclipse.org/lyo/) --%> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> @@ -50,6 +42,7 @@ <% LinkType aLinkType = (LinkType) request.getAttribute("aLinkType"); + String catalogUrl = UriBuilder.fromUri(OSLC4JUtils.getServletURI()).path("/catalog/singleton").build().toString(); %> @@ -77,7 +70,7 @@ diff --git a/src/server-am/src/main/webapp/co/oslc/refimpl/am/gen/linktypelargepreview.jsp b/src/server-am/src/main/webapp/co/oslc/refimpl/am/gen/linktypelargepreview.jsp index 57a81658..c2cf1034 100644 --- a/src/server-am/src/main/webapp/co/oslc/refimpl/am/gen/linktypelargepreview.jsp +++ b/src/server-am/src/main/webapp/co/oslc/refimpl/am/gen/linktypelargepreview.jsp @@ -1,24 +1,18 @@ <%--To avoid the overriding of any manual code changes upon subsequent code generations, disable "Generate JSP Files" option in the Adaptor model.--%> <%-- - Copyright (c) 2011, 2012, 2017 IBM Corporation and others. - - All rights reserved. This program and the accompanying materials - are made available under the terms of the Eclipse Public License v1.0 - and Eclipse Distribution License v. 1.0 which accompanies this distribution. - - The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html - and the Eclipse Distribution License is available at + Copyright (c) 2020 Contributors to the Eclipse Foundation + + See the NOTICE file(s) distributed with this work for additional + information regarding copyright ownership. + + This program and the accompanying materials are made available under the + terms of the Eclipse Distribution License 1.0 which is available at http://www.eclipse.org/org/documents/edl-v10.php. + + SPDX-License-Identifier: BSD-3-Simple - Contributors: - - Sam Padgett - initial API and implementation - Michael Fiedler - adapted for OSLC4J - Jad El-khoury - initial implementation of code generator (422448) - Frédéric Loiret - Switch the template to Bootstrap (519699) - - This file is generated by org.eclipse.lyo.oslc4j.codegenerator + This file is generated by Lyo Designer (https://www.eclipse.org/lyo/) --%> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> diff --git a/src/server-am/src/main/webapp/co/oslc/refimpl/am/gen/linktypescollection.jsp b/src/server-am/src/main/webapp/co/oslc/refimpl/am/gen/linktypescollection.jsp index 3f19460a..47964bb4 100644 --- a/src/server-am/src/main/webapp/co/oslc/refimpl/am/gen/linktypescollection.jsp +++ b/src/server-am/src/main/webapp/co/oslc/refimpl/am/gen/linktypescollection.jsp @@ -1,41 +1,37 @@ <%--To avoid the overriding of any manual code changes upon subsequent code generations, disable "Generate JSP Files" option in the Adaptor model.--%> <%-- - Copyright (c) 2011, 2012, 2017 IBM Corporation and others. - - All rights reserved. This program and the accompanying materials - are made available under the terms of the Eclipse Public License v1.0 - and Eclipse Distribution License v. 1.0 which accompanies this distribution. - - The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html - and the Eclipse Distribution License is available at + Copyright (c) 2020 Contributors to the Eclipse Foundation + + See the NOTICE file(s) distributed with this work for additional + information regarding copyright ownership. + + This program and the accompanying materials are made available under the + terms of the Eclipse Distribution License 1.0 which is available at http://www.eclipse.org/org/documents/edl-v10.php. + + SPDX-License-Identifier: BSD-3-Simple - Contributors: - - Sam Padgett - initial API and implementation - Michael Fiedler - adapted for OSLC4J - Jad El-khoury - initial implementation of code generator (422448) - Frédéric Loiret - Switch the template to Bootstrap (519699) - Frédéric Loiret - Support for UI Preview (494303) - Andrii Berezovskyi - Support for UI Preview (494303) - - This file is generated by org.eclipse.lyo.oslc4j.codegenerator + This file is generated by Lyo Designer (https://www.eclipse.org/lyo/) --%> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %> +<%@page import="javax.ws.rs.core.UriBuilder"%> +<%@page import="org.eclipse.lyo.oslc4j.core.OSLC4JUtils"%> <%@page import="org.eclipse.lyo.oslc4j.core.model.ServiceProvider"%> <%@page import="org.eclipse.lyo.oslc4j.core.model.AbstractResource"%> <%@page import="org.eclipse.lyo.oslc4j.core.OSLC4JConstants"%> <%@page import="java.util.List" %> + <%@page import="org.eclipse.lyo.oslc.domains.am.LinkType"%> <%@ page contentType="text/html" language="java" pageEncoding="UTF-8" %> <% List resources = (List) request.getAttribute("resources"); String queryUri = (String)request.getAttribute("queryUri"); String nextPageUri = (String)request.getAttribute(OSLC4JConstants.OSLC4J_NEXT_PAGE); + String catalogUrl = UriBuilder.fromUri(OSLC4JUtils.getServletURI()).path("/catalog/singleton").build().toString(); %> @@ -62,7 +58,7 @@ diff --git a/src/server-am/src/main/webapp/co/oslc/refimpl/am/gen/linktypeselector.jsp b/src/server-am/src/main/webapp/co/oslc/refimpl/am/gen/linktypeselector.jsp index 64f41c8f..9cced207 100644 --- a/src/server-am/src/main/webapp/co/oslc/refimpl/am/gen/linktypeselector.jsp +++ b/src/server-am/src/main/webapp/co/oslc/refimpl/am/gen/linktypeselector.jsp @@ -1,23 +1,18 @@ <%--To avoid the overriding of any manual code changes upon subsequent code generations, disable "Generate JSP Files" option in the Adaptor model.--%> <%-- - Copyright (c) 2011, 2012 IBM Corporation and others. - - All rights reserved. This program and the accompanying materials - are made available under the terms of the Eclipse Public License v1.0 - and Eclipse Distribution License v. 1.0 which accompanies this distribution. - - The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html - and the Eclipse Distribution License is available at + Copyright (c) 2020 Contributors to the Eclipse Foundation + + See the NOTICE file(s) distributed with this work for additional + information regarding copyright ownership. + + This program and the accompanying materials are made available under the + terms of the Eclipse Distribution License 1.0 which is available at http://www.eclipse.org/org/documents/edl-v10.php. + + SPDX-License-Identifier: BSD-3-Simple - Contributors: - - Sam Padgett - initial API and implementation - Michael Fiedler - adapted for OSLC4J - Jad El-khoury - initial implementation of code generator (https://bugs.eclipse.org/bugs/show_bug.cgi?id=422448) - - This file is generated by org.eclipse.lyo.oslc4j.codegenerator + This file is generated by Lyo Designer (https://www.eclipse.org/lyo/) --%> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> diff --git a/src/server-am/src/main/webapp/co/oslc/refimpl/am/gen/linktypesmallpreview.jsp b/src/server-am/src/main/webapp/co/oslc/refimpl/am/gen/linktypesmallpreview.jsp index 57a81658..c2cf1034 100644 --- a/src/server-am/src/main/webapp/co/oslc/refimpl/am/gen/linktypesmallpreview.jsp +++ b/src/server-am/src/main/webapp/co/oslc/refimpl/am/gen/linktypesmallpreview.jsp @@ -1,24 +1,18 @@ <%--To avoid the overriding of any manual code changes upon subsequent code generations, disable "Generate JSP Files" option in the Adaptor model.--%> <%-- - Copyright (c) 2011, 2012, 2017 IBM Corporation and others. - - All rights reserved. This program and the accompanying materials - are made available under the terms of the Eclipse Public License v1.0 - and Eclipse Distribution License v. 1.0 which accompanies this distribution. - - The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html - and the Eclipse Distribution License is available at + Copyright (c) 2020 Contributors to the Eclipse Foundation + + See the NOTICE file(s) distributed with this work for additional + information regarding copyright ownership. + + This program and the accompanying materials are made available under the + terms of the Eclipse Distribution License 1.0 which is available at http://www.eclipse.org/org/documents/edl-v10.php. + + SPDX-License-Identifier: BSD-3-Simple - Contributors: - - Sam Padgett - initial API and implementation - Michael Fiedler - adapted for OSLC4J - Jad El-khoury - initial implementation of code generator (422448) - Frédéric Loiret - Switch the template to Bootstrap (519699) - - This file is generated by org.eclipse.lyo.oslc4j.codegenerator + This file is generated by Lyo Designer (https://www.eclipse.org/lyo/) --%> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> diff --git a/src/server-am/src/main/webapp/co/oslc/refimpl/am/gen/linktypetohtml.jsp b/src/server-am/src/main/webapp/co/oslc/refimpl/am/gen/linktypetohtml.jsp index d0470811..7d552051 100644 --- a/src/server-am/src/main/webapp/co/oslc/refimpl/am/gen/linktypetohtml.jsp +++ b/src/server-am/src/main/webapp/co/oslc/refimpl/am/gen/linktypetohtml.jsp @@ -1,20 +1,17 @@ <%--To avoid the overriding of any manual code changes upon subsequent code generations, disable "Generate JSP Files" option in the Adaptor model.--%> <%-- - Copyright (c) 2018 Jad El-khoury. - - All rights reserved. This program and the accompanying materials - are made available under the terms of the Eclipse Public License v1.0 - and Eclipse Distribution License v. 1.0 which accompanies this distribution. - - The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html - and the Eclipse Distribution License is available at + Copyright (c) 2020 Contributors to the Eclipse Foundation + + See the NOTICE file(s) distributed with this work for additional + information regarding copyright ownership. + + This program and the accompanying materials are made available under the + terms of the Eclipse Distribution License 1.0 which is available at http://www.eclipse.org/org/documents/edl-v10.php. + + SPDX-License-Identifier: BSD-3-Simple - Contributors: - - Jad El-khoury - Migrate toHtml methods from the resource pojos to be embedded in jsp pages. - - This file is generated by org.eclipse.lyo.oslc4j.codegenerator + This file is generated by Lyo Designer (https://www.eclipse.org/lyo/) --%> <%@page import="org.eclipse.lyo.oslc.domains.am.LinkType"%> diff --git a/src/server-am/src/main/webapp/co/oslc/refimpl/am/gen/persontohtml.jsp b/src/server-am/src/main/webapp/co/oslc/refimpl/am/gen/persontohtml.jsp index ab5f8dce..26693ee9 100644 --- a/src/server-am/src/main/webapp/co/oslc/refimpl/am/gen/persontohtml.jsp +++ b/src/server-am/src/main/webapp/co/oslc/refimpl/am/gen/persontohtml.jsp @@ -1,20 +1,17 @@ <%--To avoid the overriding of any manual code changes upon subsequent code generations, disable "Generate JSP Files" option in the Adaptor model.--%> <%-- - Copyright (c) 2018 Jad El-khoury. - - All rights reserved. This program and the accompanying materials - are made available under the terms of the Eclipse Public License v1.0 - and Eclipse Distribution License v. 1.0 which accompanies this distribution. - - The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html - and the Eclipse Distribution License is available at + Copyright (c) 2020 Contributors to the Eclipse Foundation + + See the NOTICE file(s) distributed with this work for additional + information regarding copyright ownership. + + This program and the accompanying materials are made available under the + terms of the Eclipse Distribution License 1.0 which is available at http://www.eclipse.org/org/documents/edl-v10.php. + + SPDX-License-Identifier: BSD-3-Simple - Contributors: - - Jad El-khoury - Migrate toHtml methods from the resource pojos to be embedded in jsp pages. - - This file is generated by org.eclipse.lyo.oslc4j.codegenerator + This file is generated by Lyo Designer (https://www.eclipse.org/lyo/) --%> <%@page import="org.eclipse.lyo.oslc.domains.Person"%> diff --git a/src/server-am/src/main/webapp/co/oslc/refimpl/am/gen/resource.jsp b/src/server-am/src/main/webapp/co/oslc/refimpl/am/gen/resource.jsp index 766d42c1..ade97ecb 100644 --- a/src/server-am/src/main/webapp/co/oslc/refimpl/am/gen/resource.jsp +++ b/src/server-am/src/main/webapp/co/oslc/refimpl/am/gen/resource.jsp @@ -1,26 +1,18 @@ <%--To avoid the overriding of any manual code changes upon subsequent code generations, disable "Generate JSP Files" option in the Adaptor model.--%> <%-- - Copyright (c) 2011, 2012, 2017 IBM Corporation and others. - - All rights reserved. This program and the accompanying materials - are made available under the terms of the Eclipse Public License v1.0 - and Eclipse Distribution License v. 1.0 which accompanies this distribution. - - The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html - and the Eclipse Distribution License is available at + Copyright (c) 2020 Contributors to the Eclipse Foundation + + See the NOTICE file(s) distributed with this work for additional + information regarding copyright ownership. + + This program and the accompanying materials are made available under the + terms of the Eclipse Distribution License 1.0 which is available at http://www.eclipse.org/org/documents/edl-v10.php. + + SPDX-License-Identifier: BSD-3-Simple - Contributors: - - Sam Padgett - initial API and implementation - Michael Fiedler - adapted for OSLC4J - Jad El-khoury - initial implementation of code generator (422448) - Frédéric Loiret - Switch the template to Bootstrap (519699) - Frédéric Loiret - Support for UI Preview (494303) - Andrii Berezovskyi - Support for UI Preview (494303) - - This file is generated by org.eclipse.lyo.oslc4j.codegenerator + This file is generated by Lyo Designer (https://www.eclipse.org/lyo/) --%> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> @@ -50,6 +42,7 @@ <% Resource aResource = (Resource) request.getAttribute("aResource"); + String catalogUrl = UriBuilder.fromUri(OSLC4JUtils.getServletURI()).path("/catalog/singleton").build().toString(); %> @@ -77,7 +70,7 @@ diff --git a/src/server-am/src/main/webapp/co/oslc/refimpl/am/gen/resourcelargepreview.jsp b/src/server-am/src/main/webapp/co/oslc/refimpl/am/gen/resourcelargepreview.jsp index 6bb943e5..ade276e1 100644 --- a/src/server-am/src/main/webapp/co/oslc/refimpl/am/gen/resourcelargepreview.jsp +++ b/src/server-am/src/main/webapp/co/oslc/refimpl/am/gen/resourcelargepreview.jsp @@ -1,24 +1,18 @@ <%--To avoid the overriding of any manual code changes upon subsequent code generations, disable "Generate JSP Files" option in the Adaptor model.--%> <%-- - Copyright (c) 2011, 2012, 2017 IBM Corporation and others. - - All rights reserved. This program and the accompanying materials - are made available under the terms of the Eclipse Public License v1.0 - and Eclipse Distribution License v. 1.0 which accompanies this distribution. - - The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html - and the Eclipse Distribution License is available at + Copyright (c) 2020 Contributors to the Eclipse Foundation + + See the NOTICE file(s) distributed with this work for additional + information regarding copyright ownership. + + This program and the accompanying materials are made available under the + terms of the Eclipse Distribution License 1.0 which is available at http://www.eclipse.org/org/documents/edl-v10.php. + + SPDX-License-Identifier: BSD-3-Simple - Contributors: - - Sam Padgett - initial API and implementation - Michael Fiedler - adapted for OSLC4J - Jad El-khoury - initial implementation of code generator (422448) - Frédéric Loiret - Switch the template to Bootstrap (519699) - - This file is generated by org.eclipse.lyo.oslc4j.codegenerator + This file is generated by Lyo Designer (https://www.eclipse.org/lyo/) --%> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> diff --git a/src/server-am/src/main/webapp/co/oslc/refimpl/am/gen/resourcescollection.jsp b/src/server-am/src/main/webapp/co/oslc/refimpl/am/gen/resourcescollection.jsp index 3a2dfa86..c678332d 100644 --- a/src/server-am/src/main/webapp/co/oslc/refimpl/am/gen/resourcescollection.jsp +++ b/src/server-am/src/main/webapp/co/oslc/refimpl/am/gen/resourcescollection.jsp @@ -1,41 +1,37 @@ <%--To avoid the overriding of any manual code changes upon subsequent code generations, disable "Generate JSP Files" option in the Adaptor model.--%> <%-- - Copyright (c) 2011, 2012, 2017 IBM Corporation and others. - - All rights reserved. This program and the accompanying materials - are made available under the terms of the Eclipse Public License v1.0 - and Eclipse Distribution License v. 1.0 which accompanies this distribution. - - The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html - and the Eclipse Distribution License is available at + Copyright (c) 2020 Contributors to the Eclipse Foundation + + See the NOTICE file(s) distributed with this work for additional + information regarding copyright ownership. + + This program and the accompanying materials are made available under the + terms of the Eclipse Distribution License 1.0 which is available at http://www.eclipse.org/org/documents/edl-v10.php. + + SPDX-License-Identifier: BSD-3-Simple - Contributors: - - Sam Padgett - initial API and implementation - Michael Fiedler - adapted for OSLC4J - Jad El-khoury - initial implementation of code generator (422448) - Frédéric Loiret - Switch the template to Bootstrap (519699) - Frédéric Loiret - Support for UI Preview (494303) - Andrii Berezovskyi - Support for UI Preview (494303) - - This file is generated by org.eclipse.lyo.oslc4j.codegenerator + This file is generated by Lyo Designer (https://www.eclipse.org/lyo/) --%> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %> +<%@page import="javax.ws.rs.core.UriBuilder"%> +<%@page import="org.eclipse.lyo.oslc4j.core.OSLC4JUtils"%> <%@page import="org.eclipse.lyo.oslc4j.core.model.ServiceProvider"%> <%@page import="org.eclipse.lyo.oslc4j.core.model.AbstractResource"%> <%@page import="org.eclipse.lyo.oslc4j.core.OSLC4JConstants"%> <%@page import="java.util.List" %> + <%@page import="org.eclipse.lyo.oslc.domains.am.Resource"%> <%@ page contentType="text/html" language="java" pageEncoding="UTF-8" %> <% List resources = (List) request.getAttribute("resources"); String queryUri = (String)request.getAttribute("queryUri"); String nextPageUri = (String)request.getAttribute(OSLC4JConstants.OSLC4J_NEXT_PAGE); + String catalogUrl = UriBuilder.fromUri(OSLC4JUtils.getServletURI()).path("/catalog/singleton").build().toString(); %> @@ -62,7 +58,7 @@ diff --git a/src/server-am/src/main/webapp/co/oslc/refimpl/am/gen/resourceselector.jsp b/src/server-am/src/main/webapp/co/oslc/refimpl/am/gen/resourceselector.jsp index 40fd772f..6d97ed30 100644 --- a/src/server-am/src/main/webapp/co/oslc/refimpl/am/gen/resourceselector.jsp +++ b/src/server-am/src/main/webapp/co/oslc/refimpl/am/gen/resourceselector.jsp @@ -1,23 +1,18 @@ <%--To avoid the overriding of any manual code changes upon subsequent code generations, disable "Generate JSP Files" option in the Adaptor model.--%> <%-- - Copyright (c) 2011, 2012 IBM Corporation and others. - - All rights reserved. This program and the accompanying materials - are made available under the terms of the Eclipse Public License v1.0 - and Eclipse Distribution License v. 1.0 which accompanies this distribution. - - The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html - and the Eclipse Distribution License is available at + Copyright (c) 2020 Contributors to the Eclipse Foundation + + See the NOTICE file(s) distributed with this work for additional + information regarding copyright ownership. + + This program and the accompanying materials are made available under the + terms of the Eclipse Distribution License 1.0 which is available at http://www.eclipse.org/org/documents/edl-v10.php. + + SPDX-License-Identifier: BSD-3-Simple - Contributors: - - Sam Padgett - initial API and implementation - Michael Fiedler - adapted for OSLC4J - Jad El-khoury - initial implementation of code generator (https://bugs.eclipse.org/bugs/show_bug.cgi?id=422448) - - This file is generated by org.eclipse.lyo.oslc4j.codegenerator + This file is generated by Lyo Designer (https://www.eclipse.org/lyo/) --%> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> diff --git a/src/server-am/src/main/webapp/co/oslc/refimpl/am/gen/resourceshape.jsp b/src/server-am/src/main/webapp/co/oslc/refimpl/am/gen/resourceshape.jsp index e4a65c4c..5af15d5d 100644 --- a/src/server-am/src/main/webapp/co/oslc/refimpl/am/gen/resourceshape.jsp +++ b/src/server-am/src/main/webapp/co/oslc/refimpl/am/gen/resourceshape.jsp @@ -2,21 +2,18 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <%-- - Copyright (c) 2017 KTH Royal Institute of Technology. - - All rights reserved. This program and the accompanying materials - are made available under the terms of the Eclipse Public License v1.0 - and Eclipse Distribution License v. 1.0 which accompanies this distribution. - - The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html - and the Eclipse Distribution License is available at + Copyright (c) 2020 Contributors to the Eclipse Foundation + + See the NOTICE file(s) distributed with this work for additional + information regarding copyright ownership. + + This program and the accompanying materials are made available under the + terms of the Eclipse Distribution License 1.0 which is available at http://www.eclipse.org/org/documents/edl-v10.php. + + SPDX-License-Identifier: BSD-3-Simple - Contributors: - Jad El-khoury - initial implementation of ResourceShape HTML presentation - Andrew Berezovskyi - conversion into Bootstrap - - This file is generated by org.eclipse.lyo.oslc4j.codegenerator + This file is generated by Lyo Designer (https://www.eclipse.org/lyo/) --%> <%@page import="java.util.List" %> @@ -24,18 +21,21 @@ <%@page import="org.eclipse.lyo.oslc4j.core.model.ResourceShape"%> <%@page import="org.eclipse.lyo.oslc4j.core.model.Property"%> <%@page import="org.eclipse.lyo.oslc4j.core.model.OslcConstants"%> +<%@page import="javax.ws.rs.core.UriBuilder"%> +<%@page import="org.eclipse.lyo.oslc4j.core.OSLC4JUtils"%> <%@ page contentType="text/html" language="java" pageEncoding="UTF-8" %> <% ResourceShape aResourceShape = (ResourceShape) request.getAttribute("aResourceShape"); + String catalogUrl = UriBuilder.fromUri(OSLC4JUtils.getServletURI()).path("/catalog/singleton").build().toString(); %> - <%= aResourceShape.getTitle() %> + <%= aResourceShape.getName() %> " rel="stylesheet"> " rel="stylesheet"> @@ -55,7 +55,7 @@ @@ -63,22 +63,34 @@
-

Shape "<%=aResourceShape.getTitle()%>"

- +

<%=aResourceShape.getName()%>

- About URI: - <%=aResourceShape.getAbout()%> -

- -

Describes

-
    - <%for(URI next : aResourceShape.getDescribes()) { + Describes: + <%if(aResourceShape.getDescribes().length == 1) {%> + <%=aResourceShape.getDescribes()[0]%> + <%} else {%> +
      + <%for(URI next : aResourceShape.getDescribes()) { String[] split = next.toString().split("[#/]+"); String shortName = (split.length > 1) ? split[split.length -1] : next.toString(); - %> -
    • <%=shortName%>
    • - <%}%> -
    + %> +
  • <%=shortName%>
  • + <%}%> +
+ <%}%> +

+ <%if(null != aResourceShape.getTitle()) {%> +

+ Summary: + <%=aResourceShape.getTitle()%> +

+ <%}%> + <%if(null != aResourceShape.getDescription()) {%> +

+ Description: + <%=aResourceShape.getDescription()%> +

+ <%}%>

Properties

diff --git a/src/server-am/src/main/webapp/co/oslc/refimpl/am/gen/resourcesmallpreview.jsp b/src/server-am/src/main/webapp/co/oslc/refimpl/am/gen/resourcesmallpreview.jsp index 6bb943e5..ade276e1 100644 --- a/src/server-am/src/main/webapp/co/oslc/refimpl/am/gen/resourcesmallpreview.jsp +++ b/src/server-am/src/main/webapp/co/oslc/refimpl/am/gen/resourcesmallpreview.jsp @@ -1,24 +1,18 @@ <%--To avoid the overriding of any manual code changes upon subsequent code generations, disable "Generate JSP Files" option in the Adaptor model.--%> <%-- - Copyright (c) 2011, 2012, 2017 IBM Corporation and others. - - All rights reserved. This program and the accompanying materials - are made available under the terms of the Eclipse Public License v1.0 - and Eclipse Distribution License v. 1.0 which accompanies this distribution. - - The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html - and the Eclipse Distribution License is available at + Copyright (c) 2020 Contributors to the Eclipse Foundation + + See the NOTICE file(s) distributed with this work for additional + information regarding copyright ownership. + + This program and the accompanying materials are made available under the + terms of the Eclipse Distribution License 1.0 which is available at http://www.eclipse.org/org/documents/edl-v10.php. + + SPDX-License-Identifier: BSD-3-Simple - Contributors: - - Sam Padgett - initial API and implementation - Michael Fiedler - adapted for OSLC4J - Jad El-khoury - initial implementation of code generator (422448) - Frédéric Loiret - Switch the template to Bootstrap (519699) - - This file is generated by org.eclipse.lyo.oslc4j.codegenerator + This file is generated by Lyo Designer (https://www.eclipse.org/lyo/) --%> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> diff --git a/src/server-am/src/main/webapp/co/oslc/refimpl/am/gen/resourcetohtml.jsp b/src/server-am/src/main/webapp/co/oslc/refimpl/am/gen/resourcetohtml.jsp index 5f90c818..7be2e764 100644 --- a/src/server-am/src/main/webapp/co/oslc/refimpl/am/gen/resourcetohtml.jsp +++ b/src/server-am/src/main/webapp/co/oslc/refimpl/am/gen/resourcetohtml.jsp @@ -1,20 +1,17 @@ <%--To avoid the overriding of any manual code changes upon subsequent code generations, disable "Generate JSP Files" option in the Adaptor model.--%> <%-- - Copyright (c) 2018 Jad El-khoury. - - All rights reserved. This program and the accompanying materials - are made available under the terms of the Eclipse Public License v1.0 - and Eclipse Distribution License v. 1.0 which accompanies this distribution. - - The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html - and the Eclipse Distribution License is available at + Copyright (c) 2020 Contributors to the Eclipse Foundation + + See the NOTICE file(s) distributed with this work for additional + information regarding copyright ownership. + + This program and the accompanying materials are made available under the + terms of the Eclipse Distribution License 1.0 which is available at http://www.eclipse.org/org/documents/edl-v10.php. + + SPDX-License-Identifier: BSD-3-Simple - Contributors: - - Jad El-khoury - Migrate toHtml methods from the resource pojos to be embedded in jsp pages. - - This file is generated by org.eclipse.lyo.oslc4j.codegenerator + This file is generated by Lyo Designer (https://www.eclipse.org/lyo/) --%> <%@page import="org.eclipse.lyo.oslc.domains.am.Resource"%> diff --git a/src/server-am/src/main/webapp/co/oslc/refimpl/am/gen/selectiondialogsampleclient.jsp b/src/server-am/src/main/webapp/co/oslc/refimpl/am/gen/selectiondialogsampleclient.jsp index 647455e9..b4eca0fa 100644 --- a/src/server-am/src/main/webapp/co/oslc/refimpl/am/gen/selectiondialogsampleclient.jsp +++ b/src/server-am/src/main/webapp/co/oslc/refimpl/am/gen/selectiondialogsampleclient.jsp @@ -2,28 +2,28 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <%-- - Copyright (c) 2011, 2012 IBM Corporation and others. - - All rights reserved. This program and the accompanying materials - are made available under the terms of the Eclipse Public License v1.0 - and Eclipse Distribution License v. 1.0 which accompanies this distribution. - - The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html - and the Eclipse Distribution License is available at + Copyright (c) 2020 Contributors to the Eclipse Foundation + + See the NOTICE file(s) distributed with this work for additional + information regarding copyright ownership. + + This program and the accompanying materials are made available under the + terms of the Eclipse Distribution License 1.0 which is available at http://www.eclipse.org/org/documents/edl-v10.php. + + SPDX-License-Identifier: BSD-3-Simple - Contributors: - - Andrii Berezovskyi - initial implementation of a sample delegated UI client - - This file is generated by org.eclipse.lyo.oslc4j.codegenerator + This file is generated by Lyo Designer (https://www.eclipse.org/lyo/) --%> +<%@page import="javax.ws.rs.core.UriBuilder"%> +<%@page import="org.eclipse.lyo.oslc4j.core.OSLC4JUtils"%> <%@page import="org.eclipse.lyo.oslc4j.core.model.ServiceProvider" %> <%@ page contentType="text/html" language="java" pageEncoding="UTF-8" %> <% String selectionDialogUri = request.getParameter("selectionUri"); selectionDialogUri += "#oslc-core-postMessage-1.0"; + String catalogUrl = UriBuilder.fromUri(OSLC4JUtils.getServletURI()).path("/catalog/singleton").build().toString(); %> @@ -43,7 +43,7 @@ diff --git a/src/server-am/src/main/webapp/co/oslc/refimpl/am/gen/serviceprovider.jsp b/src/server-am/src/main/webapp/co/oslc/refimpl/am/gen/serviceprovider.jsp index cae02799..876b94e3 100644 --- a/src/server-am/src/main/webapp/co/oslc/refimpl/am/gen/serviceprovider.jsp +++ b/src/server-am/src/main/webapp/co/oslc/refimpl/am/gen/serviceprovider.jsp @@ -1,24 +1,18 @@ <%--To avoid the overriding of any manual code changes upon subsequent code generations, disable "Generate JSP Files" option in the Adaptor model.--%> <%-- - Copyright (c) 2011, 2012, 2017 IBM Corporation and others. - - All rights reserved. This program and the accompanying materials - are made available under the terms of the Eclipse Public License v1.0 - and Eclipse Distribution License v. 1.0 which accompanies this distribution. - - The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html - and the Eclipse Distribution License is available at + Copyright (c) 2020 Contributors to the Eclipse Foundation + + See the NOTICE file(s) distributed with this work for additional + information regarding copyright ownership. + + This program and the accompanying materials are made available under the + terms of the Eclipse Distribution License 1.0 which is available at http://www.eclipse.org/org/documents/edl-v10.php. + + SPDX-License-Identifier: BSD-3-Simple - Contributors: - - Sam Padgett - initial API and implementation - Michael Fiedler - adapted for OSLC4J - Jad El-khoury - initial implementation of code generator (422448) - Frédéric Loiret - Switch the template to Bootstrap (519699) - - This file is generated by org.eclipse.lyo.oslc4j.codegenerator + This file is generated by Lyo Designer (https://www.eclipse.org/lyo/) --%> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> @@ -32,12 +26,15 @@ <%@ page import="org.eclipse.lyo.oslc4j.core.model.CreationFactory" %> <%@ page import="org.eclipse.lyo.oslc4j.core.model.ResourceShape" %> <%@ page import="org.eclipse.lyo.oslc4j.core.model.QueryCapability" %> +<%@page import="javax.ws.rs.core.UriBuilder"%> +<%@page import="org.eclipse.lyo.oslc4j.core.OSLC4JUtils"%> <%@ page contentType="text/html" language="java" pageEncoding="UTF-8" %> <% ServiceProvider serviceProvider = (ServiceProvider)request.getAttribute("serviceProvider"); Service[] services = (Service[])request.getAttribute("services"); +String catalogUrl = UriBuilder.fromUri(OSLC4JUtils.getServletURI()).path("/catalog/singleton").build().toString(); %> @@ -57,7 +54,7 @@ Service[] services = (Service[])request.getAttribute("services"); diff --git a/src/server-am/src/main/webapp/co/oslc/refimpl/am/gen/serviceprovidercatalog.jsp b/src/server-am/src/main/webapp/co/oslc/refimpl/am/gen/serviceprovidercatalog.jsp index be3eaf3c..fb3b2e42 100644 --- a/src/server-am/src/main/webapp/co/oslc/refimpl/am/gen/serviceprovidercatalog.jsp +++ b/src/server-am/src/main/webapp/co/oslc/refimpl/am/gen/serviceprovidercatalog.jsp @@ -1,34 +1,31 @@ <%--To avoid the overriding of any manual code changes upon subsequent code generations, disable "Generate JSP Files" option in the Adaptor model.--%> <%-- - Copyright (c) 2011, 2012, 2017 IBM Corporation and others. - - All rights reserved. This program and the accompanying materials - are made available under the terms of the Eclipse Public License v1.0 - and Eclipse Distribution License v. 1.0 which accompanies this distribution. - - The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html - and the Eclipse Distribution License is available at + Copyright (c) 2020 Contributors to the Eclipse Foundation + + See the NOTICE file(s) distributed with this work for additional + information regarding copyright ownership. + + This program and the accompanying materials are made available under the + terms of the Eclipse Distribution License 1.0 which is available at http://www.eclipse.org/org/documents/edl-v10.php. + + SPDX-License-Identifier: BSD-3-Simple - Contributors: - - Sam Padgett - initial API and implementation - Michael Fiedler - adapted for OSLC4J - Jad El-khoury - initial implementation of code generator (422448) - Frédéric Loiret - Switch the template to Bootstrap (519699) - - This file is generated by org.eclipse.lyo.oslc4j.codegenerator + This file is generated by Lyo Designer (https://www.eclipse.org/lyo/) --%> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <%@ page import="org.eclipse.lyo.oslc4j.core.model.ServiceProviderCatalog" %> <%@ page import="org.eclipse.lyo.oslc4j.core.model.ServiceProvider" %> +<%@page import="javax.ws.rs.core.UriBuilder"%> +<%@page import="org.eclipse.lyo.oslc4j.core.OSLC4JUtils"%> <%@ page contentType="text/html" language="java" pageEncoding="UTF-8" %> <% ServiceProviderCatalog catalog = (ServiceProviderCatalog)request.getAttribute("catalog"); +String catalogUrl = UriBuilder.fromUri(OSLC4JUtils.getServletURI()).path("/catalog/singleton").build().toString(); %> @@ -52,7 +49,7 @@ ServiceProviderCatalog catalog = (ServiceProviderCatalog)request.getAttribute("c diff --git a/src/server-am/src/main/webapp/index.jsp b/src/server-am/src/main/webapp/index.jsp index de547b9e..6535789c 100644 --- a/src/server-am/src/main/webapp/index.jsp +++ b/src/server-am/src/main/webapp/index.jsp @@ -1,21 +1,18 @@ <%--To avoid the overriding of any manual code changes upon subsequent code generations, disable "Generate JSP Files" option in the Adaptor model.--%> <%-- - Copyright (c) 2017 KTH Royal Institute of Technology. - - All rights reserved. This program and the accompanying materials - are made available under the terms of the Eclipse Public License v1.0 - and Eclipse Distribution License v. 1.0 which accompanies this distribution. - - The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html - and the Eclipse Distribution License is available at + Copyright (c) 2020 Contributors to the Eclipse Foundation + + See the NOTICE file(s) distributed with this work for additional + information regarding copyright ownership. + + This program and the accompanying materials are made available under the + terms of the Eclipse Distribution License 1.0 which is available at http://www.eclipse.org/org/documents/edl-v10.php. + + SPDX-License-Identifier: BSD-3-Simple - Contributors: - - Andrew Berezovskyi - initial implementation - - This file is generated by org.eclipse.lyo.oslc4j.codegenerator + This file is generated by Lyo Designer (https://www.eclipse.org/lyo/) --%> <%@page import="org.eclipse.lyo.oslc4j.core.OSLC4JUtils"%> @@ -56,7 +53,7 @@

Use Swagger UI To interact with the adaptor services dedicated for RDF.

-

You can also copy ">this OpenAPI specification document (yaml file) of this adaptor to a ">Swagger Editor to generate client SDK code for a number of languages and platforms. +

You can also copy ">this OpenAPI specification document (yaml file) of this adaptor to a ">Swagger Editor to generate client SDK code for a number of languages and platforms.

diff --git a/src/server-am/src/main/webapp/static/js/delegated-ui-helper.js b/src/server-am/src/main/webapp/static/js/delegated-ui-helper.js index 3b26915c..4e753174 100644 --- a/src/server-am/src/main/webapp/static/js/delegated-ui-helper.js +++ b/src/server-am/src/main/webapp/static/js/delegated-ui-helper.js @@ -18,6 +18,19 @@ This file is generated by org.eclipse.lyo.oslc4j.codegenerator *******************************************************************************/ // End of user code +//register an addEventListener that handles the response form the Selection DelegatedUI iframe to the parent window. +//The function passes the message payload without any processing. +function registerSelectionDUIRawResponseListener(iframeElement, oslcMessageHandler) { + window.addEventListener('message', function (e) { + var HEADER = "oslc-response:"; + if (e.source == iframeElement.contentWindow + && e.data.indexOf(HEADER) == 0) { + var message = e.data; + oslcMessageHandler(message); + } + }, false); +} + //register an addEventListener that handles the response form the Selection DelegatedUI iframe to the parent window. //For each of the selected OSLC resource, the function will call oslcSelectionPresentationFunction with the url and label of that resource. function registerSelectionDUIResponseListener(iframeElement, oslcSelectionPreprocessingFunction, oslcSelectionPresentationFunction) { @@ -35,7 +48,6 @@ function registerSelectionDUIResponseListener(iframeElement, oslcSelectionPrepro }, false); } - //register an addEventListener that handles the response form the Creation DelegatedUI iframe to the parent window. //For the created OSLC resource, the function will call oslcCreationPresentationFunction with the url and label of that resource. function registerCreationDUIResponseListener(iframeElement, oslcCreationPreprocessingFunction, oslcCreationPresentationFunction) { diff --git a/src/server-am/src/main/webapp/static/js/ui-preview-helper.js b/src/server-am/src/main/webapp/static/js/ui-preview-helper.js index f3aede45..5f9161aa 100644 --- a/src/server-am/src/main/webapp/static/js/ui-preview-helper.js +++ b/src/server-am/src/main/webapp/static/js/ui-preview-helper.js @@ -32,12 +32,18 @@ function setupUiPreviewOnPopover(oslcLinkElements) { oslcLinkElements.on("show.bs.popover", function () { var uiElem = $(this); var popoverElem = uiElem.data('bs.popover'); - getUiPreviewIframe(this.getAttribute("href"), attachIframeToHyperlinkElement, uiElem); + getUiPreviewIframes(this.getAttribute("href"), attachIframeToHyperlinkElement, uiElem); }) } -function attachIframeToHyperlinkElement(iframeTitle, iframeHtml, resourceCompactStructure, uiElem) { - uiElem.attr('data-original-title', iframeTitle); +function attachIframeToHyperlinkElement(compactStructure, uiElem) { + uiElem.attr('data-original-title', compactStructure.title); + var preview = compactStructure.small; + var w = preview.width ? preview.width : "450em"; + var h = preview.height ? preview.height : "100em"; + var iframeHtml = ""; uiElem.attr('data-content', iframeHtml); uiElem.data('bs.popover').setContent(); } @@ -45,9 +51,9 @@ function attachIframeToHyperlinkElement(iframeTitle, iframeHtml, resourceCompact //Perform an asynch GET request to obtain the resource's UI-Preview information (an OSLC Compact resource). //callbackFunction is then called once the request response is obtained. //The caller should supply this callbackFunction, with any desired paramters under "callbackParamter" -//callbackFunction will be called with the following paramters (a) iframeTitle, (b) iframeHtml, (c) compactStructure, (d) callbackParamter +//callbackFunction will be called with the following parameters (a) compactStructure, (d) callbackParamter //where compactStructure represents more detailed about the OSLC Compact resource. -function getUiPreviewIframe(resourceUrl, callbackFunction, callbackParamter) { +function getUiPreviewIframes(resourceUrl, callbackFunction, callbackParamter) { xmlhttp = new XMLHttpRequest(); xmlhttp.onload = function () { if (this.status==200) { @@ -55,21 +61,16 @@ function getUiPreviewIframe(resourceUrl, callbackFunction, callbackParamter) { try { var parser = new DOMParser(); var xmlDoc = parser.parseFromString(data,"text/xml"); - var compactStructure = parseOslcCompactXmlDocument(xmlDoc); - var w = compactStructure.width ? compactStructure.width : "45em"; - var h = compactStructure.height ? compactStructure.height : "11em"; - var iframeHtml = "