diff options
author | Ravi Pendurty <ravi.pendurty@highstreet-technologies.com> | 2023-03-14 14:08:02 +0530 |
---|---|---|
committer | Ravi Pendurty <ravi.pendurty@highstreet-technologies.com> | 2023-03-14 14:08:02 +0530 |
commit | 5ddd815de746eea6d80f4363d6daf1b1510046c0 (patch) | |
tree | d5469ec207a8594be6364ed4b7ace02ad9bacf56 /sdnr/wt/helpserver/provider | |
parent | c82a57b8b435543aa27261df1b272af3892307ba (diff) |
Use WhiteboardPattern annotations
Introduced in OSGi Compendium 7
Issue-ID: CCSDK-3865
Signed-off-by: Ravi Pendurty <ravi.pendurty@highstreet-technologies.com>
Change-Id: Id2eca252a531470f2d6cd4792cf66861ae304a2f
Diffstat (limited to 'sdnr/wt/helpserver/provider')
4 files changed, 22 insertions, 18 deletions
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======================================================= ~ --> + <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> @@ -45,8 +46,8 @@ <dependencies> <dependency> - <groupId>javax.servlet</groupId> - <artifactId>javax.servlet-api</artifactId> + <groupId>jakarta.servlet</groupId> + <artifactId>jakarta.servlet-api</artifactId> <scope>provided</scope> </dependency> <dependency> @@ -60,11 +61,6 @@ <scope>provided</scope> </dependency> <dependency> - <groupId>org.osgi</groupId> - <artifactId>org.osgi.compendium</artifactId> - <scope>provided</scope> - </dependency> - <dependency> <groupId>org.mockito</groupId> <artifactId>mockito-core</artifactId> <scope>test</scope> @@ -75,6 +71,12 @@ <version>${project.version}</version> <scope>test</scope> </dependency> + <dependency> + <groupId>org.osgi</groupId> + <artifactId>osgi.cmpn</artifactId> + <version>7.0.0</version> + <scope>compile</scope> + </dependency> </dependencies> <build> 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 @@ <bean id="helpServlet" class="org.onap.ccsdk.features.sdnr.wt.helpserver.HelpServlet"> </bean> - - <service interface="javax.servlet.http.HttpServlet" ref="helpServlet"> - <service-properties> - <entry key="alias" value="/help"/> - </service-properties> - </service> + </blueprint> |