Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generation to support migration to Jakarta #276

Merged
merged 7 commits into from
Apr 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Lyo Designer Changelog
# Eclipse Lyo Designer Changelog

## [Unreleased]

Expand All @@ -11,6 +11,8 @@


### Changed
- (**Breaking change**🧨) Migrated from Javax to Jakarta packages
- upgrade to Jersey 3.1.5
- generate the necessary maven dependencies for domain models that (a) are imported into the adaptor model yet (b) the adaptor is configured to not generate code from imported models. In such scenario, the maven dependency for the domain is necessary.
- `LYO_BASE` is replaced with `LYO_BASEURL`. To override the Base URL of the adaptor, use the `baseurl` property. This release makes the use of this property consistent and check the `LYO_BASEURL` environment variable instead of `LYO_BASE`.
- Upgraded the frontend libraries from Bootstrap v4.0.0-beta to v4.2.1.
Expand All @@ -26,6 +28,8 @@

### Removed

- (**Breaking change**🧨) Removed support for JDK 11 (and all versions below 17) in the generated code. **JDK 17 is the new baseline for Eclipse Lyo.** The SDK and sample code has been tested using JDK 17, 20, and 21-ea.
- (**Breaking change**🧨) Removed support for Java EE and Jakarta EE 8 in the generated code.
- The CSS and JS assets from Bootstrap are no longer bundled. The following files should be removed from the generated codebase:
- `src/main/webapp/static/css/bootstrap-4.0.0-beta.min.css`
- `src/main/webapp/static/js/bootstrap-4.0.0-beta.min.js`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ endif)
<maven.compiler.target>[javaVersion(mavenProjectConfiguration.lyoVersion)/]</maven.compiler.target>
<maven.compiler.release>[javaVersion(mavenProjectConfiguration.lyoVersion)/]</maven.compiler.release>
<version.lyo>[mavenProjectConfiguration.lyoVersion/]</version.lyo>
<jersey.version>2.35</jersey.version>
<jersey.version>3.1.5</jersey.version>
[if (swaggerDocumentationEnabled)]
<swagger.version>2.2.7</swagger.version>
<swagger.version>2.2.20</swagger.version>
<swagger-ui.version>3.52.5</swagger-ui.version>
[/if]
[if (serverImplementation)]
Expand Down Expand Up @@ -92,6 +92,42 @@ endif)
</repositories>
[/template]

[template public additionalProfiles(traceabilityContext : OclAny) post (trim())]
[/template]

[template private profiles(traceabilityContext : OclAny)]
<profiles>
<!-- [protected ('profiles')]
-->
<!-- TODO: Add additional profiles here to avoid them be overridden upon future re-generation -->
<!-- [/protected]
-->
<profile>
<!-- some servlet containers (Tomcat) does not ship with a JSTL impl
In such cases, run with this profile-->
<id>with-jstl-impl</id>
<dependencies>
<!-- [protected ('profile_dependencies')]
-->
<!-- TODO: Add additional dependencies to this profile here to avoid them be overridden upon future re-generation -->
<!-- [/protected]
-->
<dependency>
<groupId>jakarta.servlet.jsp.jstl</groupId>
<artifactId>jakarta.servlet.jsp.jstl-api</artifactId>
<version>3.0.0</version>
</dependency>
<dependency>
<groupId>org.glassfish.web</groupId>
<artifactId>jakarta.servlet.jsp.jstl</artifactId>
<version>3.0.1</version>
</dependency>
</dependencies>
</profile>
[additionalProfiles()/]
</profiles>
[/template]

[template private generalDependencies(traceabilityContext : OclAny)]
<!-- Specific dependencies -->
<!-- [protected ('dependencies')]
Expand All @@ -108,26 +144,28 @@ endif)
</dependency>
[/template]

[template private servletDependencies(serverImplementation : Boolean) post (trim())]
[template private servletDependencies(traceabilityContext : OclAny) post (trim())]
<!-- Servlet dependencies -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
<version>6.0.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>jakarta.servlet.jsp.jstl</groupId>
<artifactId>jakarta.servlet.jsp.jstl-api</artifactId>
<version>1.2.5</version>
<version>3.0.0</version>
<!--When running with the jetty-maven-plugin, you
get warnings about jsp classes being scanned from multiple locations.
adding the "provided" scope avoids these warnings.-->
<scope>provided</scope>
</dependency>
[if serverImplementation]
<dependency>
<groupId>org.glassfish.hk2.external</groupId>
<artifactId>jakarta.inject</artifactId>
<version>2.6.1</version>
</dependency>

