From 5ddd815de746eea6d80f4363d6daf1b1510046c0 Mon Sep 17 00:00:00 2001 From: Ravi Pendurty Date: Tue, 14 Mar 2023 14:08:02 +0530 Subject: Use WhiteboardPattern annotations Introduced in OSGi Compendium 7 Issue-ID: CCSDK-3865 Signed-off-by: Ravi Pendurty Change-Id: Id2eca252a531470f2d6cd4792cf66861ae304a2f --- sdnr/wt/helpserver/provider/pom.xml | 16 +++++++++------- .../ccsdk/features/sdnr/wt/helpserver/HelpServlet.java | 7 +++++++ .../wt/helpserver/data/HelpInfrastructureObject.java | 10 +++++----- .../src/main/resources/OSGI-INF/blueprint/blueprint.xml | 7 +------ 4 files changed, 22 insertions(+), 18 deletions(-) (limited to 'sdnr/wt') diff --git a/sdnr/wt/helpserver/provider/pom.xml b/sdnr/wt/helpserver/provider/pom.xml index e30263e87..5251d6c96 100644 --- a/sdnr/wt/helpserver/provider/pom.xml +++ b/sdnr/wt/helpserver/provider/pom.xml @@ -22,6 +22,7 @@ ~ ============LICENSE_END======================================================= ~ --> + 4.0.0 @@ -45,8 +46,8 @@ - javax.servlet - javax.servlet-api + jakarta.servlet + jakarta.servlet-api provided @@ -59,11 +60,6 @@ org.osgi.core provided - - org.osgi - org.osgi.compendium - provided - org.mockito mockito-core @@ -75,6 +71,12 @@ ${project.version} test + + org.osgi + osgi.cmpn + 7.0.0 + compile + diff --git a/sdnr/wt/helpserver/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/helpserver/HelpServlet.java b/sdnr/wt/helpserver/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/helpserver/HelpServlet.java index e9470ab09..ddd684019 100644 --- a/sdnr/wt/helpserver/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/helpserver/HelpServlet.java +++ b/sdnr/wt/helpserver/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/helpserver/HelpServlet.java @@ -26,14 +26,21 @@ import java.io.OutputStream; import java.net.URISyntaxException; import java.net.URLDecoder; import java.nio.file.Path; +import javax.servlet.Servlet; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.onap.ccsdk.features.sdnr.wt.helpserver.data.HelpInfrastructureObject; +import org.osgi.service.component.annotations.Component; +import org.osgi.service.http.whiteboard.propertytypes.HttpWhiteboardServletName; +import org.osgi.service.http.whiteboard.propertytypes.HttpWhiteboardServletPattern; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +@HttpWhiteboardServletPattern("/help/*") +@HttpWhiteboardServletName("HelpServlet") +@Component(service = Servlet.class) public class HelpServlet extends HttpServlet implements AutoCloseable { private static Logger LOG = LoggerFactory.getLogger(HelpServlet.class); diff --git a/sdnr/wt/helpserver/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/helpserver/data/HelpInfrastructureObject.java b/sdnr/wt/helpserver/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/helpserver/data/HelpInfrastructureObject.java index 35dbeec9f..4adb54dea 100644 --- a/sdnr/wt/helpserver/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/helpserver/data/HelpInfrastructureObject.java +++ b/sdnr/wt/helpserver/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/helpserver/data/HelpInfrastructureObject.java @@ -144,7 +144,7 @@ public class HelpInfrastructureObject extends JSONObject { public static void createFilesFromResources() { if (KARAFHELPDIRECTORY.exists()) { - LOG.info("Delete existing directory"); + LOG.debug("Delete existing directory"); try { ExtactBundleResource.deleteRecursively(KARAFHELPDIRECTORY); } catch (IOException e1) { @@ -152,17 +152,17 @@ public class HelpInfrastructureObject extends JSONObject { } } - LOG.info("Extract"); + LOG.debug("Extract"); try { Bundle b = FrameworkUtil.getBundle(HelpInfrastructureObject.class); if (b == null) { - LOG.info("No bundlereference: Use target in filesystem."); + LOG.debug("No bundlereference: Use target in filesystem."); // URL helpRessource = // JarFileUtils.stringToJarURL("target/helpserver-impl-0.4.0-SNAPSHOT.jar",KARAFBUNDLERESOURCEHELPROOT); } else { - LOG.info("Bundle location:{} State:{}", b.getLocation(), b.getState()); - LOG.info("Write files from Resource"); + LOG.debug("Bundle location:{} State:{}", b.getLocation(), b.getState()); + LOG.debug("Write files from Resource"); ExtactBundleResource.copyBundleResoucesRecursively(b, "data/cache/com.highstreet.technologies.", KARAFBUNDLERESOURCEHELPROOT); } diff --git a/sdnr/wt/helpserver/provider/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/sdnr/wt/helpserver/provider/src/main/resources/OSGI-INF/blueprint/blueprint.xml index 387aa4557..354e8029f 100644 --- a/sdnr/wt/helpserver/provider/src/main/resources/OSGI-INF/blueprint/blueprint.xml +++ b/sdnr/wt/helpserver/provider/src/main/resources/OSGI-INF/blueprint/blueprint.xml @@ -28,10 +28,5 @@ - - - - - - + -- cgit 1.2.3-korg