diff --git a/kura/distrib/src/main/ant/build_equinox_distrib.xml b/kura/distrib/src/main/ant/build_equinox_distrib.xml index 7087be1ba8a..6cddff1fa98 100644 --- a/kura/distrib/src/main/ant/build_equinox_distrib.xml +++ b/kura/distrib/src/main/ant/build_equinox_distrib.xml @@ -644,6 +644,61 @@ fi]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -700,8 +755,48 @@ fi]]> - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -750,62 +845,62 @@ fi]]> - + - - + + - + - + - + - + - + - + - + - + - + - + - - - + + + - + - + - + - + @@ -814,6 +909,11 @@ fi]]> + + + + + @@ -849,11 +949,6 @@ fi]]> - - - - - @@ -914,31 +1009,6 @@ fi]]> - - - - - - - - - - - - - - - - - - - - - - - - - @@ -999,6 +1069,11 @@ fi]]> + + + + + diff --git a/kura/emulator/org.eclipse.kura.emulator.watchdog/build.properties b/kura/emulator/org.eclipse.kura.emulator.watchdog/build.properties index 232d4deba05..d5dd2fc5498 100644 --- a/kura/emulator/org.eclipse.kura.emulator.watchdog/build.properties +++ b/kura/emulator/org.eclipse.kura.emulator.watchdog/build.properties @@ -19,9 +19,5 @@ bin.includes = META-INF/,\ OSGI-INF/,\ about.html,\ about_files/ -additional.bundles = org.eclipse.osgi,\ - slf4j.api,\ - org.eclipse.kura.api,\ - org.eclipse.osgi.services src.includes = about.html,\ about_files/ diff --git a/kura/examples/org.eclipse.kura.example.rest.authentication.provider/src/main/java/org/eclipse/kura/example/rest/authentication/provider/ExampleRestAuthenticationProvider.java b/kura/examples/org.eclipse.kura.example.rest.authentication.provider/src/main/java/org/eclipse/kura/example/rest/authentication/provider/ExampleRestAuthenticationProvider.java index 4d84c39d674..5f54b084600 100644 --- a/kura/examples/org.eclipse.kura.example.rest.authentication.provider/src/main/java/org/eclipse/kura/example/rest/authentication/provider/ExampleRestAuthenticationProvider.java +++ b/kura/examples/org.eclipse.kura.example.rest.authentication.provider/src/main/java/org/eclipse/kura/example/rest/authentication/provider/ExampleRestAuthenticationProvider.java @@ -18,9 +18,9 @@ import java.util.List; import java.util.Optional; -import javax.annotation.Priority; -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.container.ContainerRequestContext; +import jakarta.annotation.Priority; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.ws.rs.container.ContainerRequestContext; import org.eclipse.kura.audit.AuditConstants; import org.eclipse.kura.audit.AuditContext; diff --git a/kura/examples/org.eclipse.kura.example.web.extension/.gitignore b/kura/examples/org.eclipse.kura.example.web.extension/.gitignore deleted file mode 100644 index 8f6e4e16cd8..00000000000 --- a/kura/examples/org.eclipse.kura.example.web.extension/.gitignore +++ /dev/null @@ -1 +0,0 @@ -src/main/webapp diff --git a/kura/examples/org.eclipse.kura.example.web.extension/META-INF/MANIFEST.MF b/kura/examples/org.eclipse.kura.example.web.extension/META-INF/MANIFEST.MF deleted file mode 100644 index 9a384448759..00000000000 --- a/kura/examples/org.eclipse.kura.example.web.extension/META-INF/MANIFEST.MF +++ /dev/null @@ -1,20 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: org.eclipse.kura.example.web.extension -Bundle-SymbolicName: org.eclipse.kura.example.web.extension;singleton:=true -Bundle-Version: 2.0.0.qualifier -Bundle-Vendor: Eclipse Kura -Bundle-License: Eclipse Public License v2.0 -Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))" -Bundle-ActivationPolicy: lazy -Service-Component: OSGI-INF/*.xml, - OSGI-INF/example.xml -Bundle-ClassPath: . -Import-Package: javax.servlet;version="3.1.0", - javax.servlet.http;version="3.1.0", - org.eclipse.kura.audit;version="[1.0,2.0)", - org.eclipse.kura.web.api;version="[1.0,2.0)", - org.eclipse.kura.web2.ext;version="[1.0,2.0)";resolution:=optional, - org.osgi.service.http;version="1.2.0", - org.slf4j;version="1.7.25" -Require-Bundle: com.gwt.user;bundle-version="[2.0.0,3.0.0)" diff --git a/kura/examples/org.eclipse.kura.example.web.extension/OSGI-INF/example.xml b/kura/examples/org.eclipse.kura.example.web.extension/OSGI-INF/example.xml deleted file mode 100644 index 25853f9de7e..00000000000 --- a/kura/examples/org.eclipse.kura.example.web.extension/OSGI-INF/example.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - diff --git a/kura/examples/org.eclipse.kura.example.web.extension/about.html b/kura/examples/org.eclipse.kura.example.web.extension/about.html deleted file mode 100644 index ec5809fefb9..00000000000 --- a/kura/examples/org.eclipse.kura.example.web.extension/about.html +++ /dev/null @@ -1,36 +0,0 @@ - - - - - About - - -

About This Content

- -

November 30, 2017

-

License

- -

- The Eclipse Foundation makes available all content in this plug-in - ("Content"). Unless otherwise indicated below, the Content - is provided to you under the terms and conditions of the Eclipse - Public License Version 2.0 ("EPL"). A copy of the EPL is - available at http://www.eclipse.org/legal/epl-2.0. - For purposes of the EPL, "Program" will mean the Content. -

- -

- If you did not receive this Content directly from the Eclipse - Foundation, the Content is being redistributed by another party - ("Redistributor") and different terms and conditions may - apply to your use of any object code in the Content. Check the - Redistributor's license that was provided with the Content. If no such - license exists, contact the Redistributor. Unless otherwise indicated - below, the terms and conditions of the EPL still apply to any source - code in the Content and such source code may be obtained at http://www.eclipse.org. -

- - - \ No newline at end of file diff --git a/kura/examples/org.eclipse.kura.example.web.extension/build.properties b/kura/examples/org.eclipse.kura.example.web.extension/build.properties deleted file mode 100644 index 0b2e1faad70..00000000000 --- a/kura/examples/org.eclipse.kura.example.web.extension/build.properties +++ /dev/null @@ -1,8 +0,0 @@ -bin.includes = .,\ - OSGI-INF/,\ - META-INF/,\ - OSGI-INF/example.xml,\ - about.html -source.. = src/main/java/,\ - src/main/resources/,\ - target/generated-sources/gwt diff --git a/kura/examples/org.eclipse.kura.example.web.extension/pom.xml b/kura/examples/org.eclipse.kura.example.web.extension/pom.xml deleted file mode 100644 index 7c0a5b4949a..00000000000 --- a/kura/examples/org.eclipse.kura.example.web.extension/pom.xml +++ /dev/null @@ -1,161 +0,0 @@ - - - - - 4.0.0 - - - org.eclipse.kura - examples - 6.0.0-SNAPSHOT - - - org.eclipse.kura.example.web.extension - 2.0.0-SNAPSHOT - eclipse-plugin - - - ${project.basedir}/.. - - 2.10.0 - UTF-8 - ${project.basedir}/../.. - - - - - org.eclipse.kura - org.eclipse.kura.web2.ext - 2.0.0-SNAPSHOT - provided - - - - - - - - org.apache.maven.wagon - wagon-ssh - ${wagon-ssh.version} - - - - - org.apache.maven.plugins - maven-checkstyle-plugin - - true - - - - - org.apache.maven.plugins - maven-clean-plugin - ${maven-clean-plugin.version} - - - - src/main/webapp - - - src/main/gwt-unitCache - - - - - - - org.codehaus.mojo - gwt-maven-plugin - ${gwtVersion} - - - - compile - generateAsync - - - - - - true - -Xmx512M -Xss1024k -XX:+UseParallelGC - 2 - src/main/webapp - - - - - org.eclipse.tycho - tycho-packaging-plugin - - - - src/main/webapp - www/ - - **/WEB-INF/** - **/css/** - **/fonts/** - **/js/** - - - - - - - - - - - - org.eclipse.m2e - lifecycle-mapping - ${lifecycle-mapping.version} - - - - - - - - org.apache.maven.plugins - - - maven-war-plugin - - - [2.1.1,) - - - exploded - - - - - - - - - - - - - - diff --git a/kura/examples/org.eclipse.kura.example.web.extension/src/main/java/org/eclipse/kura/example/web/extension/client/ExampleAuthenticationHandler.java b/kura/examples/org.eclipse.kura.example.web.extension/src/main/java/org/eclipse/kura/example/web/extension/client/ExampleAuthenticationHandler.java deleted file mode 100644 index edacb68ef53..00000000000 --- a/kura/examples/org.eclipse.kura.example.web.extension/src/main/java/org/eclipse/kura/example/web/extension/client/ExampleAuthenticationHandler.java +++ /dev/null @@ -1,118 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2019, 2020 Eurotech and/or its affiliates and others - * - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Eurotech - *******************************************************************************/ -package org.eclipse.kura.example.web.extension.client; - -import org.eclipse.kura.example.web.extension.shared.service.DummyAuthenticationService; -import org.eclipse.kura.example.web.extension.shared.service.DummyAuthenticationServiceAsync; -import org.eclipse.kura.web2.ext.AuthenticationHandler; -import org.eclipse.kura.web2.ext.Context; -import org.eclipse.kura.web2.ext.Extension; -import org.eclipse.kura.web2.ext.WidgetFactory; -import org.gwtbootstrap3.client.ui.Button; -import org.gwtbootstrap3.client.ui.Input; -import org.gwtbootstrap3.client.ui.InputGroup; - -import com.google.gwt.core.client.Callback; -import com.google.gwt.core.client.GWT; -import com.google.gwt.user.client.rpc.AsyncCallback; - -public class ExampleAuthenticationHandler implements Extension { - - private static final DummyAuthenticationServiceAsync DUMMY_AUTH = GWT.create(DummyAuthenticationService.class); - - @Override - public void onLoad(final Context context) { - context.addAuthenticationHandler(new AlwaysFails()); - context.addAuthenticationHandler(new AlwaysSucceeds()); - } - - private class AlwaysSucceeds implements AuthenticationHandler { - - private final Input usernameInput = new Input(); - - public AlwaysSucceeds() { - usernameInput.setPlaceholder("Enter user name"); - } - - @Override - public String getName() { - return "Always Succeeds"; - } - - @Override - public WidgetFactory getLoginDialogElement() { - return () -> usernameInput; - } - - @Override - public void authenticate(final Callback callback) { - DUMMY_AUTH.login(usernameInput.getText(), new AsyncCallback() { - - @Override - public void onSuccess(String result) { - callback.onSuccess(result); - } - - @Override - public void onFailure(Throwable caught) { - callback.onFailure(caught.getMessage()); - } - }); - } - } - - private class ExampleWidget extends InputGroup { - - private final Input exampleInput = new Input(); - private final Button exampleButton = new Button(); - - public ExampleWidget() { - - this.exampleInput.setPlaceholder("Enter failure message here"); - this.exampleButton.setText("Example button"); - - this.exampleButton.addClickHandler(e -> exampleInput.setText("button clicked")); - - this.add(this.exampleInput); - this.add(this.exampleButton); - } - - public String getText() { - return exampleInput.getValue(); - } - } - - private class AlwaysFails implements AuthenticationHandler { - - private ExampleWidget exampleWidget; - - @Override - public String getName() { - return "Always Fails"; - } - - @Override - public WidgetFactory getLoginDialogElement() { - return () -> { - this.exampleWidget = new ExampleWidget(); - return this.exampleWidget; - }; - } - - @Override - public void authenticate(final Callback callback) { - callback.onFailure("not authorized, message: " + this.exampleWidget.getText()); - } - } - -} diff --git a/kura/examples/org.eclipse.kura.example.web.extension/src/main/java/org/eclipse/kura/example/web/extension/client/ExampleEntryPoint.java b/kura/examples/org.eclipse.kura.example.web.extension/src/main/java/org/eclipse/kura/example/web/extension/client/ExampleEntryPoint.java deleted file mode 100644 index 9e587b8a9a9..00000000000 --- a/kura/examples/org.eclipse.kura.example.web.extension/src/main/java/org/eclipse/kura/example/web/extension/client/ExampleEntryPoint.java +++ /dev/null @@ -1,29 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2019, 2020 Eurotech and/or its affiliates and others - * - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Eurotech - *******************************************************************************/ -package org.eclipse.kura.example.web.extension.client; - -import org.eclipse.kura.web2.ext.ExtensionRegistry; - -import com.google.gwt.core.client.EntryPoint; - -public class ExampleEntryPoint implements EntryPoint { - - @Override - public void onModuleLoad() { - final ExtensionRegistry registry = ExtensionRegistry.get(); - - registry.registerExtension(new ExampleViewExtension()); - registry.registerExtension(new ExampleAuthenticationHandler()); - } - -} diff --git a/kura/examples/org.eclipse.kura.example.web.extension/src/main/java/org/eclipse/kura/example/web/extension/client/ExampleViewExtension.java b/kura/examples/org.eclipse.kura.example.web.extension/src/main/java/org/eclipse/kura/example/web/extension/client/ExampleViewExtension.java deleted file mode 100644 index 69e341c8ff7..00000000000 --- a/kura/examples/org.eclipse.kura.example.web.extension/src/main/java/org/eclipse/kura/example/web/extension/client/ExampleViewExtension.java +++ /dev/null @@ -1,29 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2019, 2020 Eurotech and/or its affiliates and others - * - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Eurotech - *******************************************************************************/ -package org.eclipse.kura.example.web.extension.client; - -import org.eclipse.kura.web2.ext.Context; -import org.eclipse.kura.web2.ext.Extension; - -import com.google.gwt.user.client.ui.Label; - -public class ExampleViewExtension implements Extension { - - @Override - public void onLoad(final Context context) { - context.addSidenavComponent("Example Sidenav Extension", "PUZZLE_PIECE", - () -> new Label("test string from extension in sidenav")); - context.addSettingsComponent("Extension", () -> new Label("test string from extension in settings")); - } - -} diff --git a/kura/examples/org.eclipse.kura.example.web.extension/src/main/java/org/eclipse/kura/example/web/extension/server/DummyAuthenticationServiceImpl.java b/kura/examples/org.eclipse.kura.example.web.extension/src/main/java/org/eclipse/kura/example/web/extension/server/DummyAuthenticationServiceImpl.java deleted file mode 100644 index 052b18281f5..00000000000 --- a/kura/examples/org.eclipse.kura.example.web.extension/src/main/java/org/eclipse/kura/example/web/extension/server/DummyAuthenticationServiceImpl.java +++ /dev/null @@ -1,82 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2019, 2020 Eurotech and/or its affiliates and others - * - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Eurotech - *******************************************************************************/ -package org.eclipse.kura.example.web.extension.server; - -import java.io.IOException; -import java.io.InputStream; -import java.net.URI; - -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.http.HttpServletRequest; - -import org.eclipse.kura.audit.AuditContext; -import org.eclipse.kura.audit.AuditContext.Scope; -import org.eclipse.kura.example.web.extension.shared.service.DummyAuthenticationService; -import org.eclipse.kura.web.api.Console; - -import com.google.gwt.user.server.rpc.RemoteServiceServlet; -import com.google.gwt.user.server.rpc.SerializationPolicy; -import com.google.gwt.user.server.rpc.SerializationPolicyLoader; - -public class DummyAuthenticationServiceImpl extends RemoteServiceServlet implements DummyAuthenticationService { - - /** - * - */ - private static final long serialVersionUID = 1L; - - private final Console console; - - @Override - public void service(ServletRequest req, ServletResponse res) throws ServletException, IOException { - final ClassLoader orig = Thread.currentThread().getContextClassLoader(); - - Thread.currentThread().setContextClassLoader(getClass().getClassLoader()); - final AuditContext context = console.initAuditContext((HttpServletRequest) req); - - try (final Scope scope = AuditContext.openScope(context)) { - super.service(req, res); - } finally { - Thread.currentThread().setContextClassLoader(orig); - } - } - - @Override - protected SerializationPolicy doGetSerializationPolicy(HttpServletRequest request, String moduleBaseURL, - String strongName) { - - try { - final String modulePath = new URI(moduleBaseURL).getPath(); - final String policyPath = "/www" + modulePath + strongName + ".gwt.rpc"; - - final InputStream in = getClass().getClassLoader().getResourceAsStream(policyPath); - return SerializationPolicyLoader.loadFromStream(in, null); - } catch (Exception e) { - return null; - } - - } - - public DummyAuthenticationServiceImpl(final Console console) { - this.console = console; - } - - @Override - public String login(final String user) { - return console.setAuthenticated(getThreadLocalRequest().getSession(false), user, - AuditContext.currentOrInternal()); - } - -} diff --git a/kura/examples/org.eclipse.kura.example.web.extension/src/main/java/org/eclipse/kura/example/web/extension/server/ExampleExtensionComponent.java b/kura/examples/org.eclipse.kura.example.web.extension/src/main/java/org/eclipse/kura/example/web/extension/server/ExampleExtensionComponent.java deleted file mode 100644 index 1065fe01fdc..00000000000 --- a/kura/examples/org.eclipse.kura.example.web.extension/src/main/java/org/eclipse/kura/example/web/extension/server/ExampleExtensionComponent.java +++ /dev/null @@ -1,159 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2019, 2020 Eurotech and/or its affiliates and others - * - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Eurotech - *******************************************************************************/ -package org.eclipse.kura.example.web.extension.server; - -import java.io.IOException; -import java.util.Arrays; -import java.util.Collections; -import java.util.HashSet; -import java.util.Set; -import java.util.function.Function; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.eclipse.kura.web.api.ClientExtensionBundle; -import org.eclipse.kura.web.api.Console; -import org.osgi.service.http.HttpContext; -import org.osgi.service.http.HttpService; -import org.osgi.service.http.NamespaceException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class ExampleExtensionComponent { - - private static final Logger logger = LoggerFactory.getLogger(ExampleExtensionComponent.class); - - private static final ClientExtensionBundle EXTENSION = new ClientExtensionBundle() { - - @Override - public java.util.Map getProperties() { - return Collections.emptyMap(); - } - - @Override - public String getEntryPointUrl() { - return "/exampleext/exampleext.nocache.js"; - } - - @Override - public Set getProvidedAuthenticationMethods() { - - return Collections.unmodifiableSet(new HashSet<>(Arrays.asList("Always Fails", "Always Succeeds"))); - } - }; - - private HttpService httpService; - private Console console; - private DummyAuthenticationServiceImpl dummyAuth; - - public void setHttpService(final HttpService httpService) { - this.httpService = httpService; - } - - public void setConsole(final Console console) { - this.console = console; - } - - public void activate() { - this.dummyAuth = new DummyAuthenticationServiceImpl(console); - - this.console.registerConsoleExtensionBundle(EXTENSION); - this.console.registerLoginExtensionBundle(EXTENSION); - try { - final HttpContext context = this.httpService.createDefaultHttpContext(); - - console.registerLoginServlet("/exampleext/dummylogin", dummyAuth); - this.httpService.registerResources("/exampleext", "www/exampleext", context); - } catch (final NamespaceException | ServletException e) { - logger.warn("failed to register resources", e); - } - } - - public void deactivate() { - - try { - this.console.unregisterConsoleExtensionBundle(EXTENSION); - this.console.unregisterLoginExtensionBundle(EXTENSION); - this.console.unregisterServlet("/exampleext/dummylogin"); - this.httpService.unregister("/exampleext"); - } catch (Exception e) { - logger.warn("failed to unregister resources", e); - } - - } - - public class RedirectServlet extends HttpServlet { - - /** - * - */ - private static final long serialVersionUID = 1L; - - private final Function location; - - public RedirectServlet(final Function location) { - this.location = location; - } - - @Override - protected void doGet(final HttpServletRequest req, final HttpServletResponse resp) - throws ServletException, IOException { - redirect(req, resp); - } - - @Override - protected void doPost(final HttpServletRequest req, final HttpServletResponse resp) - throws ServletException, IOException { - redirect(req, resp); - } - - @Override - protected void doPut(final HttpServletRequest req, final HttpServletResponse resp) - throws ServletException, IOException { - redirect(req, resp); - } - - @Override - protected void doDelete(final HttpServletRequest req, final HttpServletResponse resp) - throws ServletException, IOException { - redirect(req, resp); - } - - @Override - protected void doHead(final HttpServletRequest req, final HttpServletResponse resp) - throws ServletException, IOException { - redirect(req, resp); - } - - @Override - protected void doOptions(HttpServletRequest req, HttpServletResponse resp) - throws ServletException, IOException { - redirect(req, resp); - } - - private final void redirect(final HttpServletRequest req, final HttpServletResponse resp) { - try { - final String path = req.getRequestURI(); - - resp.sendRedirect(location.apply(path)); - - } catch (final Exception e) { - logger.warn("unexpected exception", e); - } - } - - } -} diff --git a/kura/examples/org.eclipse.kura.example.web.extension/src/main/java/org/eclipse/kura/example/web/extension/shared/service/DummyAuthenticationService.java b/kura/examples/org.eclipse.kura.example.web.extension/src/main/java/org/eclipse/kura/example/web/extension/shared/service/DummyAuthenticationService.java deleted file mode 100644 index 0545b0fb1c3..00000000000 --- a/kura/examples/org.eclipse.kura.example.web.extension/src/main/java/org/eclipse/kura/example/web/extension/shared/service/DummyAuthenticationService.java +++ /dev/null @@ -1,23 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2019, 2020 Eurotech and/or its affiliates and others - * - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Eurotech - *******************************************************************************/ -package org.eclipse.kura.example.web.extension.shared.service; - -import com.google.gwt.user.client.rpc.RemoteService; -import com.google.gwt.user.client.rpc.RemoteServiceRelativePath; - -@RemoteServiceRelativePath("dummylogin") -public interface DummyAuthenticationService extends RemoteService { - - public String login(final String user); - -} diff --git a/kura/examples/org.eclipse.kura.example.web.extension/src/main/resources/org/eclipse/kura/example/web/extension/example.gwt.xml b/kura/examples/org.eclipse.kura.example.web.extension/src/main/resources/org/eclipse/kura/example/web/extension/example.gwt.xml deleted file mode 100644 index 3f5eb0567ac..00000000000 --- a/kura/examples/org.eclipse.kura.example.web.extension/src/main/resources/org/eclipse/kura/example/web/extension/example.gwt.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/kura/examples/test/org.eclipse.kura.example.wire.logic.multiport.provider.test/pom.xml b/kura/examples/test/org.eclipse.kura.example.wire.logic.multiport.provider.test/pom.xml index 6a524bed3d3..7ee50716898 100644 --- a/kura/examples/test/org.eclipse.kura.example.wire.logic.multiport.provider.test/pom.xml +++ b/kura/examples/test/org.eclipse.kura.example.wire.logic.multiport.provider.test/pom.xml @@ -395,11 +395,6 @@ log4j2-api-config 0.0.0 - - p2-installable-unit - com.eclipsesource.jaxrs.jersey-min - 0.0.0 - eclipse-plugin org.eclipse.kura.core.system diff --git a/kura/examples/test/org.eclipse.kura.example.wire.math.singleport.provider.test/pom.xml b/kura/examples/test/org.eclipse.kura.example.wire.math.singleport.provider.test/pom.xml index b776f9d8901..d1997993541 100644 --- a/kura/examples/test/org.eclipse.kura.example.wire.math.singleport.provider.test/pom.xml +++ b/kura/examples/test/org.eclipse.kura.example.wire.math.singleport.provider.test/pom.xml @@ -399,11 +399,6 @@ log4j2-api-config 0.0.0 - - p2-installable-unit - com.eclipsesource.jaxrs.jersey-min - 0.0.0 - eclipse-plugin org.eclipse.kura.core.system diff --git a/kura/examples/test/org.eclipse.kura.example.wire.math.trig.test/pom.xml b/kura/examples/test/org.eclipse.kura.example.wire.math.trig.test/pom.xml index dcde72784ba..4ed0fb41e47 100644 --- a/kura/examples/test/org.eclipse.kura.example.wire.math.trig.test/pom.xml +++ b/kura/examples/test/org.eclipse.kura.example.wire.math.trig.test/pom.xml @@ -399,11 +399,6 @@ log4j2-api-config 0.0.0 - - p2-installable-unit - com.eclipsesource.jaxrs.jersey-min - 0.0.0 - eclipse-plugin org.eclipse.kura.core.system diff --git a/kura/examples/test/pom.xml b/kura/examples/test/pom.xml index 420718742ea..4d89343cd06 100644 --- a/kura/examples/test/pom.xml +++ b/kura/examples/test/pom.xml @@ -512,26 +512,6 @@ 4 true - - com.eclipsesource.jaxrs.jersey-min - 4 - true - - - com.eclipsesource.jaxrs.provider.gson - 4 - true - - - com.eclipsesource.jaxrs.provider.security - 4 - true - - - com.eclipsesource.jaxrs.publisher - 4 - true - org.apache.felix.useradmin 4 @@ -597,11 +577,6 @@ org.apache.logging.log4j.slf4j.impl 0.0.0 - - p2-installable-unit - com.eclipsesource.jaxrs.jersey-min - 0.0.0 - p2-installable-unit jakarta.xml.bind-api @@ -739,26 +714,6 @@ org.eclipse.equinox.http.jetty 0.0.0 - - eclipse-plugin - com.eclipsesource.jaxrs.jersey-min - 0.0.0 - - - eclipse-plugin - com.eclipsesource.jaxrs.provider.gson - 0.0.0 - - - eclipse-plugin - com.eclipsesource.jaxrs.provider.security - 0.0.0 - - - eclipse-plugin - com.eclipsesource.jaxrs.publisher - 0.0.0 - eclipse-plugin org.eclipse.kura.rest.provider diff --git a/kura/org.eclipse.kura.ai.triton.server/META-INF/MANIFEST.MF b/kura/org.eclipse.kura.ai.triton.server/META-INF/MANIFEST.MF index 6acd1c8cc73..a7fc126b032 100644 --- a/kura/org.eclipse.kura.ai.triton.server/META-INF/MANIFEST.MF +++ b/kura/org.eclipse.kura.ai.triton.server/META-INF/MANIFEST.MF @@ -22,7 +22,6 @@ Import-Package: com.google.common.base;version="25.0.0", com.google.common.util.concurrent;version="25.0.0", com.google.gson;version="2.7.0", com.google.protobuf;version="3.19.3", - javax.annotation;version="1.2.0", org.apache.commons.io;version="2.4.0", org.apache.commons.io.filefilter;version="2.11.0", org.bouncycastle.jcajce;version="1.78.1", diff --git a/kura/org.eclipse.kura.ai.triton.server/build.properties b/kura/org.eclipse.kura.ai.triton.server/build.properties index cc3701fa9f2..2555ad9a4ef 100644 --- a/kura/org.eclipse.kura.ai.triton.server/build.properties +++ b/kura/org.eclipse.kura.ai.triton.server/build.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 2022 Eurotech and/or its affiliates and others +# Copyright (c) 2024 Eurotech and/or its affiliates and others # # This program and the accompanying materials are made # available under the terms of the Eclipse Public License 2.0 @@ -26,10 +26,5 @@ bin.includes = .,\ source.. = src/main/java/,\ target/generated-sources/protobuf/java/,\ target/generated-sources/protobuf/grpc-java/ -additional.bundles = org.eclipse.kura.api,\ - slf4j.api,\ - org.eclipse.osgi,\ - org.eclipse.osgi.services,\ - org.eclipse.kura.core src.includes = about.html,\ about_files diff --git a/kura/org.eclipse.kura.ai.triton.server/pom.xml b/kura/org.eclipse.kura.ai.triton.server/pom.xml index c67c167f4e4..e08fecc56fc 100644 --- a/kura/org.eclipse.kura.ai.triton.server/pom.xml +++ b/kura/org.eclipse.kura.ai.triton.server/pom.xml @@ -7,145 +7,148 @@ available under the terms of the Eclipse Public License 2.0 which is available at https://www.eclipse.org/legal/epl-2.0/ - SPDX-License-Identifier: EPL-2.0 - - Contributors: - Eurotech + SPDX-License-Identifier: EPL-2.0 + + Contributors: + Eurotech --> - 4.0.0 + 4.0.0 - - org.eclipse.kura - kura - 6.0.0-SNAPSHOT - + + org.eclipse.kura + kura + 6.0.0-SNAPSHOT + - org.eclipse.kura.ai.triton.server - 2.0.0-SNAPSHOT - eclipse-plugin + org.eclipse.kura.ai.triton.server + 2.0.0-SNAPSHOT + eclipse-plugin - - ${project.basedir}/.. - ${project.basedir}/../test/org.eclipse.kura.ai.triton.server.test/target/site/jacoco-aggregate/jacoco.xml - 1.56.1 - 0.6.1 - 3.12.0 - + + ${project.basedir}/.. + ${project.basedir}/../test/org.eclipse.kura.ai.triton.server.test/target/site/jacoco-aggregate/jacoco.xml + 1.68.2 + 0.6.1 + 3.12.0 + - - - - org.apache.maven.plugins - maven-dependency-plugin - 3.0.0 - - - generate-sources - - ${project.basedir}/lib - true - - - io.grpc - grpc-api - 1.56.1 - - - io.grpc - grpc-context - 1.56.1 - - - io.grpc - grpc-core - 1.56.1 - - - io.grpc - grpc-netty-shaded - 1.56.1 - - - io.grpc - grpc-protobuf - 1.56.1 - - - io.grpc - grpc-protobuf-lite - 1.56.1 - - - io.grpc - grpc-stub - 1.56.1 - - - io.perfmark - perfmark-api - 0.26.0 - - - - - copy - - - - - - kr.motd.maven - os-maven-plugin - 1.7.0 - - - initialize - - detect - - - - - - org.xolstice.maven.plugins - protobuf-maven-plugin - ${protobuf-maven-plugin.version} - - com.google.protobuf:protoc:${protoc.version}:exe:${os.detected.classifier} - grpc-java - io.grpc:protoc-gen-grpc-java:${grpc.version}:exe:${os.detected.classifier} - - - - generate-sources - - compile - compile-custom - - - - - - org.codehaus.mojo - build-helper-maven-plugin - 3.3.0 - - - generate-sources - - add-source - - - - ${project.build.directory}/generated-sources/protobuf/java - ${project.build.directory}/generated-sources/protobuf/grpc-java - - - - - - - + + + + org.apache.maven.plugins + maven-dependency-plugin + 3.0.0 + + + generate-sources + + ${project.basedir}/lib + true + + + io.grpc + grpc-api + ${grpc.version} + + + io.grpc + grpc-context + ${grpc.version} + + + io.grpc + grpc-core + ${grpc.version} + + + io.grpc + grpc-netty-shaded + ${grpc.version} + + + io.grpc + grpc-protobuf + ${grpc.version} + + + io.grpc + grpc-protobuf-lite + ${grpc.version} + + + io.grpc + grpc-stub + ${grpc.version} + + + io.perfmark + perfmark-api + 0.26.0 + + + + + copy + + + + + + kr.motd.maven + os-maven-plugin + 1.7.0 + + + initialize + + detect + + + + + + org.xolstice.maven.plugins + protobuf-maven-plugin + ${protobuf-maven-plugin.version} + + com.google.protobuf:protoc:${protoc.version}:exe:${os.detected.classifier} + grpc-java + io.grpc:protoc-gen-grpc-java:${grpc.version}:exe:${os.detected.classifier} + + + + + @generated=omit + + generate-sources + + compile + compile-custom + + + + + + org.codehaus.mojo + build-helper-maven-plugin + 3.3.0 + + + generate-sources + + add-source + + + + ${project.build.directory}/generated-sources/protobuf/java + ${project.build.directory}/generated-sources/protobuf/grpc-java + + + + + + + diff --git a/kura/org.eclipse.kura.api/build.properties b/kura/org.eclipse.kura.api/build.properties index 5f0172357eb..238c5108072 100644 --- a/kura/org.eclipse.kura.api/build.properties +++ b/kura/org.eclipse.kura.api/build.properties @@ -19,7 +19,6 @@ bin.includes = META-INF/,\ additional.bundles = org.eclipse.equinox.io,\ slf4j.api,\ org.eclipse.osgi,\ - org.eclipse.osgi.services,\ org.eclipse.osgi.util src.includes = about.html,\ about_files/ diff --git a/kura/org.eclipse.kura.asset.cloudlet.provider/META-INF/MANIFEST.MF b/kura/org.eclipse.kura.asset.cloudlet.provider/META-INF/MANIFEST.MF index 2b401ac501c..c148ffa3c83 100644 --- a/kura/org.eclipse.kura.asset.cloudlet.provider/META-INF/MANIFEST.MF +++ b/kura/org.eclipse.kura.asset.cloudlet.provider/META-INF/MANIFEST.MF @@ -7,7 +7,7 @@ Bundle-Vendor: Eclipse Kura Bundle-License: Eclipse Public License v2.0 Bundle-Category: Asset-Driver Management Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))" -Import-Package: com.eclipsesource.json;version="0.9.5", +Import-Package: com.eclipsesource.json;version="[0.9.0,1.0.0)", org.eclipse.kura;version="[1.3,2.0)", org.eclipse.kura.asset;version="[1.0,2.0)", org.eclipse.kura.channel;version="[2.0,3.0)", diff --git a/kura/org.eclipse.kura.cloudconnection.eclipseiot.mqtt.provider/META-INF/MANIFEST.MF b/kura/org.eclipse.kura.cloudconnection.eclipseiot.mqtt.provider/META-INF/MANIFEST.MF index d73da9d462a..e0694ac7fe1 100644 --- a/kura/org.eclipse.kura.cloudconnection.eclipseiot.mqtt.provider/META-INF/MANIFEST.MF +++ b/kura/org.eclipse.kura.cloudconnection.eclipseiot.mqtt.provider/META-INF/MANIFEST.MF @@ -9,8 +9,7 @@ Service-Component: OSGI-INF/*.xml Bundle-ClassPath: ., lib/protobuf-java.jar Bundle-ActivationPolicy: lazy -Import-Package: com.eclipsesource.json;version="0.9.5", - org.eclipse.kura;version="[1.0,2.0)", +Import-Package: org.eclipse.kura;version="[1.0,2.0)", org.eclipse.kura.audit;version="[1.0,2.0)", org.eclipse.kura.certificate;version="[2.0,3.0)", org.eclipse.kura.cloud;version="[1.1,1.2)", diff --git a/kura/org.eclipse.kura.cloudconnection.eclipseiot.mqtt.provider/build.properties b/kura/org.eclipse.kura.cloudconnection.eclipseiot.mqtt.provider/build.properties index ce1106086c6..48997df67d2 100644 --- a/kura/org.eclipse.kura.cloudconnection.eclipseiot.mqtt.provider/build.properties +++ b/kura/org.eclipse.kura.cloudconnection.eclipseiot.mqtt.provider/build.properties @@ -5,8 +5,4 @@ bin.includes = .,\ lib/protobuf-java.jar src.includes = about.html,\ about_files/ -source.. = src/main/java/ -additional.bundles = org.eclipse.kura.api,\ - slf4j.api,\ - org.eclipse.osgi,\ - org.eclipse.osgi.services +source.. = src/main/java/ \ No newline at end of file diff --git a/kura/org.eclipse.kura.cloudconnection.kapua.mqtt.provider/build.properties b/kura/org.eclipse.kura.cloudconnection.kapua.mqtt.provider/build.properties index bb3a8f981b5..484d9289b0e 100644 --- a/kura/org.eclipse.kura.cloudconnection.kapua.mqtt.provider/build.properties +++ b/kura/org.eclipse.kura.cloudconnection.kapua.mqtt.provider/build.properties @@ -7,7 +7,3 @@ bin.includes = .,\ src.includes = about.html,\ about_files/ source.. = src/main/java/ -additional.bundles = org.eclipse.kura.api,\ - slf4j.api,\ - org.eclipse.osgi,\ - org.eclipse.osgi.services diff --git a/kura/org.eclipse.kura.cloudconnection.sparkplug.mqtt.provider/META-INF/MANIFEST.MF b/kura/org.eclipse.kura.cloudconnection.sparkplug.mqtt.provider/META-INF/MANIFEST.MF index bde25da8707..c3bbbb05967 100644 --- a/kura/org.eclipse.kura.cloudconnection.sparkplug.mqtt.provider/META-INF/MANIFEST.MF +++ b/kura/org.eclipse.kura.cloudconnection.sparkplug.mqtt.provider/META-INF/MANIFEST.MF @@ -4,8 +4,8 @@ Bundle-Name: Sparkplug MQTT Cloud Connection Provider Bundle-SymbolicName: org.eclipse.kura.cloudconnection.sparkplug.mqtt.provider Bundle-Version: 2.0.0.qualifier Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))" -Import-Package: com.google.gson;version="[2.7,3.0)", - com.google.protobuf;version="[3.0,4.0]", +Import-Package: com.google.gson;version="2.9.0", + com.google.protobuf;version="3.21.12", org.eclipse.kura;version="[1.0,2.0)", org.eclipse.kura.cloud;version="[1.1,2.0)", org.eclipse.kura.cloudconnection;version="[1.0,1.1)", @@ -27,7 +27,7 @@ Import-Package: com.google.gson;version="[2.7,3.0)", org.osgi.service.component;version="1.2.0", org.osgi.service.event;version="1.3.1", org.osgi.util.tracker;version="[1.5,2.0)", - org.slf4j;version="[1.7,2.0]" + org.slf4j;version="1.7.36" Bundle-ActivationPolicy: lazy Service-Component: OSGI-INF/*.xml Bundle-Vendor: Eclipse Kura diff --git a/kura/org.eclipse.kura.cloudconnection.sparkplug.mqtt.provider/pom.xml b/kura/org.eclipse.kura.cloudconnection.sparkplug.mqtt.provider/pom.xml index d984c17a425..e47b0967965 100644 --- a/kura/org.eclipse.kura.cloudconnection.sparkplug.mqtt.provider/pom.xml +++ b/kura/org.eclipse.kura.cloudconnection.sparkplug.mqtt.provider/pom.xml @@ -59,9 +59,7 @@ protobuf-maven-plugin 0.6.1 - - com.google.protobuf:protoc:${protoc.version}:exe:${os.detected.classifier} - + com.google.protobuf:protoc:${protoc.version}:exe:${os.detected.classifier} diff --git a/kura/org.eclipse.kura.configuration.change.manager/build.properties b/kura/org.eclipse.kura.configuration.change.manager/build.properties index fad74f8f7f6..76b260596bf 100644 --- a/kura/org.eclipse.kura.configuration.change.manager/build.properties +++ b/kura/org.eclipse.kura.configuration.change.manager/build.properties @@ -7,7 +7,3 @@ bin.includes = .,\ src.includes = about.html,\ about_files/ source.. = src/main/java/ -additional.bundles = org.eclipse.kura.api,\ - slf4j.api,\ - org.eclipse.osgi,\ - org.eclipse.osgi.services diff --git a/kura/org.eclipse.kura.core.certificates/META-INF/MANIFEST.MF b/kura/org.eclipse.kura.core.certificates/META-INF/MANIFEST.MF index db7201e67ab..b429d44df68 100644 --- a/kura/org.eclipse.kura.core.certificates/META-INF/MANIFEST.MF +++ b/kura/org.eclipse.kura.core.certificates/META-INF/MANIFEST.MF @@ -6,9 +6,6 @@ Bundle-Version: 2.0.0.qualifier Bundle-Vendor: Eclipse Kura Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))" Import-Package: com.google.gson;version="2.7.0", - javax.annotation.security;version="1.2.0", - javax.ws.rs;version="2.0.1", - javax.ws.rs.core;version="2.0.1", org.eclipse.kura;version="[1.0,2.0)", org.eclipse.kura.certificate;version="[2.1,2.2)", org.eclipse.kura.configuration;version="[1.2,2.0)", diff --git a/kura/org.eclipse.kura.core.certificates/build.properties b/kura/org.eclipse.kura.core.certificates/build.properties index 8cf7bcf4907..20efa7ed4b7 100644 --- a/kura/org.eclipse.kura.core.certificates/build.properties +++ b/kura/org.eclipse.kura.core.certificates/build.properties @@ -19,7 +19,6 @@ bin.includes = META-INF/,\ about_files/,\ about.html additional.bundles = org.eclipse.osgi,\ - org.eclipse.osgi.services,\ org.eclipse.osgi.util,\ org.eclipse.kura.api src.includes = about.html,\ diff --git a/kura/org.eclipse.kura.core.cloud.command/build.properties b/kura/org.eclipse.kura.core.cloud.command/build.properties index 11e1cbd467a..d57e7ebcb94 100644 --- a/kura/org.eclipse.kura.core.cloud.command/build.properties +++ b/kura/org.eclipse.kura.core.cloud.command/build.properties @@ -8,5 +8,4 @@ src.includes = about.html,\ source.. = src/main/java/ additional.bundles = org.eclipse.kura.api,\ slf4j.api,\ - org.eclipse.osgi,\ - org.eclipse.osgi.services + org.eclipse.osgi diff --git a/kura/org.eclipse.kura.core.comm/build.properties b/kura/org.eclipse.kura.core.comm/build.properties index f62327822eb..5e74707e775 100644 --- a/kura/org.eclipse.kura.core.comm/build.properties +++ b/kura/org.eclipse.kura.core.comm/build.properties @@ -20,7 +20,6 @@ source.. = src/main/java/ additional.bundles = org.eclipse.kura.api,\ slf4j.api,\ org.eclipse.osgi,\ - org.eclipse.osgi.services,\ org.eclipse.equinox.io src.includes = about.html,\ about_files/ diff --git a/kura/org.eclipse.kura.core.configuration/META-INF/MANIFEST.MF b/kura/org.eclipse.kura.core.configuration/META-INF/MANIFEST.MF index b971df8d7b0..3d59dd204cb 100644 --- a/kura/org.eclipse.kura.core.configuration/META-INF/MANIFEST.MF +++ b/kura/org.eclipse.kura.core.configuration/META-INF/MANIFEST.MF @@ -8,8 +8,7 @@ Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))" Service-Component: OSGI-INF/*.xml Bundle-ClassPath: . Bundle-ActivationPolicy: lazy -Import-Package: com.eclipsesource.json;version="0.9.5", - javax.crypto, +Import-Package: javax.crypto, javax.xml.namespace, javax.xml.parsers, javax.xml.stream, diff --git a/kura/org.eclipse.kura.core.configuration/build.properties b/kura/org.eclipse.kura.core.configuration/build.properties index fac8bbadb58..fcda655a4d6 100644 --- a/kura/org.eclipse.kura.core.configuration/build.properties +++ b/kura/org.eclipse.kura.core.configuration/build.properties @@ -9,5 +9,4 @@ src.includes = about.html,\ source.. = src/main/java/ additional.bundles = org.eclipse.kura.api,\ slf4j.api,\ - org.eclipse.osgi,\ - org.eclipse.osgi.services + org.eclipse.osgi diff --git a/kura/org.eclipse.kura.core.deployment/build.properties b/kura/org.eclipse.kura.core.deployment/build.properties index e7ee79cd54f..ff4954e3ded 100644 --- a/kura/org.eclipse.kura.core.deployment/build.properties +++ b/kura/org.eclipse.kura.core.deployment/build.properties @@ -19,7 +19,6 @@ bin.includes = .,\ source.. = src/main/java/ additional.bundles = org.eclipse.kura.api,\ slf4j.api,\ - org.eclipse.osgi,\ - org.eclipse.osgi.services + org.eclipse.osgi src.includes = about.html,\ about_files/ diff --git a/kura/org.eclipse.kura.core.inventory/build.properties b/kura/org.eclipse.kura.core.inventory/build.properties index 8f5675d2052..56dd4a51b10 100644 --- a/kura/org.eclipse.kura.core.inventory/build.properties +++ b/kura/org.eclipse.kura.core.inventory/build.properties @@ -19,7 +19,6 @@ bin.includes = .,\ source.. = src/main/java/ additional.bundles = org.eclipse.kura.api,\ slf4j.api,\ - org.eclipse.osgi,\ - org.eclipse.osgi.services + org.eclipse.osgi src.includes = about.html,\ about_files/ diff --git a/kura/org.eclipse.kura.core.keystore/META-INF/MANIFEST.MF b/kura/org.eclipse.kura.core.keystore/META-INF/MANIFEST.MF index 6615fd2bde1..84fc37980d6 100644 --- a/kura/org.eclipse.kura.core.keystore/META-INF/MANIFEST.MF +++ b/kura/org.eclipse.kura.core.keystore/META-INF/MANIFEST.MF @@ -5,7 +5,7 @@ Bundle-SymbolicName: org.eclipse.kura.core.keystore;singleton:=true Bundle-Version: 2.0.0.qualifier Bundle-Vendor: Eclipse Kura Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))" -Import-Package: com.eclipsesource.json;version="0.9.5", +Import-Package: com.eclipsesource.json;version="[0.9.0,1.0.0)", org.bouncycastle.asn1;version="1.78.1", org.bouncycastle.asn1.cms;version="1.78.1", org.bouncycastle.asn1.pkcs;version="1.78.1", diff --git a/kura/org.eclipse.kura.core.keystore/build.properties b/kura/org.eclipse.kura.core.keystore/build.properties index 090cdc3e8fd..07e1b2e926c 100644 --- a/kura/org.eclipse.kura.core.keystore/build.properties +++ b/kura/org.eclipse.kura.core.keystore/build.properties @@ -19,7 +19,6 @@ bin.includes = META-INF/,\ about_files/,\ about.html additional.bundles = org.eclipse.osgi,\ - org.eclipse.osgi.services,\ org.eclipse.osgi.util,\ org.eclipse.kura.api src.includes = about.html,\ diff --git a/kura/org.eclipse.kura.core.net/build.properties b/kura/org.eclipse.kura.core.net/build.properties index 46fc11cac08..380adea18a3 100644 --- a/kura/org.eclipse.kura.core.net/build.properties +++ b/kura/org.eclipse.kura.core.net/build.properties @@ -18,7 +18,6 @@ bin.includes = .,\ source.. = src/main/java/ additional.bundles = org.eclipse.kura.api,\ slf4j.api,\ - org.eclipse.osgi,\ - org.eclipse.osgi.services + org.eclipse.osgi src.includes = about.html,\ about_files/ diff --git a/kura/org.eclipse.kura.core.status/build.properties b/kura/org.eclipse.kura.core.status/build.properties index 0f6294c208a..5fce10bab0f 100644 --- a/kura/org.eclipse.kura.core.status/build.properties +++ b/kura/org.eclipse.kura.core.status/build.properties @@ -20,7 +20,6 @@ source.. = src/main/java/ additional.bundles = org.eclipse.kura.api,\ slf4j.api,\ org.eclipse.osgi,\ - org.eclipse.osgi.services,\ org.eclipse.kura.core src.includes = about.html,\ about_files/ diff --git a/kura/org.eclipse.kura.core.tamper.detection/META-INF/MANIFEST.MF b/kura/org.eclipse.kura.core.tamper.detection/META-INF/MANIFEST.MF index 2f72542506e..29ead761780 100644 --- a/kura/org.eclipse.kura.core.tamper.detection/META-INF/MANIFEST.MF +++ b/kura/org.eclipse.kura.core.tamper.detection/META-INF/MANIFEST.MF @@ -9,14 +9,15 @@ Bundle-ClassPath: . Bundle-ActivationPolicy: lazy Service-Component: OSGI-INF/*.xml Import-Package: com.google.gson;version="2.7.0", - javax.annotation.security;version="1.2.0", - javax.ws.rs;version="2.0.1", - javax.ws.rs.core;version="2.0.1", - org.eclipse.kura;version="[1.6,2.0)", + jakarta.annotation.security;version="2.1.1", + jakarta.ws.rs;version="3.1.0", + jakarta.ws.rs.core;version="3.1.0", + org.eclipse.kura;version="[1.0,2.0)", org.eclipse.kura.cloudconnection.message;version="[1.0,2.0)", org.eclipse.kura.cloudconnection.request;version="[1.0,2.0)", org.eclipse.kura.message;version="[1.4,2.0)", org.eclipse.kura.security.tamper.detection;version="[1.0,2.0)", org.eclipse.kura.type;version="[1.1,2.0)", + org.osgi.service.jakartars.whiteboard.propertytypes;version="2.0.0", org.osgi.service.useradmin;version="1.1.0", org.slf4j;version="1.7.25" diff --git a/kura/org.eclipse.kura.core.tamper.detection/src/main/java/org/eclipse/kura/core/tamper/detection/TamperDetectionRestService.java b/kura/org.eclipse.kura.core.tamper.detection/src/main/java/org/eclipse/kura/core/tamper/detection/TamperDetectionRestService.java index 177509ed03a..0cee788012e 100644 --- a/kura/org.eclipse.kura.core.tamper.detection/src/main/java/org/eclipse/kura/core/tamper/detection/TamperDetectionRestService.java +++ b/kura/org.eclipse.kura.core.tamper.detection/src/main/java/org/eclipse/kura/core/tamper/detection/TamperDetectionRestService.java @@ -14,23 +14,27 @@ import java.util.List; -import javax.annotation.security.RolesAllowed; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.WebApplicationException; -import javax.ws.rs.core.MediaType; - import org.eclipse.kura.KuraErrorCode; import org.eclipse.kura.KuraException; import org.eclipse.kura.core.tamper.detection.model.TamperDetectionServiceInfo; import org.eclipse.kura.core.tamper.detection.model.TamperStatusInfo; import org.eclipse.kura.core.tamper.detection.util.TamperDetectionRemoteService; +import org.osgi.service.jakartars.whiteboard.propertytypes.JakartarsName; +import org.osgi.service.jakartars.whiteboard.propertytypes.JakartarsResource; import org.osgi.service.useradmin.Role; import org.osgi.service.useradmin.UserAdmin; +import jakarta.annotation.security.RolesAllowed; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.POST; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.PathParam; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.WebApplicationException; +import jakarta.ws.rs.core.MediaType; + +@JakartarsResource +@JakartarsName("tamperDetectionRestService") @Path("/tamper/v1") public class TamperDetectionRestService extends TamperDetectionRemoteService { diff --git a/kura/org.eclipse.kura.driver.helper.provider/build.properties b/kura/org.eclipse.kura.driver.helper.provider/build.properties index eba769de46d..9a2e2c39447 100644 --- a/kura/org.eclipse.kura.driver.helper.provider/build.properties +++ b/kura/org.eclipse.kura.driver.helper.provider/build.properties @@ -18,5 +18,4 @@ bin.includes = META-INF/,\ .,\ about.html,\ OSGI-INF/ -additional.bundles = org.eclipse.osgi,\ - org.eclipse.osgi.services +additional.bundles = org.eclipse.osgi diff --git a/kura/org.eclipse.kura.http.server.manager/META-INF/MANIFEST.MF b/kura/org.eclipse.kura.http.server.manager/META-INF/MANIFEST.MF index fac3e44b20a..7c99ff761f0 100644 --- a/kura/org.eclipse.kura.http.server.manager/META-INF/MANIFEST.MF +++ b/kura/org.eclipse.kura.http.server.manager/META-INF/MANIFEST.MF @@ -15,4 +15,6 @@ Import-Package: org.eclipse.equinox.http.jetty;version="1.5.0", org.osgi.framework;version="1.8.0", org.osgi.service.component;version="1.3.0", org.osgi.service.event;version="1.4.0", + org.osgi.service.http.whiteboard.annotations;version="1.1.0", + org.osgi.service.jakartars.whiteboard.annotations;version="2.0.0", org.slf4j;version="1.7.21" diff --git a/kura/org.eclipse.kura.http.server.manager/build.properties b/kura/org.eclipse.kura.http.server.manager/build.properties index 0b893393c43..8654ececde9 100644 --- a/kura/org.eclipse.kura.http.server.manager/build.properties +++ b/kura/org.eclipse.kura.http.server.manager/build.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 2019, 2020 Eurotech and/or its affiliates and others +# Copyright (c) 2019, 2024 Eurotech and/or its affiliates and others # # This program and the accompanying materials are made # available under the terms of the Eclipse Public License 2.0 @@ -17,9 +17,3 @@ bin.includes = META-INF/,\ .,\ OSGI-INF/,\ about.html -additional.bundles = org.eclipse.osgi,\ - org.eclipse.osgi.services,\ - org.eclipse.osgi.util,\ - org.eclipse.kura.api,\ - slf4j.api - diff --git a/kura/org.eclipse.kura.http.server.manager/src/main/java/org/eclipse/kura/http/server/manager/HttpService.java b/kura/org.eclipse.kura.http.server.manager/src/main/java/org/eclipse/kura/http/server/manager/HttpService.java index 5d64a8c30e1..28d8d453056 100755 --- a/kura/org.eclipse.kura.http.server.manager/src/main/java/org/eclipse/kura/http/server/manager/HttpService.java +++ b/kura/org.eclipse.kura.http.server.manager/src/main/java/org/eclipse/kura/http/server/manager/HttpService.java @@ -36,9 +36,13 @@ import org.eclipse.kura.system.SystemService; import org.osgi.service.event.Event; import org.osgi.service.event.EventHandler; +import org.osgi.service.http.whiteboard.annotations.RequireHttpWhiteboard; +import org.osgi.service.jakartars.whiteboard.annotations.RequireJakartarsWhiteboard; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +@RequireHttpWhiteboard +@RequireJakartarsWhiteboard public class HttpService implements ConfigurableComponent, EventHandler { private static final String KURA_JETTY_PID = "kura.default"; diff --git a/kura/org.eclipse.kura.json.marshaller.unmarshaller.provider/META-INF/MANIFEST.MF b/kura/org.eclipse.kura.json.marshaller.unmarshaller.provider/META-INF/MANIFEST.MF index 72cf0646d3d..7bbe03f5a18 100644 --- a/kura/org.eclipse.kura.json.marshaller.unmarshaller.provider/META-INF/MANIFEST.MF +++ b/kura/org.eclipse.kura.json.marshaller.unmarshaller.provider/META-INF/MANIFEST.MF @@ -6,7 +6,7 @@ Bundle-Version: 2.0.0.qualifier Bundle-Vendor: Eclipse Kura Bundle-License: Eclipse Public License v2.0 Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))" -Import-Package: com.eclipsesource.json;version="0.9.5", +Import-Package: com.eclipsesource.json;version="0.9.0", com.google.gson;version="2.7.0", org.eclipse.kura;version="[1.4,2.0)", org.eclipse.kura.configuration;version="[1.1,2.0)", diff --git a/kura/org.eclipse.kura.json.marshaller.unmarshaller.provider/build.properties b/kura/org.eclipse.kura.json.marshaller.unmarshaller.provider/build.properties index 9f893de804c..6844658adc0 100644 --- a/kura/org.eclipse.kura.json.marshaller.unmarshaller.provider/build.properties +++ b/kura/org.eclipse.kura.json.marshaller.unmarshaller.provider/build.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 2017, 2020 Eurotech and/or its affiliates and others +# Copyright (c) 2017, 2024 Eurotech and/or its affiliates and others # # This program and the accompanying materials are made # available under the terms of the Eclipse Public License 2.0 @@ -18,5 +18,3 @@ bin.includes = META-INF/,\ OSGI-INF/ src.includes = about.html source.. = src/main/java/ -additional.bundles = org.eclipse.osgi,\ - org.eclipse.osgi.services diff --git a/kura/org.eclipse.kura.linux.clock/build.properties b/kura/org.eclipse.kura.linux.clock/build.properties index 0f6294c208a..5fce10bab0f 100644 --- a/kura/org.eclipse.kura.linux.clock/build.properties +++ b/kura/org.eclipse.kura.linux.clock/build.properties @@ -20,7 +20,6 @@ source.. = src/main/java/ additional.bundles = org.eclipse.kura.api,\ slf4j.api,\ org.eclipse.osgi,\ - org.eclipse.osgi.services,\ org.eclipse.kura.core src.includes = about.html,\ about_files/ diff --git a/kura/org.eclipse.kura.linux.gpio/build.properties b/kura/org.eclipse.kura.linux.gpio/build.properties index b530d9bee60..310024551da 100644 --- a/kura/org.eclipse.kura.linux.gpio/build.properties +++ b/kura/org.eclipse.kura.linux.gpio/build.properties @@ -20,7 +20,6 @@ source.. = src/main/java/ additional.bundles = org.eclipse.kura.api,\ slf4j.api,\ org.eclipse.osgi,\ - org.eclipse.osgi.services,\ org.eclipse.kura.core,\ jdk.dio src.includes = about.html,\ diff --git a/kura/org.eclipse.kura.linux.position/build.properties b/kura/org.eclipse.kura.linux.position/build.properties index 8372bf0fed2..f794527f97b 100644 --- a/kura/org.eclipse.kura.linux.position/build.properties +++ b/kura/org.eclipse.kura.linux.position/build.properties @@ -20,7 +20,6 @@ source.. = src/main/java/ additional.bundles = org.eclipse.kura.api,\ slf4j.api,\ org.eclipse.osgi,\ - org.eclipse.osgi.services,\ org.eclipse.osgi.util,\ org.eclipse.equinox.io src.includes = about.html,\ diff --git a/kura/org.eclipse.kura.linux.usb/build.properties b/kura/org.eclipse.kura.linux.usb/build.properties index d138f675cbb..d7fbda9799a 100644 --- a/kura/org.eclipse.kura.linux.usb/build.properties +++ b/kura/org.eclipse.kura.linux.usb/build.properties @@ -20,7 +20,6 @@ source.. = src/main/java/ additional.bundles = org.eclipse.kura.api,\ slf4j.api,\ org.eclipse.osgi,\ - org.eclipse.osgi.services,\ org.eclipse.equinox.io,\ org.eclipse.kura.core src.includes = about.html,\ diff --git a/kura/org.eclipse.kura.linux.watchdog/build.properties b/kura/org.eclipse.kura.linux.watchdog/build.properties index e7ee79cd54f..ff4954e3ded 100644 --- a/kura/org.eclipse.kura.linux.watchdog/build.properties +++ b/kura/org.eclipse.kura.linux.watchdog/build.properties @@ -19,7 +19,6 @@ bin.includes = .,\ source.. = src/main/java/ additional.bundles = org.eclipse.kura.api,\ slf4j.api,\ - org.eclipse.osgi,\ - org.eclipse.osgi.services + org.eclipse.osgi src.includes = about.html,\ about_files/ diff --git a/kura/org.eclipse.kura.log.filesystem.provider/build.properties b/kura/org.eclipse.kura.log.filesystem.provider/build.properties index cfd6617aed3..fc3b961ac48 100644 --- a/kura/org.eclipse.kura.log.filesystem.provider/build.properties +++ b/kura/org.eclipse.kura.log.filesystem.provider/build.properties @@ -18,10 +18,5 @@ bin.includes = META-INF/,\ OSGI-INF/,\ about.html,\ about_files/ -additional.bundles = org.eclipse.osgi,\ - org.eclipse.osgi.services,\ - org.eclipse.osgi.util,\ - org.eclipse.kura.api,\ - slf4j.api src.includes = about.html,\ about_files/ diff --git a/kura/org.eclipse.kura.net.admin.firewall/build.properties b/kura/org.eclipse.kura.net.admin.firewall/build.properties index 4e2203614c8..fcefab7b015 100644 --- a/kura/org.eclipse.kura.net.admin.firewall/build.properties +++ b/kura/org.eclipse.kura.net.admin.firewall/build.properties @@ -22,7 +22,6 @@ additional.bundles = slf4j.api,\ org.eclipse.kura.api,\ org.eclipse.kura.core,\ org.eclipse.osgi,\ - org.eclipse.osgi.services,\ org.eclipse.osgi.util,\ org.eclipse.kura.deployment.agent,\ org.eclipse.equinox.io diff --git a/kura/org.eclipse.kura.network.threat.manager/META-INF/MANIFEST.MF b/kura/org.eclipse.kura.network.threat.manager/META-INF/MANIFEST.MF index 2b7cf2ab2e7..f0cd3080f25 100644 --- a/kura/org.eclipse.kura.network.threat.manager/META-INF/MANIFEST.MF +++ b/kura/org.eclipse.kura.network.threat.manager/META-INF/MANIFEST.MF @@ -8,9 +8,7 @@ Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))" Service-Component: OSGI-INF/*.xml Bundle-ClassPath: . Bundle-ActivationPolicy: lazy -Import-Package: javax.ws.rs;version="2.0.1", - javax.ws.rs.core;version="2.0.1", - org.eclipse.kura;version="[1.6,2.0)", +Import-Package: org.eclipse.kura;version="[1.6,2.0)", org.eclipse.kura.configuration;version="[1.2,2.0)", org.eclipse.kura.core.configuration;version="[2.0,3.0)", org.eclipse.kura.core.configuration.metatype;version="[1.0,2.0)", diff --git a/kura/org.eclipse.kura.nm/build.properties b/kura/org.eclipse.kura.nm/build.properties index a1e13c656c3..506c9db078a 100644 --- a/kura/org.eclipse.kura.nm/build.properties +++ b/kura/org.eclipse.kura.nm/build.properties @@ -36,7 +36,6 @@ additional.bundles = slf4j.api,\ org.eclipse.kura.api,\ org.eclipse.kura.core,\ org.eclipse.osgi,\ - org.eclipse.osgi.services,\ org.eclipse.osgi.util,\ org.eclipse.kura.deployment.agent,\ org.eclipse.equinox.io diff --git a/kura/org.eclipse.kura.request.handler.jaxrs/META-INF/MANIFEST.MF b/kura/org.eclipse.kura.request.handler.jaxrs/META-INF/MANIFEST.MF index bf542936e6c..139ca9f0787 100644 --- a/kura/org.eclipse.kura.request.handler.jaxrs/META-INF/MANIFEST.MF +++ b/kura/org.eclipse.kura.request.handler.jaxrs/META-INF/MANIFEST.MF @@ -8,8 +8,8 @@ Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))" Bundle-ClassPath: . Bundle-ActivationPolicy: lazy Import-Package: com.google.gson, - javax.ws.rs;version="2.0.1", - javax.ws.rs.core;version="2.0.1", + jakarta.ws.rs;version="3.1.0", + jakarta.ws.rs.core;version="3.1.0", org.apache.commons.io;version="2.4.0", org.eclipse.kura;version="[1.6,2.0)", org.eclipse.kura.cloudconnection.message;version="[1.0,2.0)", diff --git a/kura/org.eclipse.kura.request.handler.jaxrs/src/main/java/org/eclipse/kura/request/handler/jaxrs/DefaultExceptionHandler.java b/kura/org.eclipse.kura.request.handler.jaxrs/src/main/java/org/eclipse/kura/request/handler/jaxrs/DefaultExceptionHandler.java index 95733508dee..822714a2c78 100644 --- a/kura/org.eclipse.kura.request.handler.jaxrs/src/main/java/org/eclipse/kura/request/handler/jaxrs/DefaultExceptionHandler.java +++ b/kura/org.eclipse.kura.request.handler.jaxrs/src/main/java/org/eclipse/kura/request/handler/jaxrs/DefaultExceptionHandler.java @@ -15,10 +15,10 @@ import java.lang.reflect.InvocationTargetException; import java.util.Optional; -import javax.ws.rs.WebApplicationException; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import javax.ws.rs.core.Response.Status; +import jakarta.ws.rs.WebApplicationException; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.core.Response.Status; import org.eclipse.kura.KuraErrorCode; import org.eclipse.kura.KuraException; diff --git a/kura/org.eclipse.kura.request.handler.jaxrs/src/main/java/org/eclipse/kura/request/handler/jaxrs/JaxRsRequestHandlerProxy.java b/kura/org.eclipse.kura.request.handler.jaxrs/src/main/java/org/eclipse/kura/request/handler/jaxrs/JaxRsRequestHandlerProxy.java index e2fcc19f30c..82bb7be0ff2 100644 --- a/kura/org.eclipse.kura.request.handler.jaxrs/src/main/java/org/eclipse/kura/request/handler/jaxrs/JaxRsRequestHandlerProxy.java +++ b/kura/org.eclipse.kura.request.handler.jaxrs/src/main/java/org/eclipse/kura/request/handler/jaxrs/JaxRsRequestHandlerProxy.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2021, 2023 Eurotech and/or its affiliates and others + * Copyright (c) 2021, 2024 Eurotech and/or its affiliates and others * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -27,14 +27,6 @@ import java.util.Optional; import java.util.stream.Collectors; -import javax.ws.rs.DELETE; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.core.Context; -import javax.ws.rs.core.Response; - import org.eclipse.kura.KuraErrorCode; import org.eclipse.kura.KuraException; import org.eclipse.kura.cloudconnection.message.KuraMessage; @@ -51,6 +43,14 @@ import com.google.gson.Gson; +import jakarta.ws.rs.DELETE; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.POST; +import jakarta.ws.rs.PUT; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.core.Context; +import jakarta.ws.rs.core.Response; + public class JaxRsRequestHandlerProxy implements RequestHandler { private static final Logger logger = LoggerFactory.getLogger(JaxRsRequestHandlerProxy.class); diff --git a/kura/org.eclipse.kura.request.handler.jaxrs/src/main/java/org/eclipse/kura/request/handler/jaxrs/ResponseBodyHandlers.java b/kura/org.eclipse.kura.request.handler.jaxrs/src/main/java/org/eclipse/kura/request/handler/jaxrs/ResponseBodyHandlers.java index 324df5b7cde..66bd9d9c8dc 100644 --- a/kura/org.eclipse.kura.request.handler.jaxrs/src/main/java/org/eclipse/kura/request/handler/jaxrs/ResponseBodyHandlers.java +++ b/kura/org.eclipse.kura.request.handler.jaxrs/src/main/java/org/eclipse/kura/request/handler/jaxrs/ResponseBodyHandlers.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2021, 2022 Eurotech and/or its affiliates and others + * Copyright (c) 2021, 2024 Eurotech and/or its affiliates and others * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -16,14 +16,14 @@ import java.nio.charset.StandardCharsets; import java.util.Optional; -import javax.ws.rs.core.Response; - import org.apache.commons.io.IOUtils; import org.eclipse.kura.KuraException; import org.eclipse.kura.request.handler.jaxrs.consumer.ResponseBodyHandler; import com.google.gson.Gson; +import jakarta.ws.rs.core.Response; + public final class ResponseBodyHandlers { private ResponseBodyHandlers() { diff --git a/kura/org.eclipse.kura.rest.asset.provider/META-INF/MANIFEST.MF b/kura/org.eclipse.kura.rest.asset.provider/META-INF/MANIFEST.MF index 32709493187..63568cfb5a4 100644 --- a/kura/org.eclipse.kura.rest.asset.provider/META-INF/MANIFEST.MF +++ b/kura/org.eclipse.kura.rest.asset.provider/META-INF/MANIFEST.MF @@ -9,15 +9,16 @@ Bundle-ClassPath: . Bundle-ActivationPolicy: lazy Service-Component: OSGI-INF/*.xml Import-Package: com.google.gson;version="2.7.0", - javax.annotation.security;version="1.2.0", - javax.ws.rs;version="2.0.1", - javax.ws.rs.core;version="2.0.1", + jakarta.annotation.security;version="2.1.1", + jakarta.ws.rs;version="3.1.0", + jakarta.ws.rs.core;version="3.1.0", org.eclipse.kura;version="[1.3,2.0)", org.eclipse.kura.asset;version="[1.0,2.0)", org.eclipse.kura.channel;version="[2.0,3.0)", org.eclipse.kura.rest.utils;version="[1.0,1.1)", org.eclipse.kura.type;version="[1.1,2.0]", org.osgi.framework;version="1.8.0", + org.osgi.service.jakartars.whiteboard.propertytypes;version="2.0.0", org.osgi.service.useradmin;version="1.1.0", org.slf4j;version="1.7.21" Export-Package: org.eclipse.kura.internal.rest.asset diff --git a/kura/org.eclipse.kura.rest.asset.provider/src/main/java/org/eclipse/kura/internal/rest/asset/AssetRestService.java b/kura/org.eclipse.kura.rest.asset.provider/src/main/java/org/eclipse/kura/internal/rest/asset/AssetRestService.java index dc0a339b7d4..f7755d91593 100644 --- a/kura/org.eclipse.kura.rest.asset.provider/src/main/java/org/eclipse/kura/internal/rest/asset/AssetRestService.java +++ b/kura/org.eclipse.kura.rest.asset.provider/src/main/java/org/eclipse/kura/internal/rest/asset/AssetRestService.java @@ -21,17 +21,6 @@ import java.util.List; import java.util.stream.Collectors; -import javax.annotation.security.RolesAllowed; -import javax.ws.rs.Consumes; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.WebApplicationException; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; - import org.eclipse.kura.KuraException; import org.eclipse.kura.asset.Asset; import org.eclipse.kura.asset.AssetService; @@ -41,6 +30,8 @@ import org.osgi.framework.FrameworkUtil; import org.osgi.framework.InvalidSyntaxException; import org.osgi.framework.ServiceReference; +import org.osgi.service.jakartars.whiteboard.propertytypes.JakartarsName; +import org.osgi.service.jakartars.whiteboard.propertytypes.JakartarsResource; import org.osgi.service.useradmin.Role; import org.osgi.service.useradmin.UserAdmin; @@ -50,6 +41,19 @@ import com.google.gson.JsonPrimitive; import com.google.gson.JsonSerializer; +import jakarta.annotation.security.RolesAllowed; +import jakarta.ws.rs.Consumes; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.POST; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.PathParam; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.WebApplicationException; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; + +@JakartarsResource +@JakartarsName("assetRestService") @Path("/assets") public class AssetRestService { diff --git a/kura/org.eclipse.kura.rest.cloudconnection.provider/META-INF/MANIFEST.MF b/kura/org.eclipse.kura.rest.cloudconnection.provider/META-INF/MANIFEST.MF index 0aef9e0af3a..14d13995a60 100644 --- a/kura/org.eclipse.kura.rest.cloudconnection.provider/META-INF/MANIFEST.MF +++ b/kura/org.eclipse.kura.rest.cloudconnection.provider/META-INF/MANIFEST.MF @@ -7,9 +7,9 @@ Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))" Bundle-ClassPath: . Bundle-ActivationPolicy: lazy Service-Component: OSGI-INF/*.xml -Import-Package: javax.annotation.security;version="1.2.0", - javax.ws.rs;version="2.0.1", - javax.ws.rs.core;version="2.0.1", +Import-Package: jakarta.annotation.security;version="2.1.1", + jakarta.ws.rs;version="3.1.0", + jakarta.ws.rs.core;version="3.1.0", org.apache.commons.io;version="2.4.0", org.eclipse.kura;version="[1.3,2.0)", org.eclipse.kura.cloud;version="[1.1,2.0)", @@ -33,5 +33,6 @@ Import-Package: javax.annotation.security;version="1.2.0", org.osgi.service.component;version="[1.3,2.0)", org.osgi.service.component.runtime;version="1.4.0", org.osgi.service.component.runtime.dto;version="1.4.0", + org.osgi.service.jakartars.whiteboard.propertytypes;version="2.0.0", org.osgi.service.useradmin;version="1.1.0", org.slf4j;version="1.7.25" diff --git a/kura/org.eclipse.kura.rest.cloudconnection.provider/pom.xml b/kura/org.eclipse.kura.rest.cloudconnection.provider/pom.xml index 4ba665b47e2..b1a39253718 100644 --- a/kura/org.eclipse.kura.rest.cloudconnection.provider/pom.xml +++ b/kura/org.eclipse.kura.rest.cloudconnection.provider/pom.xml @@ -25,12 +25,11 @@ ${project.basedir}/.. - - ${project.basedir}/../test/*/target/site/jacoco-aggregate/jacoco.xml + ${project.basedir}/../test/*/target/site/jacoco-aggregate/jacoco.xml org.eclipse.kura.rest.cloudconnection.provider eclipse-plugin 2.0.0-SNAPSHOT - + diff --git a/kura/org.eclipse.kura.rest.cloudconnection.provider/src/main/java/org/eclipse/kura/internal/rest/cloudconnection/provider/CloudConnectionRestService.java b/kura/org.eclipse.kura.rest.cloudconnection.provider/src/main/java/org/eclipse/kura/internal/rest/cloudconnection/provider/CloudConnectionRestService.java index 91c7144a16e..0f38dc1abbc 100644 --- a/kura/org.eclipse.kura.rest.cloudconnection.provider/src/main/java/org/eclipse/kura/internal/rest/cloudconnection/provider/CloudConnectionRestService.java +++ b/kura/org.eclipse.kura.rest.cloudconnection.provider/src/main/java/org/eclipse/kura/internal/rest/cloudconnection/provider/CloudConnectionRestService.java @@ -16,17 +16,6 @@ import java.util.Set; import java.util.stream.Collectors; -import javax.annotation.security.RolesAllowed; -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; - import org.eclipse.kura.cloudconnection.request.RequestHandler; import org.eclipse.kura.cloudconnection.request.RequestHandlerRegistry; import org.eclipse.kura.configuration.ComponentConfiguration; @@ -45,11 +34,26 @@ import org.eclipse.kura.rest.configuration.api.PidAndFactoryPid; import org.eclipse.kura.rest.configuration.api.PidSet; import org.eclipse.kura.rest.configuration.api.UpdateComponentConfigurationRequest; +import org.osgi.service.jakartars.whiteboard.propertytypes.JakartarsName; +import org.osgi.service.jakartars.whiteboard.propertytypes.JakartarsResource; import org.osgi.service.useradmin.Role; import org.osgi.service.useradmin.UserAdmin; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import jakarta.annotation.security.RolesAllowed; +import jakarta.ws.rs.Consumes; +import jakarta.ws.rs.DELETE; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.POST; +import jakarta.ws.rs.PUT; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; + +@JakartarsResource +@JakartarsName("cloudConnectionRestService") @Path("cloudconnection/v1") public class CloudConnectionRestService { diff --git a/kura/org.eclipse.kura.rest.command.provider/META-INF/MANIFEST.MF b/kura/org.eclipse.kura.rest.command.provider/META-INF/MANIFEST.MF index ce097858679..0dc6cb1d3a5 100644 --- a/kura/org.eclipse.kura.rest.command.provider/META-INF/MANIFEST.MF +++ b/kura/org.eclipse.kura.rest.command.provider/META-INF/MANIFEST.MF @@ -7,10 +7,10 @@ Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))" Bundle-ClassPath: . Bundle-ActivationPolicy: lazy Service-Component: OSGI-INF/*.xml -Import-Package: javax.annotation.security;version="1.2.0", - javax.ws.rs;version="2.0.1", - javax.ws.rs.core;version="2.0.1", - org.apache.commons.io;version="2.4.0", +Import-Package: jakarta.annotation.security;version="2.1.1", + jakarta.ws.rs;version="3.1.0", + jakarta.ws.rs.core;version="3.1.0", + org.apache.commons.io;version="2.11.0", org.eclipse.kura;version="[1.3,2.0)", org.eclipse.kura.cloud.app.command;version="[1.4,2.0)", org.eclipse.kura.cloudconnection.message;version="[1.0,2.0)", @@ -21,5 +21,6 @@ Import-Package: javax.annotation.security;version="1.2.0", org.osgi.framework;version="1.8.0", org.osgi.service.cm;version="1.6.0", org.osgi.service.component;version="1.3.0", + org.osgi.service.jakartars.whiteboard.propertytypes;version="2.0.0", org.osgi.service.useradmin;version="1.1.0";resolution:=optional, org.slf4j;version="1.7.25" diff --git a/kura/org.eclipse.kura.rest.command.provider/src/main/java/org/eclipse/kura/internal/rest/command/CommandRestService.java b/kura/org.eclipse.kura.rest.command.provider/src/main/java/org/eclipse/kura/internal/rest/command/CommandRestService.java index 1ab16084c0b..98f19fbbeb3 100644 --- a/kura/org.eclipse.kura.rest.command.provider/src/main/java/org/eclipse/kura/internal/rest/command/CommandRestService.java +++ b/kura/org.eclipse.kura.rest.command.provider/src/main/java/org/eclipse/kura/internal/rest/command/CommandRestService.java @@ -18,14 +18,6 @@ import java.util.HashMap; import java.util.Map; -import javax.annotation.security.RolesAllowed; -import javax.ws.rs.Consumes; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; - import org.eclipse.kura.KuraErrorCode; import org.eclipse.kura.KuraException; import org.eclipse.kura.cloud.app.command.CommandCloudApp; @@ -35,11 +27,23 @@ import org.eclipse.kura.request.handler.jaxrs.DefaultExceptionHandler; import org.eclipse.kura.rest.command.api.RestCommandRequest; import org.eclipse.kura.rest.command.api.RestCommandResponse; +import org.osgi.service.jakartars.whiteboard.propertytypes.JakartarsName; +import org.osgi.service.jakartars.whiteboard.propertytypes.JakartarsResource; import org.osgi.service.useradmin.Role; import org.osgi.service.useradmin.UserAdmin; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import jakarta.annotation.security.RolesAllowed; +import jakarta.ws.rs.Consumes; +import jakarta.ws.rs.POST; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; + +@JakartarsResource +@JakartarsName("commandRestService") @Path("/command/v1") public class CommandRestService { diff --git a/kura/org.eclipse.kura.rest.configuration.provider/META-INF/MANIFEST.MF b/kura/org.eclipse.kura.rest.configuration.provider/META-INF/MANIFEST.MF index 5497132b273..9f03b7a550b 100644 --- a/kura/org.eclipse.kura.rest.configuration.provider/META-INF/MANIFEST.MF +++ b/kura/org.eclipse.kura.rest.configuration.provider/META-INF/MANIFEST.MF @@ -7,9 +7,9 @@ Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))" Bundle-ClassPath: . Bundle-ActivationPolicy: lazy Service-Component: OSGI-INF/*.xml -Import-Package: javax.annotation.security;version="1.2.0", - javax.ws.rs;version="2.0.1", - javax.ws.rs.core;version="2.0.1", +Import-Package: jakarta.annotation.security;version="2.1.1", + jakarta.ws.rs;version="3.1.0", + jakarta.ws.rs.core;version="3.1.0", org.apache.commons.io;version="2.4.0", org.eclipse.kura;version="[1.3,2.0)", org.eclipse.kura.cloudconnection.request;version="[1.0,2.0)", @@ -23,6 +23,7 @@ Import-Package: javax.annotation.security;version="1.2.0", org.osgi.framework;version="1.8.0", org.osgi.service.cm;version="1.6.0", org.osgi.service.component;version="1.3.0", + org.osgi.service.jakartars.whiteboard.propertytypes;version="2.0.0", org.osgi.service.useradmin;version="1.1.0";resolution:=optional, org.slf4j;version="1.7.25" Export-Package: org.eclipse.kura.rest.configuration.api;version="1.1.0" diff --git a/kura/org.eclipse.kura.rest.configuration.provider/src/main/java/org/eclipse/kura/internal/rest/configuration/ConfigurationRestService.java b/kura/org.eclipse.kura.rest.configuration.provider/src/main/java/org/eclipse/kura/internal/rest/configuration/ConfigurationRestService.java index 64b966932ba..40972a34926 100644 --- a/kura/org.eclipse.kura.rest.configuration.provider/src/main/java/org/eclipse/kura/internal/rest/configuration/ConfigurationRestService.java +++ b/kura/org.eclipse.kura.rest.configuration.provider/src/main/java/org/eclipse/kura/internal/rest/configuration/ConfigurationRestService.java @@ -22,17 +22,6 @@ import java.util.TreeSet; import java.util.stream.Collectors; -import javax.annotation.security.RolesAllowed; -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; - import org.eclipse.kura.KuraException; import org.eclipse.kura.cloudconnection.request.RequestHandler; import org.eclipse.kura.cloudconnection.request.RequestHandlerRegistry; @@ -57,11 +46,26 @@ import org.eclipse.kura.rest.configuration.api.SnapshotIdSet; import org.eclipse.kura.rest.configuration.api.UpdateComponentConfigurationRequest; import org.osgi.service.cm.ConfigurationAdmin; +import org.osgi.service.jakartars.whiteboard.propertytypes.JakartarsName; +import org.osgi.service.jakartars.whiteboard.propertytypes.JakartarsResource; import org.osgi.service.useradmin.Role; import org.osgi.service.useradmin.UserAdmin; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import jakarta.annotation.security.RolesAllowed; +import jakarta.ws.rs.Consumes; +import jakarta.ws.rs.DELETE; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.POST; +import jakarta.ws.rs.PUT; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; + +@JakartarsResource +@JakartarsName("configurationRestService") @Path("/configuration/v2") public class ConfigurationRestService { @@ -161,9 +165,9 @@ public PidSet listFactoryComponentsPids() { * In case of a request error, an exception is thrown. * * @param factoryComponentConfiguration - * provides all the parameters needed to - * generate a new instance from a Factory - * Component + * provides all the parameters needed to + * generate a new instance from a Factory + * Component * */ @POST @@ -203,15 +207,15 @@ public Response createFactoryComponents(CreateFactoryComponentConfigurationsRequ * deletes the corresponding ConfigurableComponent instance. * * @param pid - * A String representing the pid of the - * instance generated by a Factory - * Component that needs to be - * deleted + * A String representing the pid of the + * instance generated by a Factory + * Component that needs to be + * deleted * @param factoryComponentDeleteRequest - * A {@link FactoryComponentDeleteRequest} - * containing additional information to - * ease the process of - * instance delete + * A {@link FactoryComponentDeleteRequest} + * containing additional information to + * ease the process of + * instance delete */ @DELETE @RolesAllowed("configuration") @@ -373,7 +377,7 @@ public ComponentConfigurationList listComponentConfigurations() { * {@link ConfigurationService} that match the filter specified * * @param filter - * A String representing an OSGi filter + * A String representing an OSGi filter * @return a list of {@link ComponentConfigurationDTO}s for the components that * match the specified filter */ diff --git a/kura/org.eclipse.kura.rest.configuration.provider/src/main/java/org/eclipse/kura/rest/configuration/api/ComponentConfigurationDTO.java b/kura/org.eclipse.kura.rest.configuration.provider/src/main/java/org/eclipse/kura/rest/configuration/api/ComponentConfigurationDTO.java index ddf2f37c869..24d52955e44 100644 --- a/kura/org.eclipse.kura.rest.configuration.provider/src/main/java/org/eclipse/kura/rest/configuration/api/ComponentConfigurationDTO.java +++ b/kura/org.eclipse.kura.rest.configuration.provider/src/main/java/org/eclipse/kura/rest/configuration/api/ComponentConfigurationDTO.java @@ -17,7 +17,7 @@ import java.util.Map.Entry; import java.util.Optional; -import javax.ws.rs.core.Response.Status; +import jakarta.ws.rs.core.Response.Status; import org.eclipse.kura.configuration.metatype.OCD; import org.eclipse.kura.configuration.metatype.Scalar; diff --git a/kura/org.eclipse.kura.rest.configuration.provider/src/main/java/org/eclipse/kura/rest/configuration/api/FactoryComponentConfigurationDTO.java b/kura/org.eclipse.kura.rest.configuration.provider/src/main/java/org/eclipse/kura/rest/configuration/api/FactoryComponentConfigurationDTO.java index 09ad5dc9f07..e2f88c124ce 100644 --- a/kura/org.eclipse.kura.rest.configuration.provider/src/main/java/org/eclipse/kura/rest/configuration/api/FactoryComponentConfigurationDTO.java +++ b/kura/org.eclipse.kura.rest.configuration.provider/src/main/java/org/eclipse/kura/rest/configuration/api/FactoryComponentConfigurationDTO.java @@ -15,7 +15,7 @@ import java.util.Collections; import java.util.Map; -import javax.ws.rs.core.Response.Status; +import jakarta.ws.rs.core.Response.Status; import org.eclipse.kura.request.handler.jaxrs.DefaultExceptionHandler; diff --git a/kura/org.eclipse.kura.rest.configuration.provider/src/main/java/org/eclipse/kura/rest/configuration/api/FailureHandler.java b/kura/org.eclipse.kura.rest.configuration.provider/src/main/java/org/eclipse/kura/rest/configuration/api/FailureHandler.java index 81ec1ea41f0..76c8185c170 100644 --- a/kura/org.eclipse.kura.rest.configuration.provider/src/main/java/org/eclipse/kura/rest/configuration/api/FailureHandler.java +++ b/kura/org.eclipse.kura.rest.configuration.provider/src/main/java/org/eclipse/kura/rest/configuration/api/FailureHandler.java @@ -15,10 +15,10 @@ import java.util.ArrayList; import java.util.List; -import javax.ws.rs.WebApplicationException; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import javax.ws.rs.core.Response.Status; +import jakarta.ws.rs.WebApplicationException; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.core.Response.Status; import org.eclipse.kura.KuraException; import org.slf4j.Logger; diff --git a/kura/org.eclipse.kura.rest.configuration.provider/src/main/java/org/eclipse/kura/rest/configuration/api/PropertyDTO.java b/kura/org.eclipse.kura.rest.configuration.provider/src/main/java/org/eclipse/kura/rest/configuration/api/PropertyDTO.java index bcb5261da50..c6e80d903f4 100644 --- a/kura/org.eclipse.kura.rest.configuration.provider/src/main/java/org/eclipse/kura/rest/configuration/api/PropertyDTO.java +++ b/kura/org.eclipse.kura.rest.configuration.provider/src/main/java/org/eclipse/kura/rest/configuration/api/PropertyDTO.java @@ -17,7 +17,7 @@ import java.util.Optional; import java.util.function.Function; -import javax.ws.rs.core.Response.Status; +import jakarta.ws.rs.core.Response.Status; import org.eclipse.kura.configuration.Password; import org.eclipse.kura.configuration.metatype.Scalar; diff --git a/kura/org.eclipse.kura.rest.configuration.provider/src/main/java/org/eclipse/kura/rest/configuration/api/UpdateComponentConfigurationRequest.java b/kura/org.eclipse.kura.rest.configuration.provider/src/main/java/org/eclipse/kura/rest/configuration/api/UpdateComponentConfigurationRequest.java index 388b1fe959a..fc4410932e0 100644 --- a/kura/org.eclipse.kura.rest.configuration.provider/src/main/java/org/eclipse/kura/rest/configuration/api/UpdateComponentConfigurationRequest.java +++ b/kura/org.eclipse.kura.rest.configuration.provider/src/main/java/org/eclipse/kura/rest/configuration/api/UpdateComponentConfigurationRequest.java @@ -14,7 +14,7 @@ import java.util.List; -import javax.ws.rs.core.Response.Status; +import jakarta.ws.rs.core.Response.Status; import org.eclipse.kura.request.handler.jaxrs.DefaultExceptionHandler; diff --git a/kura/org.eclipse.kura.rest.identity.provider/META-INF/MANIFEST.MF b/kura/org.eclipse.kura.rest.identity.provider/META-INF/MANIFEST.MF index 9f5b57e236a..5c1bac473c3 100644 --- a/kura/org.eclipse.kura.rest.identity.provider/META-INF/MANIFEST.MF +++ b/kura/org.eclipse.kura.rest.identity.provider/META-INF/MANIFEST.MF @@ -7,10 +7,10 @@ Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))" Bundle-ClassPath: . Bundle-ActivationPolicy: lazy Service-Component: OSGI-INF/*.xml -Import-Package: javax.annotation.security;version="1.2.0", - javax.ws.rs;version="2.0.1", - javax.ws.rs.core;version="2.0.1", - org.apache.commons.lang3;version="[3.12.0,4.0.0]", +Import-Package: jakarta.annotation.security;version="2.1.1", + jakarta.ws.rs;version="3.1.0", + jakarta.ws.rs.core;version="3.1.0", + org.apache.commons.lang3;version="3.12.0", org.eclipse.kura;version="[1.3,2.0)", org.eclipse.kura.cloudconnection.request;version="[1.0,2.0)", org.eclipse.kura.configuration;version="[1.2,2.0)", @@ -26,5 +26,6 @@ Import-Package: javax.annotation.security;version="1.2.0", org.osgi.framework;version="1.8.0", org.osgi.service.cm;version="1.6.0", org.osgi.service.component;version="[1.3,2.0)", + org.osgi.service.jakartars.whiteboard.propertytypes;version="2.0.0", org.osgi.service.useradmin;version="1.1.0";resolution:=optional, org.slf4j;version="1.7.25" diff --git a/kura/org.eclipse.kura.rest.identity.provider/src/main/java/org/eclipse/kura/internal/rest/identity/provider/IdentityRestServiceV1.java b/kura/org.eclipse.kura.rest.identity.provider/src/main/java/org/eclipse/kura/internal/rest/identity/provider/IdentityRestServiceV1.java index e45478b0a6c..c56c3b7b5d4 100644 --- a/kura/org.eclipse.kura.rest.identity.provider/src/main/java/org/eclipse/kura/internal/rest/identity/provider/IdentityRestServiceV1.java +++ b/kura/org.eclipse.kura.rest.identity.provider/src/main/java/org/eclipse/kura/internal/rest/identity/provider/IdentityRestServiceV1.java @@ -12,18 +12,6 @@ ******************************************************************************/ package org.eclipse.kura.internal.rest.identity.provider; -import javax.annotation.security.RolesAllowed; -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import javax.ws.rs.core.Response.Status; - import org.eclipse.kura.KuraErrorCode; import org.eclipse.kura.KuraException; import org.eclipse.kura.cloudconnection.request.RequestHandler; @@ -37,11 +25,27 @@ import org.eclipse.kura.request.handler.jaxrs.DefaultExceptionHandler; import org.eclipse.kura.request.handler.jaxrs.JaxRsRequestHandlerProxy; import org.eclipse.kura.util.validation.ValidatorOptions; +import org.osgi.service.jakartars.whiteboard.propertytypes.JakartarsName; +import org.osgi.service.jakartars.whiteboard.propertytypes.JakartarsResource; import org.osgi.service.useradmin.Role; import org.osgi.service.useradmin.UserAdmin; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import jakarta.annotation.security.RolesAllowed; +import jakarta.ws.rs.Consumes; +import jakarta.ws.rs.DELETE; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.POST; +import jakarta.ws.rs.PUT; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.core.Response.Status; + +@JakartarsResource +@JakartarsName("identityRestServiceV1") @SuppressWarnings("restriction") @Path("identity/v1") public class IdentityRestServiceV1 { diff --git a/kura/org.eclipse.kura.rest.identity.provider/src/main/java/org/eclipse/kura/internal/rest/identity/provider/IdentityRestServiceV2.java b/kura/org.eclipse.kura.rest.identity.provider/src/main/java/org/eclipse/kura/internal/rest/identity/provider/IdentityRestServiceV2.java index ddae86e9dd2..b88e930ca97 100644 --- a/kura/org.eclipse.kura.rest.identity.provider/src/main/java/org/eclipse/kura/internal/rest/identity/provider/IdentityRestServiceV2.java +++ b/kura/org.eclipse.kura.rest.identity.provider/src/main/java/org/eclipse/kura/internal/rest/identity/provider/IdentityRestServiceV2.java @@ -19,19 +19,6 @@ import java.util.Set; import java.util.stream.Collectors; -import javax.annotation.security.RolesAllowed; -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.WebApplicationException; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import javax.ws.rs.core.Response.Status; - import org.eclipse.kura.KuraErrorCode; import org.eclipse.kura.KuraException; import org.eclipse.kura.cloudconnection.request.RequestHandler; @@ -52,11 +39,28 @@ import org.eclipse.kura.internal.rest.identity.provider.v2.dto.PermissionDTO; import org.eclipse.kura.request.handler.jaxrs.DefaultExceptionHandler; import org.eclipse.kura.request.handler.jaxrs.JaxRsRequestHandlerProxy; +import org.osgi.service.jakartars.whiteboard.propertytypes.JakartarsName; +import org.osgi.service.jakartars.whiteboard.propertytypes.JakartarsResource; import org.osgi.service.useradmin.Role; import org.osgi.service.useradmin.UserAdmin; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import jakarta.annotation.security.RolesAllowed; +import jakarta.ws.rs.Consumes; +import jakarta.ws.rs.DELETE; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.POST; +import jakarta.ws.rs.PUT; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.WebApplicationException; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.core.Response.Status; + +@JakartarsResource +@JakartarsName("identityRestServiceV2") @Path("identity/v2") public class IdentityRestServiceV2 { diff --git a/kura/org.eclipse.kura.rest.identity.provider/src/main/java/org/eclipse/kura/internal/rest/identity/provider/util/StringUtils.java b/kura/org.eclipse.kura.rest.identity.provider/src/main/java/org/eclipse/kura/internal/rest/identity/provider/util/StringUtils.java index 7f89a63ff68..332bdc9924c 100644 --- a/kura/org.eclipse.kura.rest.identity.provider/src/main/java/org/eclipse/kura/internal/rest/identity/provider/util/StringUtils.java +++ b/kura/org.eclipse.kura.rest.identity.provider/src/main/java/org/eclipse/kura/internal/rest/identity/provider/util/StringUtils.java @@ -14,7 +14,7 @@ import static java.util.Objects.isNull; -import javax.ws.rs.core.Response.Status; +import jakarta.ws.rs.core.Response.Status; import org.eclipse.kura.request.handler.jaxrs.DefaultExceptionHandler; diff --git a/kura/org.eclipse.kura.rest.inventory.provider/META-INF/MANIFEST.MF b/kura/org.eclipse.kura.rest.inventory.provider/META-INF/MANIFEST.MF index 7a9e28ef0b4..1cca997ad9b 100644 --- a/kura/org.eclipse.kura.rest.inventory.provider/META-INF/MANIFEST.MF +++ b/kura/org.eclipse.kura.rest.inventory.provider/META-INF/MANIFEST.MF @@ -7,9 +7,9 @@ Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))" Bundle-ClassPath: . Bundle-ActivationPolicy: lazy Service-Component: OSGI-INF/*.xml -Import-Package: javax.annotation.security;version="1.2.0", - javax.ws.rs;version="2.0.1", - javax.ws.rs.core;version="2.0.1", +Import-Package: jakarta.annotation.security;version="2.1.1", + jakarta.ws.rs;version="3.1.0", + jakarta.ws.rs.core;version="3.1.0", org.apache.commons.io;version="2.4.0", org.eclipse.kura;version="[1.3,2.0)", org.eclipse.kura.cloudconnection.request;version="[1.0,2.0)", diff --git a/kura/org.eclipse.kura.rest.inventory.provider/src/main/java/org/eclipse/kura/internal/rest/inventory/InventoryRestService.java b/kura/org.eclipse.kura.rest.inventory.provider/src/main/java/org/eclipse/kura/internal/rest/inventory/InventoryRestService.java index b7ae1509f7e..df0f13967ef 100644 --- a/kura/org.eclipse.kura.rest.inventory.provider/src/main/java/org/eclipse/kura/internal/rest/inventory/InventoryRestService.java +++ b/kura/org.eclipse.kura.rest.inventory.provider/src/main/java/org/eclipse/kura/internal/rest/inventory/InventoryRestService.java @@ -19,14 +19,14 @@ import java.util.List; import java.util.Map; -import javax.annotation.security.RolesAllowed; -import javax.ws.rs.Consumes; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; +import jakarta.annotation.security.RolesAllowed; +import jakarta.ws.rs.Consumes; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.POST; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; import org.eclipse.kura.KuraErrorCode; import org.eclipse.kura.KuraException; diff --git a/kura/org.eclipse.kura.rest.keystore.provider/META-INF/MANIFEST.MF b/kura/org.eclipse.kura.rest.keystore.provider/META-INF/MANIFEST.MF index 074192b079f..0023f8b8627 100644 --- a/kura/org.eclipse.kura.rest.keystore.provider/META-INF/MANIFEST.MF +++ b/kura/org.eclipse.kura.rest.keystore.provider/META-INF/MANIFEST.MF @@ -5,9 +5,9 @@ Bundle-SymbolicName: org.eclipse.kura.rest.keystore.provider;singleton:=true Bundle-Version: 1.0.0.qualifier Import-Package: com.google.gson;version="2.7.0", com.google.gson.annotations;version="2.7.0", - javax.annotation.security;version="1.2.0", - javax.ws.rs;version="2.0.1", - javax.ws.rs.core;version="2.0.1", + jakarta.annotation.security;version="2.1.1", + jakarta.ws.rs;version="3.1.0", + jakarta.ws.rs.core;version="3.1.0", org.bouncycastle.asn1.pkcs;version="1.78.1", org.bouncycastle.jce.provider;version="1.78.1", org.bouncycastle.openssl;version="1.78.1", @@ -24,6 +24,7 @@ Import-Package: com.google.gson;version="2.7.0", org.eclipse.kura.util.service;version="[1.0,2.0)", org.osgi.framework;version="1.10.0", org.osgi.service.component;version="1.2.0", + org.osgi.service.jakartars.whiteboard.propertytypes;version="2.0.0", org.osgi.service.useradmin;version="1.1.0", org.osgi.util.tracker;version="1.5.2", org.slf4j;version="1.7.36" diff --git a/kura/org.eclipse.kura.rest.keystore.provider/src/main/java/org/eclipse/kura/internal/rest/keystore/provider/KeystoreRestService.java b/kura/org.eclipse.kura.rest.keystore.provider/src/main/java/org/eclipse/kura/internal/rest/keystore/provider/KeystoreRestService.java index 2476ee9dd30..91e077fb648 100644 --- a/kura/org.eclipse.kura.rest.keystore.provider/src/main/java/org/eclipse/kura/internal/rest/keystore/provider/KeystoreRestService.java +++ b/kura/org.eclipse.kura.rest.keystore.provider/src/main/java/org/eclipse/kura/internal/rest/keystore/provider/KeystoreRestService.java @@ -17,15 +17,15 @@ import java.util.List; -import javax.annotation.security.RolesAllowed; -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.MediaType; +import jakarta.annotation.security.RolesAllowed; +import jakarta.ws.rs.Consumes; +import jakarta.ws.rs.DELETE; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.POST; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.QueryParam; +import jakarta.ws.rs.core.MediaType; import org.eclipse.kura.core.keystore.util.EntryInfo; import org.eclipse.kura.internal.rest.keystore.request.CsrReadRequest; diff --git a/kura/org.eclipse.kura.rest.keystore.provider/src/main/java/org/eclipse/kura/internal/rest/keystore/provider/KeystoreRestServiceV1.java b/kura/org.eclipse.kura.rest.keystore.provider/src/main/java/org/eclipse/kura/internal/rest/keystore/provider/KeystoreRestServiceV1.java index 367854949c9..a3dfdda50c9 100644 --- a/kura/org.eclipse.kura.rest.keystore.provider/src/main/java/org/eclipse/kura/internal/rest/keystore/provider/KeystoreRestServiceV1.java +++ b/kura/org.eclipse.kura.rest.keystore.provider/src/main/java/org/eclipse/kura/internal/rest/keystore/provider/KeystoreRestServiceV1.java @@ -12,8 +12,13 @@ *******************************************************************************/ package org.eclipse.kura.internal.rest.keystore.provider; -import javax.ws.rs.Path; +import org.osgi.service.jakartars.whiteboard.propertytypes.JakartarsName; +import org.osgi.service.jakartars.whiteboard.propertytypes.JakartarsResource; +import jakarta.ws.rs.Path; + +@JakartarsResource +@JakartarsName("keystoreRestServiceV1") @Path("/keystores/v1") public class KeystoreRestServiceV1 extends KeystoreRestService { diff --git a/kura/org.eclipse.kura.rest.keystore.provider/src/main/java/org/eclipse/kura/internal/rest/keystore/provider/KeystoreRestServiceV2.java b/kura/org.eclipse.kura.rest.keystore.provider/src/main/java/org/eclipse/kura/internal/rest/keystore/provider/KeystoreRestServiceV2.java index c6326a9bbcf..6fad5331848 100644 --- a/kura/org.eclipse.kura.rest.keystore.provider/src/main/java/org/eclipse/kura/internal/rest/keystore/provider/KeystoreRestServiceV2.java +++ b/kura/org.eclipse.kura.rest.keystore.provider/src/main/java/org/eclipse/kura/internal/rest/keystore/provider/KeystoreRestServiceV2.java @@ -14,15 +14,19 @@ import static org.eclipse.kura.rest.utils.Validable.validate; -import javax.annotation.security.RolesAllowed; -import javax.ws.rs.Consumes; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.core.MediaType; - import org.eclipse.kura.internal.rest.keystore.request.PrivateKeyWriteRequest; import org.eclipse.kura.request.handler.jaxrs.DefaultExceptionHandler; +import org.osgi.service.jakartars.whiteboard.propertytypes.JakartarsName; +import org.osgi.service.jakartars.whiteboard.propertytypes.JakartarsResource; + +import jakarta.annotation.security.RolesAllowed; +import jakarta.ws.rs.Consumes; +import jakarta.ws.rs.POST; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.core.MediaType; +@JakartarsResource +@JakartarsName("keystoreRestServiceV1") @Path("/keystores/v2") public class KeystoreRestServiceV2 extends KeystoreRestService { diff --git a/kura/org.eclipse.kura.rest.keystore.provider/src/main/java/org/eclipse/kura/internal/rest/keystore/util/KeystoreRemoteService.java b/kura/org.eclipse.kura.rest.keystore.provider/src/main/java/org/eclipse/kura/internal/rest/keystore/util/KeystoreRemoteService.java index e83d712096e..56b6dd9bbac 100644 --- a/kura/org.eclipse.kura.rest.keystore.provider/src/main/java/org/eclipse/kura/internal/rest/keystore/util/KeystoreRemoteService.java +++ b/kura/org.eclipse.kura.rest.keystore.provider/src/main/java/org/eclipse/kura/internal/rest/keystore/util/KeystoreRemoteService.java @@ -40,7 +40,7 @@ import java.util.stream.Collectors; import javax.security.auth.x500.X500Principal; -import javax.ws.rs.WebApplicationException; +import jakarta.ws.rs.WebApplicationException; import org.eclipse.kura.KuraErrorCode; import org.eclipse.kura.KuraException; diff --git a/kura/org.eclipse.kura.rest.network.configuration.provider/META-INF/MANIFEST.MF b/kura/org.eclipse.kura.rest.network.configuration.provider/META-INF/MANIFEST.MF index a4a3aec6128..c8c37bf8cfb 100644 --- a/kura/org.eclipse.kura.rest.network.configuration.provider/META-INF/MANIFEST.MF +++ b/kura/org.eclipse.kura.rest.network.configuration.provider/META-INF/MANIFEST.MF @@ -7,9 +7,9 @@ Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))" Bundle-ClassPath: . Bundle-ActivationPolicy: lazy Service-Component: OSGI-INF/*.xml -Import-Package: javax.annotation.security;version="1.2.0", - javax.ws.rs;version="2.0.1", - javax.ws.rs.core;version="2.0.1", +Import-Package: jakarta.annotation.security;version="2.1.1", + jakarta.ws.rs;version="3.1.0", + jakarta.ws.rs.core;version="3.1.0", org.apache.commons.io;version="2.4.0", org.apache.commons.lang3;version="3.12.0", org.eclipse.kura;version="[1.3,2.0)", @@ -25,5 +25,6 @@ Import-Package: javax.annotation.security;version="1.2.0", org.osgi.framework;version="1.8.0", org.osgi.service.cm;version="1.6.0", org.osgi.service.component;version="1.3.0", + org.osgi.service.jakartars.whiteboard.propertytypes;version="2.0.0", org.osgi.service.useradmin;version="1.1.0";resolution:=optional, org.slf4j;version="1.7.25" diff --git a/kura/org.eclipse.kura.rest.network.configuration.provider/src/main/java/org/eclipse/kura/internal/rest/network/configuration/NetworkConfigurationRestService.java b/kura/org.eclipse.kura.rest.network.configuration.provider/src/main/java/org/eclipse/kura/internal/rest/network/configuration/NetworkConfigurationRestService.java index f0873274ead..3406e9a5318 100644 --- a/kura/org.eclipse.kura.rest.network.configuration.provider/src/main/java/org/eclipse/kura/internal/rest/network/configuration/NetworkConfigurationRestService.java +++ b/kura/org.eclipse.kura.rest.network.configuration.provider/src/main/java/org/eclipse/kura/internal/rest/network/configuration/NetworkConfigurationRestService.java @@ -24,17 +24,6 @@ import java.util.Set; import java.util.stream.Collectors; -import javax.annotation.security.RolesAllowed; -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; - import org.apache.commons.lang3.StringUtils; import org.eclipse.kura.KuraErrorCode; import org.eclipse.kura.KuraException; @@ -51,11 +40,26 @@ import org.eclipse.kura.rest.configuration.api.FailureHandler; import org.eclipse.kura.rest.configuration.api.PidSet; import org.eclipse.kura.rest.configuration.api.UpdateComponentConfigurationRequest; +import org.osgi.service.jakartars.whiteboard.propertytypes.JakartarsName; +import org.osgi.service.jakartars.whiteboard.propertytypes.JakartarsResource; import org.osgi.service.useradmin.Role; import org.osgi.service.useradmin.UserAdmin; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import jakarta.annotation.security.RolesAllowed; +import jakarta.ws.rs.Consumes; +import jakarta.ws.rs.DELETE; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.POST; +import jakarta.ws.rs.PUT; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; + +@JakartarsResource +@JakartarsName("networkConfigurationRestService") @Path("networkConfiguration/v1") public class NetworkConfigurationRestService { diff --git a/kura/org.eclipse.kura.rest.network.status.provider/META-INF/MANIFEST.MF b/kura/org.eclipse.kura.rest.network.status.provider/META-INF/MANIFEST.MF index 3f96746e46e..9d10b2f97ba 100644 --- a/kura/org.eclipse.kura.rest.network.status.provider/META-INF/MANIFEST.MF +++ b/kura/org.eclipse.kura.rest.network.status.provider/META-INF/MANIFEST.MF @@ -6,10 +6,9 @@ Bundle-Version: 2.0.0.qualifier Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))" Service-Component: OSGI-INF/*.xml Bundle-ActivationPolicy: lazy -Import-Package: javax.annotation.security;version="1.2.0", - javax.ws.rs;version="2.0.1", - javax.ws.rs.core;version="2.0.1", - javax.ws.rs.ext;version="2.0.1", +Import-Package: jakarta.annotation.security;version="2.1.1", + jakarta.ws.rs;version="3.1.0", + jakarta.ws.rs.core;version="3.1.0", org.eclipse.kura;version="[1.7,2.0)", org.eclipse.kura.cloudconnection.request;version="[1.0,2.0)", org.eclipse.kura.net;version="[2.4,3.0)", @@ -20,6 +19,7 @@ Import-Package: javax.annotation.security;version="1.2.0", org.eclipse.kura.net.status.wifi;version="[1.1,1.2)", org.eclipse.kura.request.handler.jaxrs;version="[1.0,2.0)", org.eclipse.kura.request.handler.jaxrs.annotation;version="[1.0,2.0)", + org.osgi.service.jakartars.whiteboard.propertytypes;version="2.0.0", org.osgi.service.useradmin;version="1.1.0", org.slf4j;version="1.7.36" Export-Package: org.eclipse.kura.network.status.provider.api;version="1.0.0";x-internal:=true diff --git a/kura/org.eclipse.kura.rest.network.status.provider/src/main/java/org/eclipse/kura/internal/network/status/provider/NetworkStatusRestServiceImpl.java b/kura/org.eclipse.kura.rest.network.status.provider/src/main/java/org/eclipse/kura/internal/network/status/provider/NetworkStatusRestServiceImpl.java index 538721b22d4..6b326562e12 100644 --- a/kura/org.eclipse.kura.rest.network.status.provider/src/main/java/org/eclipse/kura/internal/network/status/provider/NetworkStatusRestServiceImpl.java +++ b/kura/org.eclipse.kura.rest.network.status.provider/src/main/java/org/eclipse/kura/internal/network/status/provider/NetworkStatusRestServiceImpl.java @@ -15,14 +15,6 @@ import java.util.ArrayList; import java.util.List; -import javax.annotation.security.RolesAllowed; -import javax.ws.rs.Consumes; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.core.MediaType; - import org.eclipse.kura.KuraErrorCode; import org.eclipse.kura.KuraException; import org.eclipse.kura.cloudconnection.request.RequestHandler; @@ -34,11 +26,23 @@ import org.eclipse.kura.network.status.provider.api.InterfaceStatusListDTO; import org.eclipse.kura.request.handler.jaxrs.DefaultExceptionHandler; import org.eclipse.kura.request.handler.jaxrs.JaxRsRequestHandlerProxy; +import org.osgi.service.jakartars.whiteboard.propertytypes.JakartarsName; +import org.osgi.service.jakartars.whiteboard.propertytypes.JakartarsResource; import org.osgi.service.useradmin.Role; import org.osgi.service.useradmin.UserAdmin; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import jakarta.annotation.security.RolesAllowed; +import jakarta.ws.rs.Consumes; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.POST; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.core.MediaType; + +@JakartarsResource +@JakartarsName("networkStatusRestServiceImpl") @Path("/networkStatus/v1") public class NetworkStatusRestServiceImpl { diff --git a/kura/org.eclipse.kura.rest.packages.provider/META-INF/MANIFEST.MF b/kura/org.eclipse.kura.rest.packages.provider/META-INF/MANIFEST.MF index f471afa6fb7..4235cffad28 100644 --- a/kura/org.eclipse.kura.rest.packages.provider/META-INF/MANIFEST.MF +++ b/kura/org.eclipse.kura.rest.packages.provider/META-INF/MANIFEST.MF @@ -8,17 +8,16 @@ Bundle-ClassPath: . Bundle-ActivationPolicy: lazy Service-Component: OSGI-INF/*.xml Import-Package: com.google.gson;version="2.7.0", - javax.annotation.security;version="1.2.0", - javax.ws.rs;version="2.0.1", - javax.ws.rs.core;version="2.0.1", - javax.ws.rs.ext;version="2.0.1", - org.apache.commons.io;version="[2.0,3.0)", + jakarta.annotation.security;version="2.1.1", + jakarta.ws.rs;version="3.1.0", + jakarta.ws.rs.core;version="3.1.0", + org.apache.commons.io;version="2.11.0", org.eclipse.kura;version="[1.3,2.0)", org.eclipse.kura.deployment.agent;version="[1.1,2.0)", - org.glassfish.jersey.media.multipart;version="[2.0,3.0)", org.osgi.framework;version="1.8.0", org.osgi.service.component;version="1.3.0", org.osgi.service.deploymentadmin;version="1.0.0", + org.osgi.service.jakartars.whiteboard.propertytypes;version="2.0.0", org.osgi.service.useradmin;version="1.1.0";resolution:=optional, org.slf4j;version="1.7.21" Export-Package: org.eclipse.kura.rest.deployment.agent.api;version="1.0.0";x-internal:=true diff --git a/kura/org.eclipse.kura.rest.packages.provider/src/main/java/org/eclipse/kura/internal/rest/deployment/agent/DeploymentRestService.java b/kura/org.eclipse.kura.rest.packages.provider/src/main/java/org/eclipse/kura/internal/rest/deployment/agent/DeploymentRestService.java index b28a6226f29..10b55d8c481 100644 --- a/kura/org.eclipse.kura.rest.packages.provider/src/main/java/org/eclipse/kura/internal/rest/deployment/agent/DeploymentRestService.java +++ b/kura/org.eclipse.kura.rest.packages.provider/src/main/java/org/eclipse/kura/internal/rest/deployment/agent/DeploymentRestService.java @@ -27,34 +27,38 @@ import java.util.UUID; import java.util.regex.Pattern; -import javax.annotation.security.RolesAllowed; -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.WebApplicationException; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; - import org.apache.commons.io.IOUtils; import org.eclipse.kura.deployment.agent.DeploymentAgentService; import org.eclipse.kura.deployment.agent.MarketplacePackageDescriptor; import org.eclipse.kura.rest.deployment.agent.api.DeploymentRequestStatus; import org.eclipse.kura.rest.deployment.agent.api.DescriptorRequest; import org.eclipse.kura.rest.deployment.agent.api.InstallRequest; -import org.glassfish.jersey.media.multipart.FormDataContentDisposition; -import org.glassfish.jersey.media.multipart.FormDataParam; import org.osgi.service.deploymentadmin.DeploymentAdmin; import org.osgi.service.deploymentadmin.DeploymentPackage; +import org.osgi.service.jakartars.whiteboard.propertytypes.JakartarsName; +import org.osgi.service.jakartars.whiteboard.propertytypes.JakartarsResource; import org.osgi.service.useradmin.Role; import org.osgi.service.useradmin.UserAdmin; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import jakarta.annotation.security.RolesAllowed; +import jakarta.ws.rs.Consumes; +import jakarta.ws.rs.DELETE; +import jakarta.ws.rs.FormParam; +import jakarta.ws.rs.GET; +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.WebApplicationException; +import jakarta.ws.rs.core.EntityPart; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; + +@JakartarsResource +@JakartarsName("deploymentRestService") @Path("/deploy/v2") public class DeploymentRestService { @@ -210,11 +214,15 @@ public DeploymentRequestStatus installDeploymentPackage(InstallRequest installRe @Path("/_upload") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.MULTIPART_FORM_DATA) - public DeploymentRequestStatus installUploadedDeploymentPackage( - @FormDataParam("file") InputStream uploadedInputStream, - @FormDataParam("file") FormDataContentDisposition fileDetails) { + public DeploymentRequestStatus installUploadedDeploymentPackage(@FormParam("file") EntityPart part, + @FormParam("file") InputStream uploadedInputStream) { + + if (part == null || !part.getFileName().isPresent()) { + throw new WebApplicationException(Response.status(Response.Status.BAD_REQUEST).type(MediaType.TEXT_PLAIN) + .entity("Missing file").build()); + } - final String uploadedFileName = fileDetails.getFileName(); + final String uploadedFileName = part.getFileName().get(); final String uploadedFileLocation = System.getProperty(JAVA_IO_TMPDIR) + File.separator + UUID.randomUUID() + ".dp"; diff --git a/kura/org.eclipse.kura.rest.packages.provider/src/main/java/org/eclipse/kura/rest/deployment/agent/api/Validable.java b/kura/org.eclipse.kura.rest.packages.provider/src/main/java/org/eclipse/kura/rest/deployment/agent/api/Validable.java index f96afa79b85..3aeb07e2e7b 100644 --- a/kura/org.eclipse.kura.rest.packages.provider/src/main/java/org/eclipse/kura/rest/deployment/agent/api/Validable.java +++ b/kura/org.eclipse.kura.rest.packages.provider/src/main/java/org/eclipse/kura/rest/deployment/agent/api/Validable.java @@ -12,10 +12,10 @@ *******************************************************************************/ package org.eclipse.kura.rest.deployment.agent.api; -import javax.ws.rs.WebApplicationException; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import javax.ws.rs.core.Response.Status; +import jakarta.ws.rs.WebApplicationException; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.core.Response.Status; public interface Validable { diff --git a/kura/org.eclipse.kura.rest.position.provider/META-INF/MANIFEST.MF b/kura/org.eclipse.kura.rest.position.provider/META-INF/MANIFEST.MF index 5f36d89eb1a..a8f98157d08 100644 --- a/kura/org.eclipse.kura.rest.position.provider/META-INF/MANIFEST.MF +++ b/kura/org.eclipse.kura.rest.position.provider/META-INF/MANIFEST.MF @@ -7,25 +7,26 @@ Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))" Bundle-ClassPath: . Bundle-ActivationPolicy: lazy Service-Component: OSGI-INF/*.xml -Import-Package: javax.annotation.security;version="1.2.0", - javax.ws.rs;version="2.0.1", - javax.ws.rs.core;version="2.0.1", - org.apache.commons.io;version="2.4.0", +Import-Package: jakarta.annotation.security;version="2.1.1", + jakarta.ws.rs;version="3.1.0", + jakarta.ws.rs.core;version="3.1.0", + org.apache.commons.io;version="2.11.0", org.eclipse.kura;version="[1.3,2.0)", - org.eclipse.kura.cloudconnection.request;version="[1.0,2.0)", - org.eclipse.kura.message;version="[1.0,2.0)", org.eclipse.kura.cloudconnection.message;version="[1.0,2.0)", + org.eclipse.kura.cloudconnection.request;version="[1.0,2.0)", org.eclipse.kura.comm;version="[1.0,2.0)", - org.eclipse.kura.position;version="[1.4,1.5)", org.eclipse.kura.crypto;version="[1.3,2.0)", + org.eclipse.kura.message;version="[1.0,2.0)", + org.eclipse.kura.position;version="[1.4,1.5)", org.eclipse.kura.request.handler.jaxrs;version="[1.0,2.0)", org.eclipse.kura.request.handler.jaxrs.annotation;version="[1.0,2.0)", org.osgi.framework;version="1.8.0", org.osgi.service.cm;version="1.6.0", org.osgi.service.component;version="1.2.0", - org.osgi.service.useradmin;version="1.1.0";resolution:=optional, org.osgi.service.event;version="1.3.0", org.osgi.service.io;version="1.0.0", + org.osgi.service.jakartars.whiteboard.propertytypes;version="2.0.0", + org.osgi.service.useradmin;version="1.1.0";resolution:=optional, org.osgi.util.measurement;version="1.0.1", org.osgi.util.position;version="1.0.1", org.slf4j;version="1.7.25" diff --git a/kura/org.eclipse.kura.rest.position.provider/src/main/java/org/eclipse/kura/internal/rest/position/PositionRestService.java b/kura/org.eclipse.kura.rest.position.provider/src/main/java/org/eclipse/kura/internal/rest/position/PositionRestService.java index 52153a10b15..ede962ecf7b 100644 --- a/kura/org.eclipse.kura.rest.position.provider/src/main/java/org/eclipse/kura/internal/rest/position/PositionRestService.java +++ b/kura/org.eclipse.kura.rest.position.provider/src/main/java/org/eclipse/kura/internal/rest/position/PositionRestService.java @@ -12,12 +12,6 @@ *******************************************************************************/ package org.eclipse.kura.internal.rest.position; -import javax.annotation.security.RolesAllowed; -import javax.ws.rs.GET; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.core.MediaType; - import org.eclipse.kura.KuraErrorCode; import org.eclipse.kura.KuraException; import org.eclipse.kura.cloudconnection.request.RequestHandler; @@ -28,11 +22,21 @@ import org.eclipse.kura.rest.position.api.DateTimeDTO; import org.eclipse.kura.rest.position.api.IsLockedDTO; import org.eclipse.kura.rest.position.api.PositionDTO; +import org.osgi.service.jakartars.whiteboard.propertytypes.JakartarsName; +import org.osgi.service.jakartars.whiteboard.propertytypes.JakartarsResource; import org.osgi.service.useradmin.Role; import org.osgi.service.useradmin.UserAdmin; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import jakarta.annotation.security.RolesAllowed; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.core.MediaType; + +@JakartarsResource +@JakartarsName("positionRestService") @Path("/position/v1") public class PositionRestService { diff --git a/kura/org.eclipse.kura.rest.provider/META-INF/MANIFEST.MF b/kura/org.eclipse.kura.rest.provider/META-INF/MANIFEST.MF index 5aa5bf8ada4..c5dc5f57cd5 100644 --- a/kura/org.eclipse.kura.rest.provider/META-INF/MANIFEST.MF +++ b/kura/org.eclipse.kura.rest.provider/META-INF/MANIFEST.MF @@ -6,14 +6,15 @@ Bundle-Version: 2.0.0.qualifier Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))" Service-Component: OSGI-INF/*.xml Bundle-ActivationPolicy: lazy -Import-Package: com.eclipsesource.jaxrs.provider.security;version="2.2.0", - javax.annotation;version="1.2.0", - javax.servlet;version="3.1.0", - javax.servlet.http;version="3.1.0", - javax.ws.rs;version="2.0.1", - javax.ws.rs.container;version="2.0.1", - javax.ws.rs.core;version="2.0.1", - javax.ws.rs.ext;version="2.0.1", +Import-Package: com.google.gson;version="2.9.0", + jakarta.annotation;version="2.1.1", + jakarta.annotation.security;version="2.1.1", + jakarta.servlet;version="5.0.0", + jakarta.servlet.http;version="5.0.0", + jakarta.ws.rs;version="3.1.0", + jakarta.ws.rs.container;version="3.1.0", + jakarta.ws.rs.core;version="3.1.0", + jakarta.ws.rs.ext;version="3.1.0", org.eclipse.kura;version="[1.3,2.0)", org.eclipse.kura.audit;version="[1.0,2.0)", org.eclipse.kura.configuration;version="[1.2,2.0)", @@ -25,6 +26,7 @@ Import-Package: com.eclipsesource.jaxrs.provider.security;version="2.2.0", org.osgi.annotation.versioning;version="[1.0.0,2.0.0)";resolution:=optional, org.osgi.framework;version="1.10.0", org.osgi.service.cm;version="1.6.0", + org.osgi.service.component;version="1.5.0", org.osgi.service.useradmin;version="1.1.0", org.osgi.util.tracker;version="1.5.2", org.slf4j;version="1.7.21" diff --git a/kura/org.eclipse.kura.rest.provider/OSGI-INF/rest_service.xml b/kura/org.eclipse.kura.rest.provider/OSGI-INF/rest_service.xml index d9e8d14baf3..7a1bef4a47c 100644 --- a/kura/org.eclipse.kura.rest.provider/OSGI-INF/rest_service.xml +++ b/kura/org.eclipse.kura.rest.provider/OSGI-INF/rest_service.xml @@ -16,11 +16,11 @@ + - - + diff --git a/kura/org.eclipse.kura.rest.provider/src/main/java/org/eclipse/kura/internal/rest/auth/BasicAuthenticationProvider.java b/kura/org.eclipse.kura.rest.provider/src/main/java/org/eclipse/kura/internal/rest/auth/BasicAuthenticationProvider.java index a18e04605e4..1a93400ab90 100644 --- a/kura/org.eclipse.kura.rest.provider/src/main/java/org/eclipse/kura/internal/rest/auth/BasicAuthenticationProvider.java +++ b/kura/org.eclipse.kura.rest.provider/src/main/java/org/eclipse/kura/internal/rest/auth/BasicAuthenticationProvider.java @@ -22,12 +22,7 @@ import java.util.Optional; import java.util.StringTokenizer; -import javax.annotation.Priority; -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.container.ContainerRequestContext; -import javax.ws.rs.container.ContainerResponseContext; -import javax.ws.rs.container.ContainerResponseFilter; -import javax.ws.rs.ext.Provider; +import jakarta.servlet.http.HttpServletRequest; import org.eclipse.kura.audit.AuditConstants; import org.eclipse.kura.audit.AuditContext; @@ -38,6 +33,12 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import jakarta.annotation.Priority; +import jakarta.ws.rs.container.ContainerRequestContext; +import jakarta.ws.rs.container.ContainerResponseContext; +import jakarta.ws.rs.container.ContainerResponseFilter; +import jakarta.ws.rs.ext.Provider; + @SuppressWarnings("restriction") @Priority(200) public class BasicAuthenticationProvider implements AuthenticationProvider { diff --git a/kura/org.eclipse.kura.rest.provider/src/main/java/org/eclipse/kura/internal/rest/auth/CertificateAuthenticationProvider.java b/kura/org.eclipse.kura.rest.provider/src/main/java/org/eclipse/kura/internal/rest/auth/CertificateAuthenticationProvider.java index 7044f52dce4..570b6c039db 100644 --- a/kura/org.eclipse.kura.rest.provider/src/main/java/org/eclipse/kura/internal/rest/auth/CertificateAuthenticationProvider.java +++ b/kura/org.eclipse.kura.rest.provider/src/main/java/org/eclipse/kura/internal/rest/auth/CertificateAuthenticationProvider.java @@ -16,11 +16,9 @@ import java.security.cert.X509Certificate; import java.util.Optional; -import javax.annotation.Priority; import javax.naming.ldap.LdapName; import javax.naming.ldap.Rdn; -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.container.ContainerRequestContext; +import jakarta.servlet.http.HttpServletRequest; import org.eclipse.kura.audit.AuditConstants; import org.eclipse.kura.audit.AuditContext; @@ -29,6 +27,9 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import jakarta.annotation.Priority; +import jakarta.ws.rs.container.ContainerRequestContext; + @SuppressWarnings("restriction") @Priority(100) public class CertificateAuthenticationProvider implements AuthenticationProvider { @@ -73,7 +74,7 @@ public Principal authenticate(final ContainerRequestContext requestContext) thro try { - final Object clientCertificatesRaw = requestContext.getProperty("javax.servlet.request.X509Certificate"); + final Object clientCertificatesRaw = requestContext.getProperty("jakarta.servlet.request.X509Certificate"); if (!(clientCertificatesRaw instanceof X509Certificate[])) { throw new CertificateAuthException(CertificateAuthException.Reason.CLIENT_CERTIFICATE_CHAIN_MISSING); diff --git a/kura/org.eclipse.kura.rest.provider/src/main/java/org/eclipse/kura/internal/rest/auth/RestSessionHelper.java b/kura/org.eclipse.kura.rest.provider/src/main/java/org/eclipse/kura/internal/rest/auth/RestSessionHelper.java index c891cd015a1..7c7facc881b 100644 --- a/kura/org.eclipse.kura.rest.provider/src/main/java/org/eclipse/kura/internal/rest/auth/RestSessionHelper.java +++ b/kura/org.eclipse.kura.rest.provider/src/main/java/org/eclipse/kura/internal/rest/auth/RestSessionHelper.java @@ -18,15 +18,16 @@ import java.util.UUID; import java.util.concurrent.TimeUnit; -import javax.servlet.http.Cookie; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; -import javax.ws.rs.container.ContainerRequestContext; +import jakarta.servlet.http.Cookie; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpSession; import org.eclipse.kura.audit.AuditContext; import org.eclipse.kura.util.useradmin.UserAdminHelper; +import jakarta.ws.rs.container.ContainerRequestContext; + @SuppressWarnings("restriction") public class RestSessionHelper { diff --git a/kura/org.eclipse.kura.rest.provider/src/main/java/org/eclipse/kura/internal/rest/auth/SessionAuthProvider.java b/kura/org.eclipse.kura.rest.provider/src/main/java/org/eclipse/kura/internal/rest/auth/SessionAuthProvider.java index 0d2b2f0bead..9dfadc0a29c 100644 --- a/kura/org.eclipse.kura.rest.provider/src/main/java/org/eclipse/kura/internal/rest/auth/SessionAuthProvider.java +++ b/kura/org.eclipse.kura.rest.provider/src/main/java/org/eclipse/kura/internal/rest/auth/SessionAuthProvider.java @@ -18,11 +18,8 @@ import java.util.Set; import java.util.stream.Collectors; -import javax.annotation.Priority; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpSession; -import javax.ws.rs.container.ContainerRequestContext; -import javax.ws.rs.core.PathSegment; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpSession; import org.eclipse.kura.audit.AuditConstants; import org.eclipse.kura.audit.AuditContext; @@ -31,6 +28,10 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import jakarta.annotation.Priority; +import jakarta.ws.rs.container.ContainerRequestContext; +import jakarta.ws.rs.core.PathSegment; + @Priority(300) public class SessionAuthProvider implements AuthenticationProvider { @@ -85,22 +86,19 @@ public Optional authenticate(final HttpServletRequest request, auditContext.getProperties().put(AuditConstants.KEY_IDENTITY.getValue(), result.get().getName()); if (!isXsrfTokenValid(request, requestContext)) { - auditLogger.warn("{} Rest - Failure - Session authentication failed, invalid XSRF token", - auditContext); + auditLogger.warn("{} Rest - Failure - Session authentication failed, invalid XSRF token", auditContext); return Optional.empty(); } - if (this.sessionHelper - .isSessionExpired(session.get(), this.restServiceOptions.getSessionInactivityInterval())) { - auditLogger.warn("{} Rest - Failure - Session authentication failed, session expired", - auditContext); + if (this.sessionHelper.isSessionExpired(session.get(), + this.restServiceOptions.getSessionInactivityInterval())) { + auditLogger.warn("{} Rest - Failure - Session authentication failed, session expired", auditContext); session.get().invalidate(); return Optional.empty(); } if (isSessionLocked(session.get(), requestContext)) { - auditLogger.warn("{} Rest - Failure - Session authentication failed, session is locked", - auditContext); + auditLogger.warn("{} Rest - Failure - Session authentication failed, session is locked", auditContext); return Optional.empty(); } @@ -136,8 +134,7 @@ private boolean isXsrfTokenValid(final HttpServletRequest request, final Contain private boolean containsPath(final Set paths, final ContainerRequestContext requestContext) { final String reuqestPath = '/' + requestContext.getUriInfo().getPathSegments().stream() - .map(PathSegment::getPath) - .collect(Collectors.joining("/")); + .map(PathSegment::getPath).collect(Collectors.joining("/")); return paths.contains(reuqestPath); } diff --git a/kura/org.eclipse.kura.rest.provider/src/main/java/org/eclipse/kura/internal/rest/auth/SessionRestService.java b/kura/org.eclipse.kura.rest.provider/src/main/java/org/eclipse/kura/internal/rest/auth/SessionRestService.java index 3afd5d4a840..6f6f47cb508 100644 --- a/kura/org.eclipse.kura.rest.provider/src/main/java/org/eclipse/kura/internal/rest/auth/SessionRestService.java +++ b/kura/org.eclipse.kura.rest.provider/src/main/java/org/eclipse/kura/internal/rest/auth/SessionRestService.java @@ -19,19 +19,9 @@ import java.util.Optional; import java.util.Set; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; -import javax.ws.rs.Consumes; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.WebApplicationException; -import javax.ws.rs.container.ContainerRequestContext; -import javax.ws.rs.core.Context; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response.Status; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpSession; import org.eclipse.kura.audit.AuditConstants; import org.eclipse.kura.audit.AuditContext; @@ -52,6 +42,17 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import jakarta.ws.rs.Consumes; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.POST; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.WebApplicationException; +import jakarta.ws.rs.container.ContainerRequestContext; +import jakarta.ws.rs.core.Context; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response.Status; + @SuppressWarnings("restriction") @Path(SessionRestServiceConstants.BASE_PATH) public class SessionRestService { diff --git a/kura/org.eclipse.kura.rest.provider/src/main/java/org/eclipse/kura/internal/rest/auth/dto/UpdatePasswordDTO.java b/kura/org.eclipse.kura.rest.provider/src/main/java/org/eclipse/kura/internal/rest/auth/dto/UpdatePasswordDTO.java index f43a8ab15cb..52593daf2ab 100644 --- a/kura/org.eclipse.kura.rest.provider/src/main/java/org/eclipse/kura/internal/rest/auth/dto/UpdatePasswordDTO.java +++ b/kura/org.eclipse.kura.rest.provider/src/main/java/org/eclipse/kura/internal/rest/auth/dto/UpdatePasswordDTO.java @@ -12,7 +12,7 @@ *******************************************************************************/ package org.eclipse.kura.internal.rest.auth.dto; -import javax.ws.rs.core.Response.Status; +import jakarta.ws.rs.core.Response.Status; import org.eclipse.kura.request.handler.jaxrs.DefaultExceptionHandler; diff --git a/kura/org.eclipse.kura.rest.provider/src/main/java/org/eclipse/kura/internal/rest/auth/dto/UsernamePasswordDTO.java b/kura/org.eclipse.kura.rest.provider/src/main/java/org/eclipse/kura/internal/rest/auth/dto/UsernamePasswordDTO.java index 0e80066d465..4eac36cf247 100644 --- a/kura/org.eclipse.kura.rest.provider/src/main/java/org/eclipse/kura/internal/rest/auth/dto/UsernamePasswordDTO.java +++ b/kura/org.eclipse.kura.rest.provider/src/main/java/org/eclipse/kura/internal/rest/auth/dto/UsernamePasswordDTO.java @@ -12,7 +12,7 @@ *******************************************************************************/ package org.eclipse.kura.internal.rest.auth.dto; -import javax.ws.rs.core.Response.Status; +import jakarta.ws.rs.core.Response.Status; import org.eclipse.kura.request.handler.jaxrs.DefaultExceptionHandler; diff --git a/kura/org.eclipse.kura.rest.provider/src/main/java/org/eclipse/kura/internal/rest/provider/AuditFilter.java b/kura/org.eclipse.kura.rest.provider/src/main/java/org/eclipse/kura/internal/rest/provider/AuditFilter.java new file mode 100644 index 00000000000..23c597ce626 --- /dev/null +++ b/kura/org.eclipse.kura.rest.provider/src/main/java/org/eclipse/kura/internal/rest/provider/AuditFilter.java @@ -0,0 +1,74 @@ +/******************************************************************************* + * Copyright (c) 2024 Eurotech and/or its affiliates and others + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Eurotech + *******************************************************************************/ + +package org.eclipse.kura.internal.rest.provider; + +import java.io.IOException; + +import org.eclipse.kura.audit.AuditContext; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import jakarta.servlet.http.HttpServletRequest; +import jakarta.ws.rs.container.ContainerRequestContext; +import jakarta.ws.rs.container.ContainerResponseContext; +import jakarta.ws.rs.container.ContainerResponseFilter; +import jakarta.ws.rs.core.Context; + +public class AuditFilter implements ContainerResponseFilter { + + private static final Logger auditLogger = LoggerFactory.getLogger("AuditLogger"); + + @Context + private HttpServletRequest request; + + @Override + public void filter(final ContainerRequestContext requestContext, final ContainerResponseContext responseContext) + throws IOException { + int responseStatus = responseContext.getStatus(); + + final AuditContext auditContext = RestServiceUtils.initAuditContext(requestContext, request); + + try { + if (responseContext.getStatus() == 404) { + auditLogger.warn("{} Rest - Failure - Service not found", auditContext); + return; + } + + if (responseContext.getStatus() == 403) { + if (requestContext.getSecurityContext() == null + || requestContext.getSecurityContext().getUserPrincipal() == null) { + responseContext.setStatus(401); + } else { + auditLogger.warn("{} Rest - Failure - User not authorized to perform the requested operation", + auditContext); + return; + } + + } + + if (responseContext.getStatus() == 401) { + auditLogger.warn("{} Rest - Failure - User not authenticated", auditContext); + return; + } + + if (responseStatus >= 200 && responseStatus < 400) { + auditLogger.info("{} Rest - Success - Rest request succeeded", auditContext); + } else { + auditLogger.warn("{} Rest - Failure - Request failed", auditContext); + } + } finally { + RestServiceUtils.closeAuditContext(requestContext); + } + } +} diff --git a/kura/org.eclipse.kura.rest.provider/src/main/java/org/eclipse/kura/internal/rest/provider/AuthenticationFilter.java b/kura/org.eclipse.kura.rest.provider/src/main/java/org/eclipse/kura/internal/rest/provider/AuthenticationFilter.java new file mode 100644 index 00000000000..93d75b99bf6 --- /dev/null +++ b/kura/org.eclipse.kura.rest.provider/src/main/java/org/eclipse/kura/internal/rest/provider/AuthenticationFilter.java @@ -0,0 +1,170 @@ +/******************************************************************************* + * Copyright (c) 2024 Eurotech and/or its affiliates and others + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Eurotech + *******************************************************************************/ + +package org.eclipse.kura.internal.rest.provider; + +import java.io.IOException; +import java.security.Principal; +import java.util.Iterator; +import java.util.Optional; +import java.util.Set; +import java.util.TreeSet; + +import org.eclipse.kura.rest.auth.AuthenticationProvider; +import org.osgi.service.useradmin.Group; +import org.osgi.service.useradmin.Role; +import org.osgi.service.useradmin.User; +import org.osgi.service.useradmin.UserAdmin; + +import jakarta.annotation.Priority; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.ws.rs.Priorities; +import jakarta.ws.rs.container.ContainerRequestContext; +import jakarta.ws.rs.container.ContainerRequestFilter; +import jakarta.ws.rs.core.Context; +import jakarta.ws.rs.core.SecurityContext; +import jakarta.ws.rs.ext.Provider; + +@Provider +@Priority(Priorities.AUTHENTICATION) +public class AuthenticationFilter implements ContainerRequestFilter { + + private static final String KURA_PERMISSION_PREFIX = "kura.permission."; + private static final String KURA_PERMISSION_REST_PREFIX = KURA_PERMISSION_PREFIX + "rest."; + private static final String KURA_USER_PREFIX = "kura.user."; + + private final Set authenticationProviders = new TreeSet<>(); + private UserAdmin userAdmin; + + @Context + private HttpServletRequest request; + @Context + private HttpServletResponse response; + + public void setUserAdmin(final UserAdmin userAdmin) { + this.userAdmin = userAdmin; + } + + public void registerAuthenticationProvider(final AuthenticationProvider authenticationProvider) { + synchronized (this.authenticationProviders) { + final AuthenticationProviderHolder holder = new AuthenticationProviderHolder(authenticationProvider); + this.authenticationProviders.add(holder); + holder.onEnabled(); + } + } + + public void unregisterAuthenticationProvider(final AuthenticationProvider authenticationProvider) { + synchronized (this.authenticationProviders) { + final AuthenticationProviderHolder holder = new AuthenticationProviderHolder(authenticationProvider); + if (this.authenticationProviders.remove(holder)) { + holder.onDisabled(); + } + } + } + + @Override + public void filter(final ContainerRequestContext requestContext) throws IOException { + + RestServiceUtils.initAuditContext(requestContext, request); + + final Optional principal = authenticate(requestContext); + final boolean isSecure = requestContext.getUriInfo().getRequestUri().getScheme().equals("https"); + + if (principal.isPresent()) { + requestContext.setSecurityContext(new SecurityContext() { + + final Principal currentPrincipal = principal.get(); + + @Override + public String getAuthenticationScheme() { + return null; + } + + @Override + public Principal getUserPrincipal() { + return currentPrincipal; + } + + @Override + public boolean isSecure() { + return isSecure; + } + + @Override + public boolean isUserInRole(final String role) { + return AuthenticationFilter.this.isUserInRole(currentPrincipal, role); + } + }); + } + } + + private Optional authenticate(final ContainerRequestContext requestContext) { + synchronized (this.authenticationProviders) { + for (final AuthenticationProviderHolder provider : this.authenticationProviders) { + final Optional principal = provider.authenticate(request, requestContext); + + if (principal.isPresent()) { + return principal; + } + } + } + + return Optional.empty(); + } + + private boolean isUserInRole(final Principal requestUser, final String role) { + + try { + final User user = (User) this.userAdmin.getRole(KURA_USER_PREFIX + requestUser.getName()); + + return containsBasicMember(this.userAdmin.getRole(KURA_PERMISSION_REST_PREFIX + role), user) + || containsBasicMember(this.userAdmin.getRole(KURA_PERMISSION_PREFIX + "kura.admin"), user); + + } catch (final Exception e) { + return false; + } + } + + private static boolean containsBasicMember(final Role group, final User user) { + if (!(group instanceof Group)) { + return false; + } + + final Group asGroup = (Group) group; + + final Role[] members = asGroup.getMembers(); + + if (members == null) { + return false; + } + + for (final Role member : members) { + if (member.getName().equals(user.getName())) { + return true; + } + } + + return false; + } + + public void close() { + synchronized (this.authenticationProviders) { + final Iterator iter = this.authenticationProviders.iterator(); + while (iter.hasNext()) { + iter.next().onDisabled(); + iter.remove(); + } + } + } +} diff --git a/kura/org.eclipse.kura.rest.provider/src/main/java/org/eclipse/kura/internal/rest/provider/AuthenticationProviderHolder.java b/kura/org.eclipse.kura.rest.provider/src/main/java/org/eclipse/kura/internal/rest/provider/AuthenticationProviderHolder.java index f436b0e6fc4..7a4479fe11d 100644 --- a/kura/org.eclipse.kura.rest.provider/src/main/java/org/eclipse/kura/internal/rest/provider/AuthenticationProviderHolder.java +++ b/kura/org.eclipse.kura.rest.provider/src/main/java/org/eclipse/kura/internal/rest/provider/AuthenticationProviderHolder.java @@ -16,9 +16,9 @@ import java.util.Objects; import java.util.Optional; -import javax.annotation.Priority; -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.container.ContainerRequestContext; +import jakarta.annotation.Priority; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.ws.rs.container.ContainerRequestContext; import org.eclipse.kura.rest.auth.AuthenticationProvider; import org.slf4j.Logger; diff --git a/kura/org.eclipse.kura.rest.provider/src/main/java/org/eclipse/kura/internal/rest/provider/AuthorizationFilter.java b/kura/org.eclipse.kura.rest.provider/src/main/java/org/eclipse/kura/internal/rest/provider/AuthorizationFilter.java new file mode 100644 index 00000000000..dec73583e3a --- /dev/null +++ b/kura/org.eclipse.kura.rest.provider/src/main/java/org/eclipse/kura/internal/rest/provider/AuthorizationFilter.java @@ -0,0 +1,59 @@ +/******************************************************************************* + * Copyright (c) 2024 Eurotech and/or its affiliates and others + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Eurotech + *******************************************************************************/ + +package org.eclipse.kura.internal.rest.provider; + +import java.io.IOException; + +import jakarta.annotation.Priority; +import jakarta.annotation.security.RolesAllowed; +import jakarta.ws.rs.Priorities; +import jakarta.ws.rs.container.ContainerRequestContext; +import jakarta.ws.rs.container.ContainerRequestFilter; +import jakarta.ws.rs.container.ResourceInfo; +import jakarta.ws.rs.core.Context; +import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.core.Response.Status; +import jakarta.ws.rs.core.SecurityContext; +import jakarta.ws.rs.ext.Provider; + +@Provider +@Priority(Priorities.AUTHORIZATION) +public class AuthorizationFilter implements ContainerRequestFilter { + + @Context + private ResourceInfo resourceInfo; + + @Override + public void filter(final ContainerRequestContext context) throws IOException { + final RolesAllowed rolesAllowed = resourceInfo.getResourceMethod().getAnnotation(RolesAllowed.class); + + if (rolesAllowed != null) { + final SecurityContext securityContext = context.getSecurityContext(); + + if (securityContext == null) { + context.abortWith(Response.status(Status.FORBIDDEN).build()); + return; + } + + for (final String role : rolesAllowed.value()) { + if (securityContext.isUserInRole(role)) { + return; + } + } + + context.abortWith(Response.status(Status.FORBIDDEN).build()); + } + } + +} diff --git a/kura/org.eclipse.kura.rest.provider/src/main/java/org/eclipse/kura/internal/rest/provider/GsonSerializer.java b/kura/org.eclipse.kura.rest.provider/src/main/java/org/eclipse/kura/internal/rest/provider/GsonSerializer.java new file mode 100644 index 00000000000..f8f5228181a --- /dev/null +++ b/kura/org.eclipse.kura.rest.provider/src/main/java/org/eclipse/kura/internal/rest/provider/GsonSerializer.java @@ -0,0 +1,70 @@ +/******************************************************************************* + * Copyright (c) 2024 Eurotech and/or its affiliates and others + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Eurotech + *******************************************************************************/ + +package org.eclipse.kura.internal.rest.provider; + +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.OutputStream; +import java.io.OutputStreamWriter; +import java.lang.annotation.Annotation; +import java.lang.reflect.Type; +import java.nio.charset.StandardCharsets; + +import com.google.gson.Gson; + +import jakarta.ws.rs.Consumes; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.WebApplicationException; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.MultivaluedMap; +import jakarta.ws.rs.ext.MessageBodyReader; +import jakarta.ws.rs.ext.MessageBodyWriter; +import jakarta.ws.rs.ext.Provider; + +@Provider +@Produces(MediaType.APPLICATION_JSON) +@Consumes(MediaType.APPLICATION_JSON) +public class GsonSerializer implements MessageBodyReader, MessageBodyWriter { + + private static final Gson GSON = new Gson(); + + @Override + public boolean isWriteable(Class arg0, Type arg1, Annotation[] arg2, MediaType arg3) { + return true; + } + + @Override + public void writeTo(T object, Class arg1, Type arg2, Annotation[] arg3, MediaType arg4, + MultivaluedMap arg5, OutputStream entityStream) + throws IOException, WebApplicationException { + try (final OutputStreamWriter writer = new OutputStreamWriter(entityStream, StandardCharsets.UTF_8)) { + GSON.toJson(object, writer); + } + } + + @Override + public boolean isReadable(Class arg0, Type arg1, Annotation[] arg2, MediaType arg3) { + return true; + } + + @Override + public T readFrom(Class type, Type arg1, Annotation[] arg2, MediaType arg3, MultivaluedMap arg4, + InputStream stream) throws IOException, WebApplicationException { + try (final InputStreamReader reader = new InputStreamReader(stream, StandardCharsets.UTF_8)) { + return GSON.fromJson(reader, type); + } + } + +} diff --git a/kura/org.eclipse.kura.rest.provider/src/main/java/org/eclipse/kura/internal/rest/provider/IncomingPortCheckFilter.java b/kura/org.eclipse.kura.rest.provider/src/main/java/org/eclipse/kura/internal/rest/provider/IncomingPortCheckFilter.java new file mode 100644 index 00000000000..5ae22055c9f --- /dev/null +++ b/kura/org.eclipse.kura.rest.provider/src/main/java/org/eclipse/kura/internal/rest/provider/IncomingPortCheckFilter.java @@ -0,0 +1,60 @@ +/******************************************************************************* + * Copyright (c) 2024 Eurotech and/or its affiliates and others + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Eurotech + *******************************************************************************/ + +package org.eclipse.kura.internal.rest.provider; + +import java.io.IOException; +import java.util.Collections; +import java.util.Set; + +import jakarta.annotation.Priority; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.ws.rs.Priorities; +import jakarta.ws.rs.container.ContainerRequestContext; +import jakarta.ws.rs.container.ContainerRequestFilter; +import jakarta.ws.rs.core.Context; +import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.ext.Provider; + +@Provider +@Priority(Priorities.AUTHENTICATION - 100) +class IncomingPortCheckFilter implements ContainerRequestFilter { + + private static final Response NOT_FOUND_RESPONSE = Response.status(Response.Status.NOT_FOUND).build(); + + @Context + private HttpServletRequest request; + + private Set allowedPorts = Collections.emptySet(); + + public void setAllowedPorts(final Set allowedPorts) { + this.allowedPorts = allowedPorts; + } + + @Override + public void filter(final ContainerRequestContext requestContext) throws IOException { + + RestServiceUtils.initAuditContext(requestContext, request); + + if (allowedPorts.isEmpty()) { + return; + } + + final int port = request.getLocalPort(); + + if (!allowedPorts.contains(port)) { + requestContext.abortWith(NOT_FOUND_RESPONSE); + } + } + +} \ No newline at end of file diff --git a/kura/org.eclipse.kura.rest.provider/src/main/java/org/eclipse/kura/internal/rest/provider/RestService.java b/kura/org.eclipse.kura.rest.provider/src/main/java/org/eclipse/kura/internal/rest/provider/RestService.java index 14081084f35..224946aad48 100644 --- a/kura/org.eclipse.kura.rest.provider/src/main/java/org/eclipse/kura/internal/rest/provider/RestService.java +++ b/kura/org.eclipse.kura.rest.provider/src/main/java/org/eclipse/kura/internal/rest/provider/RestService.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2017, 2023 Eurotech and/or its affiliates and others + * Copyright (c) 2017, 2024 Eurotech and/or its affiliates and others * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -17,37 +17,17 @@ import static org.eclipse.kura.internal.rest.auth.SessionRestServiceConstants.CHANGE_PASSWORD_PATH; import static org.eclipse.kura.internal.rest.auth.SessionRestServiceConstants.XSRF_TOKEN_PATH; -import java.io.IOException; -import java.security.Principal; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; -import java.util.HashMap; +import java.util.Dictionary; import java.util.HashSet; -import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Objects; -import java.util.Optional; import java.util.Set; import java.util.TreeSet; -import javax.annotation.Priority; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.ws.rs.Priorities; -import javax.ws.rs.container.ContainerRequestContext; -import javax.ws.rs.container.ContainerRequestFilter; -import javax.ws.rs.container.ContainerResponseContext; -import javax.ws.rs.container.ContainerResponseFilter; -import javax.ws.rs.core.Context; -import javax.ws.rs.core.PathSegment; -import javax.ws.rs.core.Response; -import javax.ws.rs.ext.Provider; - -import org.eclipse.kura.audit.AuditConstants; -import org.eclipse.kura.audit.AuditContext; -import org.eclipse.kura.audit.AuditContext.Scope; import org.eclipse.kura.configuration.ConfigurableComponent; import org.eclipse.kura.crypto.CryptoService; import org.eclipse.kura.internal.rest.auth.BasicAuthenticationProvider; @@ -59,43 +39,42 @@ import org.eclipse.kura.util.useradmin.UserAdminHelper; import org.osgi.framework.BundleContext; import org.osgi.framework.FrameworkUtil; -import org.osgi.framework.InvalidSyntaxException; import org.osgi.framework.ServiceRegistration; import org.osgi.service.cm.ConfigurationAdmin; import org.osgi.service.useradmin.UserAdmin; -import org.osgi.util.tracker.ServiceTracker; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.eclipsesource.jaxrs.provider.security.AuthenticationHandler; -import com.eclipsesource.jaxrs.provider.security.AuthorizationHandler; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.ws.rs.container.ContainerRequestFilter; +import jakarta.ws.rs.container.ContainerResponseFilter; +import jakarta.ws.rs.core.Context; +import jakarta.ws.rs.ext.Provider; -@SuppressWarnings("restriction") @Provider -public class RestService - implements AuthenticationHandler, AuthorizationHandler, ConfigurableComponent, ContainerResponseFilter { +@SuppressWarnings("restriction") +public class RestService implements ConfigurableComponent { private static final Logger logger = LoggerFactory.getLogger(RestService.class); - private static final Logger auditLogger = LoggerFactory.getLogger("AuditLogger"); - - private static final Response NOT_FOUND_RESPONSE = Response.status(Response.Status.NOT_FOUND).build(); private CryptoService cryptoService; private UserAdmin userAdmin; private ConfigurationAdmin configurationAdmin; - RestServiceOptions options; + private RestServiceOptions options; private final List> registeredServices = new ArrayList<>(); private final Set authenticationProviders = new TreeSet<>(); private AuthenticationProvider basicAuthProvider; private AuthenticationProvider certificateAuthProvider; + private SessionAuthProvider sessionAuthenticationProvider; private SessionRestService authRestService; - private UserAdminHelper userAdminHelper; - private ServiceTracker tracker; + private final IncomingPortCheckFilter incomingPortCheckFilter = new IncomingPortCheckFilter(); + private final AuthenticationFilter authenticationFilter = new AuthenticationFilter(); @Context private HttpServletRequest request; @@ -132,31 +111,34 @@ public void unbindAuthenticationProvider(final AuthenticationProvider provider) } public void activate(final Map properties) { + UserAdminHelper userAdminHelper; logger.info("activating..."); final BundleContext bundleContext = FrameworkUtil.getBundle(RestService.class).getBundleContext(); - try { - this.tracker = new ServiceTracker<>(bundleContext, FrameworkUtil.createFilter( - "(osgi.http.whiteboard.servlet.name=com.eclipsesource.jaxrs.publisher.internal.ServletContainerBridge)"), - new ServletContainerBridgeFix(bundleContext)); - this.tracker.open(); - } catch (InvalidSyntaxException e) { - // no need - } - - this.userAdminHelper = new UserAdminHelper(this.userAdmin, this.cryptoService); - final RestSessionHelper restSessionHelper = new RestSessionHelper(this.userAdminHelper); - - registeredServices - .add(bundleContext.registerService(ContainerRequestFilter.class, new IncomingPortCheckFilter(), null)); - - this.basicAuthProvider = new BasicAuthenticationProvider(bundleContext, this.userAdminHelper); - this.certificateAuthProvider = new CertificateAuthenticationProvider(this.userAdminHelper); - this.sessionAuthenticationProvider = new SessionAuthProvider(restSessionHelper, + configureDefaultWhiteboard(); + + userAdminHelper = new UserAdminHelper(this.userAdmin, this.cryptoService); + final RestSessionHelper restSessionHelper = new RestSessionHelper(userAdminHelper); + final Dictionary serviceProperties = RestServiceUtils.extensionProperties(); + + registeredServices.add(bundleContext.registerService(ContainerRequestFilter.class, this.incomingPortCheckFilter, + serviceProperties)); + registeredServices.add(bundleContext.registerService(ContainerRequestFilter.class, this.authenticationFilter, + serviceProperties)); + registeredServices.add(bundleContext.registerService(ContainerRequestFilter.class, new AuthorizationFilter(), + serviceProperties)); + registeredServices.add( + bundleContext.registerService(ContainerResponseFilter.class, new AuditFilter(), serviceProperties)); + + this.basicAuthProvider = new BasicAuthenticationProvider(bundleContext, userAdminHelper); + this.certificateAuthProvider = new CertificateAuthenticationProvider(userAdminHelper); + this.sessionAuthenticationProvider = new SessionAuthProvider(// + restSessionHelper, new HashSet<>(Arrays.asList(BASE_PATH + CHANGE_PASSWORD_PATH, BASE_PATH + XSRF_TOKEN_PATH)), Collections.singleton(BASE_PATH + XSRF_TOKEN_PATH)); - this.authRestService = new SessionRestService(this.userAdminHelper, restSessionHelper, this.configurationAdmin); + + this.authRestService = new SessionRestService(userAdminHelper, restSessionHelper, this.configurationAdmin); this.registeredServices .add(bundleContext.registerService(SessionRestService.class, this.authRestService, null)); @@ -166,11 +148,18 @@ public void activate(final Map properties) { logger.info("activating...done"); } + private void configureDefaultWhiteboard() { + // TODO Auto-generated method stub + + } + public void update(final Map properties) { logger.info("updating..."); final RestServiceOptions newOptions = new RestServiceOptions(properties); + this.incomingPortCheckFilter.setAllowedPorts(newOptions.getAllowedPorts()); + if (!Objects.equals(this.options, newOptions)) { this.options = newOptions; updateBuiltinAuthenticationProviders(newOptions); @@ -184,198 +173,31 @@ public void update(final Map properties) { public void deactivate() { logger.info("deactivating..."); - this.tracker.close(); - for (final ServiceRegistration reg : registeredServices) { reg.unregister(); } - synchronized (this.authenticationProviders) { - final Iterator iter = this.authenticationProviders.iterator(); - while (iter.hasNext()) { - iter.next().onDisabled(); - iter.remove(); - } - } + this.authenticationFilter.close(); logger.info("deactivating...done"); } - @Override - public boolean isUserInRole(Principal requestUser, String role) { - - try { - this.userAdminHelper.requirePermissions(requestUser.getName(), "rest." + role); - return true; - - } catch (final Exception e) { - return false; - } - } - - @Override - public Principal authenticate(ContainerRequestContext requestContext) { - - initAuditContext(requestContext); - - synchronized (this.authenticationProviders) { - for (final AuthenticationProviderHolder provider : this.authenticationProviders) { - final Optional principal = provider.authenticate(request, requestContext); - - if (principal.isPresent()) { - return principal.get(); - } - } - } - - return null; - - } - - @Override - public String getAuthenticationScheme() { - return null; - } - - @Override - public void filter(ContainerRequestContext requestContext, ContainerResponseContext responseContext) - throws IOException { - int responseStatus = responseContext.getStatus(); - - final AuditContext auditContext = initAuditContext(requestContext); - - try { - if (responseContext.getStatus() == 404) { - auditLogger.warn("{} Rest - Failure - Service not found", auditContext); - return; - } - - if (responseContext.getStatus() == 403) { - if (requestContext.getSecurityContext() == null - || requestContext.getSecurityContext().getUserPrincipal() == null) { - responseContext.setStatus(401); - } else { - auditLogger.warn("{} Rest - Failure - User not authorized to perform the requested operation", - auditContext); - return; - } - - } - - if (responseContext.getStatus() == 401) { - auditLogger.warn("{} Rest - Failure - User not authenticated", auditContext); - return; - } - - if (responseStatus >= 200 && responseStatus < 400) { - auditLogger.info("{} Rest - Success - Rest request succeeded", auditContext); - } else { - auditLogger.warn("{} Rest - Failure - Request failed", auditContext); - } - } finally { - closeAuditContext(requestContext); - } - - } - - private String getRequestPath(ContainerRequestContext request) { - List pathSegments = request.getUriInfo().getPathSegments(); - Iterator iterator = pathSegments.iterator(); - StringBuilder pathBuilder = new StringBuilder(); - - while (iterator.hasNext()) { - pathBuilder.append(iterator.next().getPath()); - if (iterator.hasNext()) { - pathBuilder.append("/"); - } - } - - return pathBuilder.toString(); - } - - private AuditContext initAuditContext(ContainerRequestContext request) { - - final Object rawContext = request.getProperty("org.eclipse.kura.rest.audit.context"); - - if (rawContext != null) { - return (AuditContext) rawContext; - } - - final Map properties = new HashMap<>(); - - String requestIp = request.getHeaderString("X-FORWARDED-FOR"); - if (requestIp == null) { - requestIp = this.request.getRemoteAddr(); - } - - properties.put(AuditConstants.KEY_ENTRY_POINT.getValue(), "RestService"); - properties.put(AuditConstants.KEY_IP.getValue(), requestIp); - properties.put("rest.method", request.getMethod()); - properties.put("rest.path", getRequestPath(request)); - - final AuditContext result = new AuditContext(properties); - - final Scope scope = AuditContext.openScope(result); - - request.setProperty("org.eclipse.kura.rest.audit.context", result); - request.setProperty("org.eclipse.kura.rest.audit.scope", scope); - - return result; - } - - private void closeAuditContext(ContainerRequestContext request) { - final Object rawScope = request.getProperty("org.eclipse.kura.rest.audit.scope"); - - if (rawScope instanceof Scope) { - ((Scope) rawScope).close(); - } - } - - @Provider - @Priority(Priorities.AUTHENTICATION - 100) - private class IncomingPortCheckFilter implements ContainerRequestFilter { - - @Context - private HttpServletRequest sr; - - @Override - public void filter(final ContainerRequestContext request) throws IOException { - - initAuditContext(request); - - final Set allowedPorts = options.getAllowedPorts(); - - if (allowedPorts.isEmpty()) { - return; - } - - final int port = sr.getLocalPort(); - - if (!allowedPorts.contains(port)) { - request.abortWith(NOT_FOUND_RESPONSE); - } - } - - } - private void updateBuiltinAuthenticationProviders(final RestServiceOptions options) { if (options.isPasswordAuthEnabled() && options.isBasicAuthEnabled()) { - bindAuthenticationProvider(this.basicAuthProvider); + this.authenticationFilter.registerAuthenticationProvider(this.basicAuthProvider); } else { - unbindAuthenticationProvider(this.basicAuthProvider); + this.authenticationFilter.unregisterAuthenticationProvider(this.basicAuthProvider); } if (options.isCertificateAuthEnabled() && options.isStatelessCertificateAuthEnabled()) { - bindAuthenticationProvider(this.certificateAuthProvider); + this.authenticationFilter.registerAuthenticationProvider(this.certificateAuthProvider); } else { - unbindAuthenticationProvider(this.certificateAuthProvider); + this.authenticationFilter.unregisterAuthenticationProvider(this.certificateAuthProvider); } if (options.isSessionManagementEnabled()) { bindAuthenticationProvider(this.sessionAuthenticationProvider); - } - } } diff --git a/kura/org.eclipse.kura.rest.provider/src/main/java/org/eclipse/kura/internal/rest/provider/RestServiceUtils.java b/kura/org.eclipse.kura.rest.provider/src/main/java/org/eclipse/kura/internal/rest/provider/RestServiceUtils.java new file mode 100644 index 00000000000..cc7a442704d --- /dev/null +++ b/kura/org.eclipse.kura.rest.provider/src/main/java/org/eclipse/kura/internal/rest/provider/RestServiceUtils.java @@ -0,0 +1,103 @@ +/******************************************************************************* + * Copyright (c) 2024 Eurotech and/or its affiliates and others + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Eurotech + *******************************************************************************/ + +package org.eclipse.kura.internal.rest.provider; + +import java.util.Dictionary; +import java.util.HashMap; +import java.util.Hashtable; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import org.eclipse.kura.audit.AuditConstants; +import org.eclipse.kura.audit.AuditContext; +import org.eclipse.kura.audit.AuditContext.Scope; + +import jakarta.servlet.http.HttpServletRequest; +import jakarta.ws.rs.container.ContainerRequestContext; +import jakarta.ws.rs.core.PathSegment; + +public final class RestServiceUtils { + + private RestServiceUtils() { + } + + public static AuditContext initAuditContext(final ContainerRequestContext requestContext, + final HttpServletRequest request) { + + final Object rawContext = requestContext.getProperty("org.eclipse.kura.rest.audit.context"); + + if (rawContext != null) { + return (AuditContext) rawContext; + } + + final Map properties = new HashMap<>(); + + String requestIp = requestContext.getHeaderString("X-FORWARDED-FOR"); + if (requestIp == null) { + requestIp = request.getRemoteAddr(); + } + + properties.put(AuditConstants.KEY_ENTRY_POINT.getValue(), "RestService"); + properties.put(AuditConstants.KEY_IP.getValue(), requestIp); + properties.put("rest.method", requestContext.getMethod()); + properties.put("rest.path", getRequestPath(requestContext)); + + final AuditContext result = new AuditContext(properties); + + final Scope scope = AuditContext.openScope(result); + + requestContext.setProperty("org.eclipse.kura.rest.audit.context", result); + requestContext.setProperty("org.eclipse.kura.rest.audit.scope", scope); + + return result; + } + + private static String getRequestPath(final ContainerRequestContext request) { + List pathSegments = request.getUriInfo().getPathSegments(); + Iterator iterator = pathSegments.iterator(); + StringBuilder pathBuilder = new StringBuilder(); + + while (iterator.hasNext()) { + pathBuilder.append(iterator.next().getPath()); + if (iterator.hasNext()) { + pathBuilder.append("/"); + } + } + + return pathBuilder.toString(); + } + + public static void closeAuditContext(ContainerRequestContext request) { + final Object rawScope = request.getProperty("org.eclipse.kura.rest.audit.scope"); + + if (rawScope instanceof Scope) { + ((Scope) rawScope).close(); + } + } + + public static Dictionary singletonDictionary(final String key, final Object value) { + final Dictionary result = new Hashtable<>(); + result.put(key, value); + return result; + } + + public static Dictionary resourceProperties() { + return singletonDictionary("osgi.jaxrs.resource", true); + } + + public static Dictionary extensionProperties() { + return singletonDictionary("osgi.jaxrs.extension", true); + } +} diff --git a/kura/org.eclipse.kura.rest.provider/src/main/java/org/eclipse/kura/rest/auth/AuthenticationProvider.java b/kura/org.eclipse.kura.rest.provider/src/main/java/org/eclipse/kura/rest/auth/AuthenticationProvider.java index 0bac9b9bbd1..dd91e31222f 100644 --- a/kura/org.eclipse.kura.rest.provider/src/main/java/org/eclipse/kura/rest/auth/AuthenticationProvider.java +++ b/kura/org.eclipse.kura.rest.provider/src/main/java/org/eclipse/kura/rest/auth/AuthenticationProvider.java @@ -15,11 +15,12 @@ import java.security.Principal; import java.util.Optional; -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.container.ContainerRequestContext; +import jakarta.servlet.http.HttpServletRequest; import org.osgi.annotation.versioning.ProviderType; +import jakarta.ws.rs.container.ContainerRequestContext; + /** * A service interface that allows to register custom authentication providers for the {@code RestService}. * Registered {@link AuthenticationProvider} instances will be considered along with the currently enabled @@ -30,8 +31,8 @@ * will determine a successful authentication. * If all providers return an empty optional the call failing with 401 status.
* - * The order in which the providers are called can be configured with the {@link javax.annotation.Priority} annotation. - * Lower {@link javax.annotation.Priority#value()} values mean higher priority. + * The order in which the providers are called can be configured with the {@link jakarta.annotation.Priority} annotation. + * Lower {@link jakarta.annotation.Priority#value()} values mean higher priority. * The priorities of the built-in authentication providers is the following: *
    *
  • Certificate authentication: 100
  • diff --git a/kura/org.eclipse.kura.rest.provider/src/main/java/org/eclipse/kura/rest/utils/Validable.java b/kura/org.eclipse.kura.rest.provider/src/main/java/org/eclipse/kura/rest/utils/Validable.java index 88224cb7f81..a4dcda6e4b0 100644 --- a/kura/org.eclipse.kura.rest.provider/src/main/java/org/eclipse/kura/rest/utils/Validable.java +++ b/kura/org.eclipse.kura.rest.provider/src/main/java/org/eclipse/kura/rest/utils/Validable.java @@ -13,10 +13,10 @@ package org.eclipse.kura.rest.utils; -import javax.ws.rs.WebApplicationException; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import javax.ws.rs.core.Response.Status; +import jakarta.ws.rs.WebApplicationException; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.core.Response.Status; public interface Validable { diff --git a/kura/org.eclipse.kura.rest.security.provider/META-INF/MANIFEST.MF b/kura/org.eclipse.kura.rest.security.provider/META-INF/MANIFEST.MF index e9df73c0c8a..e50c60f043f 100644 --- a/kura/org.eclipse.kura.rest.security.provider/META-INF/MANIFEST.MF +++ b/kura/org.eclipse.kura.rest.security.provider/META-INF/MANIFEST.MF @@ -7,21 +7,21 @@ Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))" Bundle-ClassPath: . Bundle-ActivationPolicy: lazy Service-Component: OSGI-INF/*.xml -Import-Package: javax.annotation.security;version="1.2.0", - javax.ws.rs;version="2.0.1", - javax.ws.rs.container;version="2.0.1", - javax.ws.rs.core;version="2.0.1", - org.apache.commons.io;version="2.4.0", +Import-Package: jakarta.annotation.security;version="2.1.1", + jakarta.ws.rs;version="3.1.0", + jakarta.ws.rs.container;version="3.1.0", + jakarta.ws.rs.core;version="3.1.0", + org.apache.commons.io;version="2.11.0", org.eclipse.kura;version="[1.3,2.0)", org.eclipse.kura.cloudconnection.request;version="[1.0,2.0)", org.eclipse.kura.request.handler.jaxrs;version="[1.0,2.0)", org.eclipse.kura.request.handler.jaxrs.annotation;version="[1.0,2.0)", org.eclipse.kura.rest.configuration.api;version="[1.0,2.0)", - org.eclipse.kura.system;version="[1.0,2.0)", org.eclipse.kura.security;version="[1.3,2.0)", + org.eclipse.kura.system;version="[1.0,2.0)", org.osgi.framework;version="1.8.0", org.osgi.service.cm;version="1.6.0", org.osgi.service.component;version="[1.3,2.0)", + org.osgi.service.jakartars.whiteboard.propertytypes;version="2.0.0", org.osgi.service.useradmin;version="1.1.0";resolution:=optional, - org.slf4j;version="1.7.25", - org.glassfish.jersey.media.multipart + org.slf4j;version="1.7.25" diff --git a/kura/org.eclipse.kura.rest.security.provider/src/main/java/org/eclipse/kura/internal/rest/security/provider/AbstractRestSecurityService.java b/kura/org.eclipse.kura.rest.security.provider/src/main/java/org/eclipse/kura/internal/rest/security/provider/AbstractRestSecurityService.java index da8845311ad..8c2a95160d9 100644 --- a/kura/org.eclipse.kura.rest.security.provider/src/main/java/org/eclipse/kura/internal/rest/security/provider/AbstractRestSecurityService.java +++ b/kura/org.eclipse.kura.rest.security.provider/src/main/java/org/eclipse/kura/internal/rest/security/provider/AbstractRestSecurityService.java @@ -12,6 +12,8 @@ ******************************************************************************/ package org.eclipse.kura.internal.rest.security.provider; +import java.util.Optional; + import org.eclipse.kura.cloudconnection.request.RequestHandler; import org.eclipse.kura.cloudconnection.request.RequestHandlerRegistry; import org.eclipse.kura.internal.rest.security.provider.dto.DebugEnabledDTO; @@ -23,17 +25,16 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.annotation.security.RolesAllowed; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.WebApplicationException; -import javax.ws.rs.container.ContainerRequestContext; -import javax.ws.rs.core.Context; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import java.util.Optional; +import jakarta.annotation.security.RolesAllowed; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.POST; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.WebApplicationException; +import jakarta.ws.rs.container.ContainerRequestContext; +import jakarta.ws.rs.core.Context; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; public abstract class AbstractRestSecurityService { @@ -73,7 +74,8 @@ public void unbindRequestHandlerRegistry(RequestHandlerRegistry registry) { public abstract String getMqttAppId(); /** - * POST method
    This method allows the reload of the security policy's fingerprint + * POST method
    + * This method allows the reload of the security policy's fingerprint */ @POST @RolesAllowed(REST_ROLE_NAME) @@ -91,7 +93,8 @@ public Response reloadSecurityPolicyFingerprint() { } /** - * POST method
    This method allows the reload of the command line fingerprint + * POST method
    + * This method allows the reload of the command line fingerprint */ @POST @RolesAllowed(REST_ROLE_NAME) diff --git a/kura/org.eclipse.kura.rest.security.provider/src/main/java/org/eclipse/kura/internal/rest/security/provider/SecurityRestServiceV1.java b/kura/org.eclipse.kura.rest.security.provider/src/main/java/org/eclipse/kura/internal/rest/security/provider/SecurityRestServiceV1.java index acdbdd4cf0a..1aa001ecdc6 100644 --- a/kura/org.eclipse.kura.rest.security.provider/src/main/java/org/eclipse/kura/internal/rest/security/provider/SecurityRestServiceV1.java +++ b/kura/org.eclipse.kura.rest.security.provider/src/main/java/org/eclipse/kura/internal/rest/security/provider/SecurityRestServiceV1.java @@ -12,8 +12,13 @@ ******************************************************************************/ package org.eclipse.kura.internal.rest.security.provider; -import javax.ws.rs.Path; +import org.osgi.service.jakartars.whiteboard.propertytypes.JakartarsName; +import org.osgi.service.jakartars.whiteboard.propertytypes.JakartarsResource; +import jakarta.ws.rs.Path; + +@JakartarsResource +@JakartarsName("securityRestServiceV1") @Path("security/v1") public class SecurityRestServiceV1 extends AbstractRestSecurityService { diff --git a/kura/org.eclipse.kura.rest.security.provider/src/main/java/org/eclipse/kura/internal/rest/security/provider/SecurityRestServiceV2.java b/kura/org.eclipse.kura.rest.security.provider/src/main/java/org/eclipse/kura/internal/rest/security/provider/SecurityRestServiceV2.java index cf5ae784df5..335af213a6b 100644 --- a/kura/org.eclipse.kura.rest.security.provider/src/main/java/org/eclipse/kura/internal/rest/security/provider/SecurityRestServiceV2.java +++ b/kura/org.eclipse.kura.rest.security.provider/src/main/java/org/eclipse/kura/internal/rest/security/provider/SecurityRestServiceV2.java @@ -12,17 +12,6 @@ ******************************************************************************/ package org.eclipse.kura.internal.rest.security.provider; -import org.eclipse.kura.KuraErrorCode; -import org.eclipse.kura.KuraException; -import org.eclipse.kura.request.handler.jaxrs.DefaultExceptionHandler; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import javax.annotation.security.RolesAllowed; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.core.Response; -import javax.ws.rs.core.Response.Status; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; @@ -33,6 +22,22 @@ import java.nio.charset.CodingErrorAction; import java.nio.charset.StandardCharsets; +import org.eclipse.kura.KuraErrorCode; +import org.eclipse.kura.KuraException; +import org.eclipse.kura.request.handler.jaxrs.DefaultExceptionHandler; +import org.osgi.service.jakartars.whiteboard.propertytypes.JakartarsName; +import org.osgi.service.jakartars.whiteboard.propertytypes.JakartarsResource; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import jakarta.annotation.security.RolesAllowed; +import jakarta.ws.rs.POST; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.core.Response.Status; + +@JakartarsResource +@JakartarsName("securityRestServiceV2") @Path("security/v2") public class SecurityRestServiceV2 extends AbstractRestSecurityService { @@ -45,7 +50,8 @@ public String getMqttAppId() { } /** - * POST method
    This method replaces the security policy with the default production one. Then a fingerprint + * POST method
    + * This method replaces the security policy with the default production one. Then a fingerprint * reload is performed. */ @POST @@ -66,7 +72,8 @@ public Response applyDefaultProductionSecurityPolicy() { } /** - * POST method
    This method replaces the security policy with the provided one. Then a fingerprint reload is + * POST method
    + * This method replaces the security policy with the provided one. Then a fingerprint reload is * performed. */ @POST diff --git a/kura/org.eclipse.kura.rest.service.listing.provider/META-INF/MANIFEST.MF b/kura/org.eclipse.kura.rest.service.listing.provider/META-INF/MANIFEST.MF index 2c825901153..5f4ce9db490 100644 --- a/kura/org.eclipse.kura.rest.service.listing.provider/META-INF/MANIFEST.MF +++ b/kura/org.eclipse.kura.rest.service.listing.provider/META-INF/MANIFEST.MF @@ -7,10 +7,10 @@ Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))" Bundle-ClassPath: . Bundle-ActivationPolicy: lazy Service-Component: OSGI-INF/*.xml -Import-Package: javax.annotation.security;version="1.2.0", - javax.ws.rs;version="2.0.1", - javax.ws.rs.container;version="2.0.1", - javax.ws.rs.core;version="2.0.1", +Import-Package: jakarta.annotation.security;version="2.1.1", + jakarta.ws.rs;version="3.1.0", + jakarta.ws.rs.container;version="3.1.0", + jakarta.ws.rs.core;version="3.1.0", org.eclipse.kura;version="[1.3,2.0)", org.eclipse.kura.cloudconnection.request;version="[1.0,2.0)", org.eclipse.kura.configuration;version="[1.1,2.0)", @@ -21,4 +21,5 @@ Import-Package: javax.annotation.security;version="1.2.0", org.osgi.service.component;version="1.4.0", org.osgi.service.component.runtime;version="1.4.0", org.osgi.service.component.runtime.dto;version="1.4.0", + org.osgi.service.jakartars.whiteboard.propertytypes;version="2.0.0", org.slf4j;version="1.7.25" diff --git a/kura/org.eclipse.kura.rest.service.listing.provider/src/main/java/org/eclipse/kura/internal/rest/service/listing/provider/RestServiceListingProvider.java b/kura/org.eclipse.kura.rest.service.listing.provider/src/main/java/org/eclipse/kura/internal/rest/service/listing/provider/RestServiceListingProvider.java index db3d47e71e9..e9df5cc5095 100644 --- a/kura/org.eclipse.kura.rest.service.listing.provider/src/main/java/org/eclipse/kura/internal/rest/service/listing/provider/RestServiceListingProvider.java +++ b/kura/org.eclipse.kura.rest.service.listing.provider/src/main/java/org/eclipse/kura/internal/rest/service/listing/provider/RestServiceListingProvider.java @@ -23,17 +23,6 @@ import java.util.stream.Collectors; import java.util.stream.Stream; -import javax.ws.rs.Consumes; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.WebApplicationException; -import javax.ws.rs.container.ContainerRequestContext; -import javax.ws.rs.core.Context; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response.Status; - import org.eclipse.kura.cloudconnection.request.RequestHandler; import org.eclipse.kura.cloudconnection.request.RequestHandlerRegistry; import org.eclipse.kura.configuration.ConfigurationService; @@ -52,9 +41,24 @@ import org.osgi.service.component.ComponentContext; import org.osgi.service.component.runtime.ServiceComponentRuntime; import org.osgi.service.component.runtime.dto.ComponentDescriptionDTO; +import org.osgi.service.jakartars.whiteboard.propertytypes.JakartarsName; +import org.osgi.service.jakartars.whiteboard.propertytypes.JakartarsResource; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import jakarta.ws.rs.Consumes; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.POST; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.WebApplicationException; +import jakarta.ws.rs.container.ContainerRequestContext; +import jakarta.ws.rs.core.Context; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response.Status; + +@JakartarsResource +@JakartarsName("restServiceListingProvider") @Path("serviceListing/v1") public class RestServiceListingProvider { diff --git a/kura/org.eclipse.kura.rest.system.provider/META-INF/MANIFEST.MF b/kura/org.eclipse.kura.rest.system.provider/META-INF/MANIFEST.MF index 03cd6414216..2cf47c9b40e 100644 --- a/kura/org.eclipse.kura.rest.system.provider/META-INF/MANIFEST.MF +++ b/kura/org.eclipse.kura.rest.system.provider/META-INF/MANIFEST.MF @@ -7,11 +7,10 @@ Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))" Bundle-ClassPath: . Bundle-ActivationPolicy: lazy Service-Component: OSGI-INF/*.xml -Import-Package: javax.annotation.security;version="1.2.0", - javax.validation;version="1.5.0.SNAPSHOT", - javax.ws.rs;version="2.0.1", - javax.ws.rs.core;version="2.0.1", - org.apache.commons.io;version="2.4.0", +Import-Package: jakarta.annotation.security;version="2.1.1", + jakarta.ws.rs;version="3.1.0", + jakarta.ws.rs.core;version="3.1.0", + org.apache.commons.io;version="2.11.0", org.eclipse.kura;version="[1.3,2.0)", org.eclipse.kura.cloudconnection.request;version="[1.0,2.0)", org.eclipse.kura.request.handler.jaxrs;version="[1.0,2.0)", diff --git a/kura/org.eclipse.kura.rest.system.provider/src/main/java/org/eclipse/kura/rest/system/SystemRestService.java b/kura/org.eclipse.kura.rest.system.provider/src/main/java/org/eclipse/kura/rest/system/SystemRestService.java index 69afffbc9ad..d0ee4c1efe7 100644 --- a/kura/org.eclipse.kura.rest.system.provider/src/main/java/org/eclipse/kura/rest/system/SystemRestService.java +++ b/kura/org.eclipse.kura.rest.system.provider/src/main/java/org/eclipse/kura/rest/system/SystemRestService.java @@ -23,13 +23,13 @@ import static org.eclipse.kura.rest.system.Constants.REST_APP_ID; import static org.eclipse.kura.rest.system.Constants.REST_ROLE_NAME; -import javax.annotation.security.RolesAllowed; -import javax.ws.rs.Consumes; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.core.MediaType; +import jakarta.annotation.security.RolesAllowed; +import jakarta.ws.rs.Consumes; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.POST; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.core.MediaType; import org.eclipse.kura.cloudconnection.request.RequestHandler; import org.eclipse.kura.cloudconnection.request.RequestHandlerRegistry; diff --git a/kura/org.eclipse.kura.rest.wire.provider/META-INF/MANIFEST.MF b/kura/org.eclipse.kura.rest.wire.provider/META-INF/MANIFEST.MF index d210b318645..a81a1c31697 100644 --- a/kura/org.eclipse.kura.rest.wire.provider/META-INF/MANIFEST.MF +++ b/kura/org.eclipse.kura.rest.wire.provider/META-INF/MANIFEST.MF @@ -8,10 +8,10 @@ Bundle-ClassPath: . Bundle-ActivationPolicy: lazy Service-Component: OSGI-INF/*.xml Import-Package: com.google.gson;version="2.7.0", - javax.annotation.security;version="1.2.0", - javax.ws.rs, - javax.ws.rs.core;version="2.0.1", - org.apache.commons.io;version="2.4.0", + jakarta.annotation.security;version="2.1.1", + jakarta.ws.rs;version="3.1.0", + jakarta.ws.rs.core;version="3.1.0", + org.apache.commons.io;version="2.11.0", org.eclipse.kura;version="[1.6,2.0)", org.eclipse.kura.asset;version="[1.0,2.0)", org.eclipse.kura.asset.provider;version="[2.0,3.0)", @@ -31,6 +31,7 @@ Import-Package: com.google.gson;version="2.7.0", org.osgi.framework;version="1.10.0", org.osgi.service.cm;version="1.6.0", org.osgi.service.component;version="1.4.0", + org.osgi.service.jakartars.whiteboard.propertytypes;version="2.0.0", org.osgi.service.useradmin;version="1.1.0", org.slf4j;version="1.7.32" Export-Package: org.eclipse.kura.rest.wire.api;version="1.0.0" diff --git a/kura/org.eclipse.kura.rest.wire.provider/src/main/java/org/eclipse/kura/internal/rest/wire/WireRestService.java b/kura/org.eclipse.kura.rest.wire.provider/src/main/java/org/eclipse/kura/internal/rest/wire/WireRestService.java index 674d883a00e..bfe00ba1938 100644 --- a/kura/org.eclipse.kura.rest.wire.provider/src/main/java/org/eclipse/kura/internal/rest/wire/WireRestService.java +++ b/kura/org.eclipse.kura.rest.wire.provider/src/main/java/org/eclipse/kura/internal/rest/wire/WireRestService.java @@ -29,19 +29,6 @@ import java.util.stream.Collectors; import java.util.stream.Stream; -import javax.annotation.security.RolesAllowed; -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.WebApplicationException; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import javax.ws.rs.core.Response.Status; - import org.eclipse.kura.KuraErrorCode; import org.eclipse.kura.KuraException; import org.eclipse.kura.asset.Asset; @@ -89,11 +76,28 @@ import org.osgi.framework.ServiceReference; import org.osgi.service.cm.ConfigurationAdmin; import org.osgi.service.component.ComponentContext; +import org.osgi.service.jakartars.whiteboard.propertytypes.JakartarsName; +import org.osgi.service.jakartars.whiteboard.propertytypes.JakartarsResource; import org.osgi.service.useradmin.Role; import org.osgi.service.useradmin.UserAdmin; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import jakarta.annotation.security.RolesAllowed; +import jakarta.ws.rs.Consumes; +import jakarta.ws.rs.DELETE; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.POST; +import jakarta.ws.rs.PUT; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.WebApplicationException; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.core.Response.Status; + +@JakartarsResource +@JakartarsName("wireRestService") @Path("/wire/v1") public class WireRestService { diff --git a/kura/org.eclipse.kura.stress/build.properties b/kura/org.eclipse.kura.stress/build.properties index ca785065856..e8c726e9ec6 100644 --- a/kura/org.eclipse.kura.stress/build.properties +++ b/kura/org.eclipse.kura.stress/build.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2020 Eurotech and/or its affiliates and others +# Copyright (c) 2011, 2024 Eurotech and/or its affiliates and others # # This program and the accompanying materials are made # available under the terms of the Eclipse Public License 2.0 @@ -18,10 +18,5 @@ bin.includes = META-INF/,\ OSGI-INF/,\ about.html,\ about_files/ -additional.bundles = org.eclipse.osgi,\ - org.eclipse.osgi.services,\ - org.eclipse.osgi.util,\ - org.eclipse.kura.api,\ - slf4j.api src.includes = about.html,\ about_files/ diff --git a/kura/org.eclipse.kura.useradmin.store/META-INF/MANIFEST.MF b/kura/org.eclipse.kura.useradmin.store/META-INF/MANIFEST.MF index 9f3d314b514..0dccec36fb6 100644 --- a/kura/org.eclipse.kura.useradmin.store/META-INF/MANIFEST.MF +++ b/kura/org.eclipse.kura.useradmin.store/META-INF/MANIFEST.MF @@ -9,7 +9,7 @@ Bundle-Category: Asset-Driver Management Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))" Service-Component: OSGI-INF/*.xml Bundle-ActivationPolicy: lazy -Import-Package: com.eclipsesource.json;version="0.9.5", +Import-Package: com.eclipsesource.json;version="0.9.0", org.apache.felix.useradmin;version="[1.0,1.1)", org.eclipse.kura;version="1.6.0", org.eclipse.kura.configuration;version="1.2.0", diff --git a/kura/org.eclipse.kura.web2.ext/META-INF/MANIFEST.MF b/kura/org.eclipse.kura.web2.ext/META-INF/MANIFEST.MF deleted file mode 100644 index c3143801204..00000000000 --- a/kura/org.eclipse.kura.web2.ext/META-INF/MANIFEST.MF +++ /dev/null @@ -1,11 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: org.eclipse.kura.web2.ext -Bundle-SymbolicName: org.eclipse.kura.web2.ext;singleton:=true -Bundle-Version: 2.0.0.qualifier -Bundle-Vendor: Eclipse Kura -Bundle-License: Eclipse Public License v2.0 -Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))" -Bundle-ActivationPolicy: lazy -Require-Bundle: com.gwt.user;bundle-version="[2.0.0,3.0.0)" -Export-Package: org.eclipse.kura.web2.ext;version="1.0.0" diff --git a/kura/org.eclipse.kura.web2.ext/about.html b/kura/org.eclipse.kura.web2.ext/about.html deleted file mode 100644 index ec5809fefb9..00000000000 --- a/kura/org.eclipse.kura.web2.ext/about.html +++ /dev/null @@ -1,36 +0,0 @@ - - - - - About - - -

    About This Content

    - -

    November 30, 2017

    -

    License

    - -

    - The Eclipse Foundation makes available all content in this plug-in - ("Content"). Unless otherwise indicated below, the Content - is provided to you under the terms and conditions of the Eclipse - Public License Version 2.0 ("EPL"). A copy of the EPL is - available at http://www.eclipse.org/legal/epl-2.0. - For purposes of the EPL, "Program" will mean the Content. -

    - -

    - If you did not receive this Content directly from the Eclipse - Foundation, the Content is being redistributed by another party - ("Redistributor") and different terms and conditions may - apply to your use of any object code in the Content. Check the - Redistributor's license that was provided with the Content. If no such - license exists, contact the Redistributor. Unless otherwise indicated - below, the terms and conditions of the EPL still apply to any source - code in the Content and such source code may be obtained at http://www.eclipse.org. -

    - - - \ No newline at end of file diff --git a/kura/org.eclipse.kura.web2.ext/build.properties b/kura/org.eclipse.kura.web2.ext/build.properties deleted file mode 100644 index 0cf2ac07b17..00000000000 --- a/kura/org.eclipse.kura.web2.ext/build.properties +++ /dev/null @@ -1,20 +0,0 @@ -# -# Copyright (c) 2019, 2020 Eurotech and/or its affiliates and others -# -# This program and the accompanying materials are made -# available under the terms of the Eclipse Public License 2.0 -# which is available at https://www.eclipse.org/legal/epl-2.0/ -# -# SPDX-License-Identifier: EPL-2.0 -# -# Contributors: -# Eurotech -# - -bin.includes = .,\ - META-INF/,\ - about.html - -output.. = target/classes/ -source.. = src/main/java/,\ - src/main/resources/ diff --git a/kura/org.eclipse.kura.web2.ext/pom.xml b/kura/org.eclipse.kura.web2.ext/pom.xml deleted file mode 100644 index 9b4a3be63aa..00000000000 --- a/kura/org.eclipse.kura.web2.ext/pom.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - - - 4.0.0 - - - org.eclipse.kura - kura - 6.0.0-SNAPSHOT - - - org.eclipse.kura.web2.ext - 2.0.0-SNAPSHOT - eclipse-plugin - - - ${project.basedir}/.. - - - - - - src/main/java - - **/*.java - - - - src/main/resources - - **/*.gwt.xml - - - - - - diff --git a/kura/org.eclipse.kura.web2.ext/src/main/java/org/eclipse/kura/web2/ext/AlertSeverity.java b/kura/org.eclipse.kura.web2.ext/src/main/java/org/eclipse/kura/web2/ext/AlertSeverity.java deleted file mode 100644 index 482529a62a1..00000000000 --- a/kura/org.eclipse.kura.web2.ext/src/main/java/org/eclipse/kura/web2/ext/AlertSeverity.java +++ /dev/null @@ -1,18 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2019, 2020 Eurotech and/or its affiliates and others - * - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Eurotech - *******************************************************************************/ -package org.eclipse.kura.web2.ext; - -public enum AlertSeverity { - INFO, - WARNING -} diff --git a/kura/org.eclipse.kura.web2.ext/src/main/java/org/eclipse/kura/web2/ext/Context.java b/kura/org.eclipse.kura.web2.ext/src/main/java/org/eclipse/kura/web2/ext/Context.java deleted file mode 100644 index 2c80e76b5a2..00000000000 --- a/kura/org.eclipse.kura.web2.ext/src/main/java/org/eclipse/kura/web2/ext/Context.java +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2019, 2020 Eurotech and/or its affiliates and others - * - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Eurotech - *******************************************************************************/ -package org.eclipse.kura.web2.ext; - -import java.util.function.Consumer; - -import com.google.gwt.core.client.Callback; - -public interface Context { - - public void addSidenavComponent(String name, String icon, WidgetFactory widget); - - public void addSettingsComponent(String name, WidgetFactory widget); - - public void addAuthenticationHandler(AuthenticationHandler authenticationHandler); - - public void getXSRFToken(final Callback callback); - - public Callback startLongRunningOperation(); - - public void showAlertDialog(final String message, final AlertSeverity severity, final Consumer callback); -} diff --git a/kura/org.eclipse.kura.web2.ext/src/main/java/org/eclipse/kura/web2/ext/Extension.java b/kura/org.eclipse.kura.web2.ext/src/main/java/org/eclipse/kura/web2/ext/Extension.java deleted file mode 100644 index 641de74794d..00000000000 --- a/kura/org.eclipse.kura.web2.ext/src/main/java/org/eclipse/kura/web2/ext/Extension.java +++ /dev/null @@ -1,18 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2019, 2020 Eurotech and/or its affiliates and others - * - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Eurotech - *******************************************************************************/ -package org.eclipse.kura.web2.ext; - -public interface Extension { - - public void onLoad(Context context); -} diff --git a/kura/org.eclipse.kura.web2.ext/src/main/java/org/eclipse/kura/web2/ext/ExtensionRegistry.java b/kura/org.eclipse.kura.web2.ext/src/main/java/org/eclipse/kura/web2/ext/ExtensionRegistry.java deleted file mode 100644 index b5386737f83..00000000000 --- a/kura/org.eclipse.kura.web2.ext/src/main/java/org/eclipse/kura/web2/ext/ExtensionRegistry.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2019, 2020 Eurotech and/or its affiliates and others - * - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Eurotech - *******************************************************************************/ -package org.eclipse.kura.web2.ext; - -import java.util.ArrayList; -import java.util.List; -import java.util.function.Consumer; - -import org.eclipse.kura.web2.ext.internal.ExtensionAdapter; -import org.eclipse.kura.web2.ext.internal.JsExtensionRegistry; - -import com.google.gwt.core.client.JavaScriptObject; -import com.google.gwt.core.client.JsArray; - -public class ExtensionRegistry { - - private final JsExtensionRegistry jsExtensionRegistry; - - private static final ExtensionAdapter EXTENSION_ADAPTER = new ExtensionAdapter(); - - private ExtensionRegistry(final JsExtensionRegistry jsExtensionRegistry) { - this.jsExtensionRegistry = jsExtensionRegistry; - } - - public static ExtensionRegistry get() { - return new ExtensionRegistry(JsExtensionRegistry.get()); - } - - public void registerExtension(final Extension extension) { - this.jsExtensionRegistry.registerExtension(EXTENSION_ADAPTER.adaptNullable(extension)); - } - - public void unregisterExtension(final Extension extension) { - this.jsExtensionRegistry.unregisterExtension(EXTENSION_ADAPTER.adaptNullable(extension)); - } - - public void addExtensionConsumer(final Consumer consumer) { - this.jsExtensionRegistry.addExtensionConsumer(e -> consumer.accept(EXTENSION_ADAPTER.adaptNullable(e))); - } - - public List getExtensions() { - final JsArray extensions = this.jsExtensionRegistry.getExtensions(); - - final List result = new ArrayList<>(); - - for (int i = 0; i < extensions.length(); i++) { - result.add(EXTENSION_ADAPTER.adaptNullable(extensions.get(i))); - } - - return result; - } -} diff --git a/kura/org.eclipse.kura.web2.ext/src/main/java/org/eclipse/kura/web2/ext/WidgetFactory.java b/kura/org.eclipse.kura.web2.ext/src/main/java/org/eclipse/kura/web2/ext/WidgetFactory.java deleted file mode 100644 index 5a0c99a9f5b..00000000000 --- a/kura/org.eclipse.kura.web2.ext/src/main/java/org/eclipse/kura/web2/ext/WidgetFactory.java +++ /dev/null @@ -1,20 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2019, 2020 Eurotech and/or its affiliates and others - * - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Eurotech - *******************************************************************************/ -package org.eclipse.kura.web2.ext; - -import com.google.gwt.user.client.ui.Widget; - -public interface WidgetFactory { - - public Widget buildWidget(); -} diff --git a/kura/org.eclipse.kura.web2.ext/src/main/java/org/eclipse/kura/web2/ext/internal/Adapter.java b/kura/org.eclipse.kura.web2.ext/src/main/java/org/eclipse/kura/web2/ext/internal/Adapter.java deleted file mode 100644 index 5b4c70d4767..00000000000 --- a/kura/org.eclipse.kura.web2.ext/src/main/java/org/eclipse/kura/web2/ext/internal/Adapter.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2019, 2020 Eurotech and/or its affiliates and others - * - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Eurotech - *******************************************************************************/ -package org.eclipse.kura.web2.ext.internal; - -import com.google.gwt.core.client.JavaScriptObject; - -public interface Adapter { - - public default JavaScriptObject adaptNullable(T value) { - return value == null ? null : adaptNonNull(value); - } - - public default T adaptNullable(final JavaScriptObject value) { - return value == null ? null : adaptNonNull(value); - } - - public JavaScriptObject adaptNonNull(T value); - - public T adaptNonNull(final JavaScriptObject value); - -} diff --git a/kura/org.eclipse.kura.web2.ext/src/main/java/org/eclipse/kura/web2/ext/internal/AuthenticationHandlerAdapter.java b/kura/org.eclipse.kura.web2.ext/src/main/java/org/eclipse/kura/web2/ext/internal/AuthenticationHandlerAdapter.java deleted file mode 100644 index 10180cebb37..00000000000 --- a/kura/org.eclipse.kura.web2.ext/src/main/java/org/eclipse/kura/web2/ext/internal/AuthenticationHandlerAdapter.java +++ /dev/null @@ -1,73 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2019, 2020 Eurotech and/or its affiliates and others - * - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Eurotech - *******************************************************************************/ -package org.eclipse.kura.web2.ext.internal; - -import org.eclipse.kura.web2.ext.AuthenticationHandler; -import org.eclipse.kura.web2.ext.WidgetFactory; - -import com.google.gwt.core.client.Callback; -import com.google.gwt.core.client.JavaScriptObject; - -public class AuthenticationHandlerAdapter implements Adapter { - - private static final String AUTHENTICATE = "authenticate"; - private static final String GET_LOGIN_DIALOG_ELEMENT = "getLoginDialogElement"; - private static final String GET_NAME = "getName"; - - private static final CallbackAdapter CALLBACK_ADAPTER = new CallbackAdapter<>( - new IdentityAdapter<>(), new IdentityAdapter<>()); - - @Override - public JavaScriptObject adaptNonNull(final AuthenticationHandler authenticationHandler) { - final JsObject obj = JavaScriptObject.createObject().cast(); - - obj.set(GET_NAME, new SupplierAdapter<>(new IdentityAdapter<>()).adaptNullable(authenticationHandler::getName)); - obj.set(GET_LOGIN_DIALOG_ELEMENT, new SupplierAdapter<>(new WidgetFactoryAdapter()) - .adaptNullable(authenticationHandler::getLoginDialogElement)); - obj.set(AUTHENTICATE, - new ConsumerAdapter<>(CALLBACK_ADAPTER).adaptNullable(authenticationHandler::authenticate)); - - return obj; - } - - @Override - public AuthenticationHandler adaptNonNull(final JavaScriptObject jsAuthenticationHandler) { - return new AuthenticationHandler() { - - @Override - public WidgetFactory getLoginDialogElement() { - final JsObject obj = jsAuthenticationHandler.cast(); - - return new WidgetFactoryAdapter().adaptNullable(obj.call(GET_LOGIN_DIALOG_ELEMENT)); - } - - @Override - public String getName() { - final JsObject obj = jsAuthenticationHandler.cast(); - - return new IdentityAdapter().adaptNullable(obj.call(GET_NAME)); - } - - @Override - public void authenticate(final Callback callback) { - - final JsObject obj = jsAuthenticationHandler.cast(); - - final JavaScriptObject jsCallback = CALLBACK_ADAPTER.adaptNullable(callback); - - obj.call(AUTHENTICATE, JsObject.toArray(jsCallback)); - } - }; - } - -} diff --git a/kura/org.eclipse.kura.web2.ext/src/main/java/org/eclipse/kura/web2/ext/internal/BiConsumerAdapter.java b/kura/org.eclipse.kura.web2.ext/src/main/java/org/eclipse/kura/web2/ext/internal/BiConsumerAdapter.java deleted file mode 100644 index 5459ba0f7e5..00000000000 --- a/kura/org.eclipse.kura.web2.ext/src/main/java/org/eclipse/kura/web2/ext/internal/BiConsumerAdapter.java +++ /dev/null @@ -1,50 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2019, 2020 Eurotech and/or its affiliates and others - * - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Eurotech - *******************************************************************************/ -package org.eclipse.kura.web2.ext.internal; - -import java.util.function.BiConsumer; - -import com.google.gwt.core.client.JavaScriptObject; - -public class BiConsumerAdapter implements Adapter> { - - private final Adapter firstAdapter; - private final Adapter secondAdapter; - - public BiConsumerAdapter(final Adapter firstAdapter, final Adapter secondAdapter) { - this.firstAdapter = firstAdapter; - this.secondAdapter = secondAdapter; - } - - @Override - public native JavaScriptObject adaptNonNull(final BiConsumer consumer) - /*-{ - var self = this - return function (t, u) { - var firstAdapter = self.@org.eclipse.kura.web2.ext.internal.BiConsumerAdapter::firstAdapter - var secondAdapter = self.@org.eclipse.kura.web2.ext.internal.BiConsumerAdapter::secondAdapter - var first = firstAdapter.@org.eclipse.kura.web2.ext.internal.Adapter::adaptNullable(Lcom/google/gwt/core/client/JavaScriptObject;)(t) - var second = secondAdapter.@org.eclipse.kura.web2.ext.internal.Adapter::adaptNullable(Lcom/google/gwt/core/client/JavaScriptObject;)(u) - consumer.@java.util.function.BiConsumer::accept(Ljava/lang/Object;Ljava/lang/Object;)(first, second) - } - }-*/; - - @Override - public BiConsumer adaptNonNull(final JavaScriptObject jsConsumer) { - - return (t, u) -> JsObject.call(jsConsumer, - JsObject.toArray(firstAdapter.adaptNullable(t), secondAdapter.adaptNullable(u))); - - } - -} diff --git a/kura/org.eclipse.kura.web2.ext/src/main/java/org/eclipse/kura/web2/ext/internal/BooleanAdapter.java b/kura/org.eclipse.kura.web2.ext/src/main/java/org/eclipse/kura/web2/ext/internal/BooleanAdapter.java deleted file mode 100644 index da74906d282..00000000000 --- a/kura/org.eclipse.kura.web2.ext/src/main/java/org/eclipse/kura/web2/ext/internal/BooleanAdapter.java +++ /dev/null @@ -1,47 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2019, 2020 Eurotech and/or its affiliates and others - * - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Eurotech - *******************************************************************************/ -package org.eclipse.kura.web2.ext.internal; - -import com.google.gwt.core.client.JavaScriptObject; - -public class BooleanAdapter implements Adapter { - - @Override - public native JavaScriptObject adaptNullable(final Boolean value) - /*-{ - if (value === null) { - return null - } - return value.@java.lang.Boolean::booleanValue()() - }-*/; - - @Override - public native Boolean adaptNullable(final JavaScriptObject value) - /*-{ - if (value == null) { - return null - } - return @java.lang.Boolean::valueOf(Z)(value) - }-*/; - - @Override - public JavaScriptObject adaptNonNull(final Boolean value) { - return adaptNullable(value); - } - - @Override - public Boolean adaptNonNull(JavaScriptObject value) { - return adaptNullable(value); - } - -} diff --git a/kura/org.eclipse.kura.web2.ext/src/main/java/org/eclipse/kura/web2/ext/internal/CallbackAdapter.java b/kura/org.eclipse.kura.web2.ext/src/main/java/org/eclipse/kura/web2/ext/internal/CallbackAdapter.java deleted file mode 100644 index 98ba37137e3..00000000000 --- a/kura/org.eclipse.kura.web2.ext/src/main/java/org/eclipse/kura/web2/ext/internal/CallbackAdapter.java +++ /dev/null @@ -1,59 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2019, 2020 Eurotech and/or its affiliates and others - * - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Eurotech - *******************************************************************************/ -package org.eclipse.kura.web2.ext.internal; - -import com.google.gwt.core.client.Callback; -import com.google.gwt.core.client.JavaScriptObject; - -public class CallbackAdapter implements Adapter> { - - private static final String ON_FAILURE = "onFailure"; - private static final String ON_SUCCESS = "onSuccess"; - - private final Adapter successAdapter; - private final Adapter failureAdapter; - - public CallbackAdapter(final Adapter successAdapter, final Adapter failureAdapter) { - this.successAdapter = successAdapter; - this.failureAdapter = failureAdapter; - } - - @Override - public JavaScriptObject adaptNonNull(final Callback callback) { - final JsObject result = JavaScriptObject.createObject().cast(); - - result.set(ON_SUCCESS, new ConsumerAdapter<>(successAdapter).adaptNullable(callback::onSuccess)); - result.set(ON_FAILURE, new ConsumerAdapter<>(failureAdapter).adaptNullable(callback::onFailure)); - - return result; - } - - @Override - public Callback adaptNonNull(final JavaScriptObject callback) { - return new Callback() { - - @Override - public void onSuccess(T result) { - final JsObject obj = callback.cast(); - obj.call(ON_SUCCESS, successAdapter.adaptNullable(result)); - } - - @Override - public void onFailure(U reason) { - final JsObject obj = callback.cast(); - obj.call(ON_FAILURE, failureAdapter.adaptNullable(reason)); - } - }; - } - -} diff --git a/kura/org.eclipse.kura.web2.ext/src/main/java/org/eclipse/kura/web2/ext/internal/ConsumerAdapter.java b/kura/org.eclipse.kura.web2.ext/src/main/java/org/eclipse/kura/web2/ext/internal/ConsumerAdapter.java deleted file mode 100644 index c1dcb649b2d..00000000000 --- a/kura/org.eclipse.kura.web2.ext/src/main/java/org/eclipse/kura/web2/ext/internal/ConsumerAdapter.java +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2019, 2020 Eurotech and/or its affiliates and others - * - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Eurotech - *******************************************************************************/ -package org.eclipse.kura.web2.ext.internal; - -import java.util.function.Consumer; - -import com.google.gwt.core.client.JavaScriptObject; - -public class ConsumerAdapter implements Adapter> { - - private final Adapter adapter; - - public ConsumerAdapter(final Adapter adapter) { - this.adapter = adapter; - } - - @Override - public native JavaScriptObject adaptNonNull(final Consumer consumer) - /*-{ - var self = this - return function (v) { - var adapter = self.@org.eclipse.kura.web2.ext.internal.ConsumerAdapter::adapter - var adapted = adapter.@org.eclipse.kura.web2.ext.internal.Adapter::adaptNullable(Lcom/google/gwt/core/client/JavaScriptObject;)(v) - consumer.@java.util.function.Consumer::accept(Ljava/lang/Object;)(adapted) - } - }-*/; - - @Override - public Consumer adaptNonNull(final JavaScriptObject jsConsumer) { - - return t -> JsObject.call(jsConsumer, adapter.adaptNullable(t)); - - } - -} diff --git a/kura/org.eclipse.kura.web2.ext/src/main/java/org/eclipse/kura/web2/ext/internal/ContextAdapter.java b/kura/org.eclipse.kura.web2.ext/src/main/java/org/eclipse/kura/web2/ext/internal/ContextAdapter.java deleted file mode 100644 index bf5fcfcce76..00000000000 --- a/kura/org.eclipse.kura.web2.ext/src/main/java/org/eclipse/kura/web2/ext/internal/ContextAdapter.java +++ /dev/null @@ -1,130 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2019, 2020 Eurotech and/or its affiliates and others - * - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Eurotech - *******************************************************************************/ -package org.eclipse.kura.web2.ext.internal; - -import java.util.function.Consumer; - -import org.eclipse.kura.web2.ext.AlertSeverity; -import org.eclipse.kura.web2.ext.AuthenticationHandler; -import org.eclipse.kura.web2.ext.Context; -import org.eclipse.kura.web2.ext.WidgetFactory; - -import com.google.gwt.core.client.Callback; -import com.google.gwt.core.client.JavaScriptObject; - -public class ContextAdapter implements Adapter { - - private static final String SHOW_ALERT_DIALOG = "showAlertDialog"; - private static final String START_LONG_RUNNING_OPERATION = "startLongRunningOperation"; - private static final String GET_XSRF_TOKEN = "getXSRFToken"; - private static final String ADD_AUTHENTICATION_HANDLER = "addAuthenticationHandler"; - private static final String ADD_SETTINGS_COMPONENT = "addSettingsComponent"; - private static final String ADD_SIDENAV_COMPONENT = "addSidenavComponent"; - - private static final Adapter> XSRF_TOKEN_ADAPTER = new CallbackAdapter<>( - new IdentityAdapter<>(), new IdentityAdapter<>()); - private static final Adapter> OPERATION_ADAPTER = new CallbackAdapter<>( - new IdentityAdapter<>(), new IdentityAdapter<>()); - private static final Adapter> ALERT_CALLBACK_ADAPTER = new ConsumerAdapter<>( - new BooleanAdapter()); - - @Override - public JavaScriptObject adaptNonNull(final Context context) { - final JsObject obj = JavaScriptObject.createObject().cast(); - - obj.set(ADD_SIDENAV_COMPONENT, new TriConsumerAdapter(new IdentityAdapter<>(), - new IdentityAdapter<>(), new WidgetFactoryAdapter()).adaptNullable(context::addSidenavComponent)); - obj.set(ADD_SETTINGS_COMPONENT, - new BiConsumerAdapter(new IdentityAdapter<>(), new WidgetFactoryAdapter()) - .adaptNullable(context::addSettingsComponent)); - obj.set(ADD_AUTHENTICATION_HANDLER, new ConsumerAdapter<>(new AuthenticationHandlerAdapter()) - .adaptNullable(context::addAuthenticationHandler)); - obj.set(GET_XSRF_TOKEN, new ConsumerAdapter<>(XSRF_TOKEN_ADAPTER).adaptNullable(context::getXSRFToken)); - obj.set(START_LONG_RUNNING_OPERATION, - new SupplierAdapter<>(OPERATION_ADAPTER).adaptNullable(context::startLongRunningOperation)); - obj.set(SHOW_ALERT_DIALOG, - new TriConsumerAdapter>(new IdentityAdapter<>(), - new EnumAdapter<>(AlertSeverity.class), ALERT_CALLBACK_ADAPTER) - .adaptNullable(context::showAlertDialog)); - - return obj; - } - - @Override - public Context adaptNonNull(final JavaScriptObject jsContext) { - return new Context() { - - @Override - public void addSidenavComponent(final String name, final String icon, final WidgetFactory factory) { - final JsObject obj = jsContext.cast(); - - final JavaScriptObject jsName = new IdentityAdapter<>().adaptNullable(name); - final JavaScriptObject jsIcon = new IdentityAdapter<>().adaptNullable(icon); - final JavaScriptObject jsElement = new WidgetFactoryAdapter().adaptNullable(factory); - - obj.call(ADD_SIDENAV_COMPONENT, JsObject.toArray(jsName, jsIcon, jsElement)); - } - - @Override - public void addSettingsComponent(final String name, final WidgetFactory factory) { - final JsObject obj = jsContext.cast(); - - final JavaScriptObject jsName = new IdentityAdapter<>().adaptNullable(name); - final JavaScriptObject jsElement = new WidgetFactoryAdapter().adaptNullable(factory); - - obj.call(ADD_SETTINGS_COMPONENT, JsObject.toArray(jsName, jsElement)); - } - - @Override - public void addAuthenticationHandler(final AuthenticationHandler authenticationHandler) { - final JsObject obj = jsContext.cast(); - - final JavaScriptObject jsAuthenticationHandler = new AuthenticationHandlerAdapter() - .adaptNullable(authenticationHandler); - - obj.call(ADD_AUTHENTICATION_HANDLER, jsAuthenticationHandler); - } - - @Override - public void getXSRFToken(Callback callback) { - final JsObject obj = jsContext.cast(); - - final JavaScriptObject jsCallback = XSRF_TOKEN_ADAPTER.adaptNullable(callback); - - obj.call(GET_XSRF_TOKEN, jsCallback); - - } - - @Override - public Callback startLongRunningOperation() { - final JsObject obj = jsContext.cast(); - - final JavaScriptObject jsCallback = obj.call(START_LONG_RUNNING_OPERATION); - - return OPERATION_ADAPTER.adaptNullable(jsCallback); - } - - @Override - public void showAlertDialog(String message, AlertSeverity severity, Consumer callback) { - final JsObject obj = jsContext.cast(); - - final JavaScriptObject jsMessage = new IdentityAdapter<>().adaptNullable(message); - final JavaScriptObject jsSeverity = new EnumAdapter<>(AlertSeverity.class).adaptNullable(severity); - final JavaScriptObject jsCallback = ALERT_CALLBACK_ADAPTER.adaptNullable(callback); - - obj.call(SHOW_ALERT_DIALOG, JsObject.toArray(jsMessage, jsSeverity, jsCallback)); - } - }; - } - -} diff --git a/kura/org.eclipse.kura.web2.ext/src/main/java/org/eclipse/kura/web2/ext/internal/EnumAdapter.java b/kura/org.eclipse.kura.web2.ext/src/main/java/org/eclipse/kura/web2/ext/internal/EnumAdapter.java deleted file mode 100644 index 00909416881..00000000000 --- a/kura/org.eclipse.kura.web2.ext/src/main/java/org/eclipse/kura/web2/ext/internal/EnumAdapter.java +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2019, 2020 Eurotech and/or its affiliates and others - * - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Eurotech - *******************************************************************************/ -package org.eclipse.kura.web2.ext.internal; - -import com.google.gwt.core.client.JavaScriptObject; - -public class EnumAdapter> implements Adapter { - - private final Class type; - - public EnumAdapter(final Class type) { - this.type = type; - } - - @Override - public JavaScriptObject adaptNonNull(final T value) { - return JsObject.fromString(value.name()); - } - - @Override - public T adaptNonNull(JavaScriptObject value) { - final JsObject obj = value.cast(); - return Enum.valueOf(type, obj.asString()); - } - -} diff --git a/kura/org.eclipse.kura.web2.ext/src/main/java/org/eclipse/kura/web2/ext/internal/ExtensionAdapter.java b/kura/org.eclipse.kura.web2.ext/src/main/java/org/eclipse/kura/web2/ext/internal/ExtensionAdapter.java deleted file mode 100644 index d2aee023786..00000000000 --- a/kura/org.eclipse.kura.web2.ext/src/main/java/org/eclipse/kura/web2/ext/internal/ExtensionAdapter.java +++ /dev/null @@ -1,46 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2019, 2020 Eurotech and/or its affiliates and others - * - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Eurotech - *******************************************************************************/ -package org.eclipse.kura.web2.ext.internal; - -import org.eclipse.kura.web2.ext.Context; -import org.eclipse.kura.web2.ext.Extension; - -import com.google.gwt.core.client.JavaScriptObject; - -public class ExtensionAdapter implements Adapter { - - private static final String ON_LOAD = "onLoad"; - - @Override - public JavaScriptObject adaptNonNull(final Extension extension) { - final JsObject object = JavaScriptObject.createObject().cast(); - - object.set(ON_LOAD, new ConsumerAdapter<>(new ContextAdapter()).adaptNullable(extension::onLoad)); - - return object; - } - - @Override - public Extension adaptNonNull(final JavaScriptObject jsExtension) { - return new Extension() { - - @Override - public void onLoad(Context context) { - final JsObject obj = jsExtension.cast(); - - obj.call(ON_LOAD, new ContextAdapter().adaptNullable(context)); - } - }; - } - -} diff --git a/kura/org.eclipse.kura.web2.ext/src/main/java/org/eclipse/kura/web2/ext/internal/IdentityAdapter.java b/kura/org.eclipse.kura.web2.ext/src/main/java/org/eclipse/kura/web2/ext/internal/IdentityAdapter.java deleted file mode 100644 index d91dde2a31a..00000000000 --- a/kura/org.eclipse.kura.web2.ext/src/main/java/org/eclipse/kura/web2/ext/internal/IdentityAdapter.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2019, 2020 Eurotech and/or its affiliates and others - * - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Eurotech - *******************************************************************************/ -package org.eclipse.kura.web2.ext.internal; - -import com.google.gwt.core.client.JavaScriptObject; - -public class IdentityAdapter implements Adapter { - - @Override - public native JavaScriptObject adaptNonNull(final T value) - /*-{ - return value - }-*/; - - @Override - public native T adaptNonNull(JavaScriptObject value) - /*-{ - return value - }-*/; - -} diff --git a/kura/org.eclipse.kura.web2.ext/src/main/java/org/eclipse/kura/web2/ext/internal/JsExtensionRegistry.java b/kura/org.eclipse.kura.web2.ext/src/main/java/org/eclipse/kura/web2/ext/internal/JsExtensionRegistry.java deleted file mode 100644 index 0e40882001c..00000000000 --- a/kura/org.eclipse.kura.web2.ext/src/main/java/org/eclipse/kura/web2/ext/internal/JsExtensionRegistry.java +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2019, 2020 Eurotech and/or its affiliates and others - * - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Eurotech - *******************************************************************************/ -package org.eclipse.kura.web2.ext.internal; - -import java.util.function.Consumer; - -import com.google.gwt.core.client.JavaScriptObject; -import com.google.gwt.core.client.JsArray; - -public final class JsExtensionRegistry extends JavaScriptObject { - - protected JsExtensionRegistry() { - } - - public static native JsExtensionRegistry get() - /*-{ - return window.top.extensionRegistry - }-*/; - - public final native void registerExtension(final JavaScriptObject extension) - /*-{ - this.registerExtension(extension) - }-*/; - - public final native void unregisterExtension(final JavaScriptObject extension) - /*-{ - this.unregisterExtension(extension) - }-*/; - - public final native void addExtensionConsumer(final Consumer consumer) - /*-{ - this.addExtensionConsumer(function (ex) { - consumer.@java.util.function.Consumer::accept(Ljava/lang/Object;)(ex) - }) - }-*/; - - public final native JsArray getExtensions() - /*-{ - return this.getExtensions() - }-*/; - -} diff --git a/kura/org.eclipse.kura.web2.ext/src/main/java/org/eclipse/kura/web2/ext/internal/JsObject.java b/kura/org.eclipse.kura.web2.ext/src/main/java/org/eclipse/kura/web2/ext/internal/JsObject.java deleted file mode 100644 index de848977c41..00000000000 --- a/kura/org.eclipse.kura.web2.ext/src/main/java/org/eclipse/kura/web2/ext/internal/JsObject.java +++ /dev/null @@ -1,84 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2019, 2020 Eurotech and/or its affiliates and others - * - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Eurotech - *******************************************************************************/ -package org.eclipse.kura.web2.ext.internal; - -import com.google.gwt.core.client.JavaScriptObject; -import com.google.gwt.core.client.JsArray; - -public final class JsObject extends JavaScriptObject { - - protected JsObject() { - } - - public final native T get(final String key) - /*-{ - return this[key] - }-*/; - - public final native void set(final String key, final JavaScriptObject object) - /*-{ - this[key] = object - }-*/; - - public final native JavaScriptObject call(final String key) - /*-{ - return this[key]() - }-*/; - - public final native JavaScriptObject call(final String key, final JavaScriptObject value) - /*-{ - return this[key](value) - }-*/; - - public final native JavaScriptObject call(final String key, final JsArray values) - /*-{ - return this[key].apply(this, values) - }-*/; - - public final native String asString() - /*-{ - return this - }-*/; - - public static native JsObject fromString(final String string) - /*-{ - return string - }-*/; - - public static final native JavaScriptObject call(final JavaScriptObject func) - /*-{ - return func() - }-*/; - - public static final native JavaScriptObject call(final JavaScriptObject func, final JavaScriptObject value) - /*-{ - return func(value) - }-*/; - - public static final native JavaScriptObject call(final JavaScriptObject func, - final JsArray values) - /*-{ - return func.apply(null, values) - }-*/; - - @SafeVarargs - public static final JsArray toArray(T... args) { - final JsArray result = JavaScriptObject.createArray().cast(); - - for (T val : args) { - result.push(val); - } - - return result; - } -} diff --git a/kura/org.eclipse.kura.web2.ext/src/main/java/org/eclipse/kura/web2/ext/internal/SupplierAdapter.java b/kura/org.eclipse.kura.web2.ext/src/main/java/org/eclipse/kura/web2/ext/internal/SupplierAdapter.java deleted file mode 100644 index 5ffb1cb1f80..00000000000 --- a/kura/org.eclipse.kura.web2.ext/src/main/java/org/eclipse/kura/web2/ext/internal/SupplierAdapter.java +++ /dev/null @@ -1,44 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2019, 2020 Eurotech and/or its affiliates and others - * - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Eurotech - *******************************************************************************/ -package org.eclipse.kura.web2.ext.internal; - -import java.util.function.Supplier; - -import com.google.gwt.core.client.JavaScriptObject; - -public class SupplierAdapter implements Adapter> { - - private final Adapter adapter; - - public SupplierAdapter(final Adapter adapter) { - this.adapter = adapter; - } - - @Override - public native JavaScriptObject adaptNonNull(final Supplier value) - /*-{ - var self = this - return function () { - var adapter = self.@org.eclipse.kura.web2.ext.internal.SupplierAdapter::adapter - var v = value.@java.util.function.Supplier::get()() - return adapter.@org.eclipse.kura.web2.ext.internal.Adapter::adaptNullable(Ljava/lang/Object;)(v) - } - }-*/; - - @Override - public Supplier adaptNonNull(JavaScriptObject jsSupplier) { - - return () -> adapter.adaptNullable(JsObject.call(jsSupplier)); - - } -} diff --git a/kura/org.eclipse.kura.web2.ext/src/main/java/org/eclipse/kura/web2/ext/internal/TriConsumer.java b/kura/org.eclipse.kura.web2.ext/src/main/java/org/eclipse/kura/web2/ext/internal/TriConsumer.java deleted file mode 100644 index 1aa79307b1a..00000000000 --- a/kura/org.eclipse.kura.web2.ext/src/main/java/org/eclipse/kura/web2/ext/internal/TriConsumer.java +++ /dev/null @@ -1,18 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2019, 2020 Eurotech and/or its affiliates and others - * - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Eurotech - *******************************************************************************/ -package org.eclipse.kura.web2.ext.internal; - -public interface TriConsumer { - - public void accept(T first, U second, V third); -} diff --git a/kura/org.eclipse.kura.web2.ext/src/main/java/org/eclipse/kura/web2/ext/internal/TriConsumerAdapter.java b/kura/org.eclipse.kura.web2.ext/src/main/java/org/eclipse/kura/web2/ext/internal/TriConsumerAdapter.java deleted file mode 100644 index 1f60079ece3..00000000000 --- a/kura/org.eclipse.kura.web2.ext/src/main/java/org/eclipse/kura/web2/ext/internal/TriConsumerAdapter.java +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2019, 2020 Eurotech and/or its affiliates and others - * - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Eurotech - *******************************************************************************/ -package org.eclipse.kura.web2.ext.internal; - -import com.google.gwt.core.client.JavaScriptObject; - -public class TriConsumerAdapter implements Adapter> { - - private final Adapter firstAdapter; - private final Adapter secondAdapter; - private final Adapter thirdAdapter; - - public TriConsumerAdapter(final Adapter firstAdapter, final Adapter secondAdapter, - final Adapter thirdAdapter) { - this.firstAdapter = firstAdapter; - this.secondAdapter = secondAdapter; - this.thirdAdapter = thirdAdapter; - } - - @SuppressWarnings("checkstyle:lineLength") - @Override - public native JavaScriptObject adaptNonNull(final TriConsumer consumer) - /*-{ - var self = this - return function (t, u, v) { - var firstAdapter = self.@org.eclipse.kura.web2.ext.internal.TriConsumerAdapter::firstAdapter - var secondAdapter = self.@org.eclipse.kura.web2.ext.internal.TriConsumerAdapter::secondAdapter - var thirdAdapter = self.@org.eclipse.kura.web2.ext.internal.TriConsumerAdapter::thirdAdapter - var first = firstAdapter.@org.eclipse.kura.web2.ext.internal.Adapter::adaptNullable(Lcom/google/gwt/core/client/JavaScriptObject;)(t) - var second = secondAdapter.@org.eclipse.kura.web2.ext.internal.Adapter::adaptNullable(Lcom/google/gwt/core/client/JavaScriptObject;)(u) - var third = thirdAdapter.@org.eclipse.kura.web2.ext.internal.Adapter::adaptNullable(Lcom/google/gwt/core/client/JavaScriptObject;)(v) - consumer.@org.eclipse.kura.web2.ext.internal.TriConsumer::accept(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)(first, second, third) - } - }-*/; - - @Override - public TriConsumer adaptNonNull(final JavaScriptObject jsConsumer) { - - return (t, u, v) -> JsObject.call(jsConsumer, JsObject.toArray(firstAdapter.adaptNullable(t), - secondAdapter.adaptNullable(u), thirdAdapter.adaptNullable(v))); - - } - -} diff --git a/kura/org.eclipse.kura.web2.ext/src/main/java/org/eclipse/kura/web2/ext/internal/WidgetAdapter.java b/kura/org.eclipse.kura.web2.ext/src/main/java/org/eclipse/kura/web2/ext/internal/WidgetAdapter.java deleted file mode 100644 index df5b2917b19..00000000000 --- a/kura/org.eclipse.kura.web2.ext/src/main/java/org/eclipse/kura/web2/ext/internal/WidgetAdapter.java +++ /dev/null @@ -1,39 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2019, 2020 Eurotech and/or its affiliates and others - * - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Eurotech - *******************************************************************************/ -package org.eclipse.kura.web2.ext.internal; - -import com.google.gwt.core.client.JavaScriptObject; -import com.google.gwt.dom.client.Element; -import com.google.gwt.user.client.ui.Widget; - -public class WidgetAdapter implements Adapter { - - @Override - public JavaScriptObject adaptNonNull(Widget value) { - return value.getElement(); - } - - private class WidgetWrapper extends Widget { - - public WidgetWrapper(final Element element) { - setElement(element); - } - } - - @Override - public Widget adaptNonNull(JavaScriptObject value) { - - return new WidgetWrapper(value.cast()); - } - -} diff --git a/kura/org.eclipse.kura.web2.ext/src/main/java/org/eclipse/kura/web2/ext/internal/WidgetFactoryAdapter.java b/kura/org.eclipse.kura.web2.ext/src/main/java/org/eclipse/kura/web2/ext/internal/WidgetFactoryAdapter.java deleted file mode 100644 index 67101e1269c..00000000000 --- a/kura/org.eclipse.kura.web2.ext/src/main/java/org/eclipse/kura/web2/ext/internal/WidgetFactoryAdapter.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2019, 2020 Eurotech and/or its affiliates and others - * - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Eurotech - *******************************************************************************/ -package org.eclipse.kura.web2.ext.internal; - -import org.eclipse.kura.web2.ext.WidgetFactory; - -import com.google.gwt.core.client.JavaScriptObject; -import com.google.gwt.user.client.ui.Composite; -import com.google.gwt.user.client.ui.Widget; - -public class WidgetFactoryAdapter implements Adapter { - - private static final String BUILD_WIDGET = "buildWidget"; - - @Override - public JavaScriptObject adaptNonNull(final WidgetFactory value) { - - final JsObject object = JavaScriptObject.createObject().cast(); - - object.set(BUILD_WIDGET, - new SupplierAdapter<>(new WidgetAdapter()).adaptNullable(() -> new AttachWrapper(value.buildWidget()))); - - return object; - } - - private class AttachWrapper extends Composite { - - public AttachWrapper(final Widget child) { - initWidget(child); - - onAttach(); - } - - } - - @Override - public WidgetFactory adaptNonNull(final JavaScriptObject value) { - - return new WidgetFactory() { - - @Override - public Widget buildWidget() { - final JsObject obj = value.cast(); - - final JavaScriptObject jsWidget = obj.call(BUILD_WIDGET); - - return new WidgetAdapter().adaptNullable(jsWidget); - } - }; - } - -} diff --git a/kura/org.eclipse.kura.web2.ext/src/main/resources/org/eclipse/kura/web2/ext.gwt.xml b/kura/org.eclipse.kura.web2.ext/src/main/resources/org/eclipse/kura/web2/ext.gwt.xml deleted file mode 100644 index ce624a897ff..00000000000 --- a/kura/org.eclipse.kura.web2.ext/src/main/resources/org/eclipse/kura/web2/ext.gwt.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - - - diff --git a/kura/org.eclipse.kura.web2/META-INF/MANIFEST.MF b/kura/org.eclipse.kura.web2/META-INF/MANIFEST.MF index 1bcab372728..9f3180fb679 100644 --- a/kura/org.eclipse.kura.web2/META-INF/MANIFEST.MF +++ b/kura/org.eclipse.kura.web2/META-INF/MANIFEST.MF @@ -10,22 +10,15 @@ Service-Component: OSGI-INF/*.xml Bundle-ActivationPolicy: lazy Import-Package: com.eclipsesource.json;version="0.9.5", com.google.gson;version="2.7.0", - javax.crypto, - javax.crypto.spec, - javax.security.auth, - javax.servlet;version="2.6.0", - javax.servlet.http;version="2.6.0", + jakarta.servlet;version="5.0.0", + jakarta.servlet.http;version="5.0.0", javax.xml.parsers, - javax.xml.soap, - javax.xml.ws.http, org.apache.commons.csv;version="1.4.0", - org.apache.commons.fileupload;version="1.5", - org.apache.commons.fileupload.disk;version="1.5", - org.apache.commons.fileupload.servlet;version="1.5", - org.apache.commons.io;version="1.4.0", - org.apache.commons.net.util;version="3.1.0", + org.apache.commons.fileupload2.core;version="2.0.0", + org.apache.commons.fileupload2.jakarta.servlet5;version="2.0.0", + org.apache.commons.io;version="2.18.0", + org.apache.commons.io.build;version="2.18.0", org.eclipse.kura;version="[1.2,2.0)", - org.eclipse.kura.annotation;version="[1.0,2.0)", org.eclipse.kura.asset;version="[0.9,2.0)", org.eclipse.kura.asset.provider;version="[2.1,2.2)", org.eclipse.kura.audit;version="[1.0,2.0)", @@ -46,11 +39,9 @@ Import-Package: com.eclipsesource.json;version="0.9.5", org.eclipse.kura.core.keystore.util;version="[1.0,2.0)", org.eclipse.kura.core.net;version="[1.0,2.0)", org.eclipse.kura.core.net.util;version="[1.0,2.0)", - org.eclipse.kura.core.ssl;version="[1.0,2.0)", org.eclipse.kura.core.util;version="[2.0,3.0)", org.eclipse.kura.crypto;version="[1.3,2.0)", org.eclipse.kura.data;version="[1.0,2.0)", - org.eclipse.kura.db;version="[2.0,3.0)", org.eclipse.kura.deployment.agent;version="[1.1,2.0)", org.eclipse.kura.driver;version="[1.0,2.0)", org.eclipse.kura.driver.descriptor;version="1.0.0", @@ -58,20 +49,15 @@ Import-Package: com.eclipsesource.json;version="0.9.5", org.eclipse.kura.identity;version="[1.0,2.0)", org.eclipse.kura.internal.wire.asset;version="[1.0,2.0)", org.eclipse.kura.log;version="[1.1,1.2)", - org.eclipse.kura.log.listener;version="[1.0,2.0)", org.eclipse.kura.marshalling;version="[1.0,2.0)", org.eclipse.kura.net;version="[2.1,3.0)", org.eclipse.kura.net.admin;version="[1.6,3.0)";resolution:=optional, org.eclipse.kura.net.admin.ipv6;version="[1.0,2.0)";resolution:=optional, - org.eclipse.kura.net.dhcp;version="[1.0,2.0)", org.eclipse.kura.net.firewall;version="[2.0,3.0)", org.eclipse.kura.net.modem;version="[2.2,3.0)", org.eclipse.kura.net.status;version="[1.0,2.0)", - org.eclipse.kura.net.status.ethernet;version="[1.0,2.0)", org.eclipse.kura.net.status.modem;version="[1.1,2.0)", - org.eclipse.kura.net.status.vlan;version="[1.0,2.0)", org.eclipse.kura.net.status.wifi;version="[1.1,2.0)", - org.eclipse.kura.net.vlan;version="[1.0,2.0)", org.eclipse.kura.net.wifi;version="[2.4,3.0)", org.eclipse.kura.position;version="[1.0,2.0)", org.eclipse.kura.rest.configuration.api;version="[1.0,2.0)", @@ -81,10 +67,8 @@ Import-Package: com.eclipsesource.json;version="0.9.5", org.eclipse.kura.ssl;version="[2.0,3.0)", org.eclipse.kura.system;version="[1.3,2.0)", org.eclipse.kura.type;version="[1.0,2.0)", - org.eclipse.kura.usb;version="[1.0,2.0)", org.eclipse.kura.util.base;version="[1.0,2.0)", org.eclipse.kura.util.service;version="[1.0,2.0)", - org.eclipse.kura.web2.ext;version="[1.0,2.0)";resolution:=optional, org.eclipse.kura.wire;version="[2.0,3.0)", org.eclipse.kura.wire.graph;version="[1.0,2.0)", org.osgi.framework;version="1.7.0", @@ -96,12 +80,12 @@ Import-Package: com.eclipsesource.json;version="0.9.5", org.osgi.service.event;version="1.3.0", org.osgi.service.http;version="1.2.0", org.osgi.service.metatype;version="1.2.0", + org.osgi.service.servlet.context;version="2.0.0", + org.osgi.service.servlet.whiteboard;version="2.0.0", org.osgi.service.wireadmin;version="1.0.1", org.osgi.util.measurement;version="1.0.1", org.osgi.util.position;version="1.0.1", - org.osgi.util.tracker;version="1.5.1", org.slf4j;version="1.6.4", org.w3c.dom, org.xml.sax Require-Bundle: com.gwt.user;bundle-version="[2.0.0,3.0.0)" -Export-Package: org.eclipse.kura.web.api;version="1.0.0" diff --git a/kura/org.eclipse.kura.web2/OSGI-INF/web.xml b/kura/org.eclipse.kura.web2/OSGI-INF/web.xml index 06a368afcc2..bf34bba34f1 100644 --- a/kura/org.eclipse.kura.web2/OSGI-INF/web.xml +++ b/kura/org.eclipse.kura.web2/OSGI-INF/web.xml @@ -16,8 +16,7 @@ --> - - + - + - 4.0.0 + 4.0.0 - - org.eclipse.kura - kura - 6.0.0-SNAPSHOT - + + org.eclipse.kura + kura + 6.0.0-SNAPSHOT + - org.eclipse.kura.web2 - 3.0.0-SNAPSHOT - eclipse-plugin + org.eclipse.kura.web2 + 3.0.0-SNAPSHOT + eclipse-plugin - - ${project.basedir}/.. - - 2.10.0 - UTF-8 - - - - - org.eclipse.kura - org.eclipse.kura.web2.ext - 2.0.0-SNAPSHOT - provided - - - - - - - - org.apache.maven.wagon - wagon-ssh - 1.0-beta-6 - - - - - org.apache.maven.plugins - maven-checkstyle-plugin - - true - - - - - org.apache.maven.plugins - maven-clean-plugin - 2.4.1 - - - - src/main/webapp/denali - - - src/main/webapp/WEB-INF - - - - - - - org.codehaus.mojo - gwt-maven-plugin - ${gwtVersion} - - - - compile - test - i18n - generateAsync - - - - - - true - -Xmx2048M -Xss1024k -XX:+UseParallelGC - 2 - denali.html - org.eclipse.kura.web.client.messages.Messages - org.eclipse.kura.web.client.messages.ValidationMessages - src/main/webapp - - + + ${project.basedir}/.. + + 2.10.0 + UTF-8 + + + + + org.gwtbootstrap3 + gwtbootstrap3 + 1.0.1 + + + org.gwtproject + gwt-user + 2.12.1 + + + + + + + + org.apache.maven.wagon + wagon-ssh + 1.0 + + + + + org.apache.maven.plugins + maven-checkstyle-plugin + + true + + + + org.apache.maven.plugins + maven-dependency-plugin + 3.0.0 + + + validate + + ${project.basedir}/lib + true + + + org.gwtbootstrap3 + gwtbootstrap3 + 1.0.1 + + + org.gwtproject + gwt-user + 2.12.1 + + + + + copy + + + + + + + org.apache.maven.plugins + maven-clean-plugin + 2.4.1 + + + + src/main/webapp/denali + + + src/main/webapp/WEB-INF + + + lib + + + + + + + org.codehaus.mojo + gwt-maven-plugin + ${gwtVersion} + + + + compile + test + i18n + generateAsync + + + + + + true + -Xmx2048M -Xss1024k -XX:+UseParallelGC + 2 + denali.html + org.eclipse.kura.web.client.messages.Messages + org.eclipse.kura.web.client.messages.ValidationMessages + src/main/webapp + + - - - org.apache.maven.plugins - maven-war-plugin - 3.3.2 - - - compile - - exploded - - - - - ${webappDirectory} - - false - META-INF/MANIFEST.MF - - - + + + org.apache.maven.plugins + maven-war-plugin + 3.3.2 + + + compile + + exploded + + + + + ${webappDirectory} + + false + META-INF/MANIFEST.MF + + + - - net.alchim31.maven - yuicompressor-maven-plugin - 1.5.1 - - true - - - true - src/main/webapp/login.all.js - ${basedir}/src/main/resources/org/eclipse/kura/web/js - - extensions.js - - - - true - src/main/webapp/denali.all.js - ${basedir}/src/main/resources/org/eclipse/kura/web/js - - jquery.min.js - lodash.min.js - backbone.min.js - joint.min.js - joint.shapes.devs.js - dnd_helper.js - wires_composer.js - wires_blink.js - extensions.js - - - - true - src/main/webapp/denali.all.css - ${basedir}/src/main/resources/org/eclipse/kura/web/css - - joint.min.css - denali.css - - - - - denali.all.js - login.all.js - denali.all.css - - false - false - src/main/webapp/ - src/main/webapp/ - - - - compress_js_css - process-resources - - compress - - - - + + net.alchim31.maven + yuicompressor-maven-plugin + 1.5.1 + + true + + + true + src/main/webapp/login.all.js + ${basedir}/src/main/resources/org/eclipse/kura/web/js + + extensions.js + + + + true + src/main/webapp/denali.all.js + ${basedir}/src/main/resources/org/eclipse/kura/web/js + + jquery.min.js + lodash.min.js + backbone.min.js + joint.min.js + joint.shapes.devs.js + dnd_helper.js + wires_composer.js + wires_blink.js + extensions.js + + + + true + src/main/webapp/denali.all.css + ${basedir}/src/main/resources/org/eclipse/kura/web/css + + joint.min.css + denali.css + + + + + denali.all.js + login.all.js + denali.all.css + + false + false + src/main/webapp/ + src/main/webapp/ + + + + compress_js_css + process-resources + + compress + + + + org.eclipse.tycho @@ -195,68 +232,61 @@ **/org/eclipse/kura/web/client/**/*.java + **/org/eclipse/kura/web/shared/service/*Async.java + + org.eclipse.tycho + tycho-packaging-plugin + + + + src/main/webapp + www/ + + **/WEB-INF/** + **/gwt-unitCache/**/* + **/src/main/resources/**/js/*.js + **/src/main/resources/**/css/*.css + **/src/main/webapp/*.all.js + + + + + + - - org.eclipse.tycho - tycho-packaging-plugin - - - - src/main/webapp - www/ - - **/WEB-INF/** - **/gwt-unitCache/**/* - **/src/main/resources/**/js/*.js - **/src/main/resources/**/css/*.css - **/src/main/webapp/*.all.js - - - - - - - - - - - - org.eclipse.m2e - lifecycle-mapping - 1.0.0 - - - + + + + + org.eclipse.m2e + lifecycle-mapping + 1.0.0 + + + - - - - org.apache.maven.plugins - - - maven-war-plugin - - - [2.1.1,) - - - exploded - - - - - - - - - - - - - + + + org.apache.maven.plugins + maven-war-plugin + [2.1.1,) + + exploded + + + + + + + + + + + + + diff --git a/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/Console.java b/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/Console.java index 6f3190416f6..dd5d0bd06d8 100644 --- a/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/Console.java +++ b/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/Console.java @@ -18,6 +18,7 @@ import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; +import java.util.Hashtable; import java.util.LinkedHashSet; import java.util.Map; import java.util.Objects; @@ -25,14 +26,7 @@ import java.util.Set; import java.util.concurrent.CopyOnWriteArraySet; import java.util.concurrent.atomic.AtomicReference; -import java.util.stream.Stream; -import javax.servlet.Servlet; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpSession; - -import org.eclipse.kura.KuraErrorCode; import org.eclipse.kura.KuraException; import org.eclipse.kura.audit.AuditConstants; import org.eclipse.kura.audit.AuditContext; @@ -42,14 +36,12 @@ import org.eclipse.kura.identity.IdentityService; import org.eclipse.kura.ssl.SslManagerService; import org.eclipse.kura.system.SystemService; -import org.eclipse.kura.web.api.ClientExtensionBundle; import org.eclipse.kura.web.server.GwtCertificatesServiceImpl; import org.eclipse.kura.web.server.GwtCloudConnectionServiceImpl; import org.eclipse.kura.web.server.GwtComponentServiceImpl; import org.eclipse.kura.web.server.GwtDeviceServiceImpl; import org.eclipse.kura.web.server.GwtDriverAndAssetServiceImpl; import org.eclipse.kura.web.server.GwtEventServiceImpl; -import org.eclipse.kura.web.server.GwtExtensionServiceImpl; import org.eclipse.kura.web.server.GwtKeystoreServiceImpl; import org.eclipse.kura.web.server.GwtLogServiceImpl; import org.eclipse.kura.web.server.GwtLoginInfoServiceImpl; @@ -64,7 +56,6 @@ import org.eclipse.kura.web.server.GwtStatusServiceImpl; import org.eclipse.kura.web.server.GwtUserServiceImpl; import org.eclipse.kura.web.server.GwtWireGraphServiceImpl; -import org.eclipse.kura.web.server.KuraRemoteServiceServlet; import org.eclipse.kura.web.server.servlet.ChannelServlet; import org.eclipse.kura.web.server.servlet.DeviceSnapshotsServlet; import org.eclipse.kura.web.server.servlet.FileServlet; @@ -79,24 +70,34 @@ import org.eclipse.kura.web.session.Attributes; import org.eclipse.kura.web.session.BaseSecurityHandler; import org.eclipse.kura.web.session.CreateSessionSecurityHandler; -import org.eclipse.kura.web.session.HttpContextImpl; +import org.eclipse.kura.web.session.HttpServletContextHelper; import org.eclipse.kura.web.session.RoutingSecurityHandler; import org.eclipse.kura.web.session.SecurityHandler; import org.eclipse.kura.web.session.SessionAutorizationSecurityHandler; import org.eclipse.kura.web.session.SessionExpirationSecurityHandler; import org.eclipse.kura.web.session.SessionLockedSecurityHandler; import org.osgi.framework.BundleContext; +import org.osgi.framework.Constants; +import org.osgi.framework.ServiceRegistration; import org.osgi.service.component.ComponentContext; import org.osgi.service.event.Event; import org.osgi.service.event.EventAdmin; import org.osgi.service.event.EventProperties; -import org.osgi.service.http.HttpContext; -import org.osgi.service.http.HttpService; import org.osgi.service.http.NamespaceException; +import org.osgi.service.servlet.context.ServletContextHelper; +import org.osgi.service.servlet.whiteboard.HttpWhiteboardConstants; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class Console implements SelfConfiguringComponent, org.eclipse.kura.web.api.Console { +import jakarta.servlet.http.HttpServlet; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpSession; + +public class Console implements SelfConfiguringComponent { + + private static final String SESSION_CONTEX_NAME = "sessionContex"; + + private static final String RESOURCE_CONTEX_NAME = "resourceContex"; private static final String SESSION = "/session"; @@ -122,8 +123,6 @@ public class Console implements SelfConfiguringComponent, org.eclipse.kura.web.a private int sessionMaxInactiveInterval; private ComponentContext componentContext; - private HttpService httpService; - private SystemService systemService; private final AtomicReference> sslManagerService = new AtomicReference<>( Optional.empty()); @@ -135,12 +134,11 @@ public class Console implements SelfConfiguringComponent, org.eclipse.kura.web.a private GwtEventServiceImpl eventService; private WiresBlinkServlet wiresBlinkService; - private HttpContext sessionContext; + private final Set> contexts = new CopyOnWriteArraySet<>(); + private final Set> resources = new CopyOnWriteArraySet<>(); + private final Set> servlets = new CopyOnWriteArraySet<>(); - private final Set securedServlets = new CopyOnWriteArraySet<>(); - private final Set loginServlets = new CopyOnWriteArraySet<>(); - private final Set consoleExtensions = new CopyOnWriteArraySet<>(); - private final Set loginExtensions = new CopyOnWriteArraySet<>(); + private BundleContext bundleContext; private static Console instance; @@ -169,10 +167,6 @@ public void unsetSslManagerService(SslManagerService sslManagerService) { }); } - public void setHttpService(HttpService httpService) { - this.httpService = httpService; - } - public void setSystemService(SystemService systemService) { this.systemService = systemService; } @@ -193,6 +187,8 @@ public void setIdentityService(final IdentityService identityService) { protected void activate(ComponentContext context, Map properties) { + this.bundleContext = context.getBundleContext(); + setInstance(this); try { setConsoleOptions(properties == null ? ConsoleOptions.defaultConfiguration() @@ -256,7 +252,7 @@ protected void updated(Map properties) { if (!newOptions.equals(Console.getConsoleOptions())) { logger.info("Console options changed, reconfiguring..."); Console.setConsoleOptions(newOptions); - unregisterServlet(); + unregisterAll(); doUpdate(newOptions); } } @@ -274,7 +270,7 @@ private void doUpdate(ConsoleOptions options) { try { initHTTPService(); - } catch (NamespaceException | ServletException e) { + } catch (NamespaceException e) { logger.warn("Error Registering Web Resources", e); } } @@ -282,7 +278,7 @@ private void doUpdate(ConsoleOptions options) { protected void deactivate(BundleContext context) { logger.info("deactivate..."); - unregisterServlet(); + unregisterAll(); } // ---------------------------------------------------------------- @@ -291,56 +287,59 @@ protected void deactivate(BundleContext context) { // // ---------------------------------------------------------------- - private synchronized void unregisterServlet() { - this.httpService.unregister("/"); - this.httpService.unregister(ADMIN_ROOT); - this.httpService.unregister(CONSOLE_PATH); - this.httpService.unregister(AUTH_PATH); - - this.httpService.unregister(AUTH_RESOURCE_PATH); - this.httpService.unregister(CONSOLE_RESOURCE_PATH); - this.httpService.unregister(PASSWORD_AUTH_PATH); - this.httpService.unregister(CERT_AUTH_PATH); - this.httpService.unregister(LOGIN_MODULE_PATH + "/loginInfo"); - this.httpService.unregister(DENALI_MODULE_PATH + SESSION); - this.httpService.unregister(LOGIN_MODULE_PATH + SESSION); - this.httpService.unregister(LOGIN_MODULE_PATH + "/xsrf"); - this.httpService.unregister(DENALI_MODULE_PATH + "/xsrf"); - this.httpService.unregister(DENALI_MODULE_PATH + "/status"); - this.httpService.unregister(DENALI_MODULE_PATH + "/device"); - this.httpService.unregister(DENALI_MODULE_PATH + "/logservice"); - this.httpService.unregister(DENALI_MODULE_PATH + "/network"); - this.httpService.unregister(DENALI_MODULE_PATH + "/component"); - this.httpService.unregister(DENALI_MODULE_PATH + "/package"); - this.httpService.unregister(DENALI_MODULE_PATH + "/snapshot"); - this.httpService.unregister(DENALI_MODULE_PATH + "/certificate"); - this.httpService.unregister(DENALI_MODULE_PATH + "/security"); - this.httpService.unregister(DENALI_MODULE_PATH + "/users"); - this.httpService.unregister(DENALI_MODULE_PATH + "/file"); - this.httpService.unregister(DENALI_MODULE_PATH + "/device_snapshots"); - this.httpService.unregister(DENALI_MODULE_PATH + "/assetsUpDownload"); - this.httpService.unregister(DENALI_MODULE_PATH + "/log"); - this.httpService.unregister(DENALI_MODULE_PATH + "/skin"); - this.httpService.unregister(DENALI_MODULE_PATH + "/cloudservices"); - this.httpService.unregister(DENALI_MODULE_PATH + "/wires"); - this.httpService.unregister(DENALI_MODULE_PATH + "/wiresSnapshot"); - this.httpService.unregister(DENALI_MODULE_PATH + "/assetservices"); - this.httpService.unregister(DENALI_MODULE_PATH + "/extension"); - this.httpService.unregister(DENALI_MODULE_PATH + "/ssl"); - this.httpService.unregister(DENALI_MODULE_PATH + "/keystore"); - this.httpService.unregister(LOGIN_MODULE_PATH + "/extension"); + private synchronized void unregisterAll() { + + this.contexts.forEach(ServiceRegistration::unregister); + this.resources.forEach(ServiceRegistration::unregister); + this.servlets.forEach(ServiceRegistration::unregister); + this.wiresBlinkService.stop(); - this.httpService.unregister(ADMIN_ROOT + "/sse"); + this.eventService.stop(); - this.httpService.unregister(DENALI_MODULE_PATH + EVENT_PATH); - for (final ServletRegistration reg : this.securedServlets) { - this.httpService.unregister(reg.path); + } + + public String setAuthenticated(final HttpSession session, final String user, final AuditContext context) { + session.setAttribute(Attributes.AUTORIZED_USER.getValue(), user); + + context.getProperties().put(AuditConstants.KEY_IDENTITY.getValue(), user); + session.setAttribute(Attributes.AUDIT_CONTEXT.getValue(), context); + try { + session.setAttribute(Attributes.CREDENTIALS_HASH.getValue(), this.userManager.getCredentialsHash(user)); + } catch (Exception e) { + logger.warn("failed to compute credentials hash", e); } - for (final ServletRegistration reg : this.loginServlets) { - this.httpService.unregister(reg.path); + return CONSOLE_PATH; + } + + public AuditContext initAuditContext(final HttpServletRequest req) { + final HttpSession session = req.getSession(false); + + String requestIp = req.getHeader("X-FORWARDED-FOR"); + if (isNull(requestIp)) { + requestIp = req.getRemoteAddr(); } + + final Object rawAuditContext = session != null ? session.getAttribute(Attributes.AUDIT_CONTEXT.getValue()) + : null; + + final AuditContext auditContext; + + if (rawAuditContext instanceof AuditContext) { + auditContext = ((AuditContext) rawAuditContext).copy(); + auditContext.getProperties().remove("rpc.method"); + auditContext.getProperties().put(AuditConstants.KEY_IP.getValue(), requestIp); + } else { + final Map properties = new HashMap<>(); + properties.put(AuditConstants.KEY_IP.getValue(), requestIp); + properties.put(AuditConstants.KEY_ENTRY_POINT.getValue(), "WebConsole"); + auditContext = new AuditContext(properties); + } + + auditContext.getProperties().put("web.path", req.getRequestURI()); + + return auditContext; } public static Console instance() { @@ -412,7 +411,7 @@ private void updateAuditContext(final HttpSession session) { final Set authenticationPaths = new HashSet<>(Arrays.asList(AUTH_PATH, PASSWORD_AUTH_PATH, CERT_AUTH_PATH)); - private HttpContext initSessionContext(final HttpContext defaultContext) { + private SecurityHandler createSessionHandlerChain() { final Set eventPaths = new HashSet<>(Arrays.asList(DENALI_MODULE_PATH + EVENT_PATH, "/sse")); @@ -432,9 +431,7 @@ private HttpContext initSessionContext(final HttpContext defaultContext) { // exception on authentication paths, allow access without authenticaton but // create a session - routingHandler.addRouteHandler( - p -> this.authenticationPaths.contains(p) - || this.loginServlets.stream().anyMatch(r -> r.path.contentEquals(p)), + routingHandler.addRouteHandler(this.authenticationPaths::contains, chain(baseHandler, new CreateSessionSecurityHandler())); // exception on event paths, activity on these paths does not count towards @@ -452,291 +449,162 @@ private HttpContext initSessionContext(final HttpContext defaultContext) { Arrays.asList(LOGIN_MODULE_PATH + SESSION, LOGIN_MODULE_PATH + "/xsrf")::contains, chain(baseHandler, sessionAuthHandler, sessionExpirationHandler)); - return new HttpContextImpl(routingHandler, defaultContext); - } - - private HttpContext initResourceContext(final HttpContext defaultContext) { - return new HttpContextImpl(new BaseSecurityHandler(), defaultContext); + return routingHandler; } - private synchronized void initHTTPService() throws NamespaceException, ServletException { + private synchronized void initHTTPService() throws NamespaceException { this.eventService = new GwtEventServiceImpl(); this.wiresBlinkService = new WiresBlinkServlet(); - final HttpContext defaultContext = this.httpService.createDefaultHttpContext(); - final HttpContext resourceContext = initResourceContext(defaultContext); - this.sessionContext = initSessionContext(defaultContext); - - this.httpService.registerResources(ADMIN_ROOT, "www", resourceContext); - this.httpService.registerResources(AUTH_PATH, "www/auth.html", this.sessionContext); - this.httpService.registerResources(CONSOLE_PATH, "www/denali.html", this.sessionContext); - this.httpService.registerServlet(LOGIN_MODULE_PATH + "/loginInfo", new GwtLoginInfoServiceImpl(), null, - resourceContext); - - this.httpService.registerServlet("/", new RedirectServlet("/"::equals, this.appRoot), null, resourceContext); - this.httpService.registerServlet(AUTH_RESOURCE_PATH, new SendStatusServlet(404), null, resourceContext); - this.httpService.registerServlet(CONSOLE_RESOURCE_PATH, new SendStatusServlet(404), null, resourceContext); - - this.httpService.registerServlet(PASSWORD_AUTH_PATH, - new GwtPasswordAuthenticationServiceImpl(this.userManager, CONSOLE_PATH), null, this.sessionContext); - this.httpService.registerServlet(CERT_AUTH_PATH, new SslAuthenticationServlet(CONSOLE_PATH, this.userManager), - null, this.sessionContext); - this.httpService.registerServlet(DENALI_MODULE_PATH + "/keystore", new GwtKeystoreServiceImpl(), null, - this.sessionContext); - this.httpService.registerServlet(DENALI_MODULE_PATH + "/ssl", new GwtSslManagerServiceImpl(), null, - this.sessionContext); - this.httpService.registerServlet(DENALI_MODULE_PATH + "/extension", new GwtExtensionServiceImpl(), null, - resourceContext); - this.httpService.registerServlet(LOGIN_MODULE_PATH + "/extension", new GwtExtensionServiceImpl(), null, - resourceContext); - - this.httpService.registerServlet(DENALI_MODULE_PATH + SESSION, new GwtSessionServiceImpl(this.userManager), - null, this.sessionContext); - this.httpService.registerServlet(LOGIN_MODULE_PATH + SESSION, new GwtSessionServiceImpl(this.userManager), null, - this.sessionContext); - this.httpService.registerServlet(LOGIN_MODULE_PATH + "/xsrf", new GwtSecurityTokenServiceImpl(), null, - this.sessionContext); - this.httpService.registerServlet(DENALI_MODULE_PATH + "/xsrf", new GwtSecurityTokenServiceImpl(), null, - this.sessionContext); - this.httpService.registerServlet(DENALI_MODULE_PATH + "/status", new GwtStatusServiceImpl(), null, - this.sessionContext); - this.httpService.registerServlet(DENALI_MODULE_PATH + "/device", new GwtDeviceServiceImpl(), null, - this.sessionContext); - this.httpService.registerServlet(DENALI_MODULE_PATH + "/logservice", new GwtLogServiceImpl(), null, - this.sessionContext); - this.httpService.registerServlet(DENALI_MODULE_PATH + "/network", new GwtNetworkServiceImpl(), null, - this.sessionContext); - this.httpService.registerServlet(DENALI_MODULE_PATH + "/component", new GwtComponentServiceImpl(), null, - this.sessionContext); - this.httpService.registerServlet(DENALI_MODULE_PATH + "/package", - new GwtPackageServiceImpl(this.sslManagerService::get), null, this.sessionContext); - - this.httpService.registerServlet(DENALI_MODULE_PATH + "/snapshot", new GwtSnapshotServiceImpl(), null, - this.sessionContext); - this.httpService.registerServlet(DENALI_MODULE_PATH + "/certificate", new GwtCertificatesServiceImpl(), null, - this.sessionContext); - this.httpService.registerServlet(DENALI_MODULE_PATH + "/security", new GwtSecurityServiceImpl(), null, - this.sessionContext); - this.httpService.registerServlet(DENALI_MODULE_PATH + "/users", new GwtUserServiceImpl(this.userManager), null, - this.sessionContext); - this.httpService.registerServlet(DENALI_MODULE_PATH + "/file", new FileServlet(), null, this.sessionContext); - this.httpService.registerServlet(DENALI_MODULE_PATH + "/device_snapshots", new DeviceSnapshotsServlet(), null, - this.sessionContext); - this.httpService.registerServlet(DENALI_MODULE_PATH + "/assetsUpDownload", new ChannelServlet(), null, - this.sessionContext); - this.httpService.registerServlet(DENALI_MODULE_PATH + "/log", new LogServlet(), null, this.sessionContext); - this.httpService.registerServlet(DENALI_MODULE_PATH + "/skin", new SkinServlet(), null, resourceContext); - this.httpService.registerServlet(DENALI_MODULE_PATH + "/cloudservices", new GwtCloudConnectionServiceImpl(), - null, this.sessionContext); - this.httpService.registerServlet(DENALI_MODULE_PATH + "/wires", new GwtWireGraphServiceImpl(), null, - this.sessionContext); - this.httpService.registerServlet(DENALI_MODULE_PATH + "/wiresSnapshot", new WiresSnapshotServlet(), null, - this.sessionContext); - this.httpService.registerServlet(DENALI_MODULE_PATH + "/assetservices", new GwtDriverAndAssetServiceImpl(), - null, this.sessionContext); - this.httpService.registerServlet(ADMIN_ROOT + "/sse", this.wiresBlinkService, null, this.sessionContext); - this.httpService.registerServlet(DENALI_MODULE_PATH + EVENT_PATH, this.eventService, null, this.sessionContext); - - for (final ServletRegistration reg : this.securedServlets) { - this.httpService.registerServlet(reg.path, reg.servlet, null, this.sessionContext); - } - - for (final ServletRegistration reg : this.loginServlets) { - this.httpService.registerServlet(reg.path, reg.servlet, null, this.sessionContext); - } + ServletContextHelper resourceContextHelper = new HttpServletContextHelper(new BaseSecurityHandler()); + ServletContextHelper sessionContextHelper = new HttpServletContextHelper(createSessionHandlerChain()); + + registerContextHelper(RESOURCE_CONTEX_NAME, "/", resourceContextHelper); + registerContextHelper(SESSION_CONTEX_NAME, "/", sessionContextHelper); + + registerResources(ADMIN_ROOT, "www", new AdminResources(), RESOURCE_CONTEX_NAME); + registerResources(AUTH_PATH, "www/auth.html", new AuthorizationResources(), SESSION_CONTEX_NAME); + registerResources(CONSOLE_PATH, "www/denali.html", new ConsoleResources(), SESSION_CONTEX_NAME); + + registerServlet("gwtLoginInfoService", LOGIN_MODULE_PATH + "/loginInfo", new GwtLoginInfoServiceImpl(), + RESOURCE_CONTEX_NAME); + registerServlet("redirectServlet", "/", new RedirectServlet("/"::equals, this.appRoot), RESOURCE_CONTEX_NAME); + + registerServlet("notFoundAuthResourceServlet", AUTH_RESOURCE_PATH, new SendStatusServlet(404), + RESOURCE_CONTEX_NAME); + registerServlet("notFoundConsoleResourceServlet", CONSOLE_RESOURCE_PATH, new SendStatusServlet(404), + RESOURCE_CONTEX_NAME); + + registerServlet("gwtPasswordAuthenticationService", PASSWORD_AUTH_PATH, + new GwtPasswordAuthenticationServiceImpl(this.userManager, CONSOLE_PATH), SESSION_CONTEX_NAME); + registerServlet("sslAuthenticationServlet", CERT_AUTH_PATH, + new SslAuthenticationServlet(CONSOLE_PATH, this.userManager), SESSION_CONTEX_NAME); + + registerServlet("gwtKeystoreServiceImpl", DENALI_MODULE_PATH + "/keystore", new GwtKeystoreServiceImpl(), + SESSION_CONTEX_NAME); + registerServlet("gwtSslManagerServiceImpl", DENALI_MODULE_PATH + "/ssl", new GwtSslManagerServiceImpl(), + SESSION_CONTEX_NAME); + + registerServlet("denaliSessionService", DENALI_MODULE_PATH + SESSION, + new GwtSessionServiceImpl(this.userManager), SESSION_CONTEX_NAME); + + registerServlet("loginSessionService", LOGIN_MODULE_PATH + SESSION, new GwtSessionServiceImpl(this.userManager), + SESSION_CONTEX_NAME); + registerServlet("xsrfLoginServlet", LOGIN_MODULE_PATH + "/xsrf", new GwtSecurityTokenServiceImpl(), + SESSION_CONTEX_NAME); + registerServlet("xsrfDenaliServlet", DENALI_MODULE_PATH + "/xsrf", new GwtSecurityTokenServiceImpl(), + SESSION_CONTEX_NAME); + registerServlet("statusService", DENALI_MODULE_PATH + "/status", new GwtStatusServiceImpl(), + SESSION_CONTEX_NAME); + registerServlet("deviceService", DENALI_MODULE_PATH + "/device", new GwtDeviceServiceImpl(), + SESSION_CONTEX_NAME); + registerServlet("logService", DENALI_MODULE_PATH + "/logservice", new GwtLogServiceImpl(), SESSION_CONTEX_NAME); + registerServlet("networkService", DENALI_MODULE_PATH + "/network", new GwtNetworkServiceImpl(), + SESSION_CONTEX_NAME); + registerServlet("componentService", DENALI_MODULE_PATH + "/component", new GwtComponentServiceImpl(), + SESSION_CONTEX_NAME); + registerServlet("packageService", DENALI_MODULE_PATH + "/package", + new GwtPackageServiceImpl(this.sslManagerService::get), SESSION_CONTEX_NAME); + registerServlet("snapshotServiceImpl", DENALI_MODULE_PATH + "/snapshot", new GwtSnapshotServiceImpl(), + SESSION_CONTEX_NAME); + registerServlet("certificateService", DENALI_MODULE_PATH + "/certificate", new GwtCertificatesServiceImpl(), + SESSION_CONTEX_NAME); + registerServlet("securityService", DENALI_MODULE_PATH + "/security", new GwtSecurityServiceImpl(), + SESSION_CONTEX_NAME); + registerServlet("usersService", DENALI_MODULE_PATH + "/users", new GwtUserServiceImpl(this.userManager), + SESSION_CONTEX_NAME); + registerServlet("fileServlet", DENALI_MODULE_PATH + "/file", new FileServlet(), SESSION_CONTEX_NAME); + registerServlet("deviceSnapshotsServlet", DENALI_MODULE_PATH + "/device_snapshots", + new DeviceSnapshotsServlet(), SESSION_CONTEX_NAME); + registerServlet("channelServlet", DENALI_MODULE_PATH + "/assetsUpDownload", new ChannelServlet(), + SESSION_CONTEX_NAME); + registerServlet("logServlet", DENALI_MODULE_PATH + "/log", new LogServlet(), SESSION_CONTEX_NAME); + registerServlet("skinServlet", DENALI_MODULE_PATH + "/skin", new SkinServlet(), RESOURCE_CONTEX_NAME); + registerServlet("cloudServices", DENALI_MODULE_PATH + "/cloudservices", new GwtCloudConnectionServiceImpl(), + SESSION_CONTEX_NAME); + registerServlet("wireGraphService", DENALI_MODULE_PATH + "/wires", new GwtWireGraphServiceImpl(), + SESSION_CONTEX_NAME); + registerServlet("wiresSnapshotServlet", DENALI_MODULE_PATH + "/wiresSnapshot", new WiresSnapshotServlet(), + SESSION_CONTEX_NAME); + registerServlet("driverAndAssetService", DENALI_MODULE_PATH + "/assetservices", + new GwtDriverAndAssetServiceImpl(), SESSION_CONTEX_NAME); + registerServlet("wiresBlinkService", ADMIN_ROOT + "/sse", this.wiresBlinkService, SESSION_CONTEX_NAME); + registerServlet("eventService", DENALI_MODULE_PATH + EVENT_PATH, this.eventService, SESSION_CONTEX_NAME); this.eventService.start(); } - public Set getConsoleExtensions() { - return this.consoleExtensions; - } + private void registerContextHelper(String contextName, String contextPath, ServletContextHelper contextHelper) { + Map props = new HashMap<>(); - public Set getLoginExtensions() { - return this.loginExtensions; - } + props.put(Constants.SERVICE_ID, contextName); - public Set getBuiltinAuthenticationMethods() { - return new HashSet<>(Arrays.asList("Certificate", "Password")); - } + props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME, contextName); + props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_PATH, contextPath); - public Set getAuthenticationMethods() { - final Set result = new LinkedHashSet<>(); + ServiceRegistration contextService = this.bundleContext + .registerService(ServletContextHelper.class, contextHelper, new Hashtable<>(props)); - result.add("Password"); - result.add("Certificate"); - - Stream.concat(this.loginExtensions.stream(), this.consoleExtensions.stream()).forEach(b -> { - for (final ClientExtensionBundle bundle : this.loginExtensions) { - final Set providedMethods = bundle.getProvidedAuthenticationMethods(); - - if (providedMethods == null) { - continue; - } - - result.addAll(providedMethods); - } - }); - - return result; + this.contexts.add(contextService); } - private static final class ServletRegistration { + private void registerResources(String pattern, String prefix, ResourcesService resourcesService, + String contextHelperName) { + Map props = new HashMap<>(); - private final String path; - private final Servlet servlet; - - public ServletRegistration(String path, Servlet servlet) { - this.path = path; - this.servlet = servlet; - } + props.put(Constants.SERVICE_ID, resourcesService.getClass().getSimpleName()); - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + (this.path == null ? 0 : this.path.hashCode()); - result = prime * result + (this.servlet == null ? 0 : this.servlet.hashCode()); - return result; - } + props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_RESOURCE_PATTERN, pattern); + props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_RESOURCE_PREFIX, prefix); + props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT, contextHelperName); - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if ((obj == null) || (getClass() != obj.getClass())) { - return false; - } - ServletRegistration other = (ServletRegistration) obj; - if (this.path == null) { - if (other.path != null) { - return false; - } - } else if (!this.path.equals(other.path)) { - return false; - } - return this.servlet == other.servlet; - } + ServiceRegistration resourcesS = this.bundleContext.registerService(ResourcesService.class, + resourcesService, new Hashtable<>(props)); + this.resources.add(resourcesS); } - private void refreshOptions() { - try { - setConsoleOptions( - ConsoleOptions.fromProperties(getConsoleOptions().getConfiguration().getConfigurationProperties())); - } catch (final Exception e) { - logger.warn("Failed to update options", e); - } - } + private void registerServlet(String servletName, String servletPattern, HttpServlet servlet, + String contextHelperName) { - public UserManager getUserManager() { - return this.userManager; - } + Map props = new HashMap<>(); - @Override - public void registerConsoleExtensionBundle(ClientExtensionBundle extension) { - this.consoleExtensions.add(extension); - refreshOptions(); - } + props.put(Constants.SERVICE_SCOPE, Constants.SCOPE_PROTOTYPE); + props.put(Constants.SERVICE_ID, servletName); - @Override - public void unregisterConsoleExtensionBundle(ClientExtensionBundle extension) { - this.consoleExtensions.remove(extension); - refreshOptions(); - } + props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, servletName); + props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, servletPattern); + props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT, contextHelperName); - @Override - public void registerLoginExtensionBundle(ClientExtensionBundle extension) { - this.loginExtensions.add(extension); - refreshOptions(); - } + ServiceRegistration servletService = this.bundleContext.registerService(HttpServlet.class, servlet, + new Hashtable<>(props)); - @Override - public void unregisterLoginExtensionBundle(ClientExtensionBundle extension) { - this.loginExtensions.remove(extension); - refreshOptions(); + this.servlets.add(servletService); } - @Override - public synchronized void registerSecuredServlet(final String path, final Servlet servlet) - throws NamespaceException, ServletException { - this.securedServlets.add(new ServletRegistration(path, servlet)); - this.httpService.registerServlet(path, servlet, null, this.sessionContext); + public interface ResourcesService { } - @Override - public synchronized void registerLoginServlet(final String path, final Servlet servlet) - throws NamespaceException, ServletException { - this.loginServlets.add(new ServletRegistration(path, servlet)); - this.httpService.registerServlet(path, servlet, null, this.sessionContext); - this.authenticationPaths.add(path); + public class AdminResources implements ResourcesService { } - @Override - public synchronized void unregisterServlet(final String path) throws NamespaceException, ServletException { - this.securedServlets.removeIf(r -> r.path.contentEquals(path)); - this.loginServlets.removeIf(r -> r.path.contentEquals(path)); - this.httpService.unregister(path); - this.authenticationPaths.remove(path); + public class AuthorizationResources implements ResourcesService { } - @Override - public String setAuthenticated(final HttpSession session, final String user, final AuditContext context) { - session.setAttribute(Attributes.AUTORIZED_USER.getValue(), user); - - context.getProperties().put(AuditConstants.KEY_IDENTITY.getValue(), user); - session.setAttribute(Attributes.AUDIT_CONTEXT.getValue(), context); - try { - session.setAttribute(Attributes.CREDENTIALS_HASH.getValue(), this.userManager.getCredentialsHash(user)); - } catch (Exception e) { - logger.warn("failed to compute credentials hash", e); - } - - return CONSOLE_PATH; + public class ConsoleResources implements ResourcesService { } - @Override - public AuditContext initAuditContext(final HttpServletRequest req) { - final HttpSession session = req.getSession(false); - - String requestIp = req.getHeader("X-FORWARDED-FOR"); - if (isNull(requestIp)) { - requestIp = req.getRemoteAddr(); - } - - final Object rawAuditContext = session != null ? session.getAttribute(Attributes.AUDIT_CONTEXT.getValue()) - : null; - - final AuditContext auditContext; - - if (rawAuditContext instanceof AuditContext) { - auditContext = ((AuditContext) rawAuditContext).copy(); - auditContext.getProperties().remove("rpc.method"); - auditContext.getProperties().put(AuditConstants.KEY_IP.getValue(), requestIp); - } else { - final Map properties = new HashMap<>(); - properties.put(AuditConstants.KEY_IP.getValue(), requestIp); - properties.put(AuditConstants.KEY_ENTRY_POINT.getValue(), "WebConsole"); - auditContext = new AuditContext(properties); - } - - auditContext.getProperties().put("web.path", req.getRequestURI()); - - return auditContext; + public Set getBuiltinAuthenticationMethods() { + return new HashSet<>(Arrays.asList("Certificate", "Password")); } - @Override - public void checkXSRFToken(final HttpServletRequest req, final String token) throws KuraException { - if (!KuraRemoteServiceServlet.isValidXSRFToken(req, token)) { - throw new KuraException(KuraErrorCode.SECURITY_EXCEPTION); - } + public Set getAuthenticationMethods() { + return new LinkedHashSet<>(Arrays.asList("Password", "Certificate")); } - @Override - public Optional getUsername(HttpSession session) { - return Optional.ofNullable(session.getAttribute(Attributes.AUTORIZED_USER.getValue())).map(String.class::cast); + public UserManager getUserManager() { + return this.userManager; } @Override diff --git a/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/api/ClientExtensionBundle.java b/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/api/ClientExtensionBundle.java deleted file mode 100644 index ace82910c86..00000000000 --- a/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/api/ClientExtensionBundle.java +++ /dev/null @@ -1,25 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011, 2020 Eurotech and/or its affiliates and others - * - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Eurotech - *******************************************************************************/ -package org.eclipse.kura.web.api; - -import java.util.Map; -import java.util.Set; - -public interface ClientExtensionBundle { - - public Map getProperties(); - - public String getEntryPointUrl(); - - public Set getProvidedAuthenticationMethods(); -} diff --git a/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/api/Console.java b/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/api/Console.java deleted file mode 100644 index 070c7af3700..00000000000 --- a/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/api/Console.java +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011, 2021 Eurotech and/or its affiliates and others - * - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Eurotech - *******************************************************************************/ -package org.eclipse.kura.web.api; - -import java.util.Optional; - -import javax.servlet.Servlet; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpSession; - -import org.eclipse.kura.KuraException; -import org.eclipse.kura.audit.AuditContext; -import org.osgi.service.http.NamespaceException; - -public interface Console { - - public void registerLoginExtensionBundle(final ClientExtensionBundle extension); - - public void unregisterLoginExtensionBundle(final ClientExtensionBundle extension); - - public void registerConsoleExtensionBundle(final ClientExtensionBundle extension); - - public void unregisterConsoleExtensionBundle(final ClientExtensionBundle extension); - - public void registerSecuredServlet(final String path, final Servlet servlet) - throws NamespaceException, ServletException; - - public void registerLoginServlet(final String path, final Servlet servlet) - throws NamespaceException, ServletException; - - public void unregisterServlet(final String path) throws NamespaceException, ServletException; - - public Optional getUsername(final HttpSession session); - - public AuditContext initAuditContext(final HttpServletRequest req); - - public String setAuthenticated(final HttpSession session, final String user, final AuditContext context); - - public void checkXSRFToken(final HttpServletRequest req, final String token) throws KuraException; -} diff --git a/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/client/ui/EntryClassUi.java b/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/client/ui/EntryClassUi.java index f1dab6198d7..d9961c5d616 100644 --- a/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/client/ui/EntryClassUi.java +++ b/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/client/ui/EntryClassUi.java @@ -22,7 +22,6 @@ import java.util.Date; import java.util.List; import java.util.Optional; -import java.util.function.Consumer; import org.eclipse.kura.core.configuration.ConfigurationChangeEvent; import org.eclipse.kura.web.client.messages.Messages; @@ -65,11 +64,6 @@ import org.eclipse.kura.web.shared.service.GwtSecurityTokenServiceAsync; import org.eclipse.kura.web.shared.service.GwtSessionService; import org.eclipse.kura.web.shared.service.GwtSessionServiceAsync; -import org.eclipse.kura.web2.ext.AlertSeverity; -import org.eclipse.kura.web2.ext.AuthenticationHandler; -import org.eclipse.kura.web2.ext.Context; -import org.eclipse.kura.web2.ext.ExtensionRegistry; -import org.eclipse.kura.web2.ext.WidgetFactory; import org.gwtbootstrap3.client.ui.AnchorListItem; import org.gwtbootstrap3.client.ui.Button; import org.gwtbootstrap3.client.ui.Column; @@ -105,7 +99,7 @@ import com.google.gwt.user.client.ui.ScrollPanel; import com.google.gwt.user.client.ui.Widget; -public class EntryClassUi extends Composite implements Context, ServicesUi.Listener { +public class EntryClassUi extends Composite implements ServicesUi.Listener { interface EntryClassUIUiBinder extends UiBinder { } @@ -326,15 +320,6 @@ public EntryClassUi(final GwtUserData gwtUserData, final GwtSecurityCapabilities initDropdownMenu(); initServicesTree(); - initExtensions(); - } - - private void initExtensions() { - - ExtensionRegistry.get().addExtensionConsumer(e -> { - e.onLoad(this); - }); - } private void initExceptionReportModal() { @@ -704,7 +689,7 @@ private void sortConfigurationsByName(List configs) { } else { name1 = pid1; } - + return name0.compareTo(name1); }); } @@ -1154,7 +1139,7 @@ public void init() { private void handleConcurrencyEvent(GwtEventInfo eventInfo) { String eventPid = (String) eventInfo.getProperties().get(ConfigurationChangeEvent.CONF_CHANGE_EVENT_PID_PROP); - if (eventPid.length() == 0) { + if (eventPid.isEmpty()) { this.dropdownNotification.show(MSGS.configurationChangeEventNotificationGeneric()); } else { this.dropdownNotification.show(MSGS.configurationChangeEventNotification(eventPid)); @@ -1172,62 +1157,6 @@ private void showStatusPanel() { this.statusBinder.loadStatusData(false); } - @Override - public void addSidenavComponent(final String name, final String icon, final WidgetFactory widgetFactory) { - final AnchorListItem item = new AnchorListItem(name); - - try { - item.setIcon(IconType.valueOf(icon)); - } catch (final Exception e) { - // do nothing - } - - item.addClickHandler(evt -> confirmIfUiDirty(() -> { - EntryClassUi.this.contentPanelBody.clear(); - - forceTabsCleaning(); - EntryClassUi.this.setSelectedAnchorListItem(item); - EntryClassUi.this.contentPanel.setVisible(true); - setHeader(name, null); - EntryClassUi.this.contentPanelBody.clear(); - - EntryClassUi.this.contentPanelBody.add(widgetFactory.buildWidget()); - - EntryClassUi.this.deviceBinder.setSession(EntryClassUi.this.currentSession); - EntryClassUi.this.deviceBinder.initDevicePanel(); - })); - - this.sidenavPills.add(item); - } - - @Override - public void addSettingsComponent(final String name, final WidgetFactory factory) { - this.settingsBinder.addTab(name, factory); - } - - @Override - public void addAuthenticationHandler(final AuthenticationHandler authenticationHandler) { - // unsupported - } - - @Override - public void getXSRFToken(Callback callback) { - this.gwtXSRFService.generateSecurityToken(new AsyncCallback() { - - @Override - public void onSuccess(GwtXSRFToken result) { - callback.onSuccess(result.getToken()); - } - - @Override - public void onFailure(Throwable caught) { - callback.onFailure(caught.getMessage()); - } - - }); - - } - private class WrapperRequest implements Callback, Request { private AsyncCallback wrapped; @@ -1249,24 +1178,6 @@ public void run(RequestContext context) { } - @Override - public Callback startLongRunningOperation() { - - final WrapperRequest callback = new WrapperRequest(); - - RequestQueue.submit(callback); - - return callback; - - } - - @Override - public void showAlertDialog(final String message, final AlertSeverity severity, final Consumer callback) { - this.alertDialog.show(message, - severity == AlertSeverity.INFO ? AlertDialog.Severity.INFO : AlertDialog.Severity.ALERT, - callback::accept); - } - @Override public void onConfigurationChanged() { fetchAvailableServices(); diff --git a/kura/org.eclipse.kura.web2.ext/src/main/java/org/eclipse/kura/web2/ext/AuthenticationHandler.java b/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/client/ui/login/AuthenticationHandler.java similarity index 71% rename from kura/org.eclipse.kura.web2.ext/src/main/java/org/eclipse/kura/web2/ext/AuthenticationHandler.java rename to kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/client/ui/login/AuthenticationHandler.java index e222eb9e709..d5797874fd6 100644 --- a/kura/org.eclipse.kura.web2.ext/src/main/java/org/eclipse/kura/web2/ext/AuthenticationHandler.java +++ b/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/client/ui/login/AuthenticationHandler.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2019, 2020 Eurotech and/or its affiliates and others + * Copyright (c) 2024 Eurotech and/or its affiliates and others * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -10,15 +10,19 @@ * Contributors: * Eurotech *******************************************************************************/ -package org.eclipse.kura.web2.ext; + +package org.eclipse.kura.web.client.ui.login; + +import java.util.function.Supplier; import com.google.gwt.core.client.Callback; +import com.google.gwt.user.client.ui.Widget; public interface AuthenticationHandler { public String getName(); - public WidgetFactory getLoginDialogElement(); + public Supplier getLoginDialogElement(); public void authenticate(final Callback callback); } diff --git a/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/client/ui/login/LoginUi.java b/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/client/ui/login/LoginUi.java index f2cea0c19f5..7a076527515 100644 --- a/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/client/ui/login/LoginUi.java +++ b/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/client/ui/login/LoginUi.java @@ -17,6 +17,7 @@ import java.util.Map; import java.util.Set; import java.util.function.Consumer; +import java.util.function.Supplier; import org.eclipse.kura.web.client.messages.Messages; import org.eclipse.kura.web.client.ui.AlertDialog; @@ -34,11 +35,6 @@ import org.eclipse.kura.web.shared.service.GwtSecurityTokenServiceAsync; import org.eclipse.kura.web.shared.service.GwtSessionService; import org.eclipse.kura.web.shared.service.GwtSessionServiceAsync; -import org.eclipse.kura.web2.ext.AlertSeverity; -import org.eclipse.kura.web2.ext.AuthenticationHandler; -import org.eclipse.kura.web2.ext.Context; -import org.eclipse.kura.web2.ext.ExtensionRegistry; -import org.eclipse.kura.web2.ext.WidgetFactory; import org.gwtbootstrap3.client.ui.Button; import org.gwtbootstrap3.client.ui.FormGroup; import org.gwtbootstrap3.client.ui.Icon; @@ -67,7 +63,7 @@ import com.google.gwt.user.client.ui.RootPanel; import com.google.gwt.user.client.ui.Widget; -public class LoginUi extends Composite implements Context { +public class LoginUi extends Composite { private final GwtPasswordAuthenticationServiceAsync pwdAutenticationService = GWT .create(GwtPasswordAuthenticationService.class); @@ -140,8 +136,6 @@ private void initAuthenticationHandlers(final GwtLoginInfo loginInfo) { authenticationMethod.addChangeHandler(e -> setAuthenticationMethod(authenticationMethod.getSelectedItemText())); - ExtensionRegistry.get().addExtensionConsumer(e -> e.onLoad(LoginUi.this)); - } @Override @@ -192,13 +186,13 @@ private void setAuthenticationMethod(final String authenticationMethod) { this.authenticationMethodWidget = null; } - final WidgetFactory factory = this.authenticationHandler.getLoginDialogElement(); + final Supplier factory = this.authenticationHandler.getLoginDialogElement(); if (factory == null) { return; } - this.authenticationMethodWidget = factory.buildWidget(); + this.authenticationMethodWidget = factory.get(); if (this.authenticationMethodWidget != null) { this.loginModalBody.add(this.authenticationMethodWidget); @@ -219,17 +213,6 @@ private void initWaitModal() { this.waitModal.hide(); } - @Override - public void addSidenavComponent(String name, String icon, WidgetFactory element) { - // not supported - } - - @Override - public void addSettingsComponent(String name, WidgetFactory element) { - // not supported - } - - @Override public void addAuthenticationHandler(final AuthenticationHandler authenticationHandler) { final String name = authenticationHandler.getName(); @@ -252,12 +235,6 @@ public void addAuthenticationHandler(final AuthenticationHandler authenticationH this.authenticationMethodGroup.setVisible(this.authenticationHandlers.size() >= 2); } - @Override - public void getXSRFToken(Callback callback) { - callback.onFailure("not supported"); - } - - @Override public Callback startLongRunningOperation() { this.waitModal.show(); return new Callback() { @@ -277,13 +254,6 @@ public void onSuccess(Void result) { }; } - @Override - public void showAlertDialog(String message, AlertSeverity severity, Consumer callback) { - this.alertDialog.show(message, - severity == AlertSeverity.INFO ? AlertDialog.Severity.INFO : AlertDialog.Severity.ALERT, - callback::accept); - } - private class PasswordAuthenticationHandler implements AuthenticationHandler { private final FormGroup group = new FormGroup(); @@ -340,7 +310,7 @@ public String getName() { } @Override - public WidgetFactory getLoginDialogElement() { + public Supplier getLoginDialogElement() { return () -> { this.passwordInput.setValue(""); return this.group; @@ -393,10 +363,8 @@ private void getGwtConsoleUserOptions(final Consumer onSu private void setNewPassword(final String oldPassword, final String newPassword, final Consumer onSuccess, final Consumer onFailure) { - gwtXsrfService.generateSecurityToken(asyncCallback( - token -> gwtSessionService.updatePassword(token, oldPassword, newPassword, - asyncCallback(onSuccess, onFailure)), - onFailure)); + gwtXsrfService.generateSecurityToken(asyncCallback(token -> gwtSessionService.updatePassword(token, + oldPassword, newPassword, asyncCallback(onSuccess, onFailure)), onFailure)); } @@ -442,7 +410,7 @@ public String getName() { } @Override - public WidgetFactory getLoginDialogElement() { + public Supplier getLoginDialogElement() { return () -> { final Paragraph paragraph = new Paragraph(); paragraph.setText(MSGS.loginCertificateDescription()); diff --git a/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/client/ui/security/SecurityPanelUi.java b/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/client/ui/security/SecurityPanelUi.java index 5694aae2da6..978279fe9a6 100644 --- a/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/client/ui/security/SecurityPanelUi.java +++ b/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/client/ui/security/SecurityPanelUi.java @@ -47,7 +47,6 @@ import org.eclipse.kura.web.shared.service.GwtSecurityTokenServiceAsync; import org.eclipse.kura.web.shared.service.GwtSslManagerService; import org.eclipse.kura.web.shared.service.GwtSslManagerServiceAsync; -import org.eclipse.kura.web2.ext.WidgetFactory; import org.gwtbootstrap3.client.ui.Anchor; import org.gwtbootstrap3.client.ui.NavTabs; import org.gwtbootstrap3.client.ui.TabContent; @@ -232,23 +231,6 @@ public boolean isDirty() { || webConsoleDirty || httpServiceDirty; } - public void addTab(final String name, final WidgetFactory widgetFactory) { - - final TabPane tabPane = new TabPane(); - tabPane.setId("__extension__" + name); - - final TabListItem item = new TabListItem(name); - item.setDataTarget("#__extension__" + name); - - item.addClickHandler(e -> { - tabPane.clear(); - tabPane.add(widgetFactory.buildWidget()); - }); - - this.navTabs.add(item); - this.tabContent.add(tabPane); - } - public void setDirty(boolean b) { this.certificateListPanel.setDirty(b); this.sslPanel.setDirty(b); diff --git a/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/client/ui/settings/SettingsPanelUi.java b/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/client/ui/settings/SettingsPanelUi.java index caafd6120c3..d5c825c5639 100644 --- a/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/client/ui/settings/SettingsPanelUi.java +++ b/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/client/ui/settings/SettingsPanelUi.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011, 2021 Eurotech and/or its affiliates and others + * Copyright (c) 2011, 2024 Eurotech and/or its affiliates and others * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -19,7 +19,6 @@ import org.eclipse.kura.web.client.ui.Tab; import org.eclipse.kura.web.client.ui.Tab.RefreshHandler; import org.eclipse.kura.web.shared.model.GwtSession; -import org.eclipse.kura.web2.ext.WidgetFactory; import org.gwtbootstrap3.client.ui.Anchor; import org.gwtbootstrap3.client.ui.Button; import org.gwtbootstrap3.client.ui.ButtonGroup; @@ -30,7 +29,6 @@ import org.gwtbootstrap3.client.ui.NavTabs; import org.gwtbootstrap3.client.ui.TabContent; import org.gwtbootstrap3.client.ui.TabListItem; -import org.gwtbootstrap3.client.ui.TabPane; import org.gwtbootstrap3.client.ui.html.Paragraph; import org.gwtbootstrap3.client.ui.html.Span; @@ -100,23 +98,6 @@ public boolean isDirty() { return this.snapshotsPanel.isDirty(); } - public void addTab(final String name, final WidgetFactory widgetFactory) { - - final TabPane tabPane = new TabPane(); - tabPane.setId("__extension__" + name); - - final TabListItem item = new TabListItem(name); - item.setDataTarget("#__extension__" + name); - - item.addClickHandler(e -> { - tabPane.clear(); - tabPane.add(widgetFactory.buildWidget()); - }); - - this.navTabs.add(item); - this.tabContent.add(tabPane); - } - public void setDirty(boolean b) { this.snapshotsPanel.setDirty(b); diff --git a/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/server/GwtCloudConnectionServiceImpl.java b/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/server/GwtCloudConnectionServiceImpl.java index 8298aa63938..953cc02f57e 100644 --- a/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/server/GwtCloudConnectionServiceImpl.java +++ b/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/server/GwtCloudConnectionServiceImpl.java @@ -33,7 +33,7 @@ import java.util.concurrent.atomic.AtomicReference; import java.util.stream.Collectors; -import javax.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletRequest; import org.eclipse.kura.KuraConnectException; import org.eclipse.kura.KuraException; diff --git a/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/server/GwtDriverAndAssetServiceImpl.java b/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/server/GwtDriverAndAssetServiceImpl.java index b9328f5b454..ac0b80e1f58 100644 --- a/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/server/GwtDriverAndAssetServiceImpl.java +++ b/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/server/GwtDriverAndAssetServiceImpl.java @@ -30,7 +30,7 @@ import java.util.TreeSet; import java.util.concurrent.atomic.AtomicInteger; -import javax.servlet.http.HttpSession; +import jakarta.servlet.http.HttpSession; import org.apache.commons.csv.CSVFormat; import org.apache.commons.csv.CSVPrinter; diff --git a/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/server/GwtEventServiceImpl.java b/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/server/GwtEventServiceImpl.java index ffb48c5bf4a..71296e08458 100644 --- a/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/server/GwtEventServiceImpl.java +++ b/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/server/GwtEventServiceImpl.java @@ -20,7 +20,7 @@ import java.util.LinkedList; import java.util.List; -import javax.servlet.http.HttpSession; +import jakarta.servlet.http.HttpSession; import org.eclipse.kura.core.configuration.ConfigurationChangeEvent; import org.eclipse.kura.web.server.util.GwtServerUtil; diff --git a/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/server/GwtExtensionServiceImpl.java b/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/server/GwtExtensionServiceImpl.java deleted file mode 100644 index 4b13ba6bdd9..00000000000 --- a/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/server/GwtExtensionServiceImpl.java +++ /dev/null @@ -1,47 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2019, 2020 Eurotech and/or its affiliates and others - * - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Eurotech - *******************************************************************************/ -package org.eclipse.kura.web.server; - -import java.util.List; -import java.util.stream.Collectors; - -import org.eclipse.kura.web.Console; -import org.eclipse.kura.web.api.ClientExtensionBundle; -import org.eclipse.kura.web.shared.GwtKuraException; -import org.eclipse.kura.web.shared.model.GwtClientExtensionBundle; -import org.eclipse.kura.web.shared.service.GwtExtensionService; - -public class GwtExtensionServiceImpl extends OsgiRemoteServiceServlet implements GwtExtensionService { - - /** - * - */ - private static final long serialVersionUID = 1L; - - @Override - public List getConsoleExtensions() throws GwtKuraException { - return Console.instance().getConsoleExtensions().stream().map(GwtExtensionServiceImpl::toGwt) - .collect(Collectors.toList()); - } - - @Override - public List getLoginExtensions() throws GwtKuraException { - return Console.instance().getLoginExtensions().stream().map(GwtExtensionServiceImpl::toGwt) - .collect(Collectors.toList()); - } - - private static GwtClientExtensionBundle toGwt(final ClientExtensionBundle clientExtension) { - return new GwtClientExtensionBundle(clientExtension.getProperties(), clientExtension.getEntryPointUrl()); - } - -} diff --git a/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/server/GwtNetworkServiceImpl.java b/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/server/GwtNetworkServiceImpl.java index a55cde2dca0..49dca87c604 100644 --- a/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/server/GwtNetworkServiceImpl.java +++ b/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/server/GwtNetworkServiceImpl.java @@ -22,8 +22,6 @@ import org.eclipse.kura.KuraException; import org.eclipse.kura.configuration.ConfigurationService; -import org.eclipse.kura.net.IP4Address; -import org.eclipse.kura.net.IP6Address; import org.eclipse.kura.net.IPAddress; import org.eclipse.kura.net.NetConfig; import org.eclipse.kura.net.admin.FirewallConfigurationService; @@ -105,7 +103,7 @@ public ArrayList findWifiHotspots(GwtXSRFToken xsrfToken, S throw new GwtKuraException(GwtKuraErrorCode.INTERNAL_ERROR, e); } } - + @Override public boolean verifyWifiCredentials(GwtXSRFToken xsrfToken, String interfaceName, GwtWifiConfig gwtWifiConfig) throws GwtKuraException { @@ -247,11 +245,11 @@ public List findDeviceFirewallOpenPortsIPv6(GwtXSRFTok } return new ArrayList<>(gwtOpenPortEntries); -// if (isNet2()) { -// return org.eclipse.kura.web.server.net2.GwtNetworkServiceImpl.findDeviceFirewallOpenPortsIPv6(); -// } else { -// throw new GwtKuraException(GwtKuraErrorCode.OPERATION_NOT_SUPPORTED); -// } + // if (isNet2()) { + // return org.eclipse.kura.web.server.net2.GwtNetworkServiceImpl.findDeviceFirewallOpenPortsIPv6(); + // } else { + // throw new GwtKuraException(GwtKuraErrorCode.OPERATION_NOT_SUPPORTED); + // } } @Override @@ -468,8 +466,7 @@ public void updateDeviceFirewallPortForwards(GwtXSRFToken xsrfToken, List= 2) { - stringBuilder.append(((IP4Address) IPAddress.parseHostAddress(networkAddress[0])).getHostAddress()) - .append("/").append(networkAddress[1]); + stringBuilder.append((IPAddress.parseHostAddress(networkAddress[0])).getHostAddress()).append("/") + .append(networkAddress[1]); } } diff --git a/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/server/GwtPasswordAuthenticationServiceImpl.java b/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/server/GwtPasswordAuthenticationServiceImpl.java index c0b8dc16889..6804bdcc500 100644 --- a/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/server/GwtPasswordAuthenticationServiceImpl.java +++ b/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/server/GwtPasswordAuthenticationServiceImpl.java @@ -12,7 +12,7 @@ *******************************************************************************/ package org.eclipse.kura.web.server; -import javax.servlet.http.HttpSession; +import jakarta.servlet.http.HttpSession; import org.eclipse.kura.KuraErrorCode; import org.eclipse.kura.KuraException; diff --git a/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/server/GwtSecurityTokenServiceImpl.java b/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/server/GwtSecurityTokenServiceImpl.java index c42bd1a3e59..2a977bafdb3 100644 --- a/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/server/GwtSecurityTokenServiceImpl.java +++ b/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/server/GwtSecurityTokenServiceImpl.java @@ -15,8 +15,8 @@ import java.util.Optional; import java.util.UUID; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpSession; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpSession; import org.eclipse.kura.web.session.Attributes; import org.eclipse.kura.web.shared.model.GwtXSRFToken; diff --git a/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/server/GwtSessionServiceImpl.java b/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/server/GwtSessionServiceImpl.java index 4460cca47c7..9ae8227e9a3 100644 --- a/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/server/GwtSessionServiceImpl.java +++ b/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/server/GwtSessionServiceImpl.java @@ -15,10 +15,10 @@ import java.util.Objects; import java.util.Optional; -import javax.servlet.http.Cookie; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; +import jakarta.servlet.http.Cookie; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpSession; import org.eclipse.kura.audit.AuditContext; import org.eclipse.kura.web.Console; diff --git a/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/server/GwtStatusServiceImpl.java b/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/server/GwtStatusServiceImpl.java index e4ee71305b0..e91f873f247 100644 --- a/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/server/GwtStatusServiceImpl.java +++ b/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/server/GwtStatusServiceImpl.java @@ -309,8 +309,8 @@ private static Optional getStatusName(GwtNetInterfaceConfig gwtNetInterf || gwtNetInterfaceConfig.getHwTypeEnum() == GwtNetIfType.WIFI) { return Optional.of(gwtNetInterfaceConfig.getName()); } else if (gwtNetInterfaceConfig.getHwTypeEnum() == GwtNetIfType.MODEM) { - String name = ((GwtModemInterfaceConfig) gwtNetInterfaceConfig).getName(); - String interfaceName = ((GwtModemInterfaceConfig) gwtNetInterfaceConfig).getInterfaceName(); + String name = (gwtNetInterfaceConfig).getName(); + String interfaceName = (gwtNetInterfaceConfig).getInterfaceName(); if (Objects.nonNull(interfaceName) && !interfaceName.isEmpty()) { name = name + " (" + interfaceName + ")"; } @@ -371,13 +371,11 @@ private static Optional getIPv4Status(GwtNetInterfaceConfig gwtNetInterf sb.append("IPv4").append(NL).append(TAB) .append(gwtNetInterfaceConfig.getStatusEnum().getValue()); } else { - sb.append("IPv4").append(NL) - .append(TAB).append(currentAddress).append(NL) - .append(TAB).append(TAB).append(SUBNET_MASK).append(currentSubnetMask).append(NL) - .append(TAB).append(TAB).append(MODE).append(gwtNetInterfaceConfig.getStatusEnum().getValue()) - .append(NL) - .append(TAB).append(TAB).append(IP_ACQUISITION).append(currentConfigMode).append(NL) - .append(TAB).append(TAB).append("Router Mode: ").append(currentRouterMode); + sb.append("IPv4").append(NL).append(TAB).append(currentAddress).append(NL).append(TAB) + .append(TAB).append(SUBNET_MASK).append(currentSubnetMask).append(NL).append(TAB).append(TAB) + .append(MODE).append(gwtNetInterfaceConfig.getStatusEnum().getValue()).append(NL).append(TAB) + .append(TAB).append(IP_ACQUISITION).append(currentConfigMode).append(NL).append(TAB).append(TAB) + .append("Router Mode: ").append(currentRouterMode); } return Optional.of(sb.toString()); } else if (gwtNetInterfaceConfig.getHwTypeEnum() == GwtNetIfType.WIFI @@ -397,21 +395,19 @@ private static Optional getIPv4Status(GwtNetInterfaceConfig gwtNetInterf sb.append("IPv4").append(NL).append(TAB) .append(gwtNetInterfaceConfig.getStatusEnum().getValue()); } else { - sb.append("IPv4").append(NL) - .append(TAB).append(currentAddress).append(NL) - .append(TAB).append(TAB).append(SUBNET_MASK).append(currentSubnetMask).append(NL) - .append(TAB).append(TAB).append(MODE).append(gwtNetInterfaceConfig.getStatusEnum().getValue()) - .append(NL) - .append(TAB).append(TAB).append(IP_ACQUISITION).append(currentConfigMode).append(NL) - .append(TAB).append(TAB).append("Router Mode: ").append(currentRouterMode).append(NL) - .append(TAB).append(TAB).append("Wireless Mode:").append(currentWifiMode).append(NL) - .append(TAB).append(TAB).append("SSID: ").append(currentWifiSsid).append(NL); + sb.append("IPv4").append(NL).append(TAB).append(currentAddress).append(NL).append(TAB) + .append(TAB).append(SUBNET_MASK).append(currentSubnetMask).append(NL).append(TAB).append(TAB) + .append(MODE).append(gwtNetInterfaceConfig.getStatusEnum().getValue()).append(NL).append(TAB) + .append(TAB).append(IP_ACQUISITION).append(currentConfigMode).append(NL).append(TAB).append(TAB) + .append("Router Mode: ").append(currentRouterMode).append(NL).append(TAB).append(TAB) + .append("Wireless Mode:").append(currentWifiMode).append(NL).append(TAB).append(TAB) + .append("SSID: ").append(currentWifiSsid).append(NL); } return Optional.of(sb.toString()); } else if (gwtNetInterfaceConfig.getHwTypeEnum() == GwtNetIfType.MODEM) { String currentModemApn = ((GwtModemInterfaceConfig) gwtNetInterfaceConfig).getApn(); - String name = ((GwtModemInterfaceConfig) gwtNetInterfaceConfig).getName(); - String interfaceName = ((GwtModemInterfaceConfig) gwtNetInterfaceConfig).getInterfaceName(); + String name = (gwtNetInterfaceConfig).getName(); + String interfaceName = (gwtNetInterfaceConfig).getInterfaceName(); if (Objects.nonNull(interfaceName) && !interfaceName.isEmpty()) { name = name + " (" + interfaceName + ")"; } @@ -421,15 +417,12 @@ private static Optional getIPv4Status(GwtNetInterfaceConfig gwtNetInterf sb.append("IPv4").append(NL).append(TAB) .append(gwtNetInterfaceConfig.getStatusEnum().getValue()); } else { - sb.append("IPv4").append(NL) - .append(TAB).append(currentAddress).append(NL) - .append(TAB).append(TAB).append(SUBNET_MASK).append(currentSubnetMask) - .append(NL).append(TAB).append(TAB).append(MODE) - .append(gwtNetInterfaceConfig.getStatusEnum().getValue()).append(NL) - .append(TAB).append(TAB).append(IP_ACQUISITION) - .append(currentConfigMode).append(NL) - .append(TAB).append(TAB).append("APN: ").append(currentModemApn).append(NL) - .append(TAB).append(TAB).append("Interface: ").append(interfaceName); + sb.append("IPv4").append(NL).append(TAB).append(currentAddress).append(NL).append(TAB) + .append(TAB).append(SUBNET_MASK).append(currentSubnetMask).append(NL).append(TAB).append(TAB) + .append(MODE).append(gwtNetInterfaceConfig.getStatusEnum().getValue()).append(NL).append(TAB) + .append(TAB).append(IP_ACQUISITION).append(currentConfigMode).append(NL).append(TAB).append(TAB) + .append("APN: ").append(currentModemApn).append(NL).append(TAB).append(TAB) + .append("Interface: ").append(interfaceName); } return Optional.of(sb.toString()); } else { @@ -463,17 +456,14 @@ private static Optional getIPv6Status(GwtNetInterfaceConfig gwtNetInterf StringBuilder sb = new StringBuilder(); if (gwtNetInterfaceConfig.getHwTypeEnum() == GwtNetIfType.ETHERNET) { - if (statusIPv6.equals("netIPv6StatusDisabled") - || statusIPv6.equals("netIPv6StatusUnmanaged") + if (statusIPv6.equals("netIPv6StatusDisabled") || statusIPv6.equals("netIPv6StatusUnmanaged") || statusIPv6.equals("netIPv6StatusL2Only")) { - sb.append("IPv6").append(NL).append(TAB) - .append(convertIPv6Status(statusIPv6)); + sb.append("IPv6").append(NL).append(TAB).append(convertIPv6Status(statusIPv6)); } else { - sb.append("IPv6").append(NL) - .append(TAB).append(currentIPv6Address).append(NL) - .append(TAB).append(TAB).append(SUBNET_MASK).append(currentIPv6SubnetMask).append(NL) - .append(TAB).append(TAB).append(MODE).append(convertIPv6Status(statusIPv6)).append(NL) - .append(TAB).append(TAB).append(IP_ACQUISITION).append(currentIPv6ConfigMode); + sb.append("IPv6").append(NL).append(TAB).append(currentIPv6Address).append(NL).append(TAB) + .append(TAB).append(SUBNET_MASK).append(currentIPv6SubnetMask).append(NL).append(TAB) + .append(TAB).append(MODE).append(convertIPv6Status(statusIPv6)).append(NL).append(TAB) + .append(TAB).append(IP_ACQUISITION).append(currentIPv6ConfigMode); } return Optional.of(sb.toString()); } else if (gwtNetInterfaceConfig.getHwTypeEnum() == GwtNetIfType.WIFI @@ -487,39 +477,35 @@ private static Optional getIPv6Status(GwtNetInterfaceConfig gwtNetInterf if (gwtActiveWifiConfig != null) { currentWifiSsid = gwtActiveWifiConfig.getWirelessSsid(); } - if (statusIPv6.equals("netIPv6StatusDisabled") - || statusIPv6.equals("netIPv6StatusUnmanaged") + if (statusIPv6.equals("netIPv6StatusDisabled") || statusIPv6.equals("netIPv6StatusUnmanaged") || statusIPv6.equals("netIPv6StatusL2Only")) { sb.append("IPv6").append(NL).append(TAB).append(convertIPv6Status(statusIPv6)); } else { - sb.append("IPv6").append(NL) - .append(TAB).append(currentIPv6Address).append(NL) - .append(TAB).append(TAB).append(SUBNET_MASK).append(currentIPv6SubnetMask).append(NL) - .append(TAB).append(TAB).append(MODE).append(convertIPv6Status(statusIPv6)).append(NL) - .append(TAB).append(TAB).append(IP_ACQUISITION).append(currentIPv6ConfigMode).append(NL) - .append(TAB).append(TAB).append("Wireless Mode:").append(currentWifiMode).append(NL) - .append(TAB).append(TAB).append("SSID: ").append(currentWifiSsid).append(NL); + sb.append("IPv6").append(NL).append(TAB).append(currentIPv6Address).append(NL).append(TAB) + .append(TAB).append(SUBNET_MASK).append(currentIPv6SubnetMask).append(NL).append(TAB) + .append(TAB).append(MODE).append(convertIPv6Status(statusIPv6)).append(NL).append(TAB) + .append(TAB).append(IP_ACQUISITION).append(currentIPv6ConfigMode).append(NL).append(TAB) + .append(TAB).append("Wireless Mode:").append(currentWifiMode).append(NL).append(TAB).append(TAB) + .append("SSID: ").append(currentWifiSsid).append(NL); } return Optional.of(sb.toString()); } else if (gwtNetInterfaceConfig.getHwTypeEnum() == GwtNetIfType.MODEM) { String currentModemApn = ((GwtModemInterfaceConfig) gwtNetInterfaceConfig).getApn(); - String name = ((GwtModemInterfaceConfig) gwtNetInterfaceConfig).getName(); - String interfaceName = ((GwtModemInterfaceConfig) gwtNetInterfaceConfig).getInterfaceName(); + String name = (gwtNetInterfaceConfig).getName(); + String interfaceName = (gwtNetInterfaceConfig).getInterfaceName(); if (Objects.nonNull(interfaceName) && !interfaceName.isEmpty()) { name = name + " (" + interfaceName + ")"; } - if (statusIPv6.equals("netIPv6StatusDisabled") - || statusIPv6.equals("netIPv6StatusUnmanaged") + if (statusIPv6.equals("netIPv6StatusDisabled") || statusIPv6.equals("netIPv6StatusUnmanaged") || statusIPv6.equals("netIPv6StatusL2Only")) { sb.append("IPv6").append(NL).append(TAB).append(convertIPv6Status(statusIPv6)); } else { - sb.append("IPv6").append(NL) - .append(TAB).append(currentIPv6Address).append(NL) - .append(TAB).append(TAB).append(SUBNET_MASK).append(currentIPv6SubnetMask).append(NL) - .append(TAB).append(TAB).append(MODE).append(convertIPv6Status(statusIPv6)).append(NL) - .append(TAB).append(TAB).append(IP_ACQUISITION).append(currentIPv6ConfigMode).append(NL) - .append(TAB).append(TAB).append("APN: ").append(currentModemApn).append(NL) - .append(TAB).append(TAB).append("Interface: ").append(interfaceName); + sb.append("IPv6").append(NL).append(TAB).append(currentIPv6Address).append(NL).append(TAB) + .append(TAB).append(SUBNET_MASK).append(currentIPv6SubnetMask).append(NL).append(TAB) + .append(TAB).append(MODE).append(convertIPv6Status(statusIPv6)).append(NL).append(TAB) + .append(TAB).append(IP_ACQUISITION).append(currentIPv6ConfigMode).append(NL).append(TAB) + .append(TAB).append("APN: ").append(currentModemApn).append(NL).append(TAB).append(TAB) + .append("Interface: ").append(interfaceName); } return Optional.of(sb.toString()); } else { @@ -533,20 +519,20 @@ private static String convertIPv6Status(String status) { return "netIPv6StatusDisabled"; } switch (status) { - case "netIPv6StatusDisabled": - return "Disabled"; - case "netIPv6StatusUnmanaged": - return "Unmanaged"; - case "netIPv6StatusL2Only": - return "L2Only"; - case "netIPv6StatusEnabledLAN": - return "LAN"; - case "netIPv6StatusEnabledWAN": - return "WAN"; - case "netIPv6StatusUnknown": - return "Unknown"; - default: - return "Unknown"; + case "netIPv6StatusDisabled": + return "Disabled"; + case "netIPv6StatusUnmanaged": + return "Unmanaged"; + case "netIPv6StatusL2Only": + return "L2Only"; + case "netIPv6StatusEnabledLAN": + return "LAN"; + case "netIPv6StatusEnabledWAN": + return "WAN"; + case "netIPv6StatusUnknown": + return "Unknown"; + default: + return "Unknown"; } } diff --git a/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/server/KuraRemoteServiceServlet.java b/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/server/KuraRemoteServiceServlet.java index e75b6872612..1d5acce5c0b 100644 --- a/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/server/KuraRemoteServiceServlet.java +++ b/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/server/KuraRemoteServiceServlet.java @@ -19,12 +19,10 @@ import java.util.Optional; import java.util.Set; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpSession; - -import org.apache.commons.fileupload.FileItem; -import org.apache.commons.fileupload.FileUploadException; -import org.apache.commons.fileupload.servlet.ServletFileUpload; +import org.apache.commons.fileupload2.core.DiskFileItem; +import org.apache.commons.fileupload2.core.DiskFileItemFactory; +import org.apache.commons.fileupload2.core.FileUploadException; +import org.apache.commons.fileupload2.jakarta.servlet5.JakartaServletFileUpload; import org.eclipse.kura.audit.AuditContext; import org.eclipse.kura.web.Console; import org.eclipse.kura.web.UserManager; @@ -37,7 +35,10 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.google.gwt.user.server.rpc.RemoteServiceServlet; +import com.google.gwt.user.server.rpc.jakarta.RemoteServiceServlet; + +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpSession; public class KuraRemoteServiceServlet extends RemoteServiceServlet { @@ -102,8 +103,7 @@ public static boolean isValidXSRFToken(HttpServletRequest req, String userToken) } if (userToken == null) { - auditLogger.warn("{} UI XSRF - Failure - XSRF Token not provided", - AuditContext.currentOrInternal()); + auditLogger.warn("{} UI XSRF - Failure - XSRF Token not provided", AuditContext.currentOrInternal()); session.invalidate(); return false; } @@ -111,8 +111,7 @@ public static boolean isValidXSRFToken(HttpServletRequest req, String userToken) if (Objects.equals(userToken, session.getAttribute(Attributes.XSRF_TOKEN.getValue()))) { return true; } else { - auditLogger.warn("{} UI XSRF - Failure - XSRF Token validation error", - AuditContext.currentOrInternal()); + auditLogger.warn("{} UI XSRF - Failure - XSRF Token validation error", AuditContext.currentOrInternal()); session.invalidate(); return false; } @@ -132,8 +131,7 @@ public static void requirePermissions(final HttpServletRequest request, final Re } private static void requirePermissionsInternal(final HttpServletRequest request, - final RequiredPermissions.Mode mode, - final String[] permissions) { + final RequiredPermissions.Mode mode, final String[] permissions) { final HttpSession session = request.getSession(false); @@ -208,13 +206,13 @@ public static String getFieldFromMultiPartForm(HttpServletRequest req, String fi throws FileUploadException { String fieldValue = null; - ServletFileUpload upload = new ServletFileUpload(); - List items = upload.parseRequest(req); + JakartaServletFileUpload upload = new JakartaServletFileUpload<>(); + List items = upload.parseRequest(req); // Process the uploaded items - Iterator iter = items.iterator(); + Iterator iter = items.iterator(); while (iter.hasNext()) { - FileItem item = iter.next(); + DiskFileItem item = iter.next(); if (item.isFormField()) { String name = item.getFieldName(); diff --git a/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/server/OsgiRemoteServiceServlet.java b/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/server/OsgiRemoteServiceServlet.java index ada77650fe5..6668f5ab1a9 100644 --- a/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/server/OsgiRemoteServiceServlet.java +++ b/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/server/OsgiRemoteServiceServlet.java @@ -22,9 +22,9 @@ import java.util.Map; import java.util.Optional; -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.eclipse.kura.audit.AuditContext; import org.eclipse.kura.audit.AuditContext.Scope; diff --git a/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/server/servlet/AuditServlet.java b/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/server/servlet/AuditServlet.java index 09256e8dfb4..66e3cbbf917 100644 --- a/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/server/servlet/AuditServlet.java +++ b/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/server/servlet/AuditServlet.java @@ -14,11 +14,6 @@ import java.io.IOException; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - import org.eclipse.kura.audit.AuditContext; import org.eclipse.kura.audit.AuditContext.Scope; import org.eclipse.kura.web.Console; @@ -26,8 +21,15 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import jakarta.servlet.ServletException; +import jakarta.servlet.http.HttpServlet; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; + public class AuditServlet extends HttpServlet { + private static final long serialVersionUID = 1L; + private static final Logger auditLogger = LoggerFactory.getLogger("AuditLogger"); private final String componentId; diff --git a/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/server/servlet/ChannelServlet.java b/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/server/servlet/ChannelServlet.java index a13a8fa4b64..acc9f9a3c01 100644 --- a/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/server/servlet/ChannelServlet.java +++ b/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/server/servlet/ChannelServlet.java @@ -15,12 +15,6 @@ import java.io.IOException; import java.io.PrintWriter; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; -import javax.xml.ws.http.HTTPException; - import org.eclipse.kura.web.server.KuraRemoteServiceServlet; import org.eclipse.kura.web.server.RequiredPermissions.Mode; import org.eclipse.kura.web.shared.KuraPermission; @@ -28,6 +22,11 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import jakarta.servlet.ServletException; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpSession; + public class ChannelServlet extends AuditServlet { private static final long serialVersionUID = -1445700937173920652L; @@ -62,7 +61,8 @@ protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws Se final String result = (String) session.getAttribute(attributeKey); if (result == null) { - throw new HTTPException(404); + resp.setStatus(404); + return; } session.removeAttribute(attributeKey); @@ -71,6 +71,7 @@ protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws Se resp.setContentType("text/csv"); resp.setHeader("Content-Disposition", "attachment; filename=asset_" + assetPid + ".csv"); resp.setHeader("Cache-Control", "no-transform, max-age=0"); + try (PrintWriter writer = resp.getWriter()) { writer.write(result); } diff --git a/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/server/servlet/DeviceSnapshotsServlet.java b/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/server/servlet/DeviceSnapshotsServlet.java index a90e558b315..39097788a52 100644 --- a/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/server/servlet/DeviceSnapshotsServlet.java +++ b/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/server/servlet/DeviceSnapshotsServlet.java @@ -15,10 +15,6 @@ import java.io.IOException; import java.util.List; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - import org.eclipse.kura.configuration.ComponentConfiguration; import org.eclipse.kura.configuration.ConfigurationService; import org.eclipse.kura.web.server.KuraRemoteServiceServlet; @@ -30,6 +26,10 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import jakarta.servlet.ServletException; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; + public class DeviceSnapshotsServlet extends AuditServlet { private static final long serialVersionUID = -2533869595709953567L; @@ -42,7 +42,7 @@ public DeviceSnapshotsServlet() { @Override public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - KuraRemoteServiceServlet.requirePermissions(request, Mode.ALL, new String[] { KuraPermission.ADMIN }); + KuraRemoteServiceServlet.requirePermissions(request, Mode.ALL, new String[] { KuraPermission.ADMIN }); // BEGIN XSRF - Servlet dependent code diff --git a/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/server/servlet/FileServlet.java b/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/server/servlet/FileServlet.java index 7cd90c445fe..8e192dd69bc 100644 --- a/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/server/servlet/FileServlet.java +++ b/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/server/servlet/FileServlet.java @@ -38,17 +38,11 @@ import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; -import javax.servlet.ServletContext; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; - -import org.apache.commons.fileupload.FileItem; -import org.apache.commons.fileupload.FileUploadException; -import org.apache.commons.fileupload.disk.DiskFileItemFactory; -import org.apache.commons.fileupload.servlet.FileCleanerCleanup; -import org.apache.commons.fileupload.servlet.ServletFileUpload; +import org.apache.commons.fileupload2.core.DiskFileItem; +import org.apache.commons.fileupload2.core.DiskFileItemFactory; +import org.apache.commons.fileupload2.core.FileUploadException; +import org.apache.commons.fileupload2.jakarta.servlet5.JakartaFileCleaner; +import org.apache.commons.fileupload2.jakarta.servlet5.JakartaServletFileUpload; import org.apache.commons.io.FileCleaningTracker; import org.apache.commons.io.IOUtils; import org.eclipse.kura.KuraErrorCode; @@ -85,8 +79,16 @@ import com.google.gson.Gson; +import jakarta.servlet.ServletContext; +import jakarta.servlet.ServletException; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpSession; + public class FileServlet extends AuditServlet { + private static final String SYSTEM_SERVICE_ERROR_MESSAGE = "Error locating SystemService"; + private static final String CANNOT_CLOSE_INPUT_STREAM = "Cannot close input stream"; private static final String CANNOT_CLOSE_OUTPUT_STREAM = "Cannot close output stream"; @@ -138,7 +140,7 @@ public void init() throws ServletException { logger.info("Servlet {} initialized", getServletName()); ServletContext ctx = getServletContext(); - this.fileCleaningTracker = FileCleanerCleanup.getFileCleaningTracker(ctx); + this.fileCleaningTracker = JakartaFileCleaner.getFileCleaningTracker(ctx); getZipUploadSizeMax(); getZipUploadCountMax(); @@ -146,11 +148,12 @@ public void init() throws ServletException { int sizeThreshold = getFileUploadInMemorySizeThreshold(); File repository = new File(System.getProperty(JAVA_IO_TMPDIR)); - logger.info("DiskFileItemFactory.DEFAULT_SIZE_THRESHOLD: {}", DiskFileItemFactory.DEFAULT_SIZE_THRESHOLD); + logger.info("DiskFileItemFactory.DEFAULT_THRESHOLD: {}", DiskFileItemFactory.DEFAULT_THRESHOLD); logger.info("DiskFileItemFactory: using size threshold of: {}", sizeThreshold); - this.diskFileItemFactory = new DiskFileItemFactory(sizeThreshold, repository); - this.diskFileItemFactory.setFileCleaningTracker(this.fileCleaningTracker); + this.diskFileItemFactory = DiskFileItemFactory.builder() // + .setBufferSize(sizeThreshold) // + .setPath(repository.toPath()).setFileCleaningTracker(this.fileCleaningTracker).get(); } @Override @@ -325,7 +328,7 @@ private void doPostCommand(HttpServletRequest req) throws ServletException, IOEx workingDir = System.getProperty(JAVA_IO_TMPDIR, "/tmp"); } - List fileItems = null; + List fileItems = null; InputStream is = null; File localFolder = new File(workingDir); OutputStream os = null; @@ -334,7 +337,7 @@ private void doPostCommand(HttpServletRequest req) throws ServletException, IOEx fileItems = upload.getFileItems(); if (!fileItems.isEmpty()) { - FileItem item = fileItems.get(0); + DiskFileItem item = fileItems.get(0); is = item.getInputStream(); byte[] bytes = IOUtils.toByteArray(is); @@ -401,7 +404,7 @@ private void doPostCommand(HttpServletRequest req) throws ServletException, IOEx } } if (fileItems != null) { - for (FileItem fileItem : fileItems) { + for (DiskFileItem fileItem : fileItems) { fileItem.delete(); } } @@ -443,7 +446,7 @@ private void doPostAsset(HttpServletRequest req, HttpServletResponse resp) throw KuraRemoteServiceServlet.checkXSRFToken(req, token); // END XSRF security check - List fileItems = upload.getFileItems(); + List fileItems = upload.getFileItems(); int fileItemsSize = fileItems.size(); if (fileItemsSize != 1) { logger.error(EXPECTED_1_FILE_PATTERN, fileItemsSize); @@ -451,7 +454,7 @@ private void doPostAsset(HttpServletRequest req, HttpServletResponse resp) throw throw new ServletException(); } - FileItem fileItem = fileItems.get(0); + DiskFileItem fileItem = fileItems.get(0); byte[] data = fileItem.get(); String csvString = new String(data, StandardCharsets.UTF_8); String assetPid = formFields.get("assetPid"); @@ -512,14 +515,14 @@ private void doPostConfigurationSnapshot(HttpServletRequest req) throws ServletE } // END XSRF security check - List fileItems = upload.getFileItems(); + List fileItems = upload.getFileItems(); int fileItemsSize = fileItems.size(); if (fileItemsSize != 1) { logger.error(EXPECTED_1_FILE_PATTERN, fileItemsSize); throw new ServletException("Wrong number of file items"); } - FileItem fileItem = fileItems.get(0); + DiskFileItem fileItem = fileItems.get(0); byte[] data = fileItem.get(); String fileItemString = new String(data, StandardCharsets.UTF_8); @@ -597,7 +600,7 @@ private void doPostDeployUpload(HttpServletRequest req, HttpSession session) thr } // Check that we have a file upload request - boolean isMultipart = ServletFileUpload.isMultipartContent(req); + boolean isMultipart = JakartaServletFileUpload.isMultipartContent(req); if (!isMultipart) { logger.error("Not a file upload request"); throw new ServletException("Not a file upload request"); @@ -623,7 +626,7 @@ private void doPostDeployUpload(HttpServletRequest req, HttpSession session) thr } // END XSRF security check - List fileItems = null; + List fileItems = null; InputStream is = null; File localFile = null; OutputStream os = null; @@ -638,7 +641,7 @@ private void doPostDeployUpload(HttpServletRequest req, HttpSession session) thr throw new ServletException("Wrong number of file items"); } - FileItem item = fileItems.get(0); + DiskFileItem item = fileItems.get(0); String filename = item.getName(); is = item.getInputStream(); @@ -715,7 +718,7 @@ private void doPostDeployUpload(HttpServletRequest req, HttpSession session) thr } } if (fileItems != null) { - for (FileItem fileItem : fileItems) { + for (DiskFileItem fileItem : fileItems) { fileItem.delete(); } } @@ -779,7 +782,7 @@ private void getZipUploadSizeMax() { int sizeInBytes = sizeInMB * 1024 * 1024; tooBig = sizeInBytes; } catch (GwtKuraException e) { - logger.error("Error locating SystemService", e); + logger.error(SYSTEM_SERVICE_ERROR_MESSAGE, e); } } @@ -789,7 +792,7 @@ private void getZipUploadCountMax() { SystemService systemService = locator.getService(SystemService.class); tooMany = systemService.getFileCommandZipMaxUploadNumber(); } catch (GwtKuraException e) { - logger.error("Error locating SystemService", e); + logger.error(SYSTEM_SERVICE_ERROR_MESSAGE, e); } } @@ -801,7 +804,7 @@ static long getFileUploadSizeMax() { SystemService systemService = locator.getService(SystemService.class); sizeMax = Long.parseLong(systemService.getProperties().getProperty("file.upload.size.max", "-1")); } catch (GwtKuraException e) { - logger.error("Error locating SystemService", e); + logger.error(SYSTEM_SERVICE_ERROR_MESSAGE, e); } return sizeMax; @@ -810,14 +813,13 @@ static long getFileUploadSizeMax() { private static int getFileUploadInMemorySizeThreshold() { ServiceLocator locator = ServiceLocator.getInstance(); - int sizeThreshold = DiskFileItemFactory.DEFAULT_SIZE_THRESHOLD; + int sizeThreshold = DiskFileItemFactory.DEFAULT_THRESHOLD; try { SystemService systemService = locator.getService(SystemService.class); - sizeThreshold = Integer - .parseInt(systemService.getProperties().getProperty("file.upload.in.memory.size.threshold", - String.valueOf(DiskFileItemFactory.DEFAULT_SIZE_THRESHOLD))); + sizeThreshold = Integer.parseInt(systemService.getProperties().getProperty( + "file.upload.in.memory.size.threshold", String.valueOf(DiskFileItemFactory.DEFAULT_THRESHOLD))); } catch (GwtKuraException e) { - logger.error("Error locating SystemService", e); + logger.error(SYSTEM_SERVICE_ERROR_MESSAGE, e); } return sizeThreshold; @@ -855,12 +857,12 @@ protected T unmarshal(String xmlString, Class clazz) throws KuraException } } -class UploadRequest extends ServletFileUpload { +class UploadRequest extends JakartaServletFileUpload { private static Logger logger = LoggerFactory.getLogger(UploadRequest.class); Map formFields; - List fileItems; + List fileItems; public UploadRequest(DiskFileItemFactory diskFileItemFactory) { super(diskFileItemFactory); @@ -879,13 +881,13 @@ public void parse(HttpServletRequest req) throws FileUploadException { logger.debug("upload.getSizeMax(): {}", getSizeMax()); // Parse the request - List items = null; + List items = null; items = parseRequest(req); // Process the uploaded items - Iterator iter = items.iterator(); + Iterator iter = items.iterator(); while (iter.hasNext()) { - FileItem item = iter.next(); + DiskFileItem item = iter.next(); if (item.isFormField()) { String name = item.getFieldName(); @@ -902,7 +904,7 @@ public void parse(HttpServletRequest req) throws FileUploadException { long sizeInBytes = item.getSize(); logger.debug("File upload item name: {}, fileName: {}, contentType: {}, isInMemory: {}, size: {}", - new Object[] { fieldName, fileName, contentType, isInMemory, sizeInBytes }); + fieldName, fileName, contentType, isInMemory, sizeInBytes); this.fileItems.add(item); } @@ -913,7 +915,7 @@ public Map getFormFields() { return this.formFields; } - public List getFileItems() { + public List getFileItems() { return this.fileItems; } } diff --git a/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/server/servlet/LogServlet.java b/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/server/servlet/LogServlet.java index d2d7fcf515d..4e69a550d82 100644 --- a/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/server/servlet/LogServlet.java +++ b/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/server/servlet/LogServlet.java @@ -30,11 +30,11 @@ import java.util.zip.ZipEntry; import java.util.zip.ZipOutputStream; -import javax.servlet.ServletException; -import javax.servlet.ServletOutputStream; -import javax.servlet.http.Cookie; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.ServletException; +import jakarta.servlet.ServletOutputStream; +import jakarta.servlet.http.Cookie; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.eclipse.kura.executor.Command; import org.eclipse.kura.executor.CommandStatus; diff --git a/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/server/servlet/RedirectServlet.java b/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/server/servlet/RedirectServlet.java index 036695a8e8e..988cbe067ae 100644 --- a/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/server/servlet/RedirectServlet.java +++ b/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/server/servlet/RedirectServlet.java @@ -15,10 +15,10 @@ import java.io.IOException; import java.util.function.Predicate; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.ServletException; +import jakarta.servlet.http.HttpServlet; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/server/servlet/SendStatusServlet.java b/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/server/servlet/SendStatusServlet.java index 337e690c4ee..95242806b00 100644 --- a/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/server/servlet/SendStatusServlet.java +++ b/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/server/servlet/SendStatusServlet.java @@ -14,10 +14,10 @@ import java.io.IOException; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.ServletException; +import jakarta.servlet.http.HttpServlet; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/server/servlet/SkinServlet.java b/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/server/servlet/SkinServlet.java index a5880a55a10..5943307d65d 100644 --- a/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/server/servlet/SkinServlet.java +++ b/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/server/servlet/SkinServlet.java @@ -24,9 +24,9 @@ import java.util.Optional; import java.util.stream.Stream; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServlet; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.eclipse.kura.system.SystemService; import org.eclipse.kura.web.server.util.ServiceLocator; diff --git a/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/server/servlet/SslAuthenticationServlet.java b/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/server/servlet/SslAuthenticationServlet.java index 71947d52a4a..503726f5390 100644 --- a/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/server/servlet/SslAuthenticationServlet.java +++ b/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/server/servlet/SslAuthenticationServlet.java @@ -18,11 +18,11 @@ import javax.naming.ldap.LdapName; import javax.naming.ldap.Rdn; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; +import jakarta.servlet.ServletException; +import jakarta.servlet.http.HttpServlet; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpSession; import org.eclipse.kura.KuraErrorCode; import org.eclipse.kura.KuraException; @@ -66,7 +66,7 @@ protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws Se } final X509Certificate[] clientCertificates = (X509Certificate[]) req - .getAttribute("javax.servlet.request.X509Certificate"); + .getAttribute("jakarta.servlet.request.X509Certificate"); if (clientCertificates == null || clientCertificates.length == 0) { throw new IllegalArgumentException("Certificate chain is empty"); diff --git a/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/server/servlet/WiresBlinkServlet.java b/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/server/servlet/WiresBlinkServlet.java index 01982864e46..eab3249d05d 100644 --- a/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/server/servlet/WiresBlinkServlet.java +++ b/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/server/servlet/WiresBlinkServlet.java @@ -28,10 +28,10 @@ import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.TimeUnit; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.ServletException; +import jakarta.servlet.http.HttpServlet; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.eclipse.kura.web.server.KuraRemoteServiceServlet; import org.eclipse.kura.web.server.KuraRemoteServiceServlet.KuraPermissionException; diff --git a/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/server/servlet/WiresSnapshotServlet.java b/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/server/servlet/WiresSnapshotServlet.java index 5ab92674e2b..925fbba4031 100644 --- a/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/server/servlet/WiresSnapshotServlet.java +++ b/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/server/servlet/WiresSnapshotServlet.java @@ -22,9 +22,9 @@ import java.util.Set; import java.util.stream.Collectors; -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.eclipse.kura.KuraException; import org.eclipse.kura.asset.provider.AssetConstants; diff --git a/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/server/util/AssetConfigValidator.java b/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/server/util/AssetConfigValidator.java index 478483d9483..7772c72f3d5 100644 --- a/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/server/util/AssetConfigValidator.java +++ b/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/server/util/AssetConfigValidator.java @@ -28,7 +28,7 @@ import java.util.stream.Collectors; import java.util.stream.StreamSupport; -import javax.servlet.ServletException; +import jakarta.servlet.ServletException; import org.apache.commons.csv.CSVFormat; import org.apache.commons.csv.CSVParser; diff --git a/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/server/util/GwtServerUtil.java b/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/server/util/GwtServerUtil.java index 6772608e21d..dc1bb66ebbf 100644 --- a/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/server/util/GwtServerUtil.java +++ b/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/server/util/GwtServerUtil.java @@ -29,10 +29,10 @@ import java.util.stream.Collectors; import java.util.stream.Stream; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; +import jakarta.servlet.ServletException; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpSession; import org.eclipse.kura.configuration.ComponentConfiguration; import org.eclipse.kura.configuration.ConfigurationService; diff --git a/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/session/BaseSecurityHandler.java b/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/session/BaseSecurityHandler.java index 20ea6ec22a5..26d367e081f 100644 --- a/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/session/BaseSecurityHandler.java +++ b/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/session/BaseSecurityHandler.java @@ -14,8 +14,8 @@ import java.io.IOException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.eclipse.kura.web.Console; import org.slf4j.Logger; diff --git a/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/session/CreateSessionSecurityHandler.java b/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/session/CreateSessionSecurityHandler.java index aa24fc95f80..d5a996013ca 100644 --- a/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/session/CreateSessionSecurityHandler.java +++ b/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/session/CreateSessionSecurityHandler.java @@ -14,8 +14,8 @@ import java.io.IOException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.eclipse.kura.web.Console; diff --git a/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/session/HttpContextImpl.java b/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/session/HttpServletContextHelper.java similarity index 62% rename from kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/session/HttpContextImpl.java rename to kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/session/HttpServletContextHelper.java index 11108d5864d..a009b06b6d7 100644 --- a/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/session/HttpContextImpl.java +++ b/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/session/HttpServletContextHelper.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2019, 2020 Eurotech and/or its affiliates and others + * Copyright (c) 2019, 2024 Eurotech and/or its affiliates and others * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -13,26 +13,29 @@ package org.eclipse.kura.web.session; import java.io.IOException; -import java.net.URL; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; +import org.osgi.service.servlet.context.ServletContextHelper; -import org.osgi.service.http.HttpContext; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpSession; -public class HttpContextImpl implements HttpContext { +public class HttpServletContextHelper extends ServletContextHelper { - private final SecurityHandler securityHandler; - private final HttpContext delegate; + private SecurityHandler securityHandler; - public HttpContextImpl(SecurityHandler securityHandler, HttpContext delegate) { + public HttpServletContextHelper(SecurityHandler securityHandler) { + super(); this.securityHandler = securityHandler; - this.delegate = delegate; } @Override public boolean handleSecurity(HttpServletRequest request, HttpServletResponse response) throws IOException { + + if (this.securityHandler == null) { + return super.handleSecurity(request, response); + } + if (handleSecurityInternal(request, response)) { return true; } @@ -54,14 +57,4 @@ private boolean handleSecurityInternal(final HttpServletRequest request, final H } } - @Override - public URL getResource(String name) { - return this.delegate.getResource(name); - } - - @Override - public String getMimeType(String name) { - return this.delegate.getMimeType(name); - } - } diff --git a/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/session/RoutingSecurityHandler.java b/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/session/RoutingSecurityHandler.java index a861e0ae513..4dae8cc9aea 100644 --- a/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/session/RoutingSecurityHandler.java +++ b/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/session/RoutingSecurityHandler.java @@ -17,8 +17,8 @@ import java.util.List; import java.util.function.Predicate; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; public class RoutingSecurityHandler implements SecurityHandler { diff --git a/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/session/SecurityHandler.java b/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/session/SecurityHandler.java index c34cea7c477..aff012fc2e1 100644 --- a/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/session/SecurityHandler.java +++ b/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/session/SecurityHandler.java @@ -14,8 +14,8 @@ import java.io.IOException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; public interface SecurityHandler { diff --git a/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/session/SessionAutorizationSecurityHandler.java b/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/session/SessionAutorizationSecurityHandler.java index 4c4c58cfc7a..a80becce4d2 100644 --- a/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/session/SessionAutorizationSecurityHandler.java +++ b/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/session/SessionAutorizationSecurityHandler.java @@ -15,9 +15,9 @@ import java.io.IOException; import java.util.Objects; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpSession; import org.eclipse.kura.audit.AuditContext; import org.eclipse.kura.audit.AuditContext.Scope; diff --git a/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/session/SessionExpirationSecurityHandler.java b/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/session/SessionExpirationSecurityHandler.java index a4f739d3874..2e43605af00 100644 --- a/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/session/SessionExpirationSecurityHandler.java +++ b/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/session/SessionExpirationSecurityHandler.java @@ -14,9 +14,9 @@ import java.io.IOException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpSession; import org.eclipse.kura.audit.AuditContext; import org.slf4j.Logger; diff --git a/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/session/SessionLockedSecurityHandler.java b/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/session/SessionLockedSecurityHandler.java index 865ae153468..2988c0b0199 100644 --- a/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/session/SessionLockedSecurityHandler.java +++ b/kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/session/SessionLockedSecurityHandler.java @@ -14,9 +14,9 @@ import java.io.IOException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpSession; public class SessionLockedSecurityHandler implements SecurityHandler { diff --git a/kura/org.eclipse.kura.web2/src/main/resources/org/eclipse/kura/web/denali.gwt.xml b/kura/org.eclipse.kura.web2/src/main/resources/org/eclipse/kura/web/denali.gwt.xml index a878bc68c4b..91ebd4db479 100644 --- a/kura/org.eclipse.kura.web2/src/main/resources/org/eclipse/kura/web/denali.gwt.xml +++ b/kura/org.eclipse.kura.web2/src/main/resources/org/eclipse/kura/web/denali.gwt.xml @@ -22,7 +22,6 @@ - diff --git a/kura/org.eclipse.kura.web2/src/main/resources/org/eclipse/kura/web/login.gwt.xml b/kura/org.eclipse.kura.web2/src/main/resources/org/eclipse/kura/web/login.gwt.xml index 089ef6a0e00..37604235322 100644 --- a/kura/org.eclipse.kura.web2/src/main/resources/org/eclipse/kura/web/login.gwt.xml +++ b/kura/org.eclipse.kura.web2/src/main/resources/org/eclipse/kura/web/login.gwt.xml @@ -23,8 +23,6 @@ - - diff --git a/kura/org.eclipse.kura.wire.provider/build.properties b/kura/org.eclipse.kura.wire.provider/build.properties index e0465f2db75..cbb90a7d253 100644 --- a/kura/org.eclipse.kura.wire.provider/build.properties +++ b/kura/org.eclipse.kura.wire.provider/build.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 2016, 2020 Eurotech and/or its affiliates and others +# Copyright (c) 2016, 2024 Eurotech and/or its affiliates and others # # This program and the accompanying materials are made # available under the terms of the Eclipse Public License 2.0 @@ -19,5 +19,4 @@ bin.includes = META-INF/,\ OSGI-INF/ src.includes = about.html source.. = src/main/java/ -additional.bundles = org.eclipse.osgi,\ - org.eclipse.osgi.services + diff --git a/kura/org.eclipse.kura.xml.marshaller.unmarshaller.provider/build.properties b/kura/org.eclipse.kura.xml.marshaller.unmarshaller.provider/build.properties index 9f893de804c..6844658adc0 100644 --- a/kura/org.eclipse.kura.xml.marshaller.unmarshaller.provider/build.properties +++ b/kura/org.eclipse.kura.xml.marshaller.unmarshaller.provider/build.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 2017, 2020 Eurotech and/or its affiliates and others +# Copyright (c) 2017, 2024 Eurotech and/or its affiliates and others # # This program and the accompanying materials are made # available under the terms of the Eclipse Public License 2.0 @@ -18,5 +18,3 @@ bin.includes = META-INF/,\ OSGI-INF/ src.includes = about.html source.. = src/main/java/ -additional.bundles = org.eclipse.osgi,\ - org.eclipse.osgi.services diff --git a/kura/pom.xml b/kura/pom.xml index 0b99b9c2dc5..9ed01290d43 100644 --- a/kura/pom.xml +++ b/kura/pom.xml @@ -269,9 +269,9 @@ - p2-repo-equinox_3.16.0 + p2-repo-equinox p2 - file:///${kura.basedir}/target-definition/equinox_3.16.0/repository/ + file:///${kura.basedir}/target-definition/equinox/repository/ @@ -285,9 +285,9 @@ - p2-repo-equinox_3.16.0 + p2-repo-equinox p2 - file:///${kura.basedir}/target-definition/equinox_3.16.0/repository/ + file:///${kura.basedir}/target-definition/equinox/repository/ @@ -362,7 +362,6 @@ org.eclipse.kura.web2 - org.eclipse.kura.web2.ext diff --git a/kura/target-definition/kura-equinox.target b/kura/target-definition/kura-equinox.target new file mode 100644 index 00000000000..fca7f40875a --- /dev/null +++ b/kura/target-definition/kura-equinox.target @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/kura/target-definition/kura-equinox_3.16.0.target b/kura/target-definition/kura-equinox_3.16.0.target deleted file mode 100644 index 42b7e01fdcc..00000000000 --- a/kura/target-definition/kura-equinox_3.16.0.target +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/kura/target-definition/pom.xml b/kura/target-definition/pom.xml index 21f987cbd18..da6a619c076 100644 --- a/kura/target-definition/pom.xml +++ b/kura/target-definition/pom.xml @@ -40,9 +40,9 @@ - - kura.build.version=${kura.build.version} - + kura.build.version=${kura.build.version} diff --git a/kura/test/org.eclipse.kura.ai.triton.server.test/META-INF/MANIFEST.MF b/kura/test/org.eclipse.kura.ai.triton.server.test/META-INF/MANIFEST.MF index 205d3ec0a38..854d83a14f1 100644 --- a/kura/test/org.eclipse.kura.ai.triton.server.test/META-INF/MANIFEST.MF +++ b/kura/test/org.eclipse.kura.ai.triton.server.test/META-INF/MANIFEST.MF @@ -6,8 +6,7 @@ Bundle-Version: 6.0.0.qualifier Bundle-Vendor: Eclipse Kura Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))" Fragment-Host: org.eclipse.kura.ai.triton.server -Import-Package: javax.annotation;version="1.2.0", - org.apache.commons.io;version="2.4.0", +Import-Package: org.apache.commons.io;version="2.4.0", org.eclipse.kura.ai.inference;version="[1.0,2.0)", org.eclipse.kura.core.linux.executor;version="[1.0,2.0)", org.eclipse.kura.core.testutil;version="1.0.0", diff --git a/kura/test/org.eclipse.kura.container.orchestration.provider.test/META-INF/MANIFEST.MF b/kura/test/org.eclipse.kura.container.orchestration.provider.test/META-INF/MANIFEST.MF index 2e543f52314..1326f3d58d7 100644 --- a/kura/test/org.eclipse.kura.container.orchestration.provider.test/META-INF/MANIFEST.MF +++ b/kura/test/org.eclipse.kura.container.orchestration.provider.test/META-INF/MANIFEST.MF @@ -7,8 +7,7 @@ Bundle-Vendor: Eclipse Kura Fragment-Host: org.eclipse.kura.container.orchestration.provider Automatic-Module-Name: org.eclipse.kura.container.orchestration.provider.test Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))" -Import-Package: com.eclipsesource.json;version="0.9.5", - org.eclipse.kura;version="1.6.0", +Import-Package: org.eclipse.kura;version="1.6.0", org.junit;version="[4.12.0,5.0.0)", org.mockito;version="[4.0.0,5.0.0)", org.mockito.invocation;version="[4.0.0,5.0.0)", diff --git a/kura/test/org.eclipse.kura.container.provider.test/META-INF/MANIFEST.MF b/kura/test/org.eclipse.kura.container.provider.test/META-INF/MANIFEST.MF index 91c0686bade..3e3792f73d9 100644 --- a/kura/test/org.eclipse.kura.container.provider.test/META-INF/MANIFEST.MF +++ b/kura/test/org.eclipse.kura.container.provider.test/META-INF/MANIFEST.MF @@ -7,8 +7,7 @@ Bundle-Vendor: Eurotech Fragment-Host: org.eclipse.kura.container.provider Automatic-Module-Name: org.eclipse.kura.container.provider.test Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))" -Import-Package: com.eclipsesource.json;version="0.9.5", - org.eclipse.kura;version="1.6.0", +Import-Package: org.eclipse.kura;version="1.6.0", org.junit;version="[4.12.0,5.0.0)", org.mockito;version="[4.0.0,5.0.0)", org.mockito.invocation;version="[4.0.0,5.0.0)", diff --git a/kura/test/org.eclipse.kura.core.testutil/src/main/java/org/eclipse/kura/core/testutil/http/TestServer.java b/kura/test/org.eclipse.kura.core.testutil/src/main/java/org/eclipse/kura/core/testutil/http/TestServer.java index ac718e16fed..d3cd68551eb 100644 --- a/kura/test/org.eclipse.kura.core.testutil/src/main/java/org/eclipse/kura/core/testutil/http/TestServer.java +++ b/kura/test/org.eclipse.kura.core.testutil/src/main/java/org/eclipse/kura/core/testutil/http/TestServer.java @@ -20,10 +20,10 @@ import java.util.Optional; import java.util.function.Consumer; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.ServletException; +import jakarta.servlet.http.HttpServlet; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.eclipse.jetty.server.Server; import org.eclipse.jetty.server.ServerConnector; diff --git a/kura/test/org.eclipse.kura.json.marshaller.unmarshaller.provider.test/build.properties b/kura/test/org.eclipse.kura.json.marshaller.unmarshaller.provider.test/build.properties index 162c049e2d3..7112033d323 100644 --- a/kura/test/org.eclipse.kura.json.marshaller.unmarshaller.provider.test/build.properties +++ b/kura/test/org.eclipse.kura.json.marshaller.unmarshaller.provider.test/build.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 2017, 2020 Eurotech and/or its affiliates and others +# Copyright (c) 2017, 2024 Eurotech and/or its affiliates and others # # This program and the accompanying materials are made # available under the terms of the Eclipse Public License 2.0 @@ -13,6 +13,3 @@ bin.includes = .,\ META-INF/,\ about.html -additional.bundles = org.eclipse.kura.api,\ - slf4j.api - diff --git a/kura/test/org.eclipse.kura.linux.net.test/build.properties b/kura/test/org.eclipse.kura.linux.net.test/build.properties index becdbd10d10..68b2c62e09e 100644 --- a/kura/test/org.eclipse.kura.linux.net.test/build.properties +++ b/kura/test/org.eclipse.kura.linux.net.test/build.properties @@ -19,16 +19,6 @@ bin.includes = META-INF/,\ OSGI-INF/,\ about.html,\ about_files/ -additional.bundles = slf4j.api,\ - org.eclipse.kura.api,\ - org.eclipse.equinox.io,\ - org.junit,\ - org.eclipse.kura.test,\ - org.eclipse.osgi,\ - org.eclipse.osgi.services,\ - org.eclipse.osgi.util,\ - org.eclipse.kura.core,\ - org.eclipse.kura.linux.net src.includes = about.html,\ about_files/ diff --git a/kura/test/org.eclipse.kura.network.threat.manager.test/build.properties b/kura/test/org.eclipse.kura.network.threat.manager.test/build.properties index bddd23b07aa..884cc742285 100644 --- a/kura/test/org.eclipse.kura.network.threat.manager.test/build.properties +++ b/kura/test/org.eclipse.kura.network.threat.manager.test/build.properties @@ -17,15 +17,6 @@ bin.includes = META-INF/,\ .,\ about.html,\ about_files/ -additional.bundles = slf4j.api,\ - org.eclipse.kura.api,\ - org.eclipse.equinox.io,\ - org.junit,\ - org.eclipse.kura.test,\ - org.eclipse.osgi,\ - org.eclipse.osgi.services,\ - org.eclipse.osgi.util,\ - org.eclipse.kura.core src.includes = about.html,\ about_files/ diff --git a/kura/test/org.eclipse.kura.rest.asset.provider.test/src/test/java/org/eclipse/kura/internal/rest/asset/AssetRestServiceTest.java b/kura/test/org.eclipse.kura.rest.asset.provider.test/src/test/java/org/eclipse/kura/internal/rest/asset/AssetRestServiceTest.java index 6113ae0032c..dc26fa36dce 100644 --- a/kura/test/org.eclipse.kura.rest.asset.provider.test/src/test/java/org/eclipse/kura/internal/rest/asset/AssetRestServiceTest.java +++ b/kura/test/org.eclipse.kura.rest.asset.provider.test/src/test/java/org/eclipse/kura/internal/rest/asset/AssetRestServiceTest.java @@ -33,7 +33,7 @@ import java.util.Set; import java.util.TreeMap; -import javax.ws.rs.WebApplicationException; +import jakarta.ws.rs.WebApplicationException; import org.eclipse.kura.KuraException; import org.eclipse.kura.asset.Asset; diff --git a/kura/test/org.eclipse.kura.rest.cloudconnection.provider.test/META-INF/MANIFEST.MF b/kura/test/org.eclipse.kura.rest.cloudconnection.provider.test/META-INF/MANIFEST.MF index f09a7865a47..08438766a08 100644 --- a/kura/test/org.eclipse.kura.rest.cloudconnection.provider.test/META-INF/MANIFEST.MF +++ b/kura/test/org.eclipse.kura.rest.cloudconnection.provider.test/META-INF/MANIFEST.MF @@ -8,7 +8,6 @@ Bundle-License: Eclipse Public License v2.0 Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))" Bundle-ActivationPolicy: lazy Import-Package: com.google.gson;version="2.9.0", - javax.annotation;version="1.2.0", org.eclipse.kura.core.testutil.requesthandler;version="[1.1,2.0)", org.eclipse.kura.core.testutil.service;version="[1.0,2.0)", org.junit;version="[4.12.0,5.0.0)", diff --git a/kura/test/org.eclipse.kura.rest.command.provider.test/META-INF/MANIFEST.MF b/kura/test/org.eclipse.kura.rest.command.provider.test/META-INF/MANIFEST.MF index 8bfecdd4afd..75bf63ee8cd 100644 --- a/kura/test/org.eclipse.kura.rest.command.provider.test/META-INF/MANIFEST.MF +++ b/kura/test/org.eclipse.kura.rest.command.provider.test/META-INF/MANIFEST.MF @@ -7,10 +7,7 @@ Bundle-Vendor: Eclipse Kura Bundle-License: Eclipse Public License v2.0 Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))" Bundle-ActivationPolicy: lazy -Import-Package: com.eclipsesource.json;version="0.9.5", - javax.ws.rs;version="2.0.1", - javax.ws.rs.core;version="2.0.1", - org.eclipse.kura;version="1.6.0", +Import-Package: org.eclipse.kura;version="1.6.0", org.eclipse.kura.cloud.app.command;version="[1.4,2.0)", org.eclipse.kura.cloudconnection.message;version="[1.0,2.0)", org.eclipse.kura.core.util;version="1.3.0", diff --git a/kura/test/org.eclipse.kura.rest.command.provider.test/src/main/java/org/eclipse/kura/rest/command/provider/test/CommandRestServiceTest.java b/kura/test/org.eclipse.kura.rest.command.provider.test/src/main/java/org/eclipse/kura/rest/command/provider/test/CommandRestServiceTest.java index 5d64e5ecac6..68c2ae558d0 100644 --- a/kura/test/org.eclipse.kura.rest.command.provider.test/src/main/java/org/eclipse/kura/rest/command/provider/test/CommandRestServiceTest.java +++ b/kura/test/org.eclipse.kura.rest.command.provider.test/src/main/java/org/eclipse/kura/rest/command/provider/test/CommandRestServiceTest.java @@ -26,7 +26,7 @@ import java.util.List; import java.util.Map; -import javax.ws.rs.core.Response; +import jakarta.ws.rs.core.Response; import org.eclipse.kura.KuraException; import org.eclipse.kura.cloud.app.command.CommandCloudApp; diff --git a/kura/test/org.eclipse.kura.rest.identity.provider.test/META-INF/MANIFEST.MF b/kura/test/org.eclipse.kura.rest.identity.provider.test/META-INF/MANIFEST.MF index c9e6b9ccdbf..895159ba3f7 100644 --- a/kura/test/org.eclipse.kura.rest.identity.provider.test/META-INF/MANIFEST.MF +++ b/kura/test/org.eclipse.kura.rest.identity.provider.test/META-INF/MANIFEST.MF @@ -8,7 +8,6 @@ Bundle-License: Eclipse Public License v2.0 Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))" Bundle-ActivationPolicy: lazy Import-Package: com.google.gson;version="2.9.0", - javax.annotation;version="1.2.0", org.eclipse.kura.configuration.metatype;version="[1.1,2.0)", org.eclipse.kura.core.testutil.requesthandler;version="[1.1,2.0)", org.eclipse.kura.core.testutil.service;version="[1.0,2.0)", diff --git a/kura/test/org.eclipse.kura.rest.inventory.provider.test/META-INF/MANIFEST.MF b/kura/test/org.eclipse.kura.rest.inventory.provider.test/META-INF/MANIFEST.MF index f754e5d1126..fbe9eb00b6e 100644 --- a/kura/test/org.eclipse.kura.rest.inventory.provider.test/META-INF/MANIFEST.MF +++ b/kura/test/org.eclipse.kura.rest.inventory.provider.test/META-INF/MANIFEST.MF @@ -7,10 +7,7 @@ Bundle-Vendor: Eclipse Kura Bundle-License: Eclipse Public License v2.0 Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))" Bundle-ActivationPolicy: lazy -Import-Package: com.eclipsesource.json;version="0.9.5", - javax.ws.rs;version="2.0.1", - javax.ws.rs.core;version="2.0.1", - org.eclipse.kura.core.inventory;version="1.0.0", +Import-Package: org.eclipse.kura.core.inventory;version="1.0.0", org.eclipse.kura;version="1.6.0", org.eclipse.kura.core.util;version="1.3.0", org.eclipse.kura.message;version="1.4.0", diff --git a/kura/test/org.eclipse.kura.rest.network.configuration.provider.test/META-INF/MANIFEST.MF b/kura/test/org.eclipse.kura.rest.network.configuration.provider.test/META-INF/MANIFEST.MF index 60cdc627438..5618e5356f0 100644 --- a/kura/test/org.eclipse.kura.rest.network.configuration.provider.test/META-INF/MANIFEST.MF +++ b/kura/test/org.eclipse.kura.rest.network.configuration.provider.test/META-INF/MANIFEST.MF @@ -7,10 +7,7 @@ Bundle-Vendor: Eclipse Kura Bundle-License: Eclipse Public License v2.0 Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))" Bundle-ActivationPolicy: lazy -Import-Package: com.eclipsesource.json;version="0.9.5", - javax.annotation;version="1.2.0", - javax.ws.rs.core;version="2.0.1", - org.apache.commons.io;version="2.4.0", +Import-Package: org.apache.commons.io;version="2.4.0", org.eclipse.kura;version="1.6.0", org.eclipse.kura.configuration, org.eclipse.kura.configuration.metatype;version="1.1.0", diff --git a/kura/test/org.eclipse.kura.rest.packages.provider.test/META-INF/MANIFEST.MF b/kura/test/org.eclipse.kura.rest.packages.provider.test/META-INF/MANIFEST.MF index 0527d66aa8f..53b656df0df 100644 --- a/kura/test/org.eclipse.kura.rest.packages.provider.test/META-INF/MANIFEST.MF +++ b/kura/test/org.eclipse.kura.rest.packages.provider.test/META-INF/MANIFEST.MF @@ -8,8 +8,8 @@ Bundle-License: Eclipse Public License v2.0 Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))" Bundle-ActivationPolicy: lazy Fragment-Host: org.eclipse.kura.rest.packages.provider -Import-Package: com.eclipsesource.json;version="0.9.5", - javax.ws.rs.client;version="2.0.1", +Import-Package: jakarta.annotation;version="2.1.1", + jakarta.ws.rs.client;version="3.1.0", org.apache.commons.io;version="2.4.0", org.eclipse.kura;version="1.6.0", org.eclipse.kura.core.testutil.json;version="1.0.0", @@ -19,14 +19,15 @@ Import-Package: com.eclipsesource.json;version="0.9.5", org.eclipse.kura.data.transport.listener;version="1.0.1", org.eclipse.kura.marshalling;version="1.0.0", org.eclipse.kura.message;version="1.4.0", - org.glassfish.jersey.client.authentication;version="2.22.2", - org.glassfish.jersey.media.multipart.file;version="2.22.2", - org.junit;version="[4.12.0,5.0.0)", - org.junit.runner;version="[4.12.0,5.0.0)", - org.junit.runners;version="[4.12.0,5.0.0)", - org.mockito;version="[4.0.0,5.0.0)", - org.mockito.invocation;version="[4.0.0,5.0.0)", - org.mockito.stubbing;version="[4.0.0,5.0.0)", + org.glassfish.jersey.client.authentication;version="3.1.9", + org.glassfish.jersey.media.multipart;version="3.1.9", + org.glassfish.jersey.media.multipart.file;version="3.1.9", + org.junit;version="4.12.0", + org.junit.runner;version="4.12.0", + org.junit.runners;version="4.12.0", + org.mockito;version="4.0.0", + org.mockito.invocation;version="4.0.0", + org.mockito.stubbing;version="4.0.0", org.osgi.framework;version="1.10.0", org.osgi.service.cm;version="1.6.0", org.osgi.service.deploymentadmin;version="1.0.0", diff --git a/kura/test/org.eclipse.kura.rest.packages.provider.test/pom.xml b/kura/test/org.eclipse.kura.rest.packages.provider.test/pom.xml index bbe45e900c9..d0222256146 100644 --- a/kura/test/org.eclipse.kura.rest.packages.provider.test/pom.xml +++ b/kura/test/org.eclipse.kura.rest.packages.provider.test/pom.xml @@ -443,31 +443,6 @@ 4 true - - com.eclipsesource.jaxrs.jersey-min - 4 - true - - - com.eclipsesource.jaxrs.provider.gson - 4 - true - - - com.eclipsesource.jaxrs.provider.multipart - 4 - true - - - com.eclipsesource.jaxrs.provider.security - 4 - true - - - com.eclipsesource.jaxrs.publisher - 4 - true - org.apache.felix.useradmin 4 @@ -538,11 +513,6 @@ org.apache.logging.log4j.slf4j.impl 0.0.0 - - p2-installable-unit - com.eclipsesource.jaxrs.jersey-min - 0.0.0 - p2-installable-unit jakarta.xml.bind-api @@ -663,31 +633,6 @@ org.eclipse.equinox.http.jetty 0.0.0 - - eclipse-plugin - com.eclipsesource.jaxrs.jersey-min - 0.0.0 - - - eclipse-plugin - com.eclipsesource.jaxrs.provider.gson - 0.0.0 - - - eclipse-plugin - com.eclipsesource.jaxrs.provider.multipart - 0.0.0 - - - eclipse-plugin - com.eclipsesource.jaxrs.provider.security - 0.0.0 - - - eclipse-plugin - com.eclipsesource.jaxrs.publisher - 0.0.0 - eclipse-plugin org.eclipse.kura.rest.provider diff --git a/kura/test/org.eclipse.kura.rest.packages.provider.test/src/main/java/org/eclipse/kura/rest/packages/provider/test/PackagesRestServiceTest.java b/kura/test/org.eclipse.kura.rest.packages.provider.test/src/main/java/org/eclipse/kura/rest/packages/provider/test/PackagesRestServiceTest.java index 17fe1d358bd..e59d2c96b34 100644 --- a/kura/test/org.eclipse.kura.rest.packages.provider.test/src/main/java/org/eclipse/kura/rest/packages/provider/test/PackagesRestServiceTest.java +++ b/kura/test/org.eclipse.kura.rest.packages.provider.test/src/main/java/org/eclipse/kura/rest/packages/provider/test/PackagesRestServiceTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2023 Eurotech and/or its affiliates and others + * Copyright (c) 2024 Eurotech and/or its affiliates and others * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -38,12 +38,6 @@ import java.util.Hashtable; import java.util.Objects; -import javax.ws.rs.client.Client; -import javax.ws.rs.client.ClientBuilder; -import javax.ws.rs.client.Entity; -import javax.ws.rs.client.WebTarget; -import javax.ws.rs.core.Response; - import org.eclipse.kura.core.testutil.requesthandler.AbstractRequestHandlerTest; import org.eclipse.kura.core.testutil.requesthandler.RestTransport; import org.eclipse.kura.core.testutil.requesthandler.Transport; @@ -69,6 +63,12 @@ import org.osgi.service.deploymentadmin.DeploymentAdmin; import org.osgi.service.deploymentadmin.DeploymentPackage; +import jakarta.ws.rs.client.Client; +import jakarta.ws.rs.client.ClientBuilder; +import jakarta.ws.rs.client.Entity; +import jakarta.ws.rs.client.WebTarget; +import jakarta.ws.rs.core.Response; + @RunWith(Parameterized.class) public class PackagesRestServiceTest extends AbstractRequestHandlerTest { @@ -323,7 +323,8 @@ private void givenDeploymentAgentServiceThrowsExceptionOnInstall() throws Except doThrow(new RuntimeException()).when(deploymentAgentService).installDeploymentPackageAsync(anyString()); } - private void givenDeploymentAgentServiceReturnsMarketplacePackageDescriptor(MarketplacePackageDescriptor descriptor) { + private void givenDeploymentAgentServiceReturnsMarketplacePackageDescriptor( + MarketplacePackageDescriptor descriptor) { when(deploymentAgentService.getMarketplacePackageDescriptor(anyString())).thenReturn(descriptor); } diff --git a/kura/test/org.eclipse.kura.rest.packages.provider.test/src/test/java/org/eclipse/kura/internal/rest/deployment/agent/test/DeploymentRestServiceUnitTest.java b/kura/test/org.eclipse.kura.rest.packages.provider.test/src/test/java/org/eclipse/kura/internal/rest/deployment/agent/test/DeploymentRestServiceUnitTest.java index 75e4ba24e71..99f7a94179b 100644 --- a/kura/test/org.eclipse.kura.rest.packages.provider.test/src/test/java/org/eclipse/kura/internal/rest/deployment/agent/test/DeploymentRestServiceUnitTest.java +++ b/kura/test/org.eclipse.kura.rest.packages.provider.test/src/test/java/org/eclipse/kura/internal/rest/deployment/agent/test/DeploymentRestServiceUnitTest.java @@ -36,7 +36,7 @@ import java.util.List; import java.util.Objects; -import javax.ws.rs.WebApplicationException; +import jakarta.ws.rs.WebApplicationException; import org.eclipse.kura.KuraErrorCode; import org.eclipse.kura.KuraException; diff --git a/kura/test/org.eclipse.kura.rest.position.provider.test/META-INF/MANIFEST.MF b/kura/test/org.eclipse.kura.rest.position.provider.test/META-INF/MANIFEST.MF index a342da9f39a..05fb992977d 100644 --- a/kura/test/org.eclipse.kura.rest.position.provider.test/META-INF/MANIFEST.MF +++ b/kura/test/org.eclipse.kura.rest.position.provider.test/META-INF/MANIFEST.MF @@ -7,10 +7,7 @@ Bundle-Vendor: Eclipse Kura Bundle-License: Eclipse Public License v2.0 Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))" Bundle-ActivationPolicy: lazy -Import-Package: com.eclipsesource.json;version="0.9.5", - javax.ws.rs;version="2.0.1", - javax.ws.rs.core;version="2.0.1", - org.eclipse.kura.core.inventory;version="1.0.0", +Import-Package: org.eclipse.kura.core.inventory;version="1.0.0", org.eclipse.kura;version="1.6.0", org.eclipse.kura.core.util;version="1.3.0", org.eclipse.kura.message;version="1.4.0", diff --git a/kura/test/org.eclipse.kura.rest.position.provider.test/src/main/java/org/eclipse/kura/rest/position/provider/test/PositionRestServiceTest.java b/kura/test/org.eclipse.kura.rest.position.provider.test/src/main/java/org/eclipse/kura/rest/position/provider/test/PositionRestServiceTest.java index d03b8d2720c..0f6fb2cc2f0 100644 --- a/kura/test/org.eclipse.kura.rest.position.provider.test/src/main/java/org/eclipse/kura/rest/position/provider/test/PositionRestServiceTest.java +++ b/kura/test/org.eclipse.kura.rest.position.provider.test/src/main/java/org/eclipse/kura/rest/position/provider/test/PositionRestServiceTest.java @@ -22,7 +22,7 @@ import java.util.HashSet; import java.util.Set; -import javax.ws.rs.WebApplicationException; +import jakarta.ws.rs.WebApplicationException; import org.eclipse.kura.internal.rest.position.PositionRestService; import org.eclipse.kura.position.GNSSType; diff --git a/kura/test/org.eclipse.kura.rest.provider.test/META-INF/MANIFEST.MF b/kura/test/org.eclipse.kura.rest.provider.test/META-INF/MANIFEST.MF index e4280e19957..e35f8ab9ec1 100644 --- a/kura/test/org.eclipse.kura.rest.provider.test/META-INF/MANIFEST.MF +++ b/kura/test/org.eclipse.kura.rest.provider.test/META-INF/MANIFEST.MF @@ -8,12 +8,12 @@ Bundle-License: Eclipse Public License v2.0 Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))" Bundle-ActivationPolicy: lazy Import-Package: com.eclipsesource.json;version="0.9.5", - javax.annotation;version="1.2.0", - javax.annotation.security;version="1.2.0", - javax.servlet.http;version="3.1.0", - javax.ws.rs;version="2.0.1", - javax.ws.rs.container;version="2.0.1", - javax.ws.rs.ext;version="2.0.1", + jakarta.annotation;version="2.1.1", + jakarta.annotation.security;version="2.1.1", + jakarta.servlet;version="5.0.0", + jakarta.servlet.http;version="5.0.0", + jakarta.ws.rs;version="3.1.0", + jakarta.ws.rs.container;version="3.1.0", org.apache.commons.io;version="2.4.0", org.bouncycastle.asn1.x500;version="1.78.1", org.eclipse.kura;version="1.6.0", diff --git a/kura/test/org.eclipse.kura.rest.provider.test/src/main/java/org/eclipse/kura/rest/provider/test/RestServiceTest.java b/kura/test/org.eclipse.kura.rest.provider.test/src/main/java/org/eclipse/kura/rest/provider/test/RestServiceTest.java index 2cedb2eb76a..12bd04b6fb0 100644 --- a/kura/test/org.eclipse.kura.rest.provider.test/src/main/java/org/eclipse/kura/rest/provider/test/RestServiceTest.java +++ b/kura/test/org.eclipse.kura.rest.provider.test/src/main/java/org/eclipse/kura/rest/provider/test/RestServiceTest.java @@ -42,16 +42,10 @@ import java.util.concurrent.CompletableFuture; import java.util.concurrent.TimeUnit; -import javax.annotation.Priority; -import javax.annotation.security.RolesAllowed; import javax.net.ssl.KeyManager; import javax.net.ssl.KeyManagerFactory; import javax.net.ssl.SSLContext; import javax.net.ssl.TrustManagerFactory; -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.GET; -import javax.ws.rs.Path; -import javax.ws.rs.container.ContainerRequestContext; import org.bouncycastle.asn1.x500.X500Name; import org.eclipse.kura.configuration.ConfigurationService; @@ -80,6 +74,13 @@ import com.eclipsesource.json.Json; import com.eclipsesource.json.JsonObject; +import jakarta.annotation.Priority; +import jakarta.annotation.security.RolesAllowed; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.container.ContainerRequestContext; + public class RestServiceTest extends AbstractRequestHandlerTest { public RestServiceTest() { diff --git a/kura/test/org.eclipse.kura.rest.security.provider.test/META-INF/MANIFEST.MF b/kura/test/org.eclipse.kura.rest.security.provider.test/META-INF/MANIFEST.MF index b68abe5e13e..1d0c2cec4b4 100644 --- a/kura/test/org.eclipse.kura.rest.security.provider.test/META-INF/MANIFEST.MF +++ b/kura/test/org.eclipse.kura.rest.security.provider.test/META-INF/MANIFEST.MF @@ -7,8 +7,7 @@ Bundle-Vendor: Eclipse Kura Bundle-License: Eclipse Public License v2.0 Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))" Bundle-ActivationPolicy: lazy -Import-Package: javax.annotation;version="1.2.0", - org.eclipse.kura.core.testutil.requesthandler;version="[1.1,2.0)", +Import-Package: org.eclipse.kura.core.testutil.requesthandler;version="[1.1,2.0)", org.eclipse.kura.core.testutil.service;version="[1.0,2.0)", org.eclipse.kura.crypto;version="[1.3,2.0)", org.eclipse.kura.util.wire.test;version="[1.1,2.0)", diff --git a/kura/test/org.eclipse.kura.rest.security.provider.test/src/main/java/org/eclipse/kura/internal/rest/security/provider/test/SecurityEndpointsV1Test.java b/kura/test/org.eclipse.kura.rest.security.provider.test/src/main/java/org/eclipse/kura/internal/rest/security/provider/test/SecurityEndpointsV1Test.java index 67d9dbd675d..551a87b3e6e 100644 --- a/kura/test/org.eclipse.kura.rest.security.provider.test/src/main/java/org/eclipse/kura/internal/rest/security/provider/test/SecurityEndpointsV1Test.java +++ b/kura/test/org.eclipse.kura.rest.security.provider.test/src/main/java/org/eclipse/kura/internal/rest/security/provider/test/SecurityEndpointsV1Test.java @@ -37,7 +37,7 @@ import org.osgi.service.useradmin.User; import org.osgi.service.useradmin.UserAdmin; -import javax.ws.rs.core.Response.Status; +import jakarta.ws.rs.core.Response.Status; import java.util.Arrays; import java.util.Collection; import java.util.Collections; diff --git a/kura/test/org.eclipse.kura.rest.security.provider.test/src/main/java/org/eclipse/kura/internal/rest/security/provider/test/SecurityEndpointsV2Test.java b/kura/test/org.eclipse.kura.rest.security.provider.test/src/main/java/org/eclipse/kura/internal/rest/security/provider/test/SecurityEndpointsV2Test.java index bfb5d65a910..cbb9eb22933 100644 --- a/kura/test/org.eclipse.kura.rest.security.provider.test/src/main/java/org/eclipse/kura/internal/rest/security/provider/test/SecurityEndpointsV2Test.java +++ b/kura/test/org.eclipse.kura.rest.security.provider.test/src/main/java/org/eclipse/kura/internal/rest/security/provider/test/SecurityEndpointsV2Test.java @@ -31,7 +31,7 @@ import org.osgi.service.cm.Configuration; import org.osgi.service.cm.ConfigurationAdmin; -import javax.ws.rs.core.Response.Status; +import jakarta.ws.rs.core.Response.Status; import java.io.IOException; import java.util.Arrays; import java.util.Collection; diff --git a/kura/test/org.eclipse.kura.rest.service.listing.provider.test/META-INF/MANIFEST.MF b/kura/test/org.eclipse.kura.rest.service.listing.provider.test/META-INF/MANIFEST.MF index 1ffd228d7fd..34dac4a3b47 100644 --- a/kura/test/org.eclipse.kura.rest.service.listing.provider.test/META-INF/MANIFEST.MF +++ b/kura/test/org.eclipse.kura.rest.service.listing.provider.test/META-INF/MANIFEST.MF @@ -8,8 +8,7 @@ Bundle-License: Eclipse Public License v2.0 Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))" Bundle-ActivationPolicy: lazy Import-Package: com.eclipsesource.json;version="0.9.5", - javax.annotation;version="1.2.0", - javax.ws.rs.core;version="2.0.1", + jakarta.ws.rs.core;version="3.1.0", org.eclipse.kura.core.testutil.requesthandler;version="[1.1,2.0)", org.eclipse.kura.core.testutil.service;version="[1.0,2.0)", org.eclipse.kura.crypto;version="[1.3,2.0)", diff --git a/kura/test/org.eclipse.kura.rest.service.listing.provider.test/src/main/java/org/eclipse/kura/internal/rest/service/listing/provider/test/ServiceListingEndpointsTest.java b/kura/test/org.eclipse.kura.rest.service.listing.provider.test/src/main/java/org/eclipse/kura/internal/rest/service/listing/provider/test/ServiceListingEndpointsTest.java index 05408305860..f33ddf28827 100644 --- a/kura/test/org.eclipse.kura.rest.service.listing.provider.test/src/main/java/org/eclipse/kura/internal/rest/service/listing/provider/test/ServiceListingEndpointsTest.java +++ b/kura/test/org.eclipse.kura.rest.service.listing.provider.test/src/main/java/org/eclipse/kura/internal/rest/service/listing/provider/test/ServiceListingEndpointsTest.java @@ -28,7 +28,7 @@ import java.util.Optional; import java.util.concurrent.TimeUnit; -import javax.ws.rs.core.Response.Status; +import jakarta.ws.rs.core.Response.Status; import org.eclipse.kura.core.testutil.requesthandler.AbstractRequestHandlerTest; import org.eclipse.kura.core.testutil.requesthandler.MqttTransport; diff --git a/kura/test/org.eclipse.kura.rest.system.provider.test/META-INF/MANIFEST.MF b/kura/test/org.eclipse.kura.rest.system.provider.test/META-INF/MANIFEST.MF index 722237b3bb6..5eafb985627 100644 --- a/kura/test/org.eclipse.kura.rest.system.provider.test/META-INF/MANIFEST.MF +++ b/kura/test/org.eclipse.kura.rest.system.provider.test/META-INF/MANIFEST.MF @@ -7,8 +7,7 @@ Bundle-Vendor: Eclipse Kura Bundle-License: Eclipse Public License v2.0 Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))" Bundle-ActivationPolicy: lazy -Import-Package: javax.annotation;version="1.2.0", - org.eclipse.kura.core.testutil.requesthandler;version="1.1.0", +Import-Package: org.eclipse.kura.core.testutil.requesthandler;version="1.1.0", org.eclipse.kura.util.wire.test;version="1.1.0", org.junit;version="[4.12.0,5.0.0)", org.junit.runner;version="[4.12.0,5.0.0)", diff --git a/kura/test/org.eclipse.kura.rest.system.provider.test/src/main/java/org/eclipse/kura/rest/system/provider/test/EndpointsTest.java b/kura/test/org.eclipse.kura.rest.system.provider.test/src/main/java/org/eclipse/kura/rest/system/provider/test/EndpointsTest.java index 308fe3442c4..1ae188fd784 100644 --- a/kura/test/org.eclipse.kura.rest.system.provider.test/src/main/java/org/eclipse/kura/rest/system/provider/test/EndpointsTest.java +++ b/kura/test/org.eclipse.kura.rest.system.provider.test/src/main/java/org/eclipse/kura/rest/system/provider/test/EndpointsTest.java @@ -31,7 +31,7 @@ import java.util.Scanner; import java.util.concurrent.TimeUnit; -import javax.ws.rs.core.Response.Status; +import jakarta.ws.rs.core.Response.Status; import org.eclipse.kura.core.testutil.requesthandler.AbstractRequestHandlerTest; import org.eclipse.kura.core.testutil.requesthandler.MqttTransport; diff --git a/kura/test/org.eclipse.kura.test/build.properties b/kura/test/org.eclipse.kura.test/build.properties index 42d8e6c10b8..e8c726e9ec6 100644 --- a/kura/test/org.eclipse.kura.test/build.properties +++ b/kura/test/org.eclipse.kura.test/build.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2023 Eurotech and/or its affiliates and others +# Copyright (c) 2011, 2024 Eurotech and/or its affiliates and others # # This program and the accompanying materials are made # available under the terms of the Eclipse Public License 2.0 @@ -18,12 +18,5 @@ bin.includes = META-INF/,\ OSGI-INF/,\ about.html,\ about_files/ -additional.bundles = org.eclipse.osgi,\ - org.eclipse.equinox.ds,\ - org.eclipse.osgi.services,\ - org.eclipse.kura.api,\ - org.eclipse.equinox.cm,\ - slf4j.api src.includes = about.html,\ about_files/ - diff --git a/kura/test/org.eclipse.kura.wire.ai.component.provider.test/META-INF/MANIFEST.MF b/kura/test/org.eclipse.kura.wire.ai.component.provider.test/META-INF/MANIFEST.MF index 0fe9c9d9d26..958b15cdc32 100644 --- a/kura/test/org.eclipse.kura.wire.ai.component.provider.test/META-INF/MANIFEST.MF +++ b/kura/test/org.eclipse.kura.wire.ai.component.provider.test/META-INF/MANIFEST.MF @@ -8,8 +8,7 @@ Bundle-License: Eclipse Public License v2.0 Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))" Bundle-ActivationPolicy: lazy Fragment-Host: org.eclipse.kura.wire.ai.component.provider -Import-Package: com.eclipsesource.json;version="0.9.5", - org.apache.commons.io;version="2.4.0", +Import-Package: org.apache.commons.io;version="2.4.0", org.junit;version="[4.12.0,5.0.0)", org.junit.runner;version="[4.12.0,5.0.0)", org.junit.runners;version="[4.12.0,5.0.0)", diff --git a/kura/test/org.eclipse.kura.wire.script.filter.provider.test/pom.xml b/kura/test/org.eclipse.kura.wire.script.filter.provider.test/pom.xml index 3bbf70236fa..fc7c3707b0f 100644 --- a/kura/test/org.eclipse.kura.wire.script.filter.provider.test/pom.xml +++ b/kura/test/org.eclipse.kura.wire.script.filter.provider.test/pom.xml @@ -88,11 +88,6 @@ org.apache.logging.log4j.slf4j.impl 0.0.0 - - p2-installable-unit - com.eclipsesource.jaxrs.jersey-min - 0.0.0 - p2-installable-unit jakarta.xml.bind-api @@ -233,26 +228,6 @@ org.eclipse.equinox.http.jetty 0.0.0 - - eclipse-plugin - com.eclipsesource.jaxrs.jersey-min - 0.0.0 - - - eclipse-plugin - com.eclipsesource.jaxrs.provider.gson - 0.0.0 - - - eclipse-plugin - com.eclipsesource.jaxrs.provider.security - 0.0.0 - - - eclipse-plugin - com.eclipsesource.jaxrs.publisher - 0.0.0 - eclipse-plugin org.eclipse.kura.rest.provider @@ -715,26 +690,6 @@ 4 true - - com.eclipsesource.jaxrs.jersey-min - 4 - true - - - com.eclipsesource.jaxrs.provider.gson - 4 - true - - - com.eclipsesource.jaxrs.provider.security - 4 - true - - - com.eclipsesource.jaxrs.publisher - 4 - true - org.apache.felix.useradmin 4 diff --git a/kura/test/pom.xml b/kura/test/pom.xml index 4ce04925c01..f3e53173f50 100644 --- a/kura/test/pom.xml +++ b/kura/test/pom.xml @@ -560,27 +560,7 @@ org.eclipse.kura.http.server.manager 4 true - - - com.eclipsesource.jaxrs.jersey-min - 4 - true - - - com.eclipsesource.jaxrs.provider.gson - 4 - true - - - com.eclipsesource.jaxrs.provider.security - 4 - true - - - com.eclipsesource.jaxrs.publisher - 4 - true - + > org.apache.felix.useradmin 4 @@ -658,11 +638,6 @@ org.apache.logging.log4j.slf4j.impl 0.0.0 - - p2-installable-unit - com.eclipsesource.jaxrs.jersey-min - 0.0.0 - p2-installable-unit jakarta.xml.bind-api @@ -808,26 +783,6 @@ org.eclipse.equinox.http.jetty 0.0.0 - - eclipse-plugin - com.eclipsesource.jaxrs.jersey-min - 0.0.0 - - - eclipse-plugin - com.eclipsesource.jaxrs.provider.gson - 0.0.0 - - - eclipse-plugin - com.eclipsesource.jaxrs.provider.security - 0.0.0 - - - eclipse-plugin - com.eclipsesource.jaxrs.publisher - 0.0.0 - eclipse-plugin org.eclipse.kura.rest.provider diff --git a/kura/tools/archetype/example/src/main/resources/archetype-resources/__rootArtifactId__/build.properties b/kura/tools/archetype/example/src/main/resources/archetype-resources/__rootArtifactId__/build.properties index bb7678e3207..8d850e36e20 100644 --- a/kura/tools/archetype/example/src/main/resources/archetype-resources/__rootArtifactId__/build.properties +++ b/kura/tools/archetype/example/src/main/resources/archetype-resources/__rootArtifactId__/build.properties @@ -22,7 +22,6 @@ bin.includes = META-INF/,${symbol_escape} about.html,${symbol_escape} about_files/ additional.bundles = org.eclipse.osgi,${symbol_escape} - org.eclipse.osgi.services,${symbol_escape} org.eclipse.osgi.util,${symbol_escape} slf4j.api src.includes = about.html,${symbol_escape} diff --git a/target-platform/com.gwt.user/pom.xml b/target-platform/com.gwt.user/pom.xml index 324ca89a27f..de70c5cac84 100644 --- a/target-platform/com.gwt.user/pom.xml +++ b/target-platform/com.gwt.user/pom.xml @@ -1,97 +1,77 @@ - - 4.0.0 + + + 4.0.0 - com.gwt.user - 2.0.0-SNAPSHOT + + org.eclipse.kura + target-platform + 6.0.0-SNAPSHOT + .. + - bundle + com.gwt.user + 2.0.0-SNAPSHOT - gwt-user - GWT User Library + bundle - - - org.gwtproject - gwt-user - 2.10.0 - - - org.gwtbootstrap3 - gwtbootstrap3 - 1.0.1 - - + gwt-user + GWT User Library - - - - org.apache.maven.plugins - maven-checkstyle-plugin - ${maven-checkstyle-plugin.version} - - true - - - - org.apache.felix - maven-bundle-plugin - ${maven-bundle-plugin.version} - true - - META-INF - - * - ${project.artifactId} - ${project.name} - ${project.version} - - !com.gargoylesoftware.*, !com.google.gson, - !com.google.debugging.*, - !com.google.gwt.core.ext.*, - !com.google.gwt.core.linker.*, - !com.google.gwt.dev.*, - !com.google.gwt.lang.*, - !com.google.gwt.util.regexfilter, - !com.google.gwt.thirdparty.*, - !com.google.gwt.util.tools.shared, - !com.google.gwt.util.tools, - !com.ibm.icu.*, !com.thoughtworks.*, - !org.apache.tapestry.*, - !org.eclipse.jetty.*, !org.hibernate.*, - !org.kohsuke.*, - !org.objectweb.*, !javax.validation.*, - !jsinterop.annotations.*, - !net.sourceforge.htmlunit.corejs.javascript, - !junit.framework, - !org.w3c.css.sac, - !javax.jdo.annotations.*, - !javax.persistence.*, - javax.servlet.http; version="2.6.0", - javax.servlet;version="2.6.0", - * - - - !com.google.gwt.user.client.ui.doc-files, - !com.google.gwt.user.tools.templates._eclipse-test, - !com.google.gwt.user.tools.templates._sample-test._testFolder_._moduleFolder_, - !com.google.gwt.user.tools.templates._sample-test._testFolder_._moduleFolder_.client, - !com.google.gwt.user.tools.templates.sample._warFolder_.WEB-INF - - <_exportcontents>com.google.*, org.gwtbootstrap3.*, javax.validation.* - - osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))" - - - - - - + + + org.gwtproject + gwt-servlet-jakarta + 2.12.1 + + + + + + + org.apache.maven.plugins + maven-checkstyle-plugin + ${maven-checkstyle-plugin.version} + + true + + + + org.apache.felix + maven-bundle-plugin + ${maven-bundle-plugin.version} + true + + META-INF + + *;inline=true + ${project.artifactId} + ${project.name} + ${project.version} + + jakarta.servlet,jakarta.servlet.http + + + com.google.gwt.user.server.*,com.google.gwt.user.client.rpc.*, + com.google.gwt.i18n.client.*,com.google.gwt.safehtml.shared.*, + com.google.gwt.i18n.shared.* + + osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))" + + + + + diff --git a/target-platform/config/kura.target-platform.build.properties b/target-platform/config/kura.target-platform.build.properties index d4579e13b6b..4652378808a 100644 --- a/target-platform/config/kura.target-platform.build.properties +++ b/target-platform/config/kura.target-platform.build.properties @@ -32,11 +32,10 @@ org.tigris.mtoolkit.iagent.rpc.version=3.0.0.20110411-0918 org.hamcrest.version=1.1.0.v20090501071000 org.hamcrest.core.version=1.3.0.v201303031735 org.hamcrest.integration.version=1.1.0.v201303031500 -com.eclipsesource.minimal-json.version=0.9.5 org.junit.version=4.12.0.v201504281640 -commons-fileupload.version=1.5 -org.apache.commons.commons-fileupload.version=1.5.0 -org.apache.commons.commons-io.version=2.11.0 +commons-fileupload.version=2.0.0-M2 +org.apache.commons.commons-fileupload.version=2.0.0.M2 +org.apache.commons.commons-io.version=2.18.0 commons-exec.version=1.3 org.apache.commons.exec.version=1.3.0 commons-csv.version=1.4 @@ -53,15 +52,6 @@ mockito-core.version=4.8.1 byte-buddy.version=1.12.18 objenesis.version=3.3 osgi.annotation.version=8.1.0 -com.eclipsesource.jaxrs.jersey-min.version=2.22.2 -com.eclipsesource.jaxrs.publisher.version=5.3.1 -com.eclipsesource.jaxrs.publisher.jar.version=5.3.1.201602281253 -com.eclipsesource.jaxrs.provider.gson.version=2.3 -com.eclipsesource.jaxrs.provider.gson.jar.version=2.3.0.201506221200 -com.eclipsesource.jaxrs.provider.security.version=2.2 -com.eclipsesource.jaxrs.provider.security.jar.version=2.2.0.201506221200 -com.eclipsesource.jaxrs.provider.multipart.version=2.2 -com.eclipsesource.jaxrs.provider.multipart.jar.version=2.2.0.201506221200 com.google.gson.version=2.9.0 bluez-dbus-osgi.version=0.1.4 @@ -77,9 +67,13 @@ org.jboss.logging.version=3.3.2.Final spring.version=4.3.20.RELEASE_1 jakarta.activation-api.version=1.2.2 +jakarta.annotation-api.version=2.1.1 +jakarta.inject-api.version=2.0.1 + jakarta.xml.bind-api.version=2.3.3 jakarta.xml.ws-api.version=2.3.3 jakarta.xml.soap-api.version=1.4.2 +jakarta.ws.rs-api.version=3.1.0 jaxb-osgi.version=2.3.3 osgi-resource-locator.version=1.0.3 @@ -93,47 +87,54 @@ org.apache.servicemix.bundles.c3p0.version=0.9.5.5_1 hikaricp.version=2.7.9 quartz.version=2.3.2 -#target platform equinox versions -javax.servlet.version=3.1.0.v201410161800 org.apache.felix.dependencymanager.version=3.0.0 org.apache.felix.deploymentadmin.version=0.9.5 -org.apache.felix.gogo.command.version=1.0.2.v20170914-1324 -org.apache.felix.gogo.runtime.version=1.1.0.v20180713-1646 -org.apache.felix.gogo.shell.version=1.1.0.v20180713-1646 -org.apache.felix.scr.version=2.1.16.v20200110-1820 -org.eclipse.core.contenttype.version=3.7.800.v20200724-0804 -org.eclipse.core.jobs.version=3.10.800.v20200421-0950 -org.eclipse.core.runtime.version=3.19.0.v20200724-1004 -org.eclipse.equinox.app.version=1.5.0.v20200717-0620 -org.eclipse.equinox.cm.version=1.4.400.v20200422-1833 -org.eclipse.equinox.common.version=3.13.0.v20200828-1034 -org.eclipse.equinox.console.version=1.4.200.v20200828-1034 +org.apache.felix.gogo.command.version=1.1.2 +org.apache.felix.http.jetty.version=5.1.26 +org.apache.felix.http.servlet-api.version=3.0.0 +org.apache.felix.gogo.runtime.version=1.1.6 +org.apache.felix.gogo.shell.version=1.1.4 +org.apache.felix.scr.version=2.2.12 + +org.eclipse.core.contenttype.version=3.9.500.v20240708-0707 +org.eclipse.core.jobs.version=3.15.400.v20240619-0602 +org.eclipse.core.runtime.version=3.31.100.v20240524-2010 + +org.eclipse.equinox.app.version=1.7.200.v20240722-2103 +org.eclipse.equinox.cm.version=1.6.100.v20240329-0940 +org.eclipse.equinox.common.version=3.19.100.v20240524-2011 +org.eclipse.equinox.console.version=1.4.800.v20240513-1104 org.eclipse.equinox.ds.version=1.6.200.v20200422-1833 -org.eclipse.equinox.event.version=1.5.500.v20200616-0800 -org.eclipse.equinox.http.jetty.version=3.7.400.v20200123-1333 -org.eclipse.equinox.http.registry.version=1.2.0.v20200614-1851 -org.eclipse.equinox.http.servlet.version=1.6.600.v20200707-1543 -org.eclipse.equinox.io.version=1.1.100 -org.eclipse.equinox.launcher.version=1.5.800.v20200727-1323 -org.eclipse.equinox.metatype.version=1.5.300.v20200422-1833 -org.eclipse.equinox.preferences.version=3.8.0.v20200422-1833 -org.eclipse.equinox.registry.version=3.9.0.v20200625-1425 +org.eclipse.equinox.event.version=1.7.100.v20240321-1445 +org.eclipse.equinox.http.jetty.version=3.9.200.v20240321-1445 +org.eclipse.equinox.http.registry.version=1.4.100.v20240321-1445 +org.eclipse.equinox.http.servlet.version=1.8.200.v20240321-1445 +org.eclipse.equinox.io.version=1.1.300 +org.eclipse.equinox.launcher.version=1.6.900.v20240613-2009 +org.eclipse.equinox.metatype.version=1.6.600.v20240513-1104 +org.eclipse.equinox.preferences.version=3.11.100.v20240327-0645 +org.eclipse.equinox.registry.version=3.12.100.v20240524-2011 org.eclipse.equinox.util.version=1.1.300 org.eclipse.equinox.wireadmin.version=1.0.800 -org.eclipse.jetty.continuation.version=9.4.56.v20240826 -org.eclipse.jetty.http.version=9.4.56.v20240826 -org.eclipse.jetty.io.version=9.4.56.v20240826 -org.eclipse.jetty.security.version=9.4.56.v20240826 -org.eclipse.jetty.server.version=9.4.56.v20240826 -org.eclipse.jetty.servlet.version=9.4.56.v20240826 -org.eclipse.jetty.util.version=9.4.56.v20240826 -org.eclipse.jetty.util.ajax.version=9.4.56.v20240826 -org.eclipse.osgi.services.version=3.9.0.v20200511-1725 -org.eclipse.osgi.util.version=3.5.300.v20190708-1141 -org.eclipse.osgi.version=3.16.0.v20200828-0759 -org.knowhowlab.osgi.monitoradmin.version=1.0.2 + +org.eclipse.jetty.version=12.0.14 + +org.eclipse.osgi.util.version=3.7.300.v20231104-1118 +org.eclipse.osgi.version=3.21.0.v20240717-2103 + +org.eclipse.osgi-technology.rest.version=1.2.3 + +org.osgi.service.http.whiteboard.version=1.1.1 +org.osgi.service.jakartars.version=2.0.0 +org.osgi.service.servlet.version=2.0.0 +org.knowhowlab.osgi.monitoradmin.version=1.0.3 org.apache.felix.useradmin.version=1.0.4.k1 +com.fasterxml.jackson.version=2.18.2 +org.glassfish.jersey.version=3.1.9 + +com.eclipsesource.minimal-json.version=0.9.5 #test dependencies versions moquette-broker.version=1.0.0-SNAPSHOT log4j2-api-config.version=2.0.0-SNAPSHOT +org.jvnet.mimepull.version=1.10.0 diff --git a/target-platform/org.eclipse.kura.jetty.customizer/pom.xml b/target-platform/org.eclipse.kura.jetty.customizer/pom.xml index 912b245287e..5a47ecf310b 100644 --- a/target-platform/org.eclipse.kura.jetty.customizer/pom.xml +++ b/target-platform/org.eclipse.kura.jetty.customizer/pom.xml @@ -12,7 +12,8 @@ Red Hat Inc Eurotech --> - 4.0.0 @@ -27,24 +28,24 @@ bundle - ${project.basedir}/kura/../test/*/target/site/jacoco-aggregate/jacoco.xml + ${project.basedir}/kura/../test/*/target/site/jacoco-aggregate/jacoco.xml - org.eclipse.platform - org.eclipse.equinox.http.jetty - 3.7.400 + org.apache.felix + org.apache.felix.http.servlet-api + 3.0.0 - org.eclipse.jetty - jetty-server - 9.4.56.v20240826 + org.apache.felix + org.apache.felix.http.jetty + 5.1.26 - org.eclipse.jetty - jetty-servlet - 9.4.56.v20240826 + org.eclipse.platform + org.eclipse.equinox.http.jetty + 3.9.200 @@ -62,14 +63,12 @@ org.apache.felix maven-bundle-plugin - ${maven-bundle-plugin.version} true org.eclipse.equinox.http.jetty - osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))" - + osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))" diff --git a/target-platform/org.eclipse.kura.jetty.customizer/src/main/java/org/eclipse/kura/jetty/customizer/KuraErrorHandler.java b/target-platform/org.eclipse.kura.jetty.customizer/src/main/java/org/eclipse/kura/jetty/customizer/KuraErrorHandler.java index 44d00d64760..6d977a53ae0 100644 --- a/target-platform/org.eclipse.kura.jetty.customizer/src/main/java/org/eclipse/kura/jetty/customizer/KuraErrorHandler.java +++ b/target-platform/org.eclipse.kura.jetty.customizer/src/main/java/org/eclipse/kura/jetty/customizer/KuraErrorHandler.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2019, 2020 Eurotech and/or its affiliates and others + * Copyright (c) 2019, 2024 Eurotech and/or its affiliates and others * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -15,10 +15,10 @@ import java.io.IOException; import java.io.Writer; -import javax.servlet.http.HttpServletRequest; - import org.eclipse.jetty.server.handler.ErrorHandler; +import jakarta.servlet.http.HttpServletRequest; + public class KuraErrorHandler extends ErrorHandler { @Override @@ -26,4 +26,5 @@ protected void writeErrorPage(HttpServletRequest request, Writer writer, int cod boolean showStacks) throws IOException { // Not needed } + } diff --git a/target-platform/org.eclipse.kura.jetty.customizer/src/main/java/org/eclipse/kura/jetty/customizer/KuraJettyCustomizer.java b/target-platform/org.eclipse.kura.jetty.customizer/src/main/java/org/eclipse/kura/jetty/customizer/KuraJettyCustomizer.java index 5094bc6c32c..1be033a2301 100644 --- a/target-platform/org.eclipse.kura.jetty.customizer/src/main/java/org/eclipse/kura/jetty/customizer/KuraJettyCustomizer.java +++ b/target-platform/org.eclipse.kura.jetty.customizer/src/main/java/org/eclipse/kura/jetty/customizer/KuraJettyCustomizer.java @@ -29,9 +29,9 @@ import java.util.Set; import java.util.concurrent.Callable; import java.util.function.Function; +import java.util.zip.Deflater; import javax.net.ssl.KeyManager; -import javax.servlet.SessionCookieConfig; import org.eclipse.equinox.http.jetty.JettyConstants; import org.eclipse.equinox.http.jetty.JettyCustomizer; @@ -50,10 +50,17 @@ import org.eclipse.jetty.server.SslConnectionFactory; import org.eclipse.jetty.server.handler.gzip.GzipHandler; import org.eclipse.jetty.servlet.ServletContextHandler; +import org.eclipse.jetty.util.compression.CompressionPool; +import org.eclipse.jetty.util.compression.DeflaterPool; import org.eclipse.jetty.util.ssl.SslContextFactory; +import jakarta.servlet.SessionCookieConfig; + public class KuraJettyCustomizer extends JettyCustomizer { + private DeflaterPool deflaterPool = new DeflaterPool(CompressionPool.DEFAULT_CAPACITY, Deflater.BEST_COMPRESSION, + true); + @Override public Object customizeContext(Object context, Dictionary settings) { if (!(context instanceof ServletContextHandler)) { @@ -65,9 +72,9 @@ public Object customizeContext(Object context, Dictionary settings) { servletContextHandler.getServer().setErrorHandler(new KuraErrorHandler()); final GzipHandler gzipHandler = new GzipHandler(); - gzipHandler.setCompressionLevel(9); + gzipHandler.setDeflaterPool(this.deflaterPool); - servletContextHandler.setGzipHandler(gzipHandler); + servletContextHandler.insertHandler(gzipHandler); servletContextHandler.setErrorHandler(new KuraErrorHandler()); @@ -233,17 +240,6 @@ private void addCustomizer(final ServerConnector connector, final Customizer cus } } - @SuppressWarnings("unchecked") - private static T getOrDefault(final Dictionary properties, final String key, final T defaultValue) { - final Object raw = properties.get(key); - - if (defaultValue.getClass().isInstance(raw)) { - return (T) raw; - } - - return defaultValue; - } - @SuppressWarnings("unchecked") private static Optional getOptional(final Dictionary properties, final String key, final Class classz) { @@ -350,6 +346,18 @@ protected PKIXBuilderParameters newPKIXBuilderParameters(KeyStore trustStore, return pbParams; } + + @SuppressWarnings("unchecked") + private static T getOrDefault(final Dictionary properties, final String key, + final T defaultValue) { + final Object raw = properties.get(key); + + if (defaultValue.getClass().isInstance(raw)) { + return (T) raw; + } + + return defaultValue; + } } -} +} \ No newline at end of file diff --git a/target-platform/p2-repo-common/pom.xml b/target-platform/p2-repo-common/pom.xml index c08d1fcd328..da4087f5ae1 100644 --- a/target-platform/p2-repo-common/pom.xml +++ b/target-platform/p2-repo-common/pom.xml @@ -172,11 +172,6 @@ org.eclipse.kura.sun.misc ${org.eclipse.kura.sun.misc.version} - - com.eclipsesource.minimal-json - minimal-json - ${com.eclipsesource.minimal-json.version} - org.tigris org.tigris.mtoolkit.iagent.rpc @@ -187,11 +182,6 @@ com.gwt.user ${com.gwt.user.version} - org.hamcrest org.hamcrest.core @@ -263,8 +253,13 @@ ${org.junit.version} - commons-fileupload - commons-fileupload + org.apache.commons + commons-fileupload2-jakarta-servlet5 + ${commons-fileupload.version} + + + org.apache.commons + commons-fileupload2-core ${commons-fileupload.version} @@ -392,31 +387,6 @@ osgi.annotation ${osgi.annotation.version} - - org.eclipse.kura - com.eclipsesource.jaxrs.jersey-min - ${com.eclipsesource.jaxrs.jersey-min.version} - - - com.eclipsesource.jaxrs - publisher - ${com.eclipsesource.jaxrs.publisher.version} - - - com.eclipsesource.jaxrs - provider-gson - ${com.eclipsesource.jaxrs.provider.gson.version} - - - com.eclipsesource.jaxrs - provider-security - ${com.eclipsesource.jaxrs.provider.security.version} - - - com.eclipsesource.jaxrs - provider-multipart - ${com.eclipsesource.jaxrs.provider.multipart.version} - com.google.code.gson gson @@ -563,6 +533,11 @@ jakarta.activation-api ${jakarta.activation-api.version} + + jakarta.annotation + jakarta.annotation-api + ${jakarta.annotation-api.version} + jakarta.xml.ws jakarta.xml.ws-api @@ -638,6 +613,11 @@ sqlite-jdbc ${org.xerial.sqlite-jdbc.version} + + com.eclipsesource.minimal-json + minimal-json + ${com.eclipsesource.minimal-json.version} + true ${project.basedir}/target/source/plugins @@ -685,7 +665,8 @@ - + + @@ -708,17 +689,12 @@ - - - - - - + @@ -760,6 +736,7 @@ + diff --git a/target-platform/p2-repo-equinox/pom.xml b/target-platform/p2-repo-equinox/pom.xml new file mode 100644 index 00000000000..c53fe9a0a3f --- /dev/null +++ b/target-platform/p2-repo-equinox/pom.xml @@ -0,0 +1,416 @@ + + 4.0.0 + + + org.eclipse.kura + target-platform + 6.0.0-SNAPSHOT + + + p2-repo-equinox + pom + + + https://www.eclipse.org/downloads/download.php?file=/equinox/drops/R-4.33-202409030240/equinox-SDK-4.33.zip&mirror_id=1 + + + + + + org.codehaus.mojo + properties-maven-plugin + ${properties-maven-plugin.version} + + + initialize + + read-project-properties + + + + ${basedir}/../config/kura.target-platform.build.properties + + + + + + + maven-dependency-plugin + ${maven-dependency-plugin.version} + + + copy-bundles-for-publishing + generate-resources + + copy + + + + + org.apache.felix + org.apache.felix.dependencymanager + ${org.apache.felix.dependencymanager.version} + + + org.apache.felix + org.apache.felix.deploymentadmin + ${org.apache.felix.deploymentadmin.version} + + + org.apache.felix + org.apache.felix.http.jetty + ${org.apache.felix.http.jetty.version} + + + org.apache.felix + org.apache.felix.http.servlet-api + ${org.apache.felix.http.servlet-api.version} + + + org.knowhowlab.osgi + monitoradmin + ${org.knowhowlab.osgi.monitoradmin.version} + + + org.eclipse.jetty + jetty-http + ${org.eclipse.jetty.version} + + + org.eclipse.jetty + jetty-security + ${org.eclipse.jetty.version} + + + org.eclipse.jetty + jetty-server + ${org.eclipse.jetty.version} + + + org.eclipse.jetty + jetty-session + ${org.eclipse.jetty.version} + + + org.eclipse.jetty + jetty-util + ${org.eclipse.jetty.version} + + + org.eclipse.jetty + jetty-io + ${org.eclipse.jetty.version} + + + org.eclipse.jetty.ee8 + jetty-ee8-security + ${org.eclipse.jetty.version} + + + org.eclipse.jetty.ee8 + jetty-ee8-servlet + ${org.eclipse.jetty.version} + + + org.eclipse.jetty.ee8 + jetty-ee8-nested + ${org.eclipse.jetty.version} + + + org.eclipse.platform + org.eclipse.equinox.io + ${org.eclipse.equinox.io.version} + + + org.eclipse.platform + org.eclipse.equinox.util + ${org.eclipse.equinox.util.version} + + + org.eclipse.platform + org.eclipse.equinox.wireadmin + ${org.eclipse.equinox.wireadmin.version} + + + org.osgi + org.osgi.service.http.whiteboard + ${org.osgi.service.http.whiteboard.version} + + + org.osgi + org.osgi.service.servlet + ${org.osgi.service.servlet.version} + + + jakarta.ws.rs + jakarta.ws.rs-api + ${jakarta.ws.rs-api.version} + + + org.osgi + org.osgi.service.jakartars + ${org.osgi.service.jakartars.version} + + + org.eclipse.osgi-technology.rest + org.eclipse.osgitech.rest + ${org.eclipse.osgi-technology.rest.version} + + + org.eclipse.osgi-technology.rest + org.eclipse.osgitech.rest.config + ${org.eclipse.osgi-technology.rest.version} + + + org.eclipse.osgi-technology.rest + org.eclipse.osgitech.rest.sse + ${org.eclipse.osgi-technology.rest.version} + + + org.eclipse.osgi-technology.rest + org.eclipse.osgitech.rest.jetty + ${org.eclipse.osgi-technology.rest.version} + + + org.eclipse.osgi-technology.rest + org.eclipse.osgitech.rest.servlet.whiteboard + ${org.eclipse.osgi-technology.rest.version} + + + + org.glassfish.jersey.media + jersey-media-json-jackson + ${org.glassfish.jersey.version} + + + org.glassfish.jersey.media + jersey-media-multipart + ${org.glassfish.jersey.version} + + + + com.fasterxml.jackson.jakarta.rs + jackson-jakarta-rs-json-provider + ${com.fasterxml.jackson.version} + + + com.fasterxml.jackson.jakarta.rs + jackson-jakarta-rs-base + ${com.fasterxml.jackson.version} + + + com.fasterxml.jackson.core + jackson-annotations + ${com.fasterxml.jackson.version} + + + com.fasterxml.jackson.module + jackson-module-jakarta-xmlbind-annotations + ${com.fasterxml.jackson.version} + + + com.fasterxml.jackson.core + jackson-core + ${com.fasterxml.jackson.version} + + + com.fasterxml.jackson.core + jackson-databind + ${com.fasterxml.jackson.version} + + + true + ${project.basedir}/target/source/plugins + + + + + + org.eclipse.tycho.extras + tycho-p2-extras-plugin + ${tycho-p2-extras-plugin.version} + + + prepare-package + + publish-features-and-bundles + + + + + false + + + + maven-antrun-plugin + ${maven-antrun-plugin.version} + + + download-equinox + process-sources + + run + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + rename-maven-deps + process-resources + + run + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + install-equinox + install + + run + + + + + + + + + + + + + + + + org.apache.maven.plugins + maven-deploy-plugin + ${maven-deploy-plugin.version} + + true + + + + + + + + + no-mirror + + https://archive.eclipse.org/equinox/drops/R-4.33-202409030240/equinox-SDK-4.33.zip + + + + diff --git a/target-platform/p2-repo-equinox_3.16.0/pom.xml b/target-platform/p2-repo-equinox_3.16.0/pom.xml deleted file mode 100644 index 4be8b2bf331..00000000000 --- a/target-platform/p2-repo-equinox_3.16.0/pom.xml +++ /dev/null @@ -1,272 +0,0 @@ - - 4.0.0 - - - org.eclipse.kura - target-platform - 6.0.0-SNAPSHOT - - - p2-repo-equinox_3.16.0 - pom - - - https://www.eclipse.org/downloads/download.php?file=/equinox/drops/R-4.17-202009021800/equinox-SDK-4.17.zip&r=1 - - - - - - org.codehaus.mojo - properties-maven-plugin - ${properties-maven-plugin.version} - - - initialize - - read-project-properties - - - - ${basedir}/../config/kura.target-platform.build.properties - - - - - - - maven-dependency-plugin - ${maven-dependency-plugin.version} - - - copy-bundles-for-publishing - generate-resources - - copy - - - - - org.apache.felix - org.apache.felix.dependencymanager - ${org.apache.felix.dependencymanager.version} - - - org.apache.felix - org.apache.felix.deploymentadmin - ${org.apache.felix.deploymentadmin.version} - - - org.knowhowlab - org.knowhowlab.osgi.monitoradmin - ${org.knowhowlab.osgi.monitoradmin.version} - - - org.eclipse.jetty - jetty-http - ${org.eclipse.jetty.http.version} - - - org.eclipse.jetty - jetty-continuation - ${org.eclipse.jetty.continuation.version} - - - org.eclipse.jetty - jetty-io - ${org.eclipse.jetty.io.version} - - - org.eclipse.jetty - jetty-security - ${org.eclipse.jetty.security.version} - - - org.eclipse.jetty - jetty-server - ${org.eclipse.jetty.server.version} - - - org.eclipse.jetty - jetty-servlet - ${org.eclipse.jetty.servlet.version} - - - org.eclipse.jetty - jetty-util - ${org.eclipse.jetty.util.version} - - - org.eclipse.jetty - jetty-util-ajax - ${org.eclipse.jetty.util.ajax.version} - - - org.eclipse.platform - org.eclipse.equinox.io - ${org.eclipse.equinox.io.version} - - - org.eclipse.platform - org.eclipse.equinox.util - ${org.eclipse.equinox.util.version} - - - org.eclipse.platform - org.eclipse.equinox.wireadmin - ${org.eclipse.equinox.wireadmin.version} - - - true - ${project.basedir}/target/source/plugins - - - - - - org.eclipse.tycho.extras - tycho-p2-extras-plugin - ${tycho-p2-extras-plugin.version} - - - prepare-package - - publish-features-and-bundles - - - - - false - - - - maven-antrun-plugin - ${maven-antrun-plugin.version} - - - download-equinox - process-sources - - run - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - rename-maven-deps - process-resources - - run - - - - - - - - - - - - - - - - - - - - - - install-equinox - install - - run - - - - - - - - - - - - - - - - org.apache.maven.plugins - maven-deploy-plugin - ${maven-deploy-plugin.version} - - true - - - - - - - - - no-mirror - - https://archive.eclipse.org/equinox/drops/R-4.17-202009021800/equinox-SDK-4.17.zip - - - - diff --git a/target-platform/p2-repo-test-deps/pom.xml b/target-platform/p2-repo-test-deps/pom.xml index 4889766de82..7a5a9a41bab 100644 --- a/target-platform/p2-repo-test-deps/pom.xml +++ b/target-platform/p2-repo-test-deps/pom.xml @@ -112,6 +112,27 @@ objenesis ${objenesis.version} + + + org.glassfish.jersey.core + jersey-client + ${org.glassfish.jersey.version} + + + org.glassfish.jersey.core + jersey-common + ${org.glassfish.jersey.version} + + + jakarta.inject + jakarta.inject-api + ${jakarta.inject-api.version} + + + org.jvnet.mimepull + mimepull + ${org.jvnet.mimepull.version} + true ${project.basedir}/target/source/plugins diff --git a/target-platform/pom.xml b/target-platform/pom.xml index 9435c30dd47..ca95dc0ed56 100644 --- a/target-platform/pom.xml +++ b/target-platform/pom.xml @@ -61,7 +61,7 @@ log4j2-api-config org.eclipse.kura.jetty.customizer p2-repo-common - p2-repo-equinox_3.16.0 + p2-repo-equinox p2-repo-test-deps