<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-server</artifactId>
Expand Down Expand Up @@ -167,10 +205,9 @@ endif)
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
<version>4.0.2</version>
<version>4.0.5</version>
<scope>runtime</scope>
</dependency>
[/if]
[/template]

[template private lyoDependencies(serverImplementation : Boolean, clientImplementation : Boolean, authenticationEnabled : Boolean, trsServiceEnabled : Boolean, storeEnabled : Boolean) post (trim())]
Expand Down Expand Up @@ -277,21 +314,22 @@ If multiple DSs share the same maven dependency, we group them into 1.
[projectHeader(anAdaptorInterface.name, mavenProjectConfiguration, true)/]
[mavenProperties(mavenProjectConfiguration, anAdaptorInterface.swaggerDocumentationEnabled(), true, mavenServerConfiguration)/]
[repositories()/]
[profiles()/]
<!-- [protected ('pre_dependencies')]
-->
<!-- [/protected]
-->
<dependencies>
[generalDependencies()/]
[servletDependencies(true)/]
[servletDependencies()/]
[lyoDependencies(true, not anAdaptorInterface.requiredAdaptors->isEmpty(), anAdaptorInterface.authenticationEnabled(), anAdaptorInterface.trsServiceEnabled(), anAdaptorInterface.storeEnabled())/]
[anAdaptorInterface.domainSpecificationDependencies()/]
[anAdaptorInterface.additionalDependencies()/]
[if (anAdaptorInterface.swaggerDocumentationEnabled())]
<!-- Swagger dependencies -->
<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-jaxrs2</artifactId>
<artifactId>swagger-jaxrs2-jakarta</artifactId>
<version>${swagger.version}</version>
<exclusions>
<exclusion>
Expand All @@ -303,7 +341,7 @@ If multiple DSs share the same maven dependency, we group them into 1.
</dependency>
<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-jaxrs2-servlet-initializer-v2</artifactId>
<artifactId>swagger-jaxrs2-servlet-initializer-v2-jakarta</artifactId>
<version>${swagger.version}</version>
</dependency>
[/if]
Expand Down Expand Up @@ -336,7 +374,7 @@ If multiple DSs share the same maven dependency, we group them into 1.
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>10.0.7</version>
<version>11.0.20</version>
<configuration>
<webApp>
<contextPath>${application.contextpath}</contextPath>
Expand All @@ -353,15 +391,13 @@ If multiple DSs share the same maven dependency, we group them into 1.
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven3-plugin</artifactId>
<version>1.10.6</version>
<version>1.10.12</version>
<configuration>
<!--This plugins supports the following containers-->
<container>
<!--These containers are know to work-->
<containerId>tomcat9x</containerId>
<!-- <containerId>jetty10x</containerId> -->
<!-- <containerId>jetty9x</containerId> -->
<!-- <containerId>tomee8x</containerId> -->
<containerId>tomcat10x</containerId>
<containerId>jetty12x</containerId>
<!-- <containerId>payara</containerId> -->
<!-- <containerId>wildfly26x</containerId> -->
<!--These containers are know to fail-->
Expand Down Expand Up @@ -459,7 +495,6 @@ If multiple DSs share the same maven dependency, we group them into 1.
-->
<dependencies>
[generalDependencies()/]
[servletDependencies(false)/]
[lyoDependencies(false, false, false, false, false)/]
[aSpecification.domainSpecificationDependencies()/]
<!-- [protected ('dependencies_final')]
Expand Down Expand Up @@ -495,7 +530,6 @@ If multiple DSs share the same maven dependency, we group them into 1.
-->
<dependencies>
[generalDependencies()/]
[servletDependencies(false)/]
[lyoDependencies(false, false, false, false, false)/]
<!-- [protected ('dependencies_final')]
-->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<servlet-name>JAX-RS Servlet</servlet-name>
<servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>javax.ws.rs.Application</param-name>
<param-name>jakarta.ws.rs.Application</param-name>
<param-value>[javaClassFullNameForAdaptorApplication(anAdaptorInterface)/]</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import java.util.HashSet;
import java.util.Map;
import java.util.Set;

