summaryrefslogtreecommitdiffstats
path: root/sdnr/wt/apigateway/provider/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'sdnr/wt/apigateway/provider/src/main')
-rw-r--r--sdnr/wt/apigateway/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/apigateway/MyProperties.java17
-rw-r--r--sdnr/wt/apigateway/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/apigateway/SitedocServlet.java73
-rw-r--r--sdnr/wt/apigateway/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/apigateway/TerrainServlet.java72
-rw-r--r--sdnr/wt/apigateway/provider/src/main/resources/org/opendaylight/blueprint/blueprint.xml19
4 files changed, 180 insertions, 1 deletions
diff --git a/sdnr/wt/apigateway/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/apigateway/MyProperties.java b/sdnr/wt/apigateway/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/apigateway/MyProperties.java
index c518cff81..66cbd02e9 100644
--- a/sdnr/wt/apigateway/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/apigateway/MyProperties.java
+++ b/sdnr/wt/apigateway/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/apigateway/MyProperties.java
@@ -46,6 +46,9 @@ public class MyProperties {
private static final String DEFAULT_URL_OFF = "off";
private static final String DEFAULT_TILES = "${TILEURL}";
private static final String DEFAULT_TOPOLOGY = "${TOPOURL}";
+ private static final String DEFAULT_SITEDOC = "${SITEDOCURL}";
+ private static final String DEFAULT_TERRAIN = "${TERRAINURL}";
+
private static MyProperties mObj;
private static final String ENVVARIABLE = "${";
private static final String REGEXENVVARIABLE = "(\\$\\{[A-Z0-9_-]+\\})";
@@ -57,9 +60,10 @@ public class MyProperties {
private String esBase;
private String tilesBase;
private String topologyBase;
+ private String sitedocBase;
+ private String terrainBase;
private boolean trustInsecure;
-
private boolean corsEnabled;
public boolean isAAIOff() {
@@ -93,6 +97,13 @@ public class MyProperties {
public String getTopologyBaseUrl() {
return this.topologyBase;
}
+ public String getSitedocBaseUrl() {
+ return this.sitedocBase;
+ }
+
+ public String getTerrainBaseUrl() {
+ return this.terrainBase;
+ }
public Map<String, String> getAAIHeaders() {
return this.aaiHeaders;
@@ -143,6 +154,8 @@ public class MyProperties {
this.esBase = getProperty(defaultProps,"database", DEFAULT_ESDATABASE);
this.tilesBase = getProperty(defaultProps,"tiles", DEFAULT_TILES, DEFAULT_URL_OFF);
this.topologyBase = getProperty(defaultProps,"topology", DEFAULT_TOPOLOGY, DEFAULT_URL_OFF);
+ this.sitedocBase = getProperty(defaultProps,"sitedoc", DEFAULT_SITEDOC, DEFAULT_URL_OFF);
+ this.terrainBase = getProperty(defaultProps,"terrain", DEFAULT_TERRAIN, DEFAULT_URL_OFF);
this.trustInsecure = Integer.parseInt(getProperty(defaultProps,"insecure", DEFAULT_TRUSTINSECURE)) == 1;
this.corsEnabled = Integer.parseInt(getProperty(defaultProps,"cors", DEFAULT_CORSENABLED)) == 1;
}
@@ -207,6 +220,7 @@ public class MyProperties {
sb.append("database=" + DEFAULT_ESDATABASE + LR);
sb.append("tiles=" + DEFAULT_TILES + LR);
sb.append("topology=" + DEFAULT_TOPOLOGY + LR);
+ sb.append("terrain=" + DEFAULT_TERRAIN + LR);
sb.append("insecure=" + DEFAULT_TRUSTINSECURE + LR);
sb.append("cors=" + DEFAULT_CORSENABLED);
try {
@@ -229,4 +243,5 @@ public class MyProperties {
+ ", trustInsecure=" + trustInsecure + ", corsEnabled=" + corsEnabled + "]";
}
+
}
diff --git a/sdnr/wt/apigateway/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/apigateway/SitedocServlet.java b/sdnr/wt/apigateway/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/apigateway/SitedocServlet.java
new file mode 100644
index 000000000..347dbb0d3
--- /dev/null
+++ b/sdnr/wt/apigateway/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/apigateway/SitedocServlet.java
@@ -0,0 +1,73 @@
+/*
+ * ============LICENSE_START=======================================================
+ * ONAP : CCSDK.apps.sdnr.wt.apigateway
+ * ================================================================================
+ * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property.
+ * All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.ccsdk.features.sdnr.wt.apigateway;
+
+import java.io.IOException;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+public class SitedocServlet extends BaseServlet {
+
+ private static final long serialVersionUID = 5946205120796162644L;
+ private static final String OFFLINE_RESPONSE_MESSAGE = "Topology interface is offline";
+ private static final String BASEURL = "/sitedoc";
+ private static final String SITEDOC_SUBPATH = "/topology/stadok";
+ private static boolean trustAll = false;
+
+ public SitedocServlet() {
+ super();
+ }
+
+ @Override
+ protected void doOptions(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
+ resp.setStatus(200);
+ }
+
+ @Override
+ protected String getOfflineResponse() {
+ return OFFLINE_RESPONSE_MESSAGE;
+ }
+
+ @Override
+ protected boolean isOff() {
+ return MyProperties.getInstance().isTopologyOff();
+ }
+
+ @Override
+ protected String getRemoteUrl(String uri) {
+
+ if (uri != null && uri.length() > 0) {
+ uri = uri.substring(BASEURL.length());
+ }
+ return MyProperties.getInstance().getSitedocBaseUrl() + SITEDOC_SUBPATH + uri;
+ }
+
+ @Override
+ protected boolean doTrustAll() {
+ return trustAll;
+ }
+
+ @Override
+ protected void trustAll(boolean trust) {
+ trustAll = trust;
+ }
+}
diff --git a/sdnr/wt/apigateway/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/apigateway/TerrainServlet.java b/sdnr/wt/apigateway/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/apigateway/TerrainServlet.java
new file mode 100644
index 000000000..12954c647
--- /dev/null
+++ b/sdnr/wt/apigateway/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/apigateway/TerrainServlet.java
@@ -0,0 +1,72 @@
+/*
+ * ============LICENSE_START=======================================================
+ * ONAP : CCSDK.apps.sdnr.wt.apigateway
+ * ================================================================================
+ * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property.
+ * All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.ccsdk.features.sdnr.wt.apigateway;
+
+import java.io.IOException;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+public class TerrainServlet extends BaseServlet {
+
+ private static final long serialVersionUID = 5946205120796162644L;
+ private static final String OFFLINE_RESPONSE_MESSAGE = "Terrain interface is offline";
+ private static final String BASEURL = "/terrain";
+ private static boolean trustAll = false;
+
+ public TerrainServlet() {
+ super();
+ }
+
+ @Override
+ protected void doOptions(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
+ resp.setStatus(200);
+ }
+
+ @Override
+ protected String getOfflineResponse() {
+ return OFFLINE_RESPONSE_MESSAGE;
+ }
+
+ @Override
+ protected boolean isOff() {
+ return MyProperties.getInstance().isTopologyOff();
+ }
+
+ @Override
+ protected String getRemoteUrl(String uri) {
+
+ if (uri != null && uri.length() > 0) {
+ uri = uri.substring(BASEURL.length());
+ }
+ return MyProperties.getInstance().getTerrainBaseUrl() + uri;
+ }
+
+ @Override
+ protected boolean doTrustAll() {
+ return trustAll;
+ }
+
+ @Override
+ protected void trustAll(boolean trust) {
+ trustAll = trust;
+ }
+}
diff --git a/sdnr/wt/apigateway/provider/src/main/resources/org/opendaylight/blueprint/blueprint.xml b/sdnr/wt/apigateway/provider/src/main/resources/org/opendaylight/blueprint/blueprint.xml
index cd325e4dc..37fa4ee9c 100644
--- a/sdnr/wt/apigateway/provider/src/main/resources/org/opendaylight/blueprint/blueprint.xml
+++ b/sdnr/wt/apigateway/provider/src/main/resources/org/opendaylight/blueprint/blueprint.xml
@@ -62,4 +62,23 @@
</service-properties>
</service>
+ <bean id="sitedocServlet"
+ class="org.onap.ccsdk.features.sdnr.wt.apigateway.SitedocServlet">
+ </bean>
+
+ <service interface="javax.servlet.http.HttpServlet" ref="sitedocServlet">
+ <service-properties>
+ <entry key="alias" value="/sitedoc"/>
+ </service-properties>
+ </service>
+
+ <bean id="terrainServlet"
+ class="org.onap.ccsdk.features.sdnr.wt.apigateway.TerrainServlet">
+ </bean>
+
+ <service interface="javax.servlet.http.HttpServlet" ref="terrainServlet">
+ <service-properties>
+ <entry key="alias" value="/terrain"/>
+ </service-properties>
+ </service>
</blueprint>