summaryrefslogtreecommitdiffstats
path: root/catalog-fe/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'catalog-fe/src/main/java')
-rw-r--r--catalog-fe/src/main/java/org/openecomp/sdc/fe/impl/DesignerStatusBL.java78
-rw-r--r--catalog-fe/src/main/java/org/openecomp/sdc/fe/impl/PluginStatusBL.java78
-rw-r--r--catalog-fe/src/main/java/org/openecomp/sdc/fe/listen/FEAppContextListener.java6
-rw-r--r--catalog-fe/src/main/java/org/openecomp/sdc/fe/servlets/ConfigServlet.java10
4 files changed, 86 insertions, 86 deletions
diff --git a/catalog-fe/src/main/java/org/openecomp/sdc/fe/impl/DesignerStatusBL.java b/catalog-fe/src/main/java/org/openecomp/sdc/fe/impl/DesignerStatusBL.java
deleted file mode 100644
index eb43df6c95..0000000000
--- a/catalog-fe/src/main/java/org/openecomp/sdc/fe/impl/DesignerStatusBL.java
+++ /dev/null
@@ -1,78 +0,0 @@
-package org.openecomp.sdc.fe.impl;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.http.client.methods.CloseableHttpResponse;
-import org.apache.http.client.methods.HttpHead;
-import org.apache.http.impl.client.CloseableHttpClient;
-import org.apache.http.impl.client.HttpClients;
-import org.openecomp.sdc.fe.config.ConfigurationManager;
-import org.openecomp.sdc.fe.config.DesignersConfiguration;
-import org.openecomp.sdc.fe.config.DesignersConfiguration.Designer;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
-
-public class DesignerStatusBL {
-
- private static Logger log = LoggerFactory.getLogger(DesignerStatusBL.class.getName());
- private static Gson gson = new GsonBuilder().setPrettyPrinting().create();
- private CloseableHttpClient client = null;
-
- public DesignerStatusBL() {
- this.client = HttpClients.createDefault();
- }
-
- public DesignerStatusBL(CloseableHttpClient client) {
- this.client = client;
-
- }
-
- public String checkDesignerListAvailability() {
- String result = null;
-
- DesignersConfiguration designersConfiguration = ConfigurationManager.getConfigurationManager()
- .getDesignersConfiguration();
-
- if (designersConfiguration == null || designersConfiguration.getDesignersList() == null) {
- log.warn("Configuration of type {} was not found", DesignersConfiguration.class);
- } else {
- log.debug("The value returned from getConfig is {}", designersConfiguration);
-
- List<Designer> availableDesignersList = new ArrayList<>();
-
- designersConfiguration.getDesignersList().forEach(value -> {
- if (checkDesignerAvailability(value)) {
- availableDesignersList.add(value);
- }
-
- });
- result = gson.toJson(availableDesignersList);
- }
- return result;
- }
-
- private boolean checkDesignerAvailability(Designer designer) {
-
- StringBuilder requestString = new StringBuilder();
- boolean result = false;
-
- requestString.append(designer.getDesignerProtocol()).append("://").append(designer.getDesignerHost()).append(":")
- .append(designer.getDesignerPort()).append(designer.getDesignerPath());
-
- HttpHead head = new HttpHead(requestString.toString());
-
- try (CloseableHttpResponse response = this.client.execute(head)) {
- result = response != null && response.getStatusLine().getStatusCode() == 200;
- } catch (IOException e) {
- log.debug("The designer {} is offline", designer);
- }
-
- return result;
- }
-
-}
diff --git a/catalog-fe/src/main/java/org/openecomp/sdc/fe/impl/PluginStatusBL.java b/catalog-fe/src/main/java/org/openecomp/sdc/fe/impl/PluginStatusBL.java
new file mode 100644
index 0000000000..dcd5eef491
--- /dev/null
+++ b/catalog-fe/src/main/java/org/openecomp/sdc/fe/impl/PluginStatusBL.java
@@ -0,0 +1,78 @@
+package org.openecomp.sdc.fe.impl;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpHead;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClients;
+import org.openecomp.sdc.fe.config.ConfigurationManager;
+import org.openecomp.sdc.fe.config.PluginsConfiguration;
+import org.openecomp.sdc.fe.config.PluginsConfiguration.Plugin;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+
+public class PluginStatusBL {
+
+ private static Logger log = LoggerFactory.getLogger(PluginStatusBL.class.getName());
+ private static Gson gson = new GsonBuilder().setPrettyPrinting().create();
+ private CloseableHttpClient client = null;
+
+ public PluginStatusBL() {
+ this.client = HttpClients.createDefault();
+ }
+
+ public PluginStatusBL(CloseableHttpClient client) {
+ this.client = client;
+
+ }
+
+ public String checkPluginsListAvailability() {
+ String result = null;
+
+ PluginsConfiguration pluginsConfiguration = ConfigurationManager.getConfigurationManager()
+ .getPluginsConfiguration();
+
+ if (pluginsConfiguration == null || pluginsConfiguration.getPluginsList() == null) {
+ log.warn("Configuration of type {} was not found", PluginsConfiguration.class);
+ } else {
+ log.debug("The value returned from getConfig is {}", pluginsConfiguration);
+
+ List<Plugin> availablePluginsList = new ArrayList<>();
+
+ pluginsConfiguration.getPluginsList().forEach(value -> {
+ if (checkPluginAvailability(value)) {
+ availablePluginsList.add(value);
+ }
+
+ });
+ result = gson.toJson(availablePluginsList);
+ }
+ return result;
+ }
+
+ private boolean checkPluginAvailability(Plugin plugin) {
+
+ StringBuilder requestString = new StringBuilder();
+ boolean result = false;
+
+ requestString.append(plugin.getPluginProtocol()).append("://").append(plugin.getPluginHost()).append(":")
+ .append(plugin.getPluginPort()).append(plugin.getPluginPath());
+
+ HttpHead head = new HttpHead(requestString.toString());
+
+ try (CloseableHttpResponse response = this.client.execute(head)) {
+ result = response != null && response.getStatusLine().getStatusCode() == 200;
+ } catch (IOException e) {
+ log.debug("The plugin {} is offline", plugin);
+ }
+
+ return result;
+ }
+
+}
diff --git a/catalog-fe/src/main/java/org/openecomp/sdc/fe/listen/FEAppContextListener.java b/catalog-fe/src/main/java/org/openecomp/sdc/fe/listen/FEAppContextListener.java
index ea67efbc7e..76190bc790 100644
--- a/catalog-fe/src/main/java/org/openecomp/sdc/fe/listen/FEAppContextListener.java
+++ b/catalog-fe/src/main/java/org/openecomp/sdc/fe/listen/FEAppContextListener.java
@@ -30,7 +30,7 @@ import org.openecomp.sdc.common.api.Constants;
import org.openecomp.sdc.common.impl.ExternalConfiguration;
import org.openecomp.sdc.common.listener.AppContextListener;
import org.openecomp.sdc.fe.config.ConfigurationManager;
-import org.openecomp.sdc.fe.impl.DesignerStatusBL;
+import org.openecomp.sdc.fe.impl.PluginStatusBL;
import org.openecomp.sdc.fe.monitoring.FeMonitoringService;
import org.openecomp.sdc.fe.servlets.HealthCheckService;
import org.slf4j.Logger;
@@ -50,8 +50,8 @@ public class FEAppContextListener extends AppContextListener implements ServletC
ExternalConfiguration.getAppName());
context.getServletContext().setAttribute(Constants.CONFIGURATION_MANAGER_ATTR, configurationManager);
- DesignerStatusBL dsbl = new DesignerStatusBL();
- context.getServletContext().setAttribute(Constants.DESIGNER_BL_COMPONENT, dsbl);
+ PluginStatusBL pbl = new PluginStatusBL();
+ context.getServletContext().setAttribute(Constants.PLUGIN_BL_COMPONENT, pbl);
// Health Check service
HealthCheckService hcs = new HealthCheckService(context.getServletContext());
diff --git a/catalog-fe/src/main/java/org/openecomp/sdc/fe/servlets/ConfigServlet.java b/catalog-fe/src/main/java/org/openecomp/sdc/fe/servlets/ConfigServlet.java
index ba37e94d10..cbe5c43a45 100644
--- a/catalog-fe/src/main/java/org/openecomp/sdc/fe/servlets/ConfigServlet.java
+++ b/catalog-fe/src/main/java/org/openecomp/sdc/fe/servlets/ConfigServlet.java
@@ -39,7 +39,7 @@ import org.openecomp.sdc.common.api.ConfigurationSource;
import org.openecomp.sdc.common.api.Constants;
import org.openecomp.sdc.common.servlets.BasicServlet;
import org.openecomp.sdc.fe.config.Configuration;
-import org.openecomp.sdc.fe.impl.DesignerStatusBL;
+import org.openecomp.sdc.fe.impl.PluginStatusBL;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -115,16 +115,16 @@ public class ConfigServlet extends BasicServlet {
}
@GET
- @Path("/ui/designers")
+ @Path("/ui/plugins")
@Produces(MediaType.APPLICATION_JSON)
- public Response getDesignersConfiguration(@Context final HttpServletRequest request) {
+ public Response getPluginsConfiguration(@Context final HttpServletRequest request) {
String result = null;
ServletContext context = request.getSession().getServletContext();
- DesignerStatusBL designerStatusBL = (DesignerStatusBL) context.getAttribute(Constants.DESIGNER_BL_COMPONENT);
+ PluginStatusBL pluginStatusBL = (PluginStatusBL) context.getAttribute(Constants.PLUGIN_BL_COMPONENT);
- result = designerStatusBL.checkDesignerListAvailability();
+ result = pluginStatusBL.checkPluginsListAvailability();
return Response.status(Status.OK).entity(result).build();