import javax.inject.Inject;
import jakarta.inject.Inject;
import org.glassfish.hk2.api.ServiceLocator;
import org.glassfish.hk2.utilities.ServiceLocatorUtilities;

Expand Down Expand Up @@ -130,7 +130,7 @@ package [javaClassPackageNameForAdaptorApplication(anAdaptorInterface) /];
[if (anAdaptorInterface.swaggerDocumentationEnabled())]
@OpenAPIDefinition(info = @Info(title = "[anAdaptorInterface.name/]", version = "1.0.0"), servers = @Server(url = "[anAdaptorInterface.getServletFullPath()/]"))
[/if]
public class [javaClassNameForAdaptorApplication(anAdaptorInterface) /] extends javax.ws.rs.core.Application {
public class [javaClassNameForAdaptorApplication(anAdaptorInterface) /] extends jakarta.ws.rs.core.Application {

private static final Set<Class<?>> RESOURCE_CLASSES = new HashSet<Class<?>>();
private static final Map<String, Class<?>> RESOURCE_SHAPE_PATH_TO_RESOURCE_CLASS_MAP = new HashMap<String, Class<?>>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@

package [javaClassPackageNameForClient(aRequiredAdaptor, anAdaptorInterface) /];

import javax.ws.rs.core.Response;
import jakarta.ws.rs.core.Response;
import org.eclipse.lyo.client.OSLCConstants;
import org.eclipse.lyo.client.OslcClient;
import org.eclipse.lyo.oslc4j.core.model.ServiceProviderCatalog;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ package [javaClassPackageNameForAdaptorManager(anAdaptorInterface) /];
// [/protected]
[/if]

import javax.inject.Inject;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.ServletContextEvent;
import jakarta.inject.Inject;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.ServletContextEvent;
import java.util.List;
import java.util.ArrayList;
import org.slf4j.Logger;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import java.net.URI;
import java.net.URISyntaxException;
import java.util.HashMap;
import java.util.Map;
import javax.ws.rs.core.UriBuilder;
import jakarta.ws.rs.core.UriBuilder;

import org.eclipse.lyo.oslc4j.core.model.Link;
import org.eclipse.lyo.oslc4j.core.OSLC4JUtils;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ import java.util.Date;
import java.util.HashMap;
import java.util.Map;

import javax.ws.rs.core.UriBuilder;
import jakarta.ws.rs.core.UriBuilder;

import org.eclipse.lyo.oslc4j.core.exception.OslcCoreApplicationException;
import org.eclipse.lyo.oslc4j.core.model.OslcConstants;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ import java.util.Optional;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.ServletRegistration;
import javax.ws.rs.core.UriBuilder;
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 [javaClassFullNameForAdaptorManager(anAdaptorInterface) /];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ import org.slf4j.LoggerFactory;
import org.glassfish.hk2.api.Factory;
import org.glassfish.hk2.utilities.binding.AbstractBinder;

import javax.inject.Singleton;
import jakarta.inject.Singleton;

import [anAdaptorInterface.javaClassFullNameForAdaptorManager()/];
import [anAdaptorInterface.javaClassFullNameForResourcesFactory()/];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ import java.util.Optional;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.nio.charset.StandardCharsets;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ import java.util.Optional;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletOutputStream;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import jakarta.servlet.Filter;
import jakarta.servlet.FilterChain;
import jakarta.servlet.FilterConfig;
import jakarta.servlet.ServletException;
import jakarta.servlet.ServletOutputStream;
import jakarta.servlet.ServletRequest;
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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,30 +62,30 @@ import java.util.List;
import java.util.Set;
import java.util.TreeSet;

import javax.inject.Inject;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.FormParam;
import javax.ws.rs.GET;
import javax.ws.rs.HeaderParam;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
import javax.ws.rs.core.UriInfo;
import javax.ws.rs.core.UriBuilder;
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;
Expand Down
Loading