diff --git a/src/client-toolchain/src/main/kotlin/co/oslc/refimpl/client/Main.kt b/src/client-toolchain/src/main/kotlin/co/oslc/refimpl/client/Main.kt index b6cd321f..070b4257 100644 --- a/src/client-toolchain/src/main/kotlin/co/oslc/refimpl/client/Main.kt +++ b/src/client-toolchain/src/main/kotlin/co/oslc/refimpl/client/Main.kt @@ -33,7 +33,7 @@ import kotlin.collections.HashSet import kotlin.system.measureNanoTime -private val SPC_RM_DEFAULT = "http://localhost:8800/services/catalog/singleton" +private val SPC_RM_DEFAULT = "http://localhost:8800/catalog/singleton" private val SPC_CM_DEFAULT = "http://localhost:8801/services/catalog/singleton" private val SPC_AM_DEFAULT = "http://localhost:8803/services/catalog/singleton" private val SPC_QM_DEFAULT = "http://localhost:8802/services/catalog/singleton" diff --git a/src/docker-compose.yml b/src/docker-compose.yml index 86c9054a..049dd49b 100644 --- a/src/docker-compose.yml +++ b/src/docker-compose.yml @@ -4,7 +4,7 @@ services: context: ./ dockerfile: server-rm/Dockerfile ports: - - "127.0.0.1:8800:8080" + - "127.0.0.1:8800:8800" server-cm: build: context: ./ diff --git a/src/refimpl-tests/src/test/java/co/oslc/refimpl/tests/OslcTest.java b/src/refimpl-tests/src/test/java/co/oslc/refimpl/tests/OslcTest.java index 87a1ed21..a49e6791 100644 --- a/src/refimpl-tests/src/test/java/co/oslc/refimpl/tests/OslcTest.java +++ b/src/refimpl-tests/src/test/java/co/oslc/refimpl/tests/OslcTest.java @@ -30,7 +30,7 @@ public class OslcTest { @Container public static ComposeContainer environment = new ComposeContainer(new File("src/test/resources/docker-compose.yml")) .withExposedService(RM_SVC, RM_PORT, - Wait.forLogMessage(".*main: Started oejs.Server@.*", 1) + Wait.forLogMessage(".*(Started oejs.Server@|Quarkus.*started in).*", 1) .withStartupTimeout(Duration.ofSeconds(STARTUP_TIMEOUT))) .withExposedService(CM_SVC, CM_PORT, Wait.forLogMessage(".*main: Started oejs.Server@.*", 1) diff --git a/src/refimpl-tests/src/test/java/co/oslc/refimpl/tests/SwaggerTest.java b/src/refimpl-tests/src/test/java/co/oslc/refimpl/tests/SwaggerTest.java index 033e0d1b..2c55fe2e 100644 --- a/src/refimpl-tests/src/test/java/co/oslc/refimpl/tests/SwaggerTest.java +++ b/src/refimpl-tests/src/test/java/co/oslc/refimpl/tests/SwaggerTest.java @@ -42,7 +42,7 @@ public class SwaggerTest { @Container public static ComposeContainer environment = new ComposeContainer(new File("src/test/resources/docker-compose.yml")) .withExposedService(RM_SVC, RM_PORT, - Wait.forLogMessage(".*main: Started oejs.Server@.*", 1) + Wait.forLogMessage(".*(Started oejs.Server@|Quarkus.*started in).*", 1) .withStartupTimeout(Duration.ofSeconds(STARTUP_TIMEOUT))) .withExposedService(CM_SVC, CM_PORT, Wait.forLogMessage(".*main: Started oejs.Server@.*", 1) @@ -119,7 +119,10 @@ void waitForService(String url) { void swaggerUiShouldBeAccessible(String svc) { var serviceHost = "localhost"; var servicePort = fixedPorts.get(svc); - var swaggerUrl = "http://%s:%d/swagger-ui/index.jsp".formatted(serviceHost, servicePort); + // Use /q/swagger-ui for Quarkus RM server, /swagger-ui/index.jsp for legacy Jetty servers + var swaggerUrl = RM_SVC.equals(svc) + ? "http://%s:%d/q/swagger-ui".formatted(serviceHost, servicePort) + : "http://%s:%d/swagger-ui/index.jsp".formatted(serviceHost, servicePort); var expectedYamlUrl = "http://%s:%d/services/openapi.yaml".formatted(serviceHost, servicePort); var rootServicesUrl = "http://%s:%d/services/rootservices".formatted(serviceHost, servicePort); diff --git a/src/server-rm/Dockerfile b/src/server-rm/Dockerfile index a2d575fe..95208e60 100644 --- a/src/server-rm/Dockerfile +++ b/src/server-rm/Dockerfile @@ -15,10 +15,10 @@ COPY client-toolchain/pom.xml client-toolchain/pom.xml COPY lib-common/ lib-common/ COPY server-rm/ server-rm/ -# Build only the specific module and its dependencies -RUN mvn -B --no-transfer-progress -DskipTests clean package -pl server-rm -am +# Build Quarkus uber-jar (single JAR with all dependencies) +RUN mvn -B --no-transfer-progress -DskipTests clean package -pl server-rm -am -Dquarkus.package.jar.type=uber-jar -FROM docker.io/library/jetty:12-jre21-eclipse-temurin +FROM registry.access.redhat.com/ubi8/openjdk-21-runtime:1.20 # Add metadata LABEL org.opencontainers.image.title="OSLC RefImpl RM Server" @@ -27,11 +27,14 @@ LABEL org.opencontainers.image.source="https://github.com/oslc-op/refimpl" LABEL org.opencontainers.image.vendor="OSLC Open Project" LABEL org.opencontainers.image.licenses="EPL-2.0" -# WARNING DO NOT CHANGE WORKDIR or set it back to what it was before -# $JETTY_BASE must be correct before starting Jetty +ENV LANGUAGE='en_US:en' -COPY --from=build /src/server-rm/target/*.war /var/lib/jetty/webapps/ROOT.war +WORKDIR /deployments -RUN java -jar "$JETTY_HOME/start.jar" --add-modules=ee9-deploy,ee9-jsp,ee9-jstl +# Copy the Quarkus uber-jar +COPY --from=build --chown=185 /src/server-rm/target/*-runner.jar /deployments/quarkus-run.jar -EXPOSE 8080 +EXPOSE 8800 +USER 185 + +ENTRYPOINT ["java", "-jar", "/deployments/quarkus-run.jar"] diff --git a/src/server-rm/pom.xml b/src/server-rm/pom.xml index 96f28353..420372c5 100644 --- a/src/server-rm/pom.xml +++ b/src/server-rm/pom.xml @@ -18,135 +18,28 @@ co.oslc.refimpl server-rm 0.3.0-SNAPSHOT - war RM UTF-8 UTF-8 21 7.0.0-SNAPSHOT - 5.30.3 - 8800 - / + quarkus-bom + io.quarkus.platform + 3.17.4 server-rm - - 9.12.0 6.0.0 - - - - - - - Central Portal Snapshots - central-portal-snapshots - https://central.sonatype.com/repository/maven-snapshots/ - - false - - - true - - - - - - - - strict - - true - - - - - org.apache.maven.plugins - maven-enforcer-plugin - 3.6.2 - - - enforce-maven - - enforce - - - - - 3.6.0 - - - 11 - - - - xerces - xml-apis - com.sun.xml.bind:jaxb-impl - - - - - org.apache.logging.log4j:log4j-core - - - - - - - org.osgi:org.osgi.core - jakarta.servlet:jakarta.servlet-api - - - - The reactor is not valid - false - - - true - - - - - - - - - - - with-jstl-impl - - - - - - jakarta.servlet.jsp.jstl - jakarta.servlet.jsp.jstl-api - - - org.glassfish.web - jakarta.servlet.jsp.jstl - - - - - - - - + + + ${quarkus.platform.group-id} + ${quarkus.platform.artifact-id} + ${quarkus.platform.version} + pom + import + org.eclipse.lyo lyo-bom @@ -154,94 +47,183 @@ import pom - - - - - - - co.oslc.refimpl - lib-common - - - org.apache.lucene - lucene-core - ${v.lucene} - - - org.apache.lucene - lucene-queryparser - ${v.lucene} - - - - + + + org.slf4j + slf4j-api + 2.0.17 + org.slf4j - slf4j-simple - runtime + jcl-over-slf4j + 2.0.17 + + + org.wildfly.common + wildfly-common + 2.0.1 + + + com.fasterxml.jackson.core + jackson-databind + 2.19.2 + + + com.fasterxml.jackson.core + jackson-core + 2.19.2 + + + com.fasterxml.jackson.core + jackson-annotations + 2.19.2 + + + org.apache.commons + commons-lang3 + 3.20.0 + + + commons-codec + commons-codec + 1.20.0 + + + commons-io + commons-io + 2.20.0 - jakarta.servlet jakarta.servlet-api - provided + 6.1.0 - jakarta.servlet.jsp.jstl - jakarta.servlet.jsp.jstl-api - - provided + jakarta.el + jakarta.el-api + 6.0.1 - org.glassfish.jersey.core - jersey-server - - - - - org.glassfish.hk2.external - javax.inject - - + org.apache.commons + commons-compress + 1.28.0 - org.glassfish.jersey.containers - jersey-container-servlet - - - - org.glassfish.hk2.external - javax.inject - - + com.github.ben-manes.caffeine + caffeine + 3.2.2 - org.glassfish.jersey.media - jersey-media-multipart + com.google.code.gson + gson + 2.13.2 - org.glassfish.jersey.inject - jersey-hk2 + com.google.errorprone + error_prone_annotations + 2.41.0 + + + com.google.protobuf + protobuf-java + 4.32.1 + + + + + + + io.quarkus + quarkus-resteasy + + + io.quarkus + quarkus-resteasy-jackson + + + io.quarkus + quarkus-undertow + + + io.quarkus + quarkus-resteasy-qute - - org.glassfish.jaxb - jaxb-runtime - runtime + io.quarkus + quarkus-smallrye-openapi + + io.quarkus + quarkus-qute + + + io.quarkus + quarkus-arc + + + + + co.oslc.refimpl + lib-common + + + org.apache.lucene + lucene-core + ${v.lucene} + + + org.apache.lucene + lucene-queryparser + ${v.lucene} + + + + io.swagger.core.v3 + swagger-annotations-jakarta + 2.2.22 + + + org.eclipse.lyo.oslc4j.core oslc4j-core + + + org.glassfish.jersey.core + jersey-server + + + org.glassfish.jersey.containers + jersey-container-servlet + + + org.glassfish.jersey.media + jersey-media-multipart + + + org.glassfish.jersey.inject + jersey-hk2 + + + org.slf4j + slf4j-simple + + + org.slf4j + slf4j-jdk14 + + org.eclipse.lyo.oslc4j.core oslc4j-jena-provider + + + org.slf4j + slf4j-log4j12 + + org.eclipse.lyo.oslc4j.core @@ -263,6 +245,12 @@ org.eclipse.lyo.server oauth-webapp war + + + javax.servlet + javax.servlet-api + + org.eclipse.lyo @@ -270,167 +258,106 @@ 7.0.0-SNAPSHOT - + - io.swagger.core.v3 - swagger-jaxrs2-jakarta - - - - jakarta.activation - jakarta.activation-api - - + io.rest-assured + rest-assured + test - io.swagger.core.v3 - swagger-jaxrs2-servlet-initializer-v2-jakarta + io.quarkus + quarkus-junit5 + test + + + org.junit.vintage + junit-vintage-engine + 5.10.5 + test + + + junit + junit + 4.13.2 + test - - - - - io.rest-assured - rest-assured - ${v.rest-assured} - test - - - - junit - junit - 4.13.2 - test - - - - ${application.filename} + + + src/main/resources + true + + - - org.apache.maven.plugins - maven-enforcer-plugin - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.14.1 - - - -Xlint:fallthrough,unchecked,removal,deprecation,dep-ann,varargs,overloads,serial,try,finally - - + ${quarkus.platform.group-id} + quarkus-maven-plugin + ${quarkus.platform.version} + true + + + + build + generate-code + generate-code-tests + + + - org.eclipse.jetty - jetty-maven-plugin - 11.0.20 + maven-compiler-plugin + 3.13.0 - - ${application.contextpath} - <_initParams> - false - - - - ${servlet.port} - - 5 + + -parameters + - org.codehaus.cargo - cargo-maven3-plugin - 1.10.25 + maven-surefire-plugin + 3.5.2 - - - - tomcat10x - jetty12x - - - - - - - - - ${servlet.port} - - - - - war - ${project.build.directory}/${project.build.finalName}.war - - ${application.contextpath} - - - + + org.jboss.logmanager.LogManager + ${maven.home} + - - - org.apache.maven.plugins - maven-dependency-plugin - 3.9.0 + maven-failsafe-plugin + 3.5.2 - prepare-package - unpack + integration-test + verify - - - - org.webjars - swagger-ui - ${swagger-ui.version} - - - ${project.build.directory}/swagger-ui - - - - - org.apache.maven.plugins - maven-war-plugin - 3.5.1 - - - ${project.build.directory}/swagger-ui/META-INF/resources/webjars/swagger-ui/${swagger-ui.version} - - **/*.* - - /swagger-ui/dist - - + + ${project.build.directory}/${project.build.finalName}-runner + org.jboss.logmanager.LogManager + ${maven.home} + - - - - - + + + native + + + native + + + + false + true + + + diff --git a/src/server-rm/src/main/java/co/oslc/refimpl/rm/gen/RestDelegate.java b/src/server-rm/src/main/java/co/oslc/refimpl/rm/gen/RestDelegate.java index 665c4881..561401c6 100644 --- a/src/server-rm/src/main/java/co/oslc/refimpl/rm/gen/RestDelegate.java +++ b/src/server-rm/src/main/java/co/oslc/refimpl/rm/gen/RestDelegate.java @@ -88,6 +88,7 @@ // Start of user code pre_class_code // End of user code +@jakarta.enterprise.context.ApplicationScoped public class RestDelegate { private static final Logger log = LoggerFactory.getLogger(RestDelegate.class); diff --git a/src/server-rm/src/main/java/co/oslc/refimpl/rm/gen/services/Requirement_collectionsService.java b/src/server-rm/src/main/java/co/oslc/refimpl/rm/gen/services/Requirement_collectionsService.java index f9a8579e..c1247b15 100644 --- a/src/server-rm/src/main/java/co/oslc/refimpl/rm/gen/services/Requirement_collectionsService.java +++ b/src/server-rm/src/main/java/co/oslc/refimpl/rm/gen/services/Requirement_collectionsService.java @@ -85,6 +85,7 @@ import co.oslc.refimpl.rm.gen.RestDelegate; import co.oslc.refimpl.rm.gen.ServerConstants; +import co.oslc.refimpl.rm.gen.util.ServletUtil; import org.eclipse.lyo.oslc.domains.rm.Oslc_rmDomainConstants; import org.eclipse.lyo.oslc.domains.rm.Oslc_rmDomainConstants; import co.oslc.refimpl.rm.gen.servlet.ServiceProviderCatalogSingleton; @@ -187,72 +188,74 @@ public RequirementCollection[] queryRequirementCollections( return resources.toArray(new RequirementCollection [resources.size()]); } - @GET - @Path("query") - @Produces({ MediaType.TEXT_HTML }) - @Operation( - summary = "Query capability for resources of type {" + Oslc_rmDomainConstants.REQUIREMENTCOLLECTION_LOCALNAME + "}", - description = "Query capability for resources of type {" + "" + Oslc_rmDomainConstants.REQUIREMENTCOLLECTION_LOCALNAME + "" + "}" + - ", with respective resource shapes {" + "" + Oslc_rmDomainConstants.REQUIREMENTCOLLECTION_LOCALNAME + "" + "}", - 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 queryRequirementCollectionsAsHtml( - @PathParam("serviceProviderId") final String serviceProviderId , - @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 - { - boolean paging=false; - int page=0; - int pageSize=20; - if (null != pagingString) { - paging = Boolean.parseBoolean(pagingString); - } - if (null != pageString) { - page = Integer.parseInt(pageString); - } - if (null != pageSizeString) { - pageSize = Integer.parseInt(pageSizeString); - } - - // Start of user code queryRequirementCollectionsAsHtml - // End of user code - - List resources = delegate.queryRequirementCollections(httpServletRequest, serviceProviderId, where, prefix, paging, page, pageSize); - - if (resources!= null) { - // Start of user code queryRequirementCollectionsAsHtml_setAttributes - // End of user code - - 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 ((OSLC4JUtils.hasLyoStorePagingPreciseLimit() && resources.size() >= pageSize) - || (!OSLC4JUtils.hasLyoStorePagingPreciseLimit() && resources.size() > pageSize)) { - resources = resources.subList(0, pageSize); - uriBuilder.replaceQueryParam("page", page + 1); - httpServletRequest.setAttribute(OSLC4JConstants.OSLC4J_NEXT_PAGE, uriBuilder.build().toString()); - } - httpServletRequest.setAttribute("resources", resources); - RequestDispatcher rd = httpServletRequest.getRequestDispatcher("/co/oslc/refimpl/rm/gen/requirementcollectionscollection.jsp"); - rd.forward(httpServletRequest,httpServletResponse); - return; - } - throw new WebApplicationException(Status.NOT_FOUND); - } + // NOTE: HTML representation disabled in Quarkus migration as JSP forwarding is not supported. Quarkus uses Qute templates instead. For now, only RDF representations are supported. + // @GET + // @Path("query") + // @Produces({ MediaType.TEXT_HTML }) + // @Operation( + // summary = "Query capability for resources of type {" + Oslc_rmDomainConstants.REQUIREMENTCOLLECTION_LOCALNAME + "}", + // description = "Query capability for resources of type {" + "" + Oslc_rmDomainConstants.REQUIREMENTCOLLECTION_LOCALNAME + "" + "}" + + // ", with respective resource shapes {" + "" + Oslc_rmDomainConstants.REQUIREMENTCOLLECTION_LOCALNAME + "" + "}", + // 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 queryRequirementCollectionsAsHtml( + // @PathParam("serviceProviderId") final String serviceProviderId , + // @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 + // { + // boolean paging=false; + // int page=0; + // int pageSize=20; + // if (null != pagingString) { + // paging = Boolean.parseBoolean(pagingString); + // } + // if (null != pageString) { + // page = Integer.parseInt(pageString); + // } + // if (null != pageSizeString) { + // pageSize = Integer.parseInt(pageSizeString); + // } + // + // // Start of user code queryRequirementCollectionsAsHtml + // // End of user code + // + // List resources = delegate.queryRequirementCollections(httpServletRequest, serviceProviderId, where, prefix, paging, page, pageSize); + // + // if (resources!= null) { + // // Start of user code queryRequirementCollectionsAsHtml_setAttributes + // // End of user code + // + // 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 ((OSLC4JUtils.hasLyoStorePagingPreciseLimit() && resources.size() >= pageSize) + // || (!OSLC4JUtils.hasLyoStorePagingPreciseLimit() && resources.size() > pageSize)) { + // resources = resources.subList(0, pageSize); + // uriBuilder.replaceQueryParam("page", page + 1); + // httpServletRequest.setAttribute(OSLC4JConstants.OSLC4J_NEXT_PAGE, uriBuilder.build().toString()); + // } + // HttpServletRequest originalRequest = ServletUtil.unwrapRequest(httpServletRequest); + // originalRequest.setAttribute("resources", resources); + // RequestDispatcher rd = originalRequest.getRequestDispatcher("/co/oslc/refimpl/rm/gen/requirementcollectionscollection.jsp"); + // rd.forward(originalRequest,httpServletResponse); + // return; + // } + // throw new WebApplicationException(Status.NOT_FOUND); + // } @OslcDialog ( @@ -301,8 +304,9 @@ public Response RequirementCollectionSelector( throw new WebApplicationException(Status.INTERNAL_SERVER_ERROR); } else { - RequestDispatcher rd = httpServletRequest.getRequestDispatcher("/co/oslc/refimpl/rm/gen/requirementcollectionselector.jsp"); - rd.forward(httpServletRequest, httpServletResponse); + HttpServletRequest originalRequest = ServletUtil.unwrapRequest(httpServletRequest); + RequestDispatcher rd = originalRequest.getRequestDispatcher("/co/oslc/refimpl/rm/gen/requirementcollectionselector.jsp"); + rd.forward(originalRequest, httpServletResponse); return null; } } diff --git a/src/server-rm/src/main/java/co/oslc/refimpl/rm/gen/services/RequirementsService.java b/src/server-rm/src/main/java/co/oslc/refimpl/rm/gen/services/RequirementsService.java index e2d18d01..2e7bb982 100644 --- a/src/server-rm/src/main/java/co/oslc/refimpl/rm/gen/services/RequirementsService.java +++ b/src/server-rm/src/main/java/co/oslc/refimpl/rm/gen/services/RequirementsService.java @@ -85,6 +85,7 @@ import co.oslc.refimpl.rm.gen.RestDelegate; import co.oslc.refimpl.rm.gen.ServerConstants; +import co.oslc.refimpl.rm.gen.util.ServletUtil; import org.eclipse.lyo.oslc.domains.rm.Oslc_rmDomainConstants; import org.eclipse.lyo.oslc.domains.rm.Oslc_rmDomainConstants; import co.oslc.refimpl.rm.gen.servlet.ServiceProviderCatalogSingleton; @@ -93,6 +94,8 @@ import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.quarkus.qute.Template; +import io.quarkus.qute.TemplateInstance; // Start of user code imports // End of user code @@ -108,6 +111,7 @@ public class RequirementsService @Context private HttpServletResponse httpServletResponse; @Context private UriInfo uriInfo; @Inject private RestDelegate delegate; + @Inject Template requirementSelector; private static final Logger log = LoggerFactory.getLogger(RequirementsService.class); @@ -187,72 +191,74 @@ public Requirement[] queryRequirements( return resources.toArray(new Requirement [resources.size()]); } - @GET - @Path("query") - @Produces({ MediaType.TEXT_HTML }) - @Operation( - summary = "Query capability for resources of type {" + Oslc_rmDomainConstants.REQUIREMENT_LOCALNAME + "}", - description = "Query capability for resources of type {" + "" + Oslc_rmDomainConstants.REQUIREMENT_LOCALNAME + "" + "}" + - ", with respective resource shapes {" + "" + Oslc_rmDomainConstants.REQUIREMENT_LOCALNAME + "" + "}", - 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 queryRequirementsAsHtml( - @PathParam("serviceProviderId") final String serviceProviderId , - @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 - { - boolean paging=false; - int page=0; - int pageSize=20; - if (null != pagingString) { - paging = Boolean.parseBoolean(pagingString); - } - if (null != pageString) { - page = Integer.parseInt(pageString); - } - if (null != pageSizeString) { - pageSize = Integer.parseInt(pageSizeString); - } - - // Start of user code queryRequirementsAsHtml - // End of user code - - List resources = delegate.queryRequirements(httpServletRequest, serviceProviderId, where, prefix, paging, page, pageSize); - - if (resources!= null) { - // Start of user code queryRequirementsAsHtml_setAttributes - // End of user code - - 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 ((OSLC4JUtils.hasLyoStorePagingPreciseLimit() && resources.size() >= pageSize) - || (!OSLC4JUtils.hasLyoStorePagingPreciseLimit() && resources.size() > pageSize)) { - resources = resources.subList(0, pageSize); - uriBuilder.replaceQueryParam("page", page + 1); - httpServletRequest.setAttribute(OSLC4JConstants.OSLC4J_NEXT_PAGE, uriBuilder.build().toString()); - } - httpServletRequest.setAttribute("resources", resources); - RequestDispatcher rd = httpServletRequest.getRequestDispatcher("/co/oslc/refimpl/rm/gen/requirementscollection.jsp"); - rd.forward(httpServletRequest,httpServletResponse); - return; - } - throw new WebApplicationException(Status.NOT_FOUND); - } + // NOTE: HTML representation disabled in Quarkus migration as JSP forwarding is not supported. Quarkus uses Qute templates instead. For now, only RDF representations are supported. + // @GET + // @Path("query") + // @Produces({ MediaType.TEXT_HTML }) + // @Operation( + // summary = "Query capability for resources of type {" + Oslc_rmDomainConstants.REQUIREMENT_LOCALNAME + "}", + // description = "Query capability for resources of type {" + "" + Oslc_rmDomainConstants.REQUIREMENT_LOCALNAME + "" + "}" + + // ", with respective resource shapes {" + "" + Oslc_rmDomainConstants.REQUIREMENT_LOCALNAME + "" + "}", + // 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 queryRequirementsAsHtml( + // @PathParam("serviceProviderId") final String serviceProviderId , + // @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 + // { + // boolean paging=false; + // int page=0; + // int pageSize=20; + // if (null != pagingString) { + // paging = Boolean.parseBoolean(pagingString); + // } + // if (null != pageString) { + // page = Integer.parseInt(pageString); + // } + // if (null != pageSizeString) { + // pageSize = Integer.parseInt(pageSizeString); + // } + // + // // Start of user code queryRequirementsAsHtml + // // End of user code + // + // List resources = delegate.queryRequirements(httpServletRequest, serviceProviderId, where, prefix, paging, page, pageSize); + // + // if (resources!= null) { + // // Start of user code queryRequirementsAsHtml_setAttributes + // // End of user code + // + // 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 ((OSLC4JUtils.hasLyoStorePagingPreciseLimit() && resources.size() >= pageSize) + // || (!OSLC4JUtils.hasLyoStorePagingPreciseLimit() && resources.size() > pageSize)) { + // resources = resources.subList(0, pageSize); + // uriBuilder.replaceQueryParam("page", page + 1); + // httpServletRequest.setAttribute(OSLC4JConstants.OSLC4J_NEXT_PAGE, uriBuilder.build().toString()); + // } + // HttpServletRequest originalRequest = ServletUtil.unwrapRequest(httpServletRequest); + // originalRequest.setAttribute("resources", resources); + // RequestDispatcher rd = originalRequest.getRequestDispatcher("/co/oslc/refimpl/rm/gen/requirementscollection.jsp"); + // rd.forward(originalRequest,httpServletResponse); + // return; + // } + // throw new WebApplicationException(Status.NOT_FOUND); + // } @OslcDialog ( @@ -266,8 +272,9 @@ public void queryRequirementsAsHtml( ) @GET @Path("selector") + @Produces({ MediaType.TEXT_HTML, MediaType.APPLICATION_JSON }) @Consumes({ MediaType.TEXT_HTML, MediaType.WILDCARD }) - public Response RequirementSelector( + public Object RequirementSelector( @QueryParam("terms") final String terms , @PathParam("serviceProviderId") final String serviceProviderId ) throws ServletException, IOException, JSONException @@ -275,12 +282,11 @@ public Response RequirementSelector( // Start of user code RequirementSelector_init // End of user code - httpServletRequest.setAttribute("selectionUri",UriBuilder.fromUri(OSLC4JUtils.getServletURI()).path(uriInfo.getPath()).build().toString()); + String selectionUri = UriBuilder.fromUri(OSLC4JUtils.getServletURI()).path(uriInfo.getPath()).build().toString(); // Start of user code RequirementSelector_setAttributes // End of user code if (terms != null ) { - httpServletRequest.setAttribute("terms", terms); final List resources = delegate.RequirementSelector(httpServletRequest, serviceProviderId, terms); if (resources!= null) { JSONArray resourceArray = new JSONArray(); @@ -301,9 +307,8 @@ public Response RequirementSelector( throw new WebApplicationException(Status.INTERNAL_SERVER_ERROR); } else { - RequestDispatcher rd = httpServletRequest.getRequestDispatcher("/co/oslc/refimpl/rm/gen/requirementselector.jsp"); - rd.forward(httpServletRequest, httpServletResponse); - return null; + // Use Qute template instead of JSP + return requirementSelector.data("selectionUri", selectionUri); } } @@ -359,11 +364,12 @@ public Response RequirementCreator( // Start of user code RequirementCreator // End of user code - httpServletRequest.setAttribute("creatorUri", UriBuilder.fromUri(OSLC4JUtils.getServletURI()).path(uriInfo.getPath()).build().toString()); - httpServletRequest.setAttribute("serviceProviderId", serviceProviderId); + HttpServletRequest originalRequest = ServletUtil.unwrapRequest(httpServletRequest); + originalRequest.setAttribute("creatorUri", UriBuilder.fromUri(OSLC4JUtils.getServletURI()).path(uriInfo.getPath()).build().toString()); + originalRequest.setAttribute("serviceProviderId", serviceProviderId); - RequestDispatcher rd = httpServletRequest.getRequestDispatcher("/co/oslc/refimpl/rm/gen/requirementcreator.jsp"); - rd.forward(httpServletRequest, httpServletResponse); + RequestDispatcher rd = originalRequest.getRequestDispatcher("/co/oslc/refimpl/rm/gen/requirementcreator.jsp"); + rd.forward(originalRequest, httpServletResponse); return null; } diff --git a/src/server-rm/src/main/java/co/oslc/refimpl/rm/gen/services/ResourceShapeService.java b/src/server-rm/src/main/java/co/oslc/refimpl/rm/gen/services/ResourceShapeService.java index 796f07f2..f0c21abd 100644 --- a/src/server-rm/src/main/java/co/oslc/refimpl/rm/gen/services/ResourceShapeService.java +++ b/src/server-rm/src/main/java/co/oslc/refimpl/rm/gen/services/ResourceShapeService.java @@ -52,6 +52,7 @@ import io.swagger.v3.oas.annotations.Operation; import co.oslc.refimpl.rm.gen.servlet.Application; +import co.oslc.refimpl.rm.gen.util.ServletUtil; // Start of user code imports // End of user code @@ -92,25 +93,27 @@ public ResourceShape getResourceShape(@Context final Http throw new WebApplicationException(Response.Status.NOT_FOUND); } - @GET - @Path("{resourceShapePath}") - @Produces({ MediaType.TEXT_HTML }) - public void getResourceShapeAsHtml( - @PathParam("resourceShapePath") final String resourceShapePath - ) throws ServletException, IOException, URISyntaxException, OslcCoreApplicationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException - { - final Class resourceClass = Application.getResourceShapePathToResourceClassMap().get(resourceShapePath); - ResourceShape aResourceShape = null; - - if (resourceClass != null) - { - aResourceShape = (ResourceShape) resourceClass.getMethod("createResourceShape").invoke(null); - httpServletRequest.setAttribute("aResourceShape", aResourceShape); - - RequestDispatcher rd = httpServletRequest.getRequestDispatcher("/co/oslc/refimpl/rm/gen/resourceshape.jsp"); - rd.forward(httpServletRequest,httpServletResponse); - return; - } - throw new WebApplicationException(Status.NOT_FOUND); - } + // NOTE: HTML representation disabled in Quarkus migration as JSP forwarding is not supported. Quarkus uses Qute templates instead. For now, only RDF representations are supported. + // @GET + // @Path("{resourceShapePath}") + // @Produces({ MediaType.TEXT_HTML }) + // public void getResourceShapeAsHtml( + // @PathParam("resourceShapePath") final String resourceShapePath + // ) throws ServletException, IOException, URISyntaxException, OslcCoreApplicationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException + // { + // final Class resourceClass = Application.getResourceShapePathToResourceClassMap().get(resourceShapePath); + // ResourceShape aResourceShape = null; + // + // if (resourceClass != null) + // { + // aResourceShape = (ResourceShape) resourceClass.getMethod("createResourceShape").invoke(null); + // HttpServletRequest originalRequest = ServletUtil.unwrapRequest(httpServletRequest); + // originalRequest.setAttribute("aResourceShape", aResourceShape); + // + // RequestDispatcher rd = originalRequest.getRequestDispatcher("/co/oslc/refimpl/rm/gen/resourceshape.jsp"); + // rd.forward(originalRequest,httpServletResponse); + // return; + // } + // throw new WebApplicationException(Status.NOT_FOUND); + // } } diff --git a/src/server-rm/src/main/java/co/oslc/refimpl/rm/gen/services/ServiceProviderCatalogService.java b/src/server-rm/src/main/java/co/oslc/refimpl/rm/gen/services/ServiceProviderCatalogService.java index 89743c98..5002ba3a 100644 --- a/src/server-rm/src/main/java/co/oslc/refimpl/rm/gen/services/ServiceProviderCatalogService.java +++ b/src/server-rm/src/main/java/co/oslc/refimpl/rm/gen/services/ServiceProviderCatalogService.java @@ -31,6 +31,8 @@ import java.net.URISyntaxException; import jakarta.servlet.RequestDispatcher; +import jakarta.servlet.ServletRequest; +import jakarta.servlet.http.HttpServletRequestWrapper; import jakarta.servlet.http.HttpServletResponse; import jakarta.servlet.http.HttpServletRequest; import jakarta.ws.rs.GET; @@ -55,6 +57,7 @@ import co.oslc.refimpl.rm.gen.ServerConstants; import co.oslc.refimpl.rm.gen.RestDelegate; import co.oslc.refimpl.rm.gen.servlet.ServiceProviderCatalogSingleton; +import co.oslc.refimpl.rm.gen.util.ServletUtil; // Start of user code imports // End of user code @@ -127,30 +130,28 @@ public ServiceProviderCatalog getServiceProviderCatalog(@PathParam("serviceProvi /** * Return the catalog singleton as HTML * - * Forwards to serviceprovidercatalog_html.jsp to build the html + * NOTE: HTML representation disabled in Quarkus migration as JSP forwarding is not supported. + * Quarkus uses Qute templates instead. For now, only RDF representations are supported. * */ - @GET - @Path("{someId}") - @Produces(MediaType.TEXT_HTML) - public void getHtmlServiceProvider(@PathParam("someId") final String someId) - { - try { - ServiceProviderCatalog catalog = ServiceProviderCatalogSingleton.getServiceProviderCatalog(httpServletRequest); - - if (catalog !=null ) { - httpServletRequest.setAttribute("catalog",catalog); - // Start of user code getHtmlServiceProvider_setAttributes - // End of user code - - RequestDispatcher rd = httpServletRequest.getRequestDispatcher("/co/oslc/refimpl/rm/gen/serviceprovidercatalog.jsp"); - rd.forward(httpServletRequest, httpServletResponse); - return; - } - } catch (WebApplicationException e) { - throw e; - } catch (Exception e) { - throw new WebApplicationException(e, Status.INTERNAL_SERVER_ERROR); - } - } + // @GET + // @Path("{someId}") + // @Produces(MediaType.TEXT_HTML) + // public void getHtmlServiceProvider(@PathParam("someId") final String someId) + // { + // try { + // ServiceProviderCatalog catalog = ServiceProviderCatalogSingleton.getServiceProviderCatalog(httpServletRequest); + // + // if (catalog !=null ) { + // httpServletRequest.setAttribute("catalog",catalog); + // RequestDispatcher rd = httpServletRequest.getRequestDispatcher("/co/oslc/refimpl/rm/gen/serviceprovidercatalog.jsp"); + // rd.forward(httpServletRequest, httpServletResponse); + // return; + // } + // } catch (WebApplicationException e) { + // throw e; + // } catch (Exception e) { + // throw new WebApplicationException(e, Status.INTERNAL_SERVER_ERROR); + // } + // } } diff --git a/src/server-rm/src/main/java/co/oslc/refimpl/rm/gen/services/ServiceProviderService.java b/src/server-rm/src/main/java/co/oslc/refimpl/rm/gen/services/ServiceProviderService.java index adb808b5..abffe7aa 100644 --- a/src/server-rm/src/main/java/co/oslc/refimpl/rm/gen/services/ServiceProviderService.java +++ b/src/server-rm/src/main/java/co/oslc/refimpl/rm/gen/services/ServiceProviderService.java @@ -52,6 +52,7 @@ import co.oslc.refimpl.rm.gen.RestDelegate; import co.oslc.refimpl.rm.gen.servlet.ServiceProviderCatalogSingleton; +import co.oslc.refimpl.rm.gen.util.ServletUtil; // Start of user code imports // End of user code @@ -117,21 +118,23 @@ public ServiceProvider getServiceProvider(@PathParam("serviceProviderId") final * * @param serviceProviderId */ - @GET - @Path("{serviceProviderId}") - @Produces(MediaType.TEXT_HTML) - public void getHtmlServiceProvider(@PathParam("serviceProviderId") final String serviceProviderId) throws ServletException, IOException - { - ServiceProvider serviceProvider = ServiceProviderCatalogSingleton.getServiceProvider(httpServletRequest, serviceProviderId); - Service [] services = serviceProvider.getServices(); - - httpServletRequest.setAttribute("serviceProvider", serviceProvider); - httpServletRequest.setAttribute("services", services); - // Start of user code getHtmlServiceProvider_setAttributes - // End of user code - - RequestDispatcher rd = httpServletRequest.getRequestDispatcher("/co/oslc/refimpl/rm/gen/serviceprovider.jsp"); - rd.forward(httpServletRequest, httpServletResponse); - return; - } + // NOTE: HTML representation disabled in Quarkus migration as JSP forwarding is not supported. Quarkus uses Qute templates instead. For now, only RDF representations are supported. + // @GET + // @Path("{serviceProviderId}") + // @Produces(MediaType.TEXT_HTML) + // public void getHtmlServiceProvider(@PathParam("serviceProviderId") final String serviceProviderId) throws ServletException, IOException + // { + // ServiceProvider serviceProvider = ServiceProviderCatalogSingleton.getServiceProvider(httpServletRequest, serviceProviderId); + // Service [] services = serviceProvider.getServices(); + // + // HttpServletRequest originalRequest = ServletUtil.unwrapRequest(httpServletRequest); + // originalRequest.setAttribute("serviceProvider", serviceProvider); + // originalRequest.setAttribute("services", services); + // // Start of user code getHtmlServiceProvider_setAttributes + // // End of user code + // + // RequestDispatcher rd = originalRequest.getRequestDispatcher("/co/oslc/refimpl/rm/gen/serviceprovider.jsp"); + // rd.forward(originalRequest, httpServletResponse); + // return; + // } } diff --git a/src/server-rm/src/main/java/co/oslc/refimpl/rm/gen/services/WebServiceBasic.java b/src/server-rm/src/main/java/co/oslc/refimpl/rm/gen/services/WebServiceBasic.java index 6f8d75c7..97f05cee 100644 --- a/src/server-rm/src/main/java/co/oslc/refimpl/rm/gen/services/WebServiceBasic.java +++ b/src/server-rm/src/main/java/co/oslc/refimpl/rm/gen/services/WebServiceBasic.java @@ -18,633 +18,646 @@ * * This file is generated by org.eclipse.lyo.oslc4j.codegenerator *******************************************************************************/ -// End of user code - -package co.oslc.refimpl.rm.gen.services; - -// spotless:off -import java.io.IOException; -import java.io.PrintWriter; -import java.net.URI; -import java.net.URISyntaxException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Date; -import java.text.SimpleDateFormat; -import java.text.ParseException; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import java.util.TreeSet; - -import jakarta.inject.Inject; -import jakarta.servlet.RequestDispatcher; -import jakarta.servlet.ServletException; -import jakarta.servlet.http.HttpServletRequest; -import jakarta.servlet.http.HttpServletResponse; -import jakarta.ws.rs.Consumes; -import jakarta.ws.rs.DELETE; -import jakarta.ws.rs.FormParam; -import jakarta.ws.rs.GET; -import jakarta.ws.rs.HeaderParam; -import jakarta.ws.rs.POST; -import jakarta.ws.rs.PUT; -import jakarta.ws.rs.Path; -import jakarta.ws.rs.PathParam; -import jakarta.ws.rs.Produces; -import jakarta.ws.rs.QueryParam; -import jakarta.ws.rs.WebApplicationException; -import jakarta.ws.rs.core.Context; -import jakarta.ws.rs.core.MediaType; -import jakarta.ws.rs.core.MultivaluedMap; -import jakarta.ws.rs.core.Response; -import jakarta.ws.rs.core.Response.Status; -import jakarta.ws.rs.core.UriInfo; -import jakarta.ws.rs.core.UriBuilder; - -import org.apache.wink.json4j.JSONException; -import org.apache.wink.json4j.JSONObject; -import org.eclipse.lyo.oslc4j.provider.json4j.JsonHelper; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.eclipse.lyo.oslc4j.core.OSLC4JUtils; -import org.eclipse.lyo.oslc4j.core.annotation.OslcCreationFactory; -import org.eclipse.lyo.oslc4j.core.annotation.OslcDialog; -import org.eclipse.lyo.oslc4j.core.annotation.OslcDialogs; -import org.eclipse.lyo.oslc4j.core.annotation.OslcQueryCapability; -import org.eclipse.lyo.oslc4j.core.annotation.OslcService; -import org.eclipse.lyo.oslc4j.core.model.Compact; -import org.eclipse.lyo.oslc4j.core.model.OslcConstants; -import org.eclipse.lyo.oslc4j.core.model.OslcMediaType; -import org.eclipse.lyo.oslc4j.core.model.Preview; -import org.eclipse.lyo.oslc4j.core.model.ServiceProvider; -import org.eclipse.lyo.oslc4j.core.model.Link; -import org.eclipse.lyo.oslc4j.core.model.AbstractResource; - -import co.oslc.refimpl.rm.gen.RestDelegate; -import co.oslc.refimpl.rm.gen.ServerConstants; -import org.eclipse.lyo.oslc.domains.rm.Oslc_rmDomainConstants; -import org.eclipse.lyo.oslc.domains.rm.Oslc_rmDomainConstants; -import co.oslc.refimpl.rm.gen.servlet.ServiceProviderCatalogSingleton; -import org.eclipse.lyo.oslc.domains.rm.Requirement; -import org.eclipse.lyo.oslc.domains.rm.RequirementCollection; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.media.Content; -import io.swagger.v3.oas.annotations.responses.ApiResponse; - +// End of user code + +package co.oslc.refimpl.rm.gen.services; + +// spotless:off +import java.io.IOException; +import java.io.PrintWriter; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Date; +import java.text.SimpleDateFormat; +import java.text.ParseException; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.TreeSet; + +import jakarta.inject.Inject; +import jakarta.servlet.RequestDispatcher; +import jakarta.servlet.ServletException; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.ws.rs.Consumes; +import jakarta.ws.rs.DELETE; +import jakarta.ws.rs.FormParam; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.HeaderParam; +import jakarta.ws.rs.POST; +import jakarta.ws.rs.PUT; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.PathParam; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.QueryParam; +import jakarta.ws.rs.WebApplicationException; +import jakarta.ws.rs.core.Context; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.MultivaluedMap; +import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.core.Response.Status; +import jakarta.ws.rs.core.UriInfo; +import jakarta.ws.rs.core.UriBuilder; + +import org.apache.wink.json4j.JSONException; +import org.apache.wink.json4j.JSONObject; +import org.eclipse.lyo.oslc4j.provider.json4j.JsonHelper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.eclipse.lyo.oslc4j.core.OSLC4JUtils; +import org.eclipse.lyo.oslc4j.core.annotation.OslcCreationFactory; +import org.eclipse.lyo.oslc4j.core.annotation.OslcDialog; +import org.eclipse.lyo.oslc4j.core.annotation.OslcDialogs; +import org.eclipse.lyo.oslc4j.core.annotation.OslcQueryCapability; +import org.eclipse.lyo.oslc4j.core.annotation.OslcService; +import org.eclipse.lyo.oslc4j.core.model.Compact; +import org.eclipse.lyo.oslc4j.core.model.OslcConstants; +import org.eclipse.lyo.oslc4j.core.model.OslcMediaType; +import org.eclipse.lyo.oslc4j.core.model.Preview; +import org.eclipse.lyo.oslc4j.core.model.ServiceProvider; +import org.eclipse.lyo.oslc4j.core.model.Link; +import org.eclipse.lyo.oslc4j.core.model.AbstractResource; + +import co.oslc.refimpl.rm.gen.RestDelegate; +import co.oslc.refimpl.rm.gen.ServerConstants; +import co.oslc.refimpl.rm.gen.util.ServletUtil; +import org.eclipse.lyo.oslc.domains.rm.Oslc_rmDomainConstants; +import org.eclipse.lyo.oslc.domains.rm.Oslc_rmDomainConstants; +import co.oslc.refimpl.rm.gen.servlet.ServiceProviderCatalogSingleton; +import org.eclipse.lyo.oslc.domains.rm.Requirement; +import org.eclipse.lyo.oslc.domains.rm.RequirementCollection; +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 -// spotless:on - +// End of user code +// spotless:on + // Start of user code pre_class_code -// End of user code -@Path("") -public class WebServiceBasic -{ - @Context private HttpServletRequest httpServletRequest; - @Context private HttpServletResponse httpServletResponse; - @Context private UriInfo uriInfo; - @Inject private RestDelegate delegate; - - private static final Logger log = LoggerFactory.getLogger(WebServiceBasic.class); - +// End of user code +@Path("") +public class WebServiceBasic +{ + @Context private HttpServletRequest httpServletRequest; + @Context private HttpServletResponse httpServletResponse; + @Context private UriInfo uriInfo; + @Inject private RestDelegate delegate; + + private static final Logger log = LoggerFactory.getLogger(WebServiceBasic.class); + // Start of user code class_attributes - // End of user code - + // End of user code + // Start of user code class_methods - // End of user code - - public WebServiceBasic() - { - super(); - } - - @GET - @Path("Requirement/{serviceProviderId}/{resourceId}") - @Produces({OslcMediaType.APPLICATION_RDF_XML, OslcMediaType.APPLICATION_JSON_LD, OslcMediaType.TEXT_TURTLE, OslcMediaType.APPLICATION_XML, OslcMediaType.APPLICATION_JSON}) - @Operation( - summary = "GET for resources of type {'" + Oslc_rmDomainConstants.REQUIREMENT_LOCALNAME + "'}", - description = "GET for resources of type {'" + "" + Oslc_rmDomainConstants.REQUIREMENT_LOCALNAME + "" + "'}" + - ", with respective resource shapes {'" + "" + Oslc_rmDomainConstants.REQUIREMENT_LOCALNAME + "" + "'}", - 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 Requirement getRequirement( - @PathParam("serviceProviderId") final String serviceProviderId, @PathParam("resourceId") final String resourceId - ) throws IOException, ServletException, URISyntaxException - { - // Start of user code getResource_init - // End of user code - - final Requirement aRequirement = delegate.getRequirement(httpServletRequest, serviceProviderId, resourceId); - - if (aRequirement != null) { + // End of user code + + public WebServiceBasic() + { + super(); + } + + @GET + @Path("Requirement/{serviceProviderId}/{resourceId}") + @Produces({OslcMediaType.APPLICATION_RDF_XML, OslcMediaType.APPLICATION_JSON_LD, OslcMediaType.TEXT_TURTLE, OslcMediaType.APPLICATION_XML, OslcMediaType.APPLICATION_JSON}) + @Operation( + summary = "GET for resources of type {'" + Oslc_rmDomainConstants.REQUIREMENT_LOCALNAME + "'}", + description = "GET for resources of type {'" + "" + Oslc_rmDomainConstants.REQUIREMENT_LOCALNAME + "" + "'}" + + ", with respective resource shapes {'" + "" + Oslc_rmDomainConstants.REQUIREMENT_LOCALNAME + "" + "'}", + 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 Requirement getRequirement( + @PathParam("serviceProviderId") final String serviceProviderId, @PathParam("resourceId") final String resourceId + ) throws IOException, ServletException, URISyntaxException + { + // Start of user code getResource_init + // End of user code + + final Requirement aRequirement = delegate.getRequirement(httpServletRequest, serviceProviderId, resourceId); + + if (aRequirement != null) { // Start of user code getRequirement - // End of user code - httpServletResponse.setHeader("ETag", delegate.getETagFromRequirement(aRequirement)); - httpServletResponse.addHeader(ServerConstants.HDR_OSLC_VERSION, ServerConstants.OSLC_VERSION_V2); - return aRequirement; - } - - throw new WebApplicationException(Status.NOT_FOUND); - } - - @GET - @Path("Requirement/{serviceProviderId}/{resourceId}") - @Produces({ MediaType.TEXT_HTML }) - @Operation( - summary = "GET for resources of type {'" + Oslc_rmDomainConstants.REQUIREMENT_LOCALNAME + "'}", - description = "GET for resources of type {'" + "" + Oslc_rmDomainConstants.REQUIREMENT_LOCALNAME + "" + "'}" + - ", with respective resource shapes {'" + "" + Oslc_rmDomainConstants.REQUIREMENT_LOCALNAME + "" + "'}", - 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 getRequirementAsHtml( - @PathParam("serviceProviderId") final String serviceProviderId, @PathParam("resourceId") final String resourceId - ) throws ServletException, IOException, URISyntaxException - { - // Start of user code getRequirementAsHtml_init - // End of user code - - final Requirement aRequirement = delegate.getRequirement(httpServletRequest, serviceProviderId, resourceId); - - if (aRequirement != null) { - httpServletRequest.setAttribute("aRequirement", aRequirement); - // Start of user code getRequirementAsHtml_setAttributes - // End of user code - - RequestDispatcher rd = httpServletRequest.getRequestDispatcher("/co/oslc/refimpl/rm/gen/requirement.jsp"); - rd.forward(httpServletRequest,httpServletResponse); - return; - } - - throw new WebApplicationException(Status.NOT_FOUND); - } - - @GET - @Path("Requirement/{serviceProviderId}/{resourceId}") - @Produces({OslcMediaType.APPLICATION_X_OSLC_COMPACT_XML}) - @Operation( - summary = "GET for resources of type {'" + Oslc_rmDomainConstants.REQUIREMENT_LOCALNAME + "'}", - description = "GET for resources of type {'" + "" + Oslc_rmDomainConstants.REQUIREMENT_LOCALNAME + "" + "'}" + - ", with respective resource shapes {'" + "" + Oslc_rmDomainConstants.REQUIREMENT_LOCALNAME + "" + "'}", - 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 getRequirementCompact( - @PathParam("serviceProviderId") final String serviceProviderId, @PathParam("resourceId") final String resourceId - ) throws ServletException, IOException, URISyntaxException - { - String iconUri = OSLC4JUtils.getPublicURI() + "/images/ui_preview_icon.gif"; - String smallPreviewHintHeight = "200px"; - String smallPreviewHintWidth = "300px"; - String largePreviewHintHeight = "400px"; - String largePreviewHintWidth = "600px"; - + // End of user code + httpServletResponse.setHeader("ETag", delegate.getETagFromRequirement(aRequirement)); + httpServletResponse.addHeader(ServerConstants.HDR_OSLC_VERSION, ServerConstants.OSLC_VERSION_V2); + return aRequirement; + } + + throw new WebApplicationException(Status.NOT_FOUND); + } + + // NOTE: HTML representation disabled in Quarkus migration as JSP forwarding is not supported. Quarkus uses Qute templates instead. For now, only RDF representations are supported. + // @GET + // @Path("Requirement/{serviceProviderId}/{resourceId}") + // @Produces({ MediaType.TEXT_HTML }) + // @Operation( + // summary = "GET for resources of type {'" + Oslc_rmDomainConstants.REQUIREMENT_LOCALNAME + "'}", + // description = "GET for resources of type {'" + "" + Oslc_rmDomainConstants.REQUIREMENT_LOCALNAME + "" + "'}" + + // ", with respective resource shapes {'" + "" + Oslc_rmDomainConstants.REQUIREMENT_LOCALNAME + "" + "'}", + // 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 getRequirementAsHtml( + // @PathParam("serviceProviderId") final String serviceProviderId, @PathParam("resourceId") final String resourceId + // ) throws ServletException, IOException, URISyntaxException + // { + // // Start of user code getRequirementAsHtml_init + // // End of user code + // + // final Requirement aRequirement = delegate.getRequirement(httpServletRequest, serviceProviderId, resourceId); + // + // if (aRequirement != null) { + // HttpServletRequest originalRequest = ServletUtil.unwrapRequest(httpServletRequest); + // originalRequest.setAttribute("aRequirement", aRequirement); + // // Start of user code getRequirementAsHtml_setAttributes + // // End of user code + // + // RequestDispatcher rd = originalRequest.getRequestDispatcher("/co/oslc/refimpl/rm/gen/requirement.jsp"); + // rd.forward(originalRequest,httpServletResponse); + // return; + // } + // + // throw new WebApplicationException(Status.NOT_FOUND); + // } + + @GET + @Path("Requirement/{serviceProviderId}/{resourceId}") + @Produces({OslcMediaType.APPLICATION_X_OSLC_COMPACT_XML}) + @Operation( + summary = "GET for resources of type {'" + Oslc_rmDomainConstants.REQUIREMENT_LOCALNAME + "'}", + description = "GET for resources of type {'" + "" + Oslc_rmDomainConstants.REQUIREMENT_LOCALNAME + "" + "'}" + + ", with respective resource shapes {'" + "" + Oslc_rmDomainConstants.REQUIREMENT_LOCALNAME + "" + "'}", + 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 getRequirementCompact( + @PathParam("serviceProviderId") final String serviceProviderId, @PathParam("resourceId") final String resourceId + ) throws ServletException, IOException, URISyntaxException + { + String iconUri = OSLC4JUtils.getPublicURI() + "/images/ui_preview_icon.gif"; + String smallPreviewHintHeight = "200px"; + String smallPreviewHintWidth = "300px"; + String largePreviewHintHeight = "400px"; + String largePreviewHintWidth = "600px"; + // Start of user code getRequirementCompact_init //TODO: adjust the preview height & width values from the default values provided above. - // End of user code - - final Requirement aRequirement = delegate.getRequirement(httpServletRequest, serviceProviderId, resourceId); - - if (aRequirement != null) { - final Compact compact = new Compact(); - - compact.setAbout(aRequirement.getAbout()); - compact.setTitle(aRequirement.toString()); - - compact.setIcon(new URI(iconUri)); - - //Create and set attributes for OSLC preview resource - final Preview smallPreview = new Preview(); - smallPreview.setHintHeight(smallPreviewHintHeight); - smallPreview.setHintWidth(smallPreviewHintWidth); - smallPreview.setDocument(UriBuilder.fromUri(aRequirement.getAbout()).path("smallPreview").build()); - compact.setSmallPreview(smallPreview); - - final Preview largePreview = new Preview(); - largePreview.setHintHeight(largePreviewHintHeight); - largePreview.setHintWidth(largePreviewHintWidth); - largePreview.setDocument(UriBuilder.fromUri(aRequirement.getAbout()).path("largePreview").build()); - compact.setLargePreview(largePreview); - - httpServletResponse.addHeader(ServerConstants.HDR_OSLC_VERSION, ServerConstants.OSLC_VERSION_V2); - return compact; - } - throw new WebApplicationException(Status.NOT_FOUND); - } - - @GET - @Path("Requirement/{serviceProviderId}/{resourceId}/smallPreview") - @Produces({ MediaType.TEXT_HTML }) - public void getRequirementAsHtmlSmallPreview( - @PathParam("serviceProviderId") final String serviceProviderId, @PathParam("resourceId") final String resourceId - ) throws ServletException, IOException, URISyntaxException - { - // Start of user code getRequirementAsHtmlSmallPreview_init - // End of user code - - final Requirement aRequirement = delegate.getRequirement(httpServletRequest, serviceProviderId, resourceId); - - if (aRequirement != null) { - httpServletRequest.setAttribute("aRequirement", aRequirement); - // Start of user code getRequirementAsHtmlSmallPreview_setAttributes - // End of user code - - RequestDispatcher rd = httpServletRequest.getRequestDispatcher("/co/oslc/refimpl/rm/gen/requirementsmallpreview.jsp"); - httpServletResponse.addHeader(ServerConstants.HDR_OSLC_VERSION, ServerConstants.OSLC_VERSION_V2); - rd.forward(httpServletRequest, httpServletResponse); - return; - } - - throw new WebApplicationException(Status.NOT_FOUND); - } - - @GET - @Path("Requirement/{serviceProviderId}/{resourceId}/largePreview") - @Produces({ MediaType.TEXT_HTML }) - public void getRequirementAsHtmlLargePreview( - @PathParam("serviceProviderId") final String serviceProviderId, @PathParam("resourceId") final String resourceId - ) throws ServletException, IOException, URISyntaxException - { - // Start of user code getRequirementAsHtmlLargePreview_init - // End of user code - - final Requirement aRequirement = delegate.getRequirement(httpServletRequest, serviceProviderId, resourceId); - - if (aRequirement != null) { - httpServletRequest.setAttribute("aRequirement", aRequirement); - // Start of user code getRequirementAsHtmlLargePreview_setAttributes - // End of user code - - RequestDispatcher rd = httpServletRequest.getRequestDispatcher("/co/oslc/refimpl/rm/gen/requirementlargepreview.jsp"); - httpServletResponse.addHeader(ServerConstants.HDR_OSLC_VERSION, ServerConstants.OSLC_VERSION_V2); - rd.forward(httpServletRequest, httpServletResponse); - return; - } - - throw new WebApplicationException(Status.NOT_FOUND); - } - @GET - @Path("RequirementCollection/{serviceProviderId}/{resourceId}") - @Produces({OslcMediaType.APPLICATION_RDF_XML, OslcMediaType.APPLICATION_JSON_LD, OslcMediaType.TEXT_TURTLE, OslcMediaType.APPLICATION_XML, OslcMediaType.APPLICATION_JSON}) - @Operation( - summary = "GET for resources of type {'" + Oslc_rmDomainConstants.REQUIREMENTCOLLECTION_LOCALNAME + "'}", - description = "GET for resources of type {'" + "" + Oslc_rmDomainConstants.REQUIREMENTCOLLECTION_LOCALNAME + "" + "'}" + - ", with respective resource shapes {'" + "" + Oslc_rmDomainConstants.REQUIREMENTCOLLECTION_LOCALNAME + "" + "'}", - 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 RequirementCollection getRequirementCollection( - @PathParam("serviceProviderId") final String serviceProviderId, @PathParam("resourceId") final String resourceId - ) throws IOException, ServletException, URISyntaxException - { - // Start of user code getResource_init - // End of user code - - final RequirementCollection aRequirementCollection = delegate.getRequirementCollection(httpServletRequest, serviceProviderId, resourceId); - - if (aRequirementCollection != null) { + // End of user code + + final Requirement aRequirement = delegate.getRequirement(httpServletRequest, serviceProviderId, resourceId); + + if (aRequirement != null) { + final Compact compact = new Compact(); + + compact.setAbout(aRequirement.getAbout()); + compact.setTitle(aRequirement.toString()); + + compact.setIcon(new URI(iconUri)); + + //Create and set attributes for OSLC preview resource + final Preview smallPreview = new Preview(); + smallPreview.setHintHeight(smallPreviewHintHeight); + smallPreview.setHintWidth(smallPreviewHintWidth); + smallPreview.setDocument(UriBuilder.fromUri(aRequirement.getAbout()).path("smallPreview").build()); + compact.setSmallPreview(smallPreview); + + final Preview largePreview = new Preview(); + largePreview.setHintHeight(largePreviewHintHeight); + largePreview.setHintWidth(largePreviewHintWidth); + largePreview.setDocument(UriBuilder.fromUri(aRequirement.getAbout()).path("largePreview").build()); + compact.setLargePreview(largePreview); + + httpServletResponse.addHeader(ServerConstants.HDR_OSLC_VERSION, ServerConstants.OSLC_VERSION_V2); + return compact; + } + throw new WebApplicationException(Status.NOT_FOUND); + } + + // NOTE: HTML representation disabled in Quarkus migration as JSP forwarding is not supported. Quarkus uses Qute templates instead. For now, only RDF representations are supported. + // @GET + // @Path("Requirement/{serviceProviderId}/{resourceId}/smallPreview") + // @Produces({ MediaType.TEXT_HTML }) + // public void getRequirementAsHtmlSmallPreview( + // @PathParam("serviceProviderId") final String serviceProviderId, @PathParam("resourceId") final String resourceId + // ) throws ServletException, IOException, URISyntaxException + // { + // // Start of user code getRequirementAsHtmlSmallPreview_init + // // End of user code + // + // final Requirement aRequirement = delegate.getRequirement(httpServletRequest, serviceProviderId, resourceId); + // + // if (aRequirement != null) { + // HttpServletRequest originalRequest = ServletUtil.unwrapRequest(httpServletRequest); + // originalRequest.setAttribute("aRequirement", aRequirement); + // // Start of user code getRequirementAsHtmlSmallPreview_setAttributes + // // End of user code + // + // RequestDispatcher rd = originalRequest.getRequestDispatcher("/co/oslc/refimpl/rm/gen/requirementsmallpreview.jsp"); + // httpServletResponse.addHeader(ServerConstants.HDR_OSLC_VERSION, ServerConstants.OSLC_VERSION_V2); + // rd.forward(originalRequest, httpServletResponse); + // return; + // } + // + // throw new WebApplicationException(Status.NOT_FOUND); + // } + + // NOTE: HTML representation disabled in Quarkus migration as JSP forwarding is not supported. Quarkus uses Qute templates instead. For now, only RDF representations are supported. + // @GET + // @Path("Requirement/{serviceProviderId}/{resourceId}/largePreview") + // @Produces({ MediaType.TEXT_HTML }) + // public void getRequirementAsHtmlLargePreview( + // @PathParam("serviceProviderId") final String serviceProviderId, @PathParam("resourceId") final String resourceId + // ) throws ServletException, IOException, URISyntaxException + // { + // // Start of user code getRequirementAsHtmlLargePreview_init + // // End of user code + // + // final Requirement aRequirement = delegate.getRequirement(httpServletRequest, serviceProviderId, resourceId); + // + // if (aRequirement != null) { + // HttpServletRequest originalRequest = ServletUtil.unwrapRequest(httpServletRequest); + // originalRequest.setAttribute("aRequirement", aRequirement); + // // Start of user code getRequirementAsHtmlLargePreview_setAttributes + // // End of user code + // + // RequestDispatcher rd = originalRequest.getRequestDispatcher("/co/oslc/refimpl/rm/gen/requirementlargepreview.jsp"); + // httpServletResponse.addHeader(ServerConstants.HDR_OSLC_VERSION, ServerConstants.OSLC_VERSION_V2); + // rd.forward(originalRequest, httpServletResponse); + // return; + // } + // + // throw new WebApplicationException(Status.NOT_FOUND); + // } + @GET + @Path("RequirementCollection/{serviceProviderId}/{resourceId}") + @Produces({OslcMediaType.APPLICATION_RDF_XML, OslcMediaType.APPLICATION_JSON_LD, OslcMediaType.TEXT_TURTLE, OslcMediaType.APPLICATION_XML, OslcMediaType.APPLICATION_JSON}) + @Operation( + summary = "GET for resources of type {'" + Oslc_rmDomainConstants.REQUIREMENTCOLLECTION_LOCALNAME + "'}", + description = "GET for resources of type {'" + "" + Oslc_rmDomainConstants.REQUIREMENTCOLLECTION_LOCALNAME + "" + "'}" + + ", with respective resource shapes {'" + "" + Oslc_rmDomainConstants.REQUIREMENTCOLLECTION_LOCALNAME + "" + "'}", + 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 RequirementCollection getRequirementCollection( + @PathParam("serviceProviderId") final String serviceProviderId, @PathParam("resourceId") final String resourceId + ) throws IOException, ServletException, URISyntaxException + { + // Start of user code getResource_init + // End of user code + + final RequirementCollection aRequirementCollection = delegate.getRequirementCollection(httpServletRequest, serviceProviderId, resourceId); + + if (aRequirementCollection != null) { // Start of user code getRequirementCollection - // End of user code - httpServletResponse.setHeader("ETag", delegate.getETagFromRequirementCollection(aRequirementCollection)); - httpServletResponse.addHeader(ServerConstants.HDR_OSLC_VERSION, ServerConstants.OSLC_VERSION_V2); - return aRequirementCollection; - } - - throw new WebApplicationException(Status.NOT_FOUND); - } - - @GET - @Path("RequirementCollection/{serviceProviderId}/{resourceId}") - @Produces({ MediaType.TEXT_HTML }) - @Operation( - summary = "GET for resources of type {'" + Oslc_rmDomainConstants.REQUIREMENTCOLLECTION_LOCALNAME + "'}", - description = "GET for resources of type {'" + "" + Oslc_rmDomainConstants.REQUIREMENTCOLLECTION_LOCALNAME + "" + "'}" + - ", with respective resource shapes {'" + "" + Oslc_rmDomainConstants.REQUIREMENTCOLLECTION_LOCALNAME + "" + "'}", - 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 getRequirementCollectionAsHtml( - @PathParam("serviceProviderId") final String serviceProviderId, @PathParam("resourceId") final String resourceId - ) throws ServletException, IOException, URISyntaxException - { - // Start of user code getRequirementCollectionAsHtml_init - // End of user code - - final RequirementCollection aRequirementCollection = delegate.getRequirementCollection(httpServletRequest, serviceProviderId, resourceId); - - if (aRequirementCollection != null) { - httpServletRequest.setAttribute("aRequirementCollection", aRequirementCollection); - // Start of user code getRequirementCollectionAsHtml_setAttributes - // End of user code - - RequestDispatcher rd = httpServletRequest.getRequestDispatcher("/co/oslc/refimpl/rm/gen/requirementcollection.jsp"); - rd.forward(httpServletRequest,httpServletResponse); - return; - } - - throw new WebApplicationException(Status.NOT_FOUND); - } - - @GET - @Path("RequirementCollection/{serviceProviderId}/{resourceId}") - @Produces({OslcMediaType.APPLICATION_X_OSLC_COMPACT_XML}) - @Operation( - summary = "GET for resources of type {'" + Oslc_rmDomainConstants.REQUIREMENTCOLLECTION_LOCALNAME + "'}", - description = "GET for resources of type {'" + "" + Oslc_rmDomainConstants.REQUIREMENTCOLLECTION_LOCALNAME + "" + "'}" + - ", with respective resource shapes {'" + "" + Oslc_rmDomainConstants.REQUIREMENTCOLLECTION_LOCALNAME + "" + "'}", - 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 getRequirementCollectionCompact( - @PathParam("serviceProviderId") final String serviceProviderId, @PathParam("resourceId") final String resourceId - ) throws ServletException, IOException, URISyntaxException - { - String iconUri = OSLC4JUtils.getPublicURI() + "/images/ui_preview_icon.gif"; - String smallPreviewHintHeight = "200px"; - String smallPreviewHintWidth = "300px"; - String largePreviewHintHeight = "400px"; - String largePreviewHintWidth = "600px"; - + // End of user code + httpServletResponse.setHeader("ETag", delegate.getETagFromRequirementCollection(aRequirementCollection)); + httpServletResponse.addHeader(ServerConstants.HDR_OSLC_VERSION, ServerConstants.OSLC_VERSION_V2); + return aRequirementCollection; + } + + throw new WebApplicationException(Status.NOT_FOUND); + } + + // NOTE: HTML representation disabled in Quarkus migration as JSP forwarding is not supported. Quarkus uses Qute templates instead. For now, only RDF representations are supported. + // @GET + // @Path("RequirementCollection/{serviceProviderId}/{resourceId}") + // @Produces({ MediaType.TEXT_HTML }) + // @Operation( + // summary = "GET for resources of type {'" + Oslc_rmDomainConstants.REQUIREMENTCOLLECTION_LOCALNAME + "'}", + // description = "GET for resources of type {'" + "" + Oslc_rmDomainConstants.REQUIREMENTCOLLECTION_LOCALNAME + "" + "'}" + + // ", with respective resource shapes {'" + "" + Oslc_rmDomainConstants.REQUIREMENTCOLLECTION_LOCALNAME + "" + "'}", + // 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 getRequirementCollectionAsHtml( + // @PathParam("serviceProviderId") final String serviceProviderId, @PathParam("resourceId") final String resourceId + // ) throws ServletException, IOException, URISyntaxException + // { + // // Start of user code getRequirementCollectionAsHtml_init + // // End of user code + // + // final RequirementCollection aRequirementCollection = delegate.getRequirementCollection(httpServletRequest, serviceProviderId, resourceId); + // + // if (aRequirementCollection != null) { + // HttpServletRequest originalRequest = ServletUtil.unwrapRequest(httpServletRequest); + // originalRequest.setAttribute("aRequirementCollection", aRequirementCollection); + // // Start of user code getRequirementCollectionAsHtml_setAttributes + // // End of user code + // + // RequestDispatcher rd = originalRequest.getRequestDispatcher("/co/oslc/refimpl/rm/gen/requirementcollection.jsp"); + // rd.forward(originalRequest,httpServletResponse); + // return; + // } + // + // throw new WebApplicationException(Status.NOT_FOUND); + // } + + @GET + @Path("RequirementCollection/{serviceProviderId}/{resourceId}") + @Produces({OslcMediaType.APPLICATION_X_OSLC_COMPACT_XML}) + @Operation( + summary = "GET for resources of type {'" + Oslc_rmDomainConstants.REQUIREMENTCOLLECTION_LOCALNAME + "'}", + description = "GET for resources of type {'" + "" + Oslc_rmDomainConstants.REQUIREMENTCOLLECTION_LOCALNAME + "" + "'}" + + ", with respective resource shapes {'" + "" + Oslc_rmDomainConstants.REQUIREMENTCOLLECTION_LOCALNAME + "" + "'}", + 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 getRequirementCollectionCompact( + @PathParam("serviceProviderId") final String serviceProviderId, @PathParam("resourceId") final String resourceId + ) throws ServletException, IOException, URISyntaxException + { + String iconUri = OSLC4JUtils.getPublicURI() + "/images/ui_preview_icon.gif"; + String smallPreviewHintHeight = "200px"; + String smallPreviewHintWidth = "300px"; + String largePreviewHintHeight = "400px"; + String largePreviewHintWidth = "600px"; + // Start of user code getRequirementCollectionCompact_init //TODO: adjust the preview height & width values from the default values provided above. - // End of user code - - final RequirementCollection aRequirementCollection = delegate.getRequirementCollection(httpServletRequest, serviceProviderId, resourceId); - - if (aRequirementCollection != null) { - final Compact compact = new Compact(); - - compact.setAbout(aRequirementCollection.getAbout()); - compact.setTitle(aRequirementCollection.toString()); - - compact.setIcon(new URI(iconUri)); - - //Create and set attributes for OSLC preview resource - final Preview smallPreview = new Preview(); - smallPreview.setHintHeight(smallPreviewHintHeight); - smallPreview.setHintWidth(smallPreviewHintWidth); - smallPreview.setDocument(UriBuilder.fromUri(aRequirementCollection.getAbout()).path("smallPreview").build()); - compact.setSmallPreview(smallPreview); - - final Preview largePreview = new Preview(); - largePreview.setHintHeight(largePreviewHintHeight); - largePreview.setHintWidth(largePreviewHintWidth); - largePreview.setDocument(UriBuilder.fromUri(aRequirementCollection.getAbout()).path("largePreview").build()); - compact.setLargePreview(largePreview); - - httpServletResponse.addHeader(ServerConstants.HDR_OSLC_VERSION, ServerConstants.OSLC_VERSION_V2); - return compact; - } - throw new WebApplicationException(Status.NOT_FOUND); - } - - @GET - @Path("RequirementCollection/{serviceProviderId}/{resourceId}/smallPreview") - @Produces({ MediaType.TEXT_HTML }) - public void getRequirementCollectionAsHtmlSmallPreview( - @PathParam("serviceProviderId") final String serviceProviderId, @PathParam("resourceId") final String resourceId - ) throws ServletException, IOException, URISyntaxException - { - // Start of user code getRequirementCollectionAsHtmlSmallPreview_init - // End of user code - - final RequirementCollection aRequirementCollection = delegate.getRequirementCollection(httpServletRequest, serviceProviderId, resourceId); - - if (aRequirementCollection != null) { - httpServletRequest.setAttribute("aRequirementCollection", aRequirementCollection); - // Start of user code getRequirementCollectionAsHtmlSmallPreview_setAttributes - // End of user code - - RequestDispatcher rd = httpServletRequest.getRequestDispatcher("/co/oslc/refimpl/rm/gen/requirementcollectionsmallpreview.jsp"); - httpServletResponse.addHeader(ServerConstants.HDR_OSLC_VERSION, ServerConstants.OSLC_VERSION_V2); - rd.forward(httpServletRequest, httpServletResponse); - return; - } - - throw new WebApplicationException(Status.NOT_FOUND); - } - - @GET - @Path("RequirementCollection/{serviceProviderId}/{resourceId}/largePreview") - @Produces({ MediaType.TEXT_HTML }) - public void getRequirementCollectionAsHtmlLargePreview( - @PathParam("serviceProviderId") final String serviceProviderId, @PathParam("resourceId") final String resourceId - ) throws ServletException, IOException, URISyntaxException - { - // Start of user code getRequirementCollectionAsHtmlLargePreview_init - // End of user code - - final RequirementCollection aRequirementCollection = delegate.getRequirementCollection(httpServletRequest, serviceProviderId, resourceId); - - if (aRequirementCollection != null) { - httpServletRequest.setAttribute("aRequirementCollection", aRequirementCollection); - // Start of user code getRequirementCollectionAsHtmlLargePreview_setAttributes - // End of user code - - RequestDispatcher rd = httpServletRequest.getRequestDispatcher("/co/oslc/refimpl/rm/gen/requirementcollectionlargepreview.jsp"); - httpServletResponse.addHeader(ServerConstants.HDR_OSLC_VERSION, ServerConstants.OSLC_VERSION_V2); - rd.forward(httpServletRequest, httpServletResponse); - return; - } - - throw new WebApplicationException(Status.NOT_FOUND); - } - @DELETE - @Path("Requirement/{serviceProviderId}/{resourceId}") - @Operation( - summary = "DELETE for resources of type {'" + Oslc_rmDomainConstants.REQUIREMENT_LOCALNAME + "'}", - description = "DELETE for resources of type {'" + "" + Oslc_rmDomainConstants.REQUIREMENT_LOCALNAME + "" + "'}" + - ", with respective resource shapes {'" + "" + Oslc_rmDomainConstants.REQUIREMENT_LOCALNAME + "" + "'}", - 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 deleteRequirement( - @PathParam("serviceProviderId") final String serviceProviderId, @PathParam("resourceId") final String resourceId - ) throws IOException, ServletException, URISyntaxException - { + // End of user code + + final RequirementCollection aRequirementCollection = delegate.getRequirementCollection(httpServletRequest, serviceProviderId, resourceId); + + if (aRequirementCollection != null) { + final Compact compact = new Compact(); + + compact.setAbout(aRequirementCollection.getAbout()); + compact.setTitle(aRequirementCollection.toString()); + + compact.setIcon(new URI(iconUri)); + + //Create and set attributes for OSLC preview resource + final Preview smallPreview = new Preview(); + smallPreview.setHintHeight(smallPreviewHintHeight); + smallPreview.setHintWidth(smallPreviewHintWidth); + smallPreview.setDocument(UriBuilder.fromUri(aRequirementCollection.getAbout()).path("smallPreview").build()); + compact.setSmallPreview(smallPreview); + + final Preview largePreview = new Preview(); + largePreview.setHintHeight(largePreviewHintHeight); + largePreview.setHintWidth(largePreviewHintWidth); + largePreview.setDocument(UriBuilder.fromUri(aRequirementCollection.getAbout()).path("largePreview").build()); + compact.setLargePreview(largePreview); + + httpServletResponse.addHeader(ServerConstants.HDR_OSLC_VERSION, ServerConstants.OSLC_VERSION_V2); + return compact; + } + throw new WebApplicationException(Status.NOT_FOUND); + } + + // NOTE: HTML representation disabled in Quarkus migration as JSP forwarding is not supported. Quarkus uses Qute templates instead. For now, only RDF representations are supported. + // @GET + // @Path("RequirementCollection/{serviceProviderId}/{resourceId}/smallPreview") + // @Produces({ MediaType.TEXT_HTML }) + // public void getRequirementCollectionAsHtmlSmallPreview( + // @PathParam("serviceProviderId") final String serviceProviderId, @PathParam("resourceId") final String resourceId + // ) throws ServletException, IOException, URISyntaxException + // { + // // Start of user code getRequirementCollectionAsHtmlSmallPreview_init + // // End of user code + // + // final RequirementCollection aRequirementCollection = delegate.getRequirementCollection(httpServletRequest, serviceProviderId, resourceId); + // + // if (aRequirementCollection != null) { + // HttpServletRequest originalRequest = ServletUtil.unwrapRequest(httpServletRequest); + // originalRequest.setAttribute("aRequirementCollection", aRequirementCollection); + // // Start of user code getRequirementCollectionAsHtmlSmallPreview_setAttributes + // // End of user code + // + // RequestDispatcher rd = originalRequest.getRequestDispatcher("/co/oslc/refimpl/rm/gen/requirementcollectionsmallpreview.jsp"); + // httpServletResponse.addHeader(ServerConstants.HDR_OSLC_VERSION, ServerConstants.OSLC_VERSION_V2); + // rd.forward(originalRequest, httpServletResponse); + // return; + // } + // + // throw new WebApplicationException(Status.NOT_FOUND); + // } + + // NOTE: HTML representation disabled in Quarkus migration as JSP forwarding is not supported. Quarkus uses Qute templates instead. For now, only RDF representations are supported. + // @GET + // @Path("RequirementCollection/{serviceProviderId}/{resourceId}/largePreview") + // @Produces({ MediaType.TEXT_HTML }) + // public void getRequirementCollectionAsHtmlLargePreview( + // @PathParam("serviceProviderId") final String serviceProviderId, @PathParam("resourceId") final String resourceId + // ) throws ServletException, IOException, URISyntaxException + // { + // // Start of user code getRequirementCollectionAsHtmlLargePreview_init + // // End of user code + // + // final RequirementCollection aRequirementCollection = delegate.getRequirementCollection(httpServletRequest, serviceProviderId, resourceId); + // + // if (aRequirementCollection != null) { + // HttpServletRequest originalRequest = ServletUtil.unwrapRequest(httpServletRequest); + // originalRequest.setAttribute("aRequirementCollection", aRequirementCollection); + // // Start of user code getRequirementCollectionAsHtmlLargePreview_setAttributes + // // End of user code + // + // RequestDispatcher rd = originalRequest.getRequestDispatcher("/co/oslc/refimpl/rm/gen/requirementcollectionlargepreview.jsp"); + // httpServletResponse.addHeader(ServerConstants.HDR_OSLC_VERSION, ServerConstants.OSLC_VERSION_V2); + // rd.forward(originalRequest, httpServletResponse); + // return; + // } + // + // throw new WebApplicationException(Status.NOT_FOUND); + // } + @DELETE + @Path("Requirement/{serviceProviderId}/{resourceId}") + @Operation( + summary = "DELETE for resources of type {'" + Oslc_rmDomainConstants.REQUIREMENT_LOCALNAME + "'}", + description = "DELETE for resources of type {'" + "" + Oslc_rmDomainConstants.REQUIREMENT_LOCALNAME + "" + "'}" + + ", with respective resource shapes {'" + "" + Oslc_rmDomainConstants.REQUIREMENT_LOCALNAME + "" + "'}", + 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 deleteRequirement( + @PathParam("serviceProviderId") final String serviceProviderId, @PathParam("resourceId") final String resourceId + ) throws IOException, ServletException, URISyntaxException + { // Start of user code deleteRequirement_init - // End of user code - final Requirement aResource = delegate.getRequirement(httpServletRequest, serviceProviderId, resourceId); - - if (aResource != null) { + // End of user code + final Requirement aResource = delegate.getRequirement(httpServletRequest, serviceProviderId, resourceId); + + if (aResource != null) { // Start of user code deleteRequirement - // End of user code - boolean deleted = delegate.deleteRequirement(httpServletRequest, serviceProviderId, resourceId); - if (deleted) - return Response.ok().header(ServerConstants.HDR_OSLC_VERSION, ServerConstants.OSLC_VERSION_V2).build(); - else - throw new WebApplicationException(Status.INTERNAL_SERVER_ERROR); - } - throw new WebApplicationException(Status.NOT_FOUND); - } - - @DELETE - @Path("RequirementCollection/{serviceProviderId}/{resourceId}") - @Operation( - summary = "DELETE for resources of type {'" + Oslc_rmDomainConstants.REQUIREMENTCOLLECTION_LOCALNAME + "'}", - description = "DELETE for resources of type {'" + "" + Oslc_rmDomainConstants.REQUIREMENTCOLLECTION_LOCALNAME + "" + "'}" + - ", with respective resource shapes {'" + "" + Oslc_rmDomainConstants.REQUIREMENTCOLLECTION_LOCALNAME + "" + "'}", - 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 deleteRequirementCollection( - @PathParam("serviceProviderId") final String serviceProviderId, @PathParam("resourceId") final String resourceId - ) throws IOException, ServletException, URISyntaxException - { + // End of user code + boolean deleted = delegate.deleteRequirement(httpServletRequest, serviceProviderId, resourceId); + if (deleted) + return Response.ok().header(ServerConstants.HDR_OSLC_VERSION, ServerConstants.OSLC_VERSION_V2).build(); + else + throw new WebApplicationException(Status.INTERNAL_SERVER_ERROR); + } + throw new WebApplicationException(Status.NOT_FOUND); + } + + @DELETE + @Path("RequirementCollection/{serviceProviderId}/{resourceId}") + @Operation( + summary = "DELETE for resources of type {'" + Oslc_rmDomainConstants.REQUIREMENTCOLLECTION_LOCALNAME + "'}", + description = "DELETE for resources of type {'" + "" + Oslc_rmDomainConstants.REQUIREMENTCOLLECTION_LOCALNAME + "" + "'}" + + ", with respective resource shapes {'" + "" + Oslc_rmDomainConstants.REQUIREMENTCOLLECTION_LOCALNAME + "" + "'}", + 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 deleteRequirementCollection( + @PathParam("serviceProviderId") final String serviceProviderId, @PathParam("resourceId") final String resourceId + ) throws IOException, ServletException, URISyntaxException + { // Start of user code deleteRequirementCollection_init - // End of user code - final RequirementCollection aResource = delegate.getRequirementCollection(httpServletRequest, serviceProviderId, resourceId); - - if (aResource != null) { + // End of user code + final RequirementCollection aResource = delegate.getRequirementCollection(httpServletRequest, serviceProviderId, resourceId); + + if (aResource != null) { // Start of user code deleteRequirementCollection - // End of user code - boolean deleted = delegate.deleteRequirementCollection(httpServletRequest, serviceProviderId, resourceId); - if (deleted) - return Response.ok().header(ServerConstants.HDR_OSLC_VERSION, ServerConstants.OSLC_VERSION_V2).build(); - else - throw new WebApplicationException(Status.INTERNAL_SERVER_ERROR); - } - throw new WebApplicationException(Status.NOT_FOUND); - } - - @PUT - @Path("Requirement/{serviceProviderId}/{resourceId}") - @Consumes({OslcMediaType.APPLICATION_RDF_XML, OslcMediaType.APPLICATION_JSON_LD, OslcMediaType.TEXT_TURTLE, OslcMediaType.APPLICATION_XML, OslcMediaType.APPLICATION_JSON }) - @Operation( - summary = "PUT for resources of type {'" + Oslc_rmDomainConstants.REQUIREMENT_LOCALNAME + "'}", - description = "PUT for resources of type {'" + "" + Oslc_rmDomainConstants.REQUIREMENT_LOCALNAME + "" + "'}" + - ", with respective resource shapes {'" + "" + Oslc_rmDomainConstants.REQUIREMENT_LOCALNAME + "" + "'}", - 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 updateRequirement( - @HeaderParam("If-Match") final String eTagHeader, - @PathParam("serviceProviderId") final String serviceProviderId, @PathParam("resourceId") final String resourceId , - final Requirement aResource - ) throws IOException, ServletException - { + // End of user code + boolean deleted = delegate.deleteRequirementCollection(httpServletRequest, serviceProviderId, resourceId); + if (deleted) + return Response.ok().header(ServerConstants.HDR_OSLC_VERSION, ServerConstants.OSLC_VERSION_V2).build(); + else + throw new WebApplicationException(Status.INTERNAL_SERVER_ERROR); + } + throw new WebApplicationException(Status.NOT_FOUND); + } + + @PUT + @Path("Requirement/{serviceProviderId}/{resourceId}") + @Consumes({OslcMediaType.APPLICATION_RDF_XML, OslcMediaType.APPLICATION_JSON_LD, OslcMediaType.TEXT_TURTLE, OslcMediaType.APPLICATION_XML, OslcMediaType.APPLICATION_JSON }) + @Operation( + summary = "PUT for resources of type {'" + Oslc_rmDomainConstants.REQUIREMENT_LOCALNAME + "'}", + description = "PUT for resources of type {'" + "" + Oslc_rmDomainConstants.REQUIREMENT_LOCALNAME + "" + "'}" + + ", with respective resource shapes {'" + "" + Oslc_rmDomainConstants.REQUIREMENT_LOCALNAME + "" + "'}", + 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 updateRequirement( + @HeaderParam("If-Match") final String eTagHeader, + @PathParam("serviceProviderId") final String serviceProviderId, @PathParam("resourceId") final String resourceId , + final Requirement aResource + ) throws IOException, ServletException + { // Start of user code updateRequirement_init - // End of user code - final Requirement originalResource = delegate.getRequirement(httpServletRequest, serviceProviderId, resourceId); - - if (originalResource != null) { - final String originalETag = delegate.getETagFromRequirement(originalResource); - - if ((eTagHeader == null) || (originalETag.equals(eTagHeader))) { + // End of user code + final Requirement originalResource = delegate.getRequirement(httpServletRequest, serviceProviderId, resourceId); + + if (originalResource != null) { + final String originalETag = delegate.getETagFromRequirement(originalResource); + + if ((eTagHeader == null) || (originalETag.equals(eTagHeader))) { // Start of user code updateRequirement - // End of user code - final Requirement updatedResource = delegate.updateRequirement(httpServletRequest, aResource, serviceProviderId, resourceId); - httpServletResponse.setHeader("ETag", delegate.getETagFromRequirement(updatedResource)); - return Response.ok().header(ServerConstants.HDR_OSLC_VERSION, ServerConstants.OSLC_VERSION_V2).build(); - } - else { - throw new WebApplicationException(Status.PRECONDITION_FAILED); - } - } - else { - throw new WebApplicationException(Status.NOT_FOUND); - } - } - - @PUT - @Path("RequirementCollection/{serviceProviderId}/{resourceId}") - @Consumes({OslcMediaType.APPLICATION_RDF_XML, OslcMediaType.APPLICATION_JSON_LD, OslcMediaType.TEXT_TURTLE, OslcMediaType.APPLICATION_XML, OslcMediaType.APPLICATION_JSON }) - @Operation( - summary = "PUT for resources of type {'" + Oslc_rmDomainConstants.REQUIREMENTCOLLECTION_LOCALNAME + "'}", - description = "PUT for resources of type {'" + "" + Oslc_rmDomainConstants.REQUIREMENTCOLLECTION_LOCALNAME + "" + "'}" + - ", with respective resource shapes {'" + "" + Oslc_rmDomainConstants.REQUIREMENTCOLLECTION_LOCALNAME + "" + "'}", - 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 updateRequirementCollection( - @HeaderParam("If-Match") final String eTagHeader, - @PathParam("serviceProviderId") final String serviceProviderId, @PathParam("resourceId") final String resourceId , - final RequirementCollection aResource - ) throws IOException, ServletException - { + // End of user code + final Requirement updatedResource = delegate.updateRequirement(httpServletRequest, aResource, serviceProviderId, resourceId); + httpServletResponse.setHeader("ETag", delegate.getETagFromRequirement(updatedResource)); + return Response.ok().header(ServerConstants.HDR_OSLC_VERSION, ServerConstants.OSLC_VERSION_V2).build(); + } + else { + throw new WebApplicationException(Status.PRECONDITION_FAILED); + } + } + else { + throw new WebApplicationException(Status.NOT_FOUND); + } + } + + @PUT + @Path("RequirementCollection/{serviceProviderId}/{resourceId}") + @Consumes({OslcMediaType.APPLICATION_RDF_XML, OslcMediaType.APPLICATION_JSON_LD, OslcMediaType.TEXT_TURTLE, OslcMediaType.APPLICATION_XML, OslcMediaType.APPLICATION_JSON }) + @Operation( + summary = "PUT for resources of type {'" + Oslc_rmDomainConstants.REQUIREMENTCOLLECTION_LOCALNAME + "'}", + description = "PUT for resources of type {'" + "" + Oslc_rmDomainConstants.REQUIREMENTCOLLECTION_LOCALNAME + "" + "'}" + + ", with respective resource shapes {'" + "" + Oslc_rmDomainConstants.REQUIREMENTCOLLECTION_LOCALNAME + "" + "'}", + 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 updateRequirementCollection( + @HeaderParam("If-Match") final String eTagHeader, + @PathParam("serviceProviderId") final String serviceProviderId, @PathParam("resourceId") final String resourceId , + final RequirementCollection aResource + ) throws IOException, ServletException + { // Start of user code updateRequirementCollection_init - // End of user code - final RequirementCollection originalResource = delegate.getRequirementCollection(httpServletRequest, serviceProviderId, resourceId); - - if (originalResource != null) { - final String originalETag = delegate.getETagFromRequirementCollection(originalResource); - - if ((eTagHeader == null) || (originalETag.equals(eTagHeader))) { + // End of user code + final RequirementCollection originalResource = delegate.getRequirementCollection(httpServletRequest, serviceProviderId, resourceId); + + if (originalResource != null) { + final String originalETag = delegate.getETagFromRequirementCollection(originalResource); + + if ((eTagHeader == null) || (originalETag.equals(eTagHeader))) { // Start of user code updateRequirementCollection - // End of user code - final RequirementCollection updatedResource = delegate.updateRequirementCollection(httpServletRequest, aResource, serviceProviderId, resourceId); - httpServletResponse.setHeader("ETag", delegate.getETagFromRequirementCollection(updatedResource)); - return Response.ok().header(ServerConstants.HDR_OSLC_VERSION, ServerConstants.OSLC_VERSION_V2).build(); - } - else { - throw new WebApplicationException(Status.PRECONDITION_FAILED); - } - } - else { - throw new WebApplicationException(Status.NOT_FOUND); - } - } - -} + // End of user code + final RequirementCollection updatedResource = delegate.updateRequirementCollection(httpServletRequest, aResource, serviceProviderId, resourceId); + httpServletResponse.setHeader("ETag", delegate.getETagFromRequirementCollection(updatedResource)); + return Response.ok().header(ServerConstants.HDR_OSLC_VERSION, ServerConstants.OSLC_VERSION_V2).build(); + } + else { + throw new WebApplicationException(Status.PRECONDITION_FAILED); + } + } + else { + throw new WebApplicationException(Status.NOT_FOUND); + } + } + +} diff --git a/src/server-rm/src/main/java/co/oslc/refimpl/rm/gen/servlet/Application.java b/src/server-rm/src/main/java/co/oslc/refimpl/rm/gen/servlet/Application.java index f55bc5c6..7182cadb 100644 --- a/src/server-rm/src/main/java/co/oslc/refimpl/rm/gen/servlet/Application.java +++ b/src/server-rm/src/main/java/co/oslc/refimpl/rm/gen/servlet/Application.java @@ -32,8 +32,6 @@ import java.util.Set; import jakarta.inject.Inject; -import org.glassfish.hk2.api.ServiceLocator; -import org.glassfish.hk2.utilities.ServiceLocatorUtilities; import org.eclipse.lyo.oslc4j.core.exception.OslcCoreApplicationException; import org.eclipse.lyo.oslc4j.core.model.AllowedValues; @@ -57,8 +55,6 @@ 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; @@ -89,7 +85,7 @@ * Generated by Lyo Designer 7.0.0.qualifier */ -@OpenAPIDefinition(info = @Info(title = "RM", version = "1.0.0"), servers = @Server(url = "/services/")) +@OpenAPIDefinition(info = @Info(title = "RM", version = "1.0.0"), servers = @Server(url = "/")) public class Application extends jakarta.ws.rs.core.Application { private static final Set> RESOURCE_CLASSES = new HashSet>(); @@ -103,7 +99,7 @@ public class Application extends jakarta.ws.rs.core.Application { @Override public Set getSingletons() { - return Collections.singleton(new ApplicationBinder()); + return Collections.emptySet(); } static { @@ -112,7 +108,7 @@ public Set getSingletons() { RESOURCE_CLASSES.addAll(Json4JProvidersRegistry.getProviders()); // CORS support - RESOURCE_CLASSES.add(co.oslc.refimpl.rm.gen.servlet.CorsFilter.class); + // RESOURCE_CLASSES.add(co.oslc.refimpl.rm.gen.servlet.CorsFilter.class); RESOURCE_CLASSES.add(RequirementsService.class); RESOURCE_CLASSES.add(Requirement_collectionsService.class); @@ -124,8 +120,8 @@ public Set getSingletons() { RESOURCE_CLASSES.add(ResourceShapeService.class); // Swagger resources - RESOURCE_CLASSES.add(OpenApiResource.class); - RESOURCE_CLASSES.add(AcceptHeaderOpenApiResource.class); + // RESOURCE_CLASSES.add(OpenApiResource.class); + // RESOURCE_CLASSES.add(AcceptHeaderOpenApiResource.class); // OAuth resources RESOURCE_CLASSES.add(RootServicesService.class); @@ -138,6 +134,7 @@ public Set getSingletons() { } // Start of user code Custom Resource Classes + RESOURCE_CLASSES.add(co.oslc.refimpl.rm.gen.servlet.HomePageResource.class); // End of user code RESOURCE_SHAPE_PATH_TO_RESOURCE_CLASS_MAP.put(OslcConstants.PATH_ALLOWED_VALUES, AllowedValues.class); @@ -162,12 +159,10 @@ public Set getSingletons() { RESOURCE_SHAPE_PATH_TO_RESOURCE_CLASS_MAP.put(Oslc_rmDomainConstants.REQUIREMENTCOLLECTION_PATH, RequirementCollection.class); } - @Inject - public Application(ServiceLocator locator) + public Application() throws OslcCoreApplicationException, URISyntaxException { - ServiceLocatorUtilities.enableImmediateScope(locator); final String BASE_URI = "http://localhost/validatingResourceShapes"; for (final Map.Entry> entry : RESOURCE_SHAPE_PATH_TO_RESOURCE_CLASS_MAP.entrySet()) { ResourceShapeFactory.createResourceShape(BASE_URI, OslcConstants.PATH_RESOURCE_SHAPES, entry.getKey(), entry.getValue()); diff --git a/src/server-rm/src/main/java/co/oslc/refimpl/rm/gen/servlet/ApplicationBinder.java b/src/server-rm/src/main/java/co/oslc/refimpl/rm/gen/servlet/ApplicationBinder.java deleted file mode 100644 index 3e59f9b1..00000000 --- a/src/server-rm/src/main/java/co/oslc/refimpl/rm/gen/servlet/ApplicationBinder.java +++ /dev/null @@ -1,119 +0,0 @@ -// 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.rm.gen.servlet; - -// spotless:off -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.glassfish.hk2.api.Factory; -import org.glassfish.hk2.utilities.binding.AbstractBinder; - -import jakarta.inject.Inject; -import jakarta.inject.Singleton; -import jakarta.ws.rs.core.UriBuilder; -import jakarta.servlet.ServletContext; - -import co.oslc.refimpl.rm.gen.RestDelegate; -import co.oslc.refimpl.rm.gen.ResourcesFactory; -import static co.oslc.refimpl.rm.gen.servlet.ServletListener.getConfigurationProperty; -import static co.oslc.refimpl.rm.gen.servlet.ServletListener.getServletUrlPattern; -import java.util.Set; - -import org.eclipse.lyo.oslc4j.core.OSLC4JUtils; -// Start of user code imports -// End of user code -// spotless:on - -// 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"); - - // Start of user code ConfigureInitialise - // End of user code - bindFactory(LyoAppConfigurationFactory.class) - .to(LyoAppConfiguration.class); - bindAsContract(RestDelegate.class).in(Singleton.class); - bindFactory(ResourcesFactoryFactory.class).to(ResourcesFactory.class).in(Singleton.class); - - - - // Start of user code ConfigureFinalize - // End of user code - } - static class ResourcesFactoryFactory implements Factory { - @Override - public ResourcesFactory provide() { - return new ResourcesFactory(OSLC4JUtils.getServletURI()); - } - - @Override - public void dispose(ResourcesFactory instance) { - } - } - public static class LyoAppConfigurationFactory implements Factory { - private static final Logger logger = LoggerFactory.getLogger(LyoAppConfigurationFactory.class); - - private final LyoAppConfiguration instance; - - @Inject - public LyoAppConfigurationFactory(ServletContext context) { - String corsFriendsString = getConfigurationProperty("cors.friends", "", context, ServletListener.class); - Set corsFriends; - if (corsFriendsString == null || corsFriendsString.isEmpty()) { - corsFriends = Set.of(); - } else { - corsFriends = java.util.Arrays.stream(corsFriendsString.split(";")) - .map(String::trim) - .filter(s -> !s.isEmpty()) - .collect(java.util.stream.Collectors.toSet()); - } - this.instance = new LyoAppConfiguration(OSLC4JUtils.getPublicURI(), OSLC4JUtils.getServletPath(), corsFriends); - } - - @Override - public LyoAppConfiguration provide() { - return instance; - } - - @Override - public void dispose(LyoAppConfiguration instance) { - // Noop - } - } - - -} diff --git a/src/server-rm/src/main/java/co/oslc/refimpl/rm/gen/servlet/CorsFilter.java b/src/server-rm/src/main/java/co/oslc/refimpl/rm/gen/servlet/CorsFilter.java index 90c4bc9f..b3641793 100644 --- a/src/server-rm/src/main/java/co/oslc/refimpl/rm/gen/servlet/CorsFilter.java +++ b/src/server-rm/src/main/java/co/oslc/refimpl/rm/gen/servlet/CorsFilter.java @@ -24,6 +24,7 @@ import jakarta.ws.rs.container.ContainerRequestContext; import jakarta.ws.rs.container.ContainerResponseContext; import jakarta.ws.rs.container.ContainerResponseFilter; +import jakarta.ws.rs.ext.Provider; import org.slf4j.Logger; import org.slf4j.LoggerFactory; // Start of user code imports @@ -33,6 +34,7 @@ // Start of user code pre_class_code // End of user code +@Provider public class CorsFilter implements ContainerResponseFilter { private final static Logger log = LoggerFactory.getLogger(CorsFilter.class); diff --git a/src/server-rm/src/main/java/co/oslc/refimpl/rm/gen/servlet/CredentialsFilter.java b/src/server-rm/src/main/java/co/oslc/refimpl/rm/gen/servlet/CredentialsFilter.java index 01f3adf4..dac7f5fe 100644 --- a/src/server-rm/src/main/java/co/oslc/refimpl/rm/gen/servlet/CredentialsFilter.java +++ b/src/server-rm/src/main/java/co/oslc/refimpl/rm/gen/servlet/CredentialsFilter.java @@ -34,11 +34,11 @@ import jakarta.servlet.ServletResponse; import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; -import net.oauth.OAuth; -import net.oauth.OAuthException; -import net.oauth.OAuthMessage; -import net.oauth.OAuthProblemException; -import net.oauth.server.OAuthServlet; +// import net.oauth.OAuth; +// import net.oauth.OAuthException; +// import net.oauth.OAuthMessage; +// import net.oauth.OAuthProblemException; +// import net.oauth.server.OAuthServlet; import org.eclipse.lyo.server.oauth.consumerstore.FileSystemConsumerStore; import org.eclipse.lyo.server.oauth.core.OAuthConfiguration; @@ -54,6 +54,7 @@ // Start of user code pre_class_code // End of user code +@jakarta.servlet.annotation.WebFilter(urlPatterns = "/*", filterName = "CredentialsFilter") public class CredentialsFilter implements Filter { private final static Logger log = LoggerFactory.getLogger(CredentialsFilter.class); @@ -80,11 +81,15 @@ private boolean isProtectedResource(HttpServletRequest httpRequest) { } String pathInfo = httpRequest.getPathInfo(); + String requestURI = httpRequest.getRequestURI(); //'protectedResource' defines the basic set of requests that needs to be protected. //You can override this defintion in the user protected code block below. - // Do not protect OSLC resources needed for initial discovery - boolean protectedResource = !pathInfo.startsWith("/rootservices") && !pathInfo.startsWith("/oauth"); + // Do not protect the home page, OSLC resources needed for initial discovery, or static resources + if (pathInfo == null || "/".equals(requestURI) || requestURI.endsWith("/")) { + return false; // Home page is not protected + } + boolean protectedResource = !pathInfo.startsWith("/rootservices") && !pathInfo.startsWith("/oauth") && !pathInfo.startsWith("/static"); // Do not protect CORS preflight requests if (protectedResource) { String method = httpRequest.getMethod(); @@ -121,70 +126,46 @@ public void doFilter(ServletRequest servletRequest, ServletResponse servletRespo // Start of user code doFilter_protectedResource_init // End of user code - //Check if this is an OAuth1 request. - //String clientRequestURL = UriBuilder.fromUri(OSLC4JUtils.getServletURI()).path(request.getPathInfo()).build().toString(); - OAuthMessage message = OAuthServlet.getMessage(request, null); - // Start of user code checkOauth1_Init + // OAuth 1.0a support is currently disabled in Quarkus migration due to incompatibility with Undertow request handling. + // The OAuth library (net.oauth) tends to consume/wrap requests in a way that triggers UT010023 errors. + // Focusing on Basic Auth support for now. + + // This is not an OAuth request, so check for authentication in the session + // Start of user code checkSession_Init + // End of user code + log.trace(request.getPathInfo() + " - checking for authentication in the session"); + String applicationConnector = authenticationApplication.getApplicationConnectorFromSession(request); + if (null != applicationConnector) { + log.trace(request.getPathInfo() + " - session authentication done"); + // Start of user code checkSession_Final + // End of user code + } else { + // Start of user code basicAuth_Init // End of user code - log.trace(request.getPathInfo() + " - checking for oauth1 authentication"); - if (message.getToken() != null) { - log.trace(request.getPathInfo() + " - Found an oauth1 token. Validating it."); + log.trace(request.getPathInfo() + " - checking for basic authentication"); + // Start of user code basicAuth_nullConnector + // End of user code try { - OAuthRequest oAuthRequest = new OAuthRequest(request); - oAuthRequest.validate(); - String applicationConnector = authenticationApplication.getApplicationConnector(message.getToken()); - if (applicationConnector == null) { - // Start of user code checkOauth1_applicationConnectorNull + //Check for basic authentication + Optional basicAuthenticationFromRequest = authenticationApplication.getBasicAuthenticationFromRequest(request); + if (basicAuthenticationFromRequest.isEmpty()) { + log.trace(request.getPathInfo() + " - no authentication identified. Throwing an exception"); + throw new AuthenticationException("No or invalid basic authentication header identified in request."); + } else { + log.trace(request.getPathInfo() + " - basic authentication done"); + // Start of user code basicAuth_Final // End of user code - log.trace(request.getPathInfo() + " - oauth1 authentication not valid. Raising an exception TOKEN_REJECTED"); - throw new OAuthProblemException(OAuth.Problems.TOKEN_REJECTED); } - log.trace(request.getPathInfo() + " - oauth1 authentication is valid. Done."); - authenticationApplication.bindApplicationConnectorToSession(request, applicationConnector); - } catch (OAuthException e) { - // Start of user code checkOauth1_exception + } catch (AuthenticationException e) { + // Start of user code basicAuth_authenticationException // End of user code - OAuthServlet.handleException(response, e, authenticationApplication.getRealm(request)); + authenticationApplication.sendUnauthorizedResponse(request, response, e); return; } - } - else { - // This is not an OAuth request, so check for authentication in the session - // Start of user code checkSession_Init - // End of user code - log.trace(request.getPathInfo() + " - checking for authentication in the session"); - String applicationConnector = authenticationApplication.getApplicationConnectorFromSession(request); - if (null != applicationConnector) { - log.trace(request.getPathInfo() + " - session authentication done"); - // Start of user code checkSession_Final - // End of user code - } else { - // Start of user code basicAuth_Init - // End of user code - log.trace(request.getPathInfo() + " - checking for basic authentication"); - // Start of user code basicAuth_nullConnector - // End of user code - try { - //Check for basic authentication - Optional basicAuthenticationFromRequest = authenticationApplication.getBasicAuthenticationFromRequest(request); - if (basicAuthenticationFromRequest.isEmpty()) { - log.trace(request.getPathInfo() + " - no authentication identified. Throwing an exception"); - throw new AuthenticationException("No or invalid basic authentication header identified in request."); - } else { - log.trace(request.getPathInfo() + " - basic authentication done"); - // Start of user code basicAuth_Final - // End of user code - } - } catch (AuthenticationException e) { - // Start of user code basicAuth_authenticationException - // End of user code - authenticationApplication.sendUnauthorizedResponse(request, response, e); - return; - } - } - // Start of user code basicAuth_final - // End of user code } + // Start of user code basicAuth_final + // End of user code + // Start of user code doFilter_protectedResource_final // End of user code } else { @@ -206,38 +187,6 @@ public void init(FilterConfig arg0) throws ServletException { // Start of user code init // End of user code - /* - * Override some SimpleTokenStrategy methods so that we can keep the - * BugzillaConnection associated with the OAuth tokens. - */ - config.setTokenStrategy(new SimpleTokenStrategy() { - @Override - public void markRequestTokenAuthorized(HttpServletRequest httpRequest, String requestToken) - throws OAuthProblemException { - // Start of user code markRequestTokenAuthorized_init - // End of user code - authenticationApplication.putApplicationConnector(requestToken, authenticationApplication.getApplicationConnectorFromSession(httpRequest)); - // Start of user code markRequestTokenAuthorized_mid - // End of user code - super.markRequestTokenAuthorized(httpRequest, requestToken); - // Start of user code markRequestTokenAuthorized_final - // End of user code - } - - @Override - public void generateAccessToken(OAuthRequest oAuthRequest) throws OAuthProblemException, IOException { - // Start of user code generateAccessToken_init - // End of user code - String requestToken = oAuthRequest.getMessage().getToken(); - // Start of user code generateAccessToken_mid - // End of user code - super.generateAccessToken(oAuthRequest); - authenticationApplication.moveApplicationConnector(requestToken, oAuthRequest.getAccessor().accessToken); - // Start of user code generateAccessToken_final - // End of user code - } - }); - try { // For now, hard-code the consumers. config.setConsumerStore(new FileSystemConsumerStore(authenticationApplication.getOslcConsumerStoreFilename())); diff --git a/src/server-rm/src/main/java/co/oslc/refimpl/rm/gen/servlet/HomePageResource.java b/src/server-rm/src/main/java/co/oslc/refimpl/rm/gen/servlet/HomePageResource.java new file mode 100644 index 00000000..bc777721 --- /dev/null +++ b/src/server-rm/src/main/java/co/oslc/refimpl/rm/gen/servlet/HomePageResource.java @@ -0,0 +1,47 @@ +package co.oslc.refimpl.rm.gen.servlet; + +import io.quarkus.qute.Template; +import io.quarkus.qute.TemplateInstance; +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.inject.Inject; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.core.Context; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.UriInfo; +import org.eclipse.lyo.oslc4j.core.OSLC4JUtils; +import org.eclipse.microprofile.config.inject.ConfigProperty; + +/** + * Home page resource for the RM OSLC Adaptor. + * Serves the main index page using Qute template. + */ +@ApplicationScoped +@Path("/") +public class HomePageResource { + + @Inject + Template index; + + @Context + UriInfo uriInfo; + + @ConfigProperty(name = "app.version", defaultValue = "N/A") + String projectVersion; + + @ConfigProperty(name = "app.lyo.version", defaultValue = "N/A") + String lyoVersion; + + @ConfigProperty(name = "app.quarkus.version", defaultValue = "N/A") + String quarkusVersion; + + @GET + @Produces(MediaType.TEXT_HTML) + public TemplateInstance get() { + return index + .data("projectVersion", projectVersion) + .data("lyoVersion", lyoVersion) + .data("quarkusVersion", quarkusVersion); + } +} diff --git a/src/server-rm/src/main/java/co/oslc/refimpl/rm/gen/servlet/HomeResource.java b/src/server-rm/src/main/java/co/oslc/refimpl/rm/gen/servlet/HomeResource.java new file mode 100644 index 00000000..92b6b35e --- /dev/null +++ b/src/server-rm/src/main/java/co/oslc/refimpl/rm/gen/servlet/HomeResource.java @@ -0,0 +1,24 @@ +package co.oslc.refimpl.rm.gen.servlet; + +import io.quarkus.qute.Template; +import io.quarkus.qute.TemplateInstance; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.core.MediaType; +import org.eclipse.lyo.oslc4j.core.OSLC4JUtils; + +import jakarta.inject.Inject; + +@Path("/") +public class HomeResource { + + @Inject + Template index; + + @GET + @Produces(MediaType.TEXT_HTML) + public TemplateInstance get() { + return index.data("servletURI", OSLC4JUtils.getServletURI()); + } +} diff --git a/src/server-rm/src/main/java/co/oslc/refimpl/rm/gen/servlet/QuarkusLifecycle.java b/src/server-rm/src/main/java/co/oslc/refimpl/rm/gen/servlet/QuarkusLifecycle.java new file mode 100644 index 00000000..6fa844a1 --- /dev/null +++ b/src/server-rm/src/main/java/co/oslc/refimpl/rm/gen/servlet/QuarkusLifecycle.java @@ -0,0 +1,41 @@ +package co.oslc.refimpl.rm.gen.servlet; + +import io.quarkus.runtime.StartupEvent; +import jakarta.enterprise.event.Observes; +import jakarta.inject.Inject; +import jakarta.inject.Singleton; +import org.eclipse.lyo.oslc4j.core.OSLC4JUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.apache.jena.sys.JenaSystem; + +import java.net.MalformedURLException; + +@Singleton +public class QuarkusLifecycle { + private static final Logger logger = LoggerFactory.getLogger(QuarkusLifecycle.class); + + @Inject + LyoAppConfiguration config; + + void onStart(@Observes StartupEvent ev) { + logger.info("Initializing QuarkusLifecycle..."); + + JenaSystem.init(); + OSLC4JUtils.setLyoStorePagingPreciseLimit(false); + + String baseUrl = config.baseUrl(); + String servletUrlPattern = config.servletPath(); + + try { + logger.info("Setting public URI: " + baseUrl); + OSLC4JUtils.setPublicURI(baseUrl); + logger.info("Setting servlet path: " + servletUrlPattern); + OSLC4JUtils.setServletPath(servletUrlPattern); + } catch (MalformedURLException e) { + logger.error("QuarkusLifecycle encountered MalformedURLException.", e); + } catch (IllegalArgumentException e) { + logger.error("QuarkusLifecycle encountered IllegalArgumentException.", e); + } + } +} diff --git a/src/server-rm/src/main/java/co/oslc/refimpl/rm/gen/servlet/RefImplProducers.java b/src/server-rm/src/main/java/co/oslc/refimpl/rm/gen/servlet/RefImplProducers.java new file mode 100644 index 00000000..fea2dfe0 --- /dev/null +++ b/src/server-rm/src/main/java/co/oslc/refimpl/rm/gen/servlet/RefImplProducers.java @@ -0,0 +1,45 @@ +package co.oslc.refimpl.rm.gen.servlet; + +import co.oslc.refimpl.rm.gen.ResourcesFactory; +import co.oslc.refimpl.rm.gen.RestDelegate; +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.enterprise.inject.Produces; +import jakarta.inject.Singleton; +import org.eclipse.lyo.oslc4j.core.OSLC4JUtils; +import org.eclipse.microprofile.config.inject.ConfigProperty; + +import java.util.Arrays; +import java.util.Collections; +import java.util.Set; +import java.util.stream.Collectors; + +@ApplicationScoped +public class RefImplProducers { + + @ConfigProperty(name = "co.oslc.refimpl.rm.gen.servlet.baseurl", defaultValue = "http://localhost:8800/") + String baseUrl; + + @ConfigProperty(name = "co.oslc.refimpl.rm.gen.servlet.cors.friends", defaultValue = "*") + String corsFriends; + + @Produces + @Singleton + public LyoAppConfiguration produceConfiguration() { + Set friends; + if (corsFriends == null || corsFriends.isEmpty()) { + friends = Collections.emptySet(); + } else { + friends = Arrays.stream(corsFriends.split(";")) + .map(String::trim) + .filter(s -> !s.isEmpty()) + .collect(Collectors.toSet()); + } + return new LyoAppConfiguration(baseUrl, "services", friends); + } + + @Produces + @Singleton + public ResourcesFactory produceResourcesFactory() { + return new ResourcesFactory(OSLC4JUtils.getServletURI()); + } +} diff --git a/src/server-rm/src/main/java/co/oslc/refimpl/rm/gen/servlet/ServletListener.java b/src/server-rm/src/main/java/co/oslc/refimpl/rm/gen/servlet/ServletListener.java deleted file mode 100644 index 80864dd3..00000000 --- a/src/server-rm/src/main/java/co/oslc/refimpl/rm/gen/servlet/ServletListener.java +++ /dev/null @@ -1,219 +0,0 @@ -// Start of user code Copyright -/******************************************************************************* - * 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 - * 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) - * Andrii Berezovskyi - change URL configuration logic (Bug 509767) - * - * This file is generated by org.eclipse.lyo.oslc4j.codegenerator - *******************************************************************************/ -// End of user code - -package co.oslc.refimpl.rm.gen.servlet; - -// spotless:off -import java.net.MalformedURLException; -import java.util.NoSuchElementException; -import java.util.Locale; -import java.util.Map; -import java.util.Optional; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import jakarta.servlet.ServletContext; -import jakarta.servlet.ServletContextEvent; -import jakarta.servlet.ServletContextListener; -import jakarta.servlet.ServletRegistration; -import jakarta.ws.rs.core.UriBuilder; - -import org.eclipse.lyo.oslc4j.core.OSLC4JUtils; -import co.oslc.refimpl.rm.gen.RestDelegate; - -// Start of user code imports -import org.apache.jena.sys.JenaSystem; -// End of user code -// spotless:on - -/** - * During the initialization of this ServletListener, the base URI for the OSLC resources produced by this server is configured through the OSLC4J method setPublicURI(). - *

- * 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); - - // Start of user code class_attributes - // End of user code - - public ServletListener() { - super(); - } - - @Override - public void contextInitialized(final ServletContextEvent servletContextEvent) - { - //These are fallback defaults. We recommend you do not modify them. Instead, set the 'baseurl' property. - String basePathKey = "baseurl"; - String fallbackBase = "http://localhost:8080"; - String servletName = "JAX-RS Servlet"; - - logger.info(""" - \n - :::::::::: :::::::: ::: ::::::::::: ::::::::: :::::::: :::::::::: ::: ::: ::: ::::::::\s - :+: :+: :+: :+: :+: :+: :+: :+: :+: :+: :+: :+: :+: :+: :+:\s - +:+ +:+ +:+ +:+ +:+ +:+ +:+ +:+ +:+ +:+ +:+ +:+ +:+ \s - +#++:++# +#+ +#+ +#+ +#++:++#+ +#++:++#++ +#++:++# +#+ +#++: +#+ +:+ \s - +#+ +#+ +#+ +#+ +#+ +#+ +#+ +#+ +#+ +#+ +#+ \s - #+# #+# #+# #+# #+# #+# #+# #+# #+# #+# #+# #+# #+# \s - ########## ######## ######### ########## ### ######## ########## ########## ### ######## \s - """); - - // Start of user code contextInitialized_init - JenaSystem.init(); - OSLC4JUtils.setLyoStorePagingPreciseLimit(false); - // End of user code - - 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(servletContext, servletName); - } catch (Exception e1) { - logger.error("servletListener encountered problems identifying the servlet URL pattern.", e1); - } - try { - logger.info("Setting public URI: " + baseUrl); - OSLC4JUtils.setPublicURI(baseUrl); - logger.info("Setting servlet path: " + servletUrlPattern); - OSLC4JUtils.setServletPath(servletUrlPattern); - } catch (MalformedURLException e) { - logger.error("servletListener encountered MalformedURLException.", e); - } catch (IllegalArgumentException e) { - logger.error("servletListener encountered IllegalArgumentException.", e); - } - - logger.info("servletListner contextInitialized."); - - // Start of user code contextInitialized_mid - // TODO Implement code to establish connection to data backbone etc ... - // End of user code - - // Start of user code contextInitialized_final - // End of user code - } - - @Override - public void contextDestroyed(ServletContextEvent servletContextEvent) - { - // Start of user code contextDestroyed_init - // End of user code - - } - - // Start of user code class_methods - private static Optional getBasePathFromSystemProperties(String basePathContextPropertyKey) { - String base = System.getProperty(basePathContextPropertyKey); - if (base == null || base.trim().isEmpty()) { - return Optional.empty(); - } - return Optional.of(base); - } - // End of user code - - /** - * 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) - */ - public 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 getConfigurationPropertyFromEnvironment(String basePathEnvKey) { - final Map env = System.getenv(); - if (!env.containsKey(basePathEnvKey)) { - logger.debug("ENV variable '{}' not defined", basePathEnvKey); - return Optional.empty(); - } - logger.info("Found {} env variable", basePathEnvKey); - return Optional.of(env.get(basePathEnvKey)); - } - - 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(); - } - 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); - } - - static String getServletUrlPattern(final ServletContext servletContext, String servletName) throws Exception { - ServletRegistration servletRegistration = servletContext.getServletRegistration(servletName); - if (servletRegistration == null) { - throw new NoSuchElementException("no servlet with name \"" + servletName + "\" is found."); - } - java.util.Collection mappings = servletRegistration.getMappings(); - if (mappings.size() != 1) { - throw new NoSuchElementException("unable to identify servlet mappings for servlet with name \"" + servletName + "\"."); - } - String mapping = (String) mappings.toArray()[0]; - - //url patterns in most cases end with '\*'. But a url-pattern with just '\' may be found for exact matches. - if (mapping.endsWith("*")) - mapping = mapping.substring(0, mapping.length()-1); - return mapping; - } -} - diff --git a/src/server-rm/src/main/java/co/oslc/refimpl/rm/gen/util/ServletUtil.java b/src/server-rm/src/main/java/co/oslc/refimpl/rm/gen/util/ServletUtil.java new file mode 100644 index 00000000..a5e0aae0 --- /dev/null +++ b/src/server-rm/src/main/java/co/oslc/refimpl/rm/gen/util/ServletUtil.java @@ -0,0 +1,30 @@ +package co.oslc.refimpl.rm.gen.util; + +import jakarta.servlet.ServletRequest; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletRequestWrapper; + +/** + * Utility methods for servlet handling, particularly for Undertow compatibility. + */ +public class ServletUtil { + + /** + * Unwrap the request to get the original HttpServletRequest. + * This is required for Undertow compatibility when forwarding requests. + * + * Undertow validates that requests passed to RequestDispatcher.forward() + * are either the original request or properly wrapped. JAX-RS injected + * requests may not meet these criteria, so we unwrap to the original. + * + * @param request the potentially wrapped request + * @return the original unwrapped HttpServletRequest + */ + public static HttpServletRequest unwrapRequest(HttpServletRequest request) { + ServletRequest current = request; + while (current instanceof HttpServletRequestWrapper) { + current = ((HttpServletRequestWrapper) current).getRequest(); + } + return (HttpServletRequest) current; + } +} diff --git a/src/server-rm/src/main/webapp/static/css/adaptor.css b/src/server-rm/src/main/resources/META-INF/resources/static/css/adaptor.css similarity index 100% rename from src/server-rm/src/main/webapp/static/css/adaptor.css rename to src/server-rm/src/main/resources/META-INF/resources/static/css/adaptor.css diff --git a/src/server-rm/src/main/webapp/static/js/delegated-ui-helper.js b/src/server-rm/src/main/resources/META-INF/resources/static/js/delegated-ui-helper.js similarity index 100% rename from src/server-rm/src/main/webapp/static/js/delegated-ui-helper.js rename to src/server-rm/src/main/resources/META-INF/resources/static/js/delegated-ui-helper.js diff --git a/src/server-rm/src/main/webapp/static/js/delegated-ui.js b/src/server-rm/src/main/resources/META-INF/resources/static/js/delegated-ui.js similarity index 100% rename from src/server-rm/src/main/webapp/static/js/delegated-ui.js rename to src/server-rm/src/main/resources/META-INF/resources/static/js/delegated-ui.js diff --git a/src/server-rm/src/main/webapp/static/js/ui-preview-helper.js b/src/server-rm/src/main/resources/META-INF/resources/static/js/ui-preview-helper.js similarity index 100% rename from src/server-rm/src/main/webapp/static/js/ui-preview-helper.js rename to src/server-rm/src/main/resources/META-INF/resources/static/js/ui-preview-helper.js diff --git a/src/server-rm/src/main/resources/application.properties b/src/server-rm/src/main/resources/application.properties new file mode 100644 index 00000000..b5b800a5 --- /dev/null +++ b/src/server-rm/src/main/resources/application.properties @@ -0,0 +1,16 @@ +co.oslc.refimpl.rm.gen.servlet.baseurl=http://localhost:8800/ +co.oslc.refimpl.rm.gen.servlet.cors.friends=* +quarkus.http.port=8800 +quarkus.http.root-path=/ +quarkus.resteasy.path=/ +# Allow all origins for CORS by default if needed, but we use custom CorsFilter +# quarkus.http.cors=true + +# Swagger UI configuration +quarkus.swagger-ui.always-include=true +quarkus.swagger-ui.path=/swagger-ui + +# Application version information +app.version=${project.version} +app.lyo.version=${version.lyo} +app.quarkus.version=${quarkus.platform.version} diff --git a/src/server-rm/src/main/resources/templates/index.html b/src/server-rm/src/main/resources/templates/index.html new file mode 100644 index 00000000..8a98cc99 --- /dev/null +++ b/src/server-rm/src/main/resources/templates/index.html @@ -0,0 +1,49 @@ + + + + + + + RM OSLC Adaptor Home + + + + + + + +
+
+

Requirements Management (RM) OSLC Adaptor

+

This is the homepage of the RM OSLC adaptor, + migrated to Quarkus framework.

+
+

+ Service Provider Catalog +

+

Start from the Service Provider Catalog to navigate the adaptor's services and resources. + Note: HTML representations have been replaced with Qute templates. + The catalog returns RDF/XML by default for programmatic access. +

+

+ Interactive Swagger UI +

+

Use Swagger UI to interact with the adaptor services.

+

You can also copy this OpenAPI specification document to a + Swagger Editor to generate client SDK code for various languages and + platforms. +

+

The OSLC Root Services document is available at /rootservices

+
+

OSLC Reference Implementation {projectVersion}. Powered by Eclipse Lyo {lyoVersion} + and Quarkus {quarkusVersion}

+
+
+ + + \ No newline at end of file diff --git a/src/server-rm/src/main/resources/templates/requirementSelector.html b/src/server-rm/src/main/resources/templates/requirementSelector.html new file mode 100644 index 00000000..2806aeca --- /dev/null +++ b/src/server-rm/src/main/resources/templates/requirementSelector.html @@ -0,0 +1,47 @@ + + + + + + + Requirement Selection Dialog + + + + +
+

Find a specific resource through a free-text search.

+ + + +
+ + +
+ +
+ +
+ +
+ + +
+
+
+ + + \ No newline at end of file diff --git a/src/server-rm/src/main/webapp/WEB-INF/web.xml b/src/server-rm/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index 1286b620..00000000 --- a/src/server-rm/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,75 +0,0 @@ - - - RM - - Base URI for the adaptor. - co.oslc.refimpl.rm.gen.servlet.baseurl - http://localhost:8800/ - - - - - - CORS friends - co.oslc.refimpl.rm.gen.servlet.cors.friends - - - - * - - - - - - - Listener for ServletContext lifecycle changes - co.oslc.refimpl.rm.gen.servlet.ServletListener - - - - - - JAX-RS Servlet - org.glassfish.jersey.servlet.ServletContainer - - jakarta.ws.rs.Application - co.oslc.refimpl.rm.gen.servlet.Application - - 1 - - - - - - JAX-RS Servlet - /services/* - - - CredentialsFilter - CredentialsFilter - co.oslc.refimpl.rm.gen.servlet.CredentialsFilter - - - CredentialsFilter - /services/* - - - - - - diff --git a/src/server-rm/src/main/webapp/index.jsp b/src/server-rm/src/main/webapp/index.jsp deleted file mode 100644 index 4fc8e5af..00000000 --- a/src/server-rm/src/main/webapp/index.jsp +++ /dev/null @@ -1,63 +0,0 @@ -<%--To avoid the overriding of any manual code changes upon subsequent code generations, disable "Generate JSP Files" option in the Adaptor model.--%> - -<%-- - Copyright (c) 2022 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/) ---%> - -<%@page import="org.eclipse.lyo.oslc4j.core.OSLC4JUtils"%> -<%@page import="jakarta.ws.rs.core.UriBuilder"%> -<%@page import="java.net.URI"%> - -<%@ page language="java" contentType="text/html; charset=UTF-8" - pageEncoding="UTF-8"%> -<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> - - - - - - Adaptor home - - - - - " rel="stylesheet"> - - -
-
-

<%= application.getServletContextName() %>

-

This is a homepage of the RM that was generated using - Eclipse Lyo Toolchain Designer.

-
-

- " role="button">Service Provider - Catalog -

-

Start from the Service Provider Catalog, to navigate your adaptor's services and resources, using the available Query capabilities, Selection and Creation Dialogs. - Note that these are end-user HTML pages, which is very useful for debugging your adaptor.

-

- " role="button">Interactive Swagger UI -

-

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. -

-

The OSLC Root Services document is available at <%= UriBuilder.fromUri(OSLC4JUtils.getServletURI()).path("/rootsevices").build() %>

-
-
- - diff --git a/src/server-rm/src/test/resources/application.properties b/src/server-rm/src/test/resources/application.properties new file mode 100644 index 00000000..9dd1f18e --- /dev/null +++ b/src/server-rm/src/test/resources/application.properties @@ -0,0 +1,3 @@ +# Application configuration +quarkus.http.port=8800 +co.oslc.refimpl.rm.gen.servlet.baseurl=http://localhost:8800/ diff --git a/src/server-rm/tomcat.Dockerfile b/src/server-rm/tomcat.Dockerfile deleted file mode 100644 index 431f8048..00000000 --- a/src/server-rm/tomcat.Dockerfile +++ /dev/null @@ -1,13 +0,0 @@ -FROM docker.io/library/maven:3-eclipse-temurin-21 AS build - -COPY . /src -WORKDIR /src -RUN mvn -B --no-transfer-progress -DskipTests clean package -pl server-rm -am -Pwith-jstl-impl - -FROM docker.io/library/tomcat:10-jre25 - -# do not write log files, log everything to the Docker daemon -COPY --from=build /src/server-rm/config/tomcat-log.properties $CATALINA_BASE/conf/logging.properties -ENV CATALINA_OUT=/dev/null - -COPY --from=build /src/server-rm/target/*.war /usr/local/tomcat/webapps/ROOT.war