summaryrefslogtreecommitdiffstats
path: root/sdnr/wt
diff options
context:
space:
mode:
authorRavi Pendurty <ravi.pendurty@highstreet-technologies.com>2023-11-20 10:21:10 +0530
committerRavi Pendurty <ravi.pendurty@highstreet-technologies.com>2023-11-20 04:54:24 +0000
commit8652f2096bd8896296c4a1a48fa8ff9285cad675 (patch)
treea7cdcd7de865f053e6c74eaadc2e1d4599e79dce /sdnr/wt
parent247be00e7d56181ab1336d182b446076014e2dde (diff)
Fix cluster-size issue in About page
Use HttpService instead of WhiteboardPattern Issue-ID: CCSDK-3963 Change-Id: I7826afbcd704b681af3b6c923c59fe666c8860d6 Signed-off-by: Ravi Pendurty <ravi.pendurty@highstreet-technologies.com>
Diffstat (limited to 'sdnr/wt')
-rw-r--r--sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/http/about/AboutHttpServlet.java10
-rw-r--r--sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/http/yangschema/YangSchemaHttpServlet.java3
-rw-r--r--sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/impl/DataProviderImpl.java18
-rw-r--r--sdnr/wt/data-provider/provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml7
4 files changed, 26 insertions, 12 deletions
diff --git a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/http/about/AboutHttpServlet.java b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/http/about/AboutHttpServlet.java
index 45bd80cd6..35549330b 100644
--- a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/http/about/AboutHttpServlet.java
+++ b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/http/about/AboutHttpServlet.java
@@ -29,7 +29,6 @@ import java.util.Map;
import java.util.Map.Entry;
import java.util.jar.Attributes;
import java.util.jar.Manifest;
-import javax.servlet.Servlet;
import javax.servlet.ServletException;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServlet;
@@ -42,16 +41,9 @@ import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.types.NetconfTimeStamp
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.FrameworkUtil;
-import org.osgi.service.component.annotations.Component;
-import org.osgi.service.component.annotations.ServiceScope;
-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("/about")
-@HttpWhiteboardServletName("AboutHttpServlet")
-@Component(service = Servlet.class)
public class AboutHttpServlet extends HttpServlet {
/**
@@ -63,7 +55,7 @@ public class AboutHttpServlet extends HttpServlet {
private static final String METAINF_MAVEN = "/META-INF/maven/";
private static final String EXCEPTION_FORMAT_UNABLE_TO_READ_INNER_POMFILE = "unable to read inner pom file: {}";
- private static final String URI_PRE = "/about";
+ public static final String URI_PRE = "/about";
private static final String RES_BASEPATH = "about/";
private static final String PLACEHOLDER_ONAP_RELEASENAME = "{release-name}";
diff --git a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/http/yangschema/YangSchemaHttpServlet.java b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/http/yangschema/YangSchemaHttpServlet.java
index f9fa2e931..45f9c80ff 100644
--- a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/http/yangschema/YangSchemaHttpServlet.java
+++ b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/http/yangschema/YangSchemaHttpServlet.java
@@ -28,7 +28,6 @@ import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-
import org.osgi.service.component.annotations.Component;
import org.osgi.service.http.whiteboard.propertytypes.HttpWhiteboardServletName;
import org.osgi.service.http.whiteboard.propertytypes.HttpWhiteboardServletPattern;
@@ -45,7 +44,7 @@ public class YangSchemaHttpServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
private static final Logger LOG = LoggerFactory.getLogger(YangSchemaHttpServlet.class);
private static final String CACHEPATH = "cache/";
- private static final String SCHEMACACHEPATH_PRIMARY = CACHEPATH+"schema/";
+ private static final String SCHEMACACHEPATH_PRIMARY = CACHEPATH + "schema/";
private final YangFileProvider fileProvider;
diff --git a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/impl/DataProviderImpl.java b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/impl/DataProviderImpl.java
index 66ffdf8b3..71ff7a85b 100644
--- a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/impl/DataProviderImpl.java
+++ b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/impl/DataProviderImpl.java
@@ -21,6 +21,7 @@
*/
package org.onap.ccsdk.features.sdnr.wt.dataprovider.impl;
+import javax.servlet.ServletException;
import org.onap.ccsdk.features.sdnr.wt.common.database.HtDatabaseClient;
import org.onap.ccsdk.features.sdnr.wt.common.database.HtDatabaseClientException;
import org.onap.ccsdk.features.sdnr.wt.dataprovider.http.DataTreeHttpServlet;
@@ -37,6 +38,8 @@ import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.StatusChangedHandler.S
import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.types.NetconfTimeStampImpl;
import org.opendaylight.mdsal.binding.api.DataBroker;
import org.opendaylight.mdsal.binding.api.RpcProviderService;
+import org.osgi.service.http.HttpService;
+import org.osgi.service.http.NamespaceException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -97,6 +100,21 @@ public class DataProviderImpl implements IEntityDataProvider, AutoCloseable {
}
}
+ public void onUnbindService(HttpService httpService) {
+ httpService.unregister(AboutHttpServlet.URI_PRE);
+ this.aboutServlet = null;
+ }
+
+ public void onBindService(HttpService httpService)
+ throws ServletException, NamespaceException {
+ if (httpService == null) {
+ LOG.warn("Unable to inject HttpService into loader.");
+ } else {
+ httpService.registerServlet(AboutHttpServlet.URI_PRE, aboutServlet, null, null);
+ LOG.info("about servlet registered.");
+ }
+ }
+
@Override
public void close() throws Exception {
LOG.info("DeviceManagerImpl closing ...");
diff --git a/sdnr/wt/data-provider/provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml b/sdnr/wt/data-provider/provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml
index 5a681d76f..8e74592d9 100644
--- a/sdnr/wt/data-provider/provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml
+++ b/sdnr/wt/data-provider/provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml
@@ -30,7 +30,12 @@
interface="org.opendaylight.mdsal.binding.api.RpcProviderService"/>
<reference id="dataBroker" interface="org.opendaylight.mdsal.binding.api.DataBroker"/>
- <bean id="aboutServlet" class="org.onap.ccsdk.features.sdnr.wt.dataprovider.http.about.AboutHttpServlet" />
+ <reference id="onBindService" availability="mandatory" activation="eager" interface="org.osgi.service.http.HttpService">
+ <reference-listener ref="provider" bind-method="onBindService" unbind-method="onUnbindService"/>
+ </reference>
+
+ <bean id="aboutServlet" class="org.onap.ccsdk.features.sdnr.wt.dataprovider.http.about.AboutHttpServlet">
+ </bean>
<bean id="msServlet"
class="org.onap.ccsdk.features.sdnr.wt.dataprovider.http.MsServlet">