aboutsummaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/docker/Dockerfile11
-rw-r--r--src/main/java/org/onap/clamp/clds/client/DcaeInventoryServices.java8
-rw-r--r--src/main/java/org/onap/clamp/clds/config/CamelConfiguration.java15
-rw-r--r--src/main/java/org/onap/clamp/clds/model/CldsDictionary.java5
-rw-r--r--src/main/java/org/onap/clamp/clds/model/CldsDictionaryItem.java4
-rw-r--r--src/main/java/org/onap/clamp/clds/model/dcae/DcaeInventoryResponse.java5
-rw-r--r--src/main/java/org/onap/clamp/clds/model/sdc/SdcArtifact.java5
-rw-r--r--src/main/java/org/onap/clamp/clds/model/sdc/SdcResource.java20
-rw-r--r--src/main/java/org/onap/clamp/clds/model/sdc/SdcResourceBasicInfo.java27
-rw-r--r--src/main/java/org/onap/clamp/clds/model/sdc/SdcServiceDetail.java25
-rw-r--r--src/main/java/org/onap/clamp/clds/util/JsonUtils.java44
-rw-r--r--src/main/resources/boot-message.txt16
-rw-r--r--src/main/resources/clds/templates/globalProperties.json2
13 files changed, 87 insertions, 100 deletions
diff --git a/src/main/docker/Dockerfile b/src/main/docker/Dockerfile
index 44e280943..983dea7da 100644
--- a/src/main/docker/Dockerfile
+++ b/src/main/docker/Dockerfile
@@ -15,10 +15,19 @@ RUN test -n "$http_proxy" && echo "Acquire::Proxy \"http://$http_proxy\";" > /et
apt-get -y dist-upgrade && \
apt-get install -y openjdk-8-jre-headless
+RUN groupadd -r onap && useradd --no-log-init -r -g onap clamp
+VOLUME /opt/clamp/config
+RUN mkdir /var/log/onap
+RUN chmod a+rwx /var/log/onap
+
COPY onap-clamp/clamp.jar /opt/clamp/app.jar
-VOLUME /etc
+RUN chmod 700 /opt/clamp/app.jar
+
COPY onap-clamp/startService.sh /opt/clamp/startService.sh
RUN chmod 700 /opt/clamp/startService.sh
+RUN chown -R clamp:onap /opt/clamp
+
+USER clamp
WORKDIR /opt/clamp/
ENTRYPOINT ./startService.sh
diff --git a/src/main/java/org/onap/clamp/clds/client/DcaeInventoryServices.java b/src/main/java/org/onap/clamp/clds/client/DcaeInventoryServices.java
index 770230784..e5ef3c67b 100644
--- a/src/main/java/org/onap/clamp/clds/client/DcaeInventoryServices.java
+++ b/src/main/java/org/onap/clamp/clds/client/DcaeInventoryServices.java
@@ -26,7 +26,6 @@ package org.onap.clamp.clds.client;
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
-import com.fasterxml.jackson.core.JsonProcessingException;
import java.io.IOException;
import java.util.Date;
@@ -83,7 +82,7 @@ public class DcaeInventoryServices {
* @throws ParseException
* In case of DCAE Json parse exception
*/
- public void setEventInventory(CldsModel cldsModel, String userId) throws ParseException, InterruptedException {
+ public void setEventInventory(CldsModel cldsModel, String userId) throws InterruptedException {
String artifactName = cldsModel.getControlName();
DcaeEvent dcaeEvent = new DcaeEvent();
DcaeInventoryResponse dcaeResponse = null;
@@ -109,7 +108,7 @@ public class DcaeInventoryServices {
dcaeEvent.setArtifactName(artifactName);
dcaeEvent.setEvent(DcaeEvent.EVENT_DISTRIBUTION);
LoggingUtils.setResponseContext("0", "Set inventory success", this.getClass().getName());
- } catch (JsonProcessingException e) {
+ } catch (ParseException e) {
LoggingUtils.setResponseContext("900", "Set inventory failed", this.getClass().getName());
LoggingUtils.setErrorContext("900", "Set inventory error");
logger.error("Error during JSON decoding", e);
@@ -154,8 +153,7 @@ public class DcaeInventoryServices {
return totalCount.intValue();
}
- private DcaeInventoryResponse getItemsFromDcaeInventoryResponse(String responseStr)
- throws ParseException {
+ private DcaeInventoryResponse getItemsFromDcaeInventoryResponse(String responseStr) throws ParseException {
JSONParser parser = new JSONParser();
Object obj0 = parser.parse(responseStr);
JSONObject jsonObj = (JSONObject) obj0;
diff --git a/src/main/java/org/onap/clamp/clds/config/CamelConfiguration.java b/src/main/java/org/onap/clamp/clds/config/CamelConfiguration.java
index c80fd0ec0..45c945c4f 100644
--- a/src/main/java/org/onap/clamp/clds/config/CamelConfiguration.java
+++ b/src/main/java/org/onap/clamp/clds/config/CamelConfiguration.java
@@ -31,13 +31,12 @@ public class CamelConfiguration extends RouteBuilder {
@Override
public void configure() {
- restConfiguration().component("servlet").bindingMode(RestBindingMode.json)
- .dataFormatProperty("prettyPrint", "true")//.enableCORS(true)
- // turn on swagger api-doc
- .apiContextPath("api-doc")
- .apiVendorExtension(true)
- .apiProperty("api.title", "Clamp Rest API").apiProperty("api.version", ClampVersioning.getCldsVersionFromProps())
- .apiProperty("base.path", "/restservices/clds/v1/");
- //.apiProperty("cors", "true");
+ restConfiguration().component("servlet").bindingMode(RestBindingMode.json).jsonDataFormat("json-gson")
+ .dataFormatProperty("prettyPrint", "true")// .enableCORS(true)
+ // turn on swagger api-doc
+ .apiContextPath("api-doc").apiVendorExtension(true).apiProperty("api.title", "Clamp Rest API")
+ .apiProperty("api.version", ClampVersioning.getCldsVersionFromProps())
+ .apiProperty("base.path", "/restservices/clds/v1/");
+ // .apiProperty("cors", "true");
}
}
diff --git a/src/main/java/org/onap/clamp/clds/model/CldsDictionary.java b/src/main/java/org/onap/clamp/clds/model/CldsDictionary.java
index a9b003d4d..73f959008 100644
--- a/src/main/java/org/onap/clamp/clds/model/CldsDictionary.java
+++ b/src/main/java/org/onap/clamp/clds/model/CldsDictionary.java
@@ -23,9 +23,6 @@
package org.onap.clamp.clds.model;
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonInclude.Include;
-
import java.util.ArrayList;
import java.util.List;
@@ -34,7 +31,7 @@ import org.onap.clamp.clds.dao.CldsDao;
/**
* Represents a CLDS Dictionary.
*/
-@JsonInclude(Include.NON_NULL)
+
public class CldsDictionary {
private String dictionaryId;
diff --git a/src/main/java/org/onap/clamp/clds/model/CldsDictionaryItem.java b/src/main/java/org/onap/clamp/clds/model/CldsDictionaryItem.java
index 87ba9fe84..cb051b810 100644
--- a/src/main/java/org/onap/clamp/clds/model/CldsDictionaryItem.java
+++ b/src/main/java/org/onap/clamp/clds/model/CldsDictionaryItem.java
@@ -23,9 +23,6 @@
package org.onap.clamp.clds.model;
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonInclude.Include;
-
import java.util.List;
import org.onap.clamp.clds.dao.CldsDao;
@@ -33,7 +30,6 @@ import org.onap.clamp.clds.dao.CldsDao;
/**
* Represents a CLDS Dictionary Item.
*/
-@JsonInclude(Include.NON_NULL)
public class CldsDictionaryItem {
private String dictElementId;
diff --git a/src/main/java/org/onap/clamp/clds/model/dcae/DcaeInventoryResponse.java b/src/main/java/org/onap/clamp/clds/model/dcae/DcaeInventoryResponse.java
index 3b1dffa22..74582a865 100644
--- a/src/main/java/org/onap/clamp/clds/model/dcae/DcaeInventoryResponse.java
+++ b/src/main/java/org/onap/clamp/clds/model/dcae/DcaeInventoryResponse.java
@@ -19,17 +19,14 @@
* limitations under the License.
* ============LICENSE_END============================================
* ===================================================================
- *
+ *
*/
package org.onap.clamp.clds.model.dcae;
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-
/**
* This class maps the DCAE inventory answer to a nice pojo.
*/
-@JsonIgnoreProperties(ignoreUnknown = true)
public class DcaeInventoryResponse {
private String typeName;
diff --git a/src/main/java/org/onap/clamp/clds/model/sdc/SdcArtifact.java b/src/main/java/org/onap/clamp/clds/model/sdc/SdcArtifact.java
index b52f6f854..f886ee644 100644
--- a/src/main/java/org/onap/clamp/clds/model/sdc/SdcArtifact.java
+++ b/src/main/java/org/onap/clamp/clds/model/sdc/SdcArtifact.java
@@ -18,14 +18,11 @@
* limitations under the License.
* ============LICENSE_END============================================
* ===================================================================
- *
+ *
*/
package org.onap.clamp.clds.model.sdc;
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-
-@JsonIgnoreProperties(ignoreUnknown = true)
public class SdcArtifact {
private String artifactName;
diff --git a/src/main/java/org/onap/clamp/clds/model/sdc/SdcResource.java b/src/main/java/org/onap/clamp/clds/model/sdc/SdcResource.java
index b9466c4f9..2474da073 100644
--- a/src/main/java/org/onap/clamp/clds/model/sdc/SdcResource.java
+++ b/src/main/java/org/onap/clamp/clds/model/sdc/SdcResource.java
@@ -18,31 +18,29 @@
* limitations under the License.
* ============LICENSE_END============================================
* ===================================================================
- *
+ *
*/
package org.onap.clamp.clds.model.sdc;
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import java.math.BigDecimal;
import java.util.List;
-@JsonIgnoreProperties(ignoreUnknown = true)
public class SdcResource implements Comparable<SdcResource> {
- protected static final EELFLogger logger = EELFManager.getInstance().getLogger(SdcResource.class);
+ protected static final EELFLogger logger = EELFManager.getInstance().getLogger(SdcResource.class);
protected static final EELFLogger metricsLogger = EELFManager.getInstance().getMetricsLogger();
- private String resourceInstanceName;
- private String resourceName;
- private String resourceInvariantUUID;
- private String resourceVersion;
- private String resoucreType;
- private String resourceUuid;
- private List<SdcArtifact> artifacts;
+ private String resourceInstanceName;
+ private String resourceName;
+ private String resourceInvariantUUID;
+ private String resourceVersion;
+ private String resoucreType;
+ private String resourceUuid;
+ private List<SdcArtifact> artifacts;
public String getResourceInstanceName() {
return resourceInstanceName;
diff --git a/src/main/java/org/onap/clamp/clds/model/sdc/SdcResourceBasicInfo.java b/src/main/java/org/onap/clamp/clds/model/sdc/SdcResourceBasicInfo.java
index b75bf4d51..e853621b4 100644
--- a/src/main/java/org/onap/clamp/clds/model/sdc/SdcResourceBasicInfo.java
+++ b/src/main/java/org/onap/clamp/clds/model/sdc/SdcResourceBasicInfo.java
@@ -18,34 +18,31 @@
* limitations under the License.
* ============LICENSE_END============================================
* ===================================================================
- *
+ *
*/
package org.onap.clamp.clds.model.sdc;
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import java.math.BigDecimal;
-@JsonIgnoreProperties(ignoreUnknown = true)
public class SdcResourceBasicInfo implements Comparable<SdcResourceBasicInfo> {
- protected static final EELFLogger logger = EELFManager.getInstance()
- .getLogger(SdcResourceBasicInfo.class);
+ protected static final EELFLogger logger = EELFManager.getInstance().getLogger(SdcResourceBasicInfo.class);
protected static final EELFLogger metricsLogger = EELFManager.getInstance().getMetricsLogger();
- private String uuid;
- private String invariantUUID;
- private String name;
- private String version;
- private String toscaModelURL;
- private String category;
- private String subCategory;
- private String resourceType;
- private String lifecycleState;
- private String lastUpdaterUserId;
+ private String uuid;
+ private String invariantUUID;
+ private String name;
+ private String version;
+ private String toscaModelURL;
+ private String category;
+ private String subCategory;
+ private String resourceType;
+ private String lifecycleState;
+ private String lastUpdaterUserId;
@Override
public int compareTo(SdcResourceBasicInfo in) {
diff --git a/src/main/java/org/onap/clamp/clds/model/sdc/SdcServiceDetail.java b/src/main/java/org/onap/clamp/clds/model/sdc/SdcServiceDetail.java
index e981e2643..e7265ff5d 100644
--- a/src/main/java/org/onap/clamp/clds/model/sdc/SdcServiceDetail.java
+++ b/src/main/java/org/onap/clamp/clds/model/sdc/SdcServiceDetail.java
@@ -18,28 +18,25 @@
* limitations under the License.
* ============LICENSE_END============================================
* ===================================================================
- *
+ *
*/
package org.onap.clamp.clds.model.sdc;
import java.util.List;
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-
-@JsonIgnoreProperties(ignoreUnknown = true)
public class SdcServiceDetail {
- private String uuid;
- private String invariantUUID;
- private String name;
- private String version;
- private String toscaModelURL;
- private String category;
- private String lifecycleState;
- private String lastUpdaterUserId;
- private String distributionStatus;
- private String lastUpdaterFullName;
+ private String uuid;
+ private String invariantUUID;
+ private String name;
+ private String version;
+ private String toscaModelURL;
+ private String category;
+ private String lifecycleState;
+ private String lastUpdaterUserId;
+ private String distributionStatus;
+ private String lastUpdaterFullName;
private List<SdcResource> resources;
private List<SdcArtifact> artifacts;
diff --git a/src/main/java/org/onap/clamp/clds/util/JsonUtils.java b/src/main/java/org/onap/clamp/clds/util/JsonUtils.java
index 96ddc2929..f59864ac0 100644
--- a/src/main/java/org/onap/clamp/clds/util/JsonUtils.java
+++ b/src/main/java/org/onap/clamp/clds/util/JsonUtils.java
@@ -31,6 +31,7 @@ import com.google.gson.GsonBuilder;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonPrimitive;
+
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
@@ -38,12 +39,13 @@ import java.util.Spliterator;
import java.util.Spliterators;
import java.util.stream.Collectors;
import java.util.stream.StreamSupport;
+
import org.onap.clamp.clds.model.properties.AbstractModelElement;
import org.onap.clamp.clds.service.SecureServicePermission;
import org.onap.clamp.clds.service.SecureServicePermissionDeserializer;
/**
- * This class is used to access the jackson with restricted type access.
+ * This class is used to access the GSON with restricted type access.
*/
public class JsonUtils {
@@ -52,19 +54,17 @@ public class JsonUtils {
private static final String LOG_ELEMENT_NOT_FOUND_IN_JSON = "Value '{}' for key 'name' not found in JSON {}";
public static final Gson GSON = new GsonBuilder()
- .registerTypeAdapter(SecureServicePermission.class, new SecureServicePermissionDeserializer())
- .create();
+ .registerTypeAdapter(SecureServicePermission.class, new SecureServicePermissionDeserializer()).create();
private JsonUtils() {
}
-
/**
- * Return the value field of the json node element that has a name field equals to the given name.
+ * Return the value field of the json node element that has a name field equals
+ * to the given name.
*/
public static String getStringValueByName(JsonElement jsonElement, String name) {
- String value = extractJsonValueFromElement(jsonElement, name)
- .map(JsonUtils::extractStringValueFromElement)
+ String value = extractJsonValueFromElement(jsonElement, name).map(JsonUtils::extractStringValueFromElement)
.orElse(null);
if (value == null) {
if (logger.isDebugEnabled()) {
@@ -77,7 +77,8 @@ public class JsonUtils {
}
/**
- * Return an array of values for the field of the json node element that has a name field equals to the given name.
+ * Return an array of values for the field of the json node element that has a
+ * name field equals to the given name.
*/
public static List<String> getStringValuesByName(JsonElement jsonElement, String name) {
List<String> values = extractJsonValueFromElement(jsonElement, name)
@@ -93,21 +94,22 @@ public class JsonUtils {
}
/**
- * Return the int value field of the json node element that has a name field equals to the given name.
+ * Return the int value field of the json node element that has a name field
+ * equals to the given name.
*/
public static Integer getIntValueByName(JsonElement element, String name) {
String value = getStringValueByName(element, name);
return Integer.valueOf(value);
}
-
/**
- * Return the Json value field of the json node element that has a name field equals to the given name.
+ * Return the Json value field of the json node element that has a name field
+ * equals to the given name.
*/
public static JsonObject getJsonObjectByName(JsonElement jsonElement, String name) {
JsonObject jsonObject = extractJsonValueFromElement(jsonElement, name).map(JsonElement::getAsJsonObject)
.orElse(null);
- if (jsonObject == null) {
+ if (jsonObject == null) {
logger.warn(LOG_ELEMENT_NOT_FOUND, name);
} else {
logger.debug(LOG_ELEMENT_NOT_FOUND_IN_JSON, name, jsonElement.toString());
@@ -116,7 +118,7 @@ public class JsonUtils {
}
private static Optional<JsonElement> extractJsonValueFromElement(JsonElement jsonElement, String name) {
- if(jsonElement != null ){
+ if (jsonElement != null) {
if (jsonElement.isJsonArray()) {
return extractValueJsonFromArray(jsonElement, name);
} else if (hasMatchingParameterName(name, jsonElement)) {
@@ -136,8 +138,7 @@ public class JsonUtils {
}
private static boolean hasMatchingParameterName(String name, JsonElement element) {
- return element.isJsonObject()
- && element.getAsJsonObject().has("name")
+ return element.isJsonObject() && element.getAsJsonObject().has("name")
&& name.equals(element.getAsJsonObject().get("name").getAsString());
}
@@ -153,14 +154,11 @@ public class JsonUtils {
private static List<String> extractStringValuesFromElement(JsonElement element) {
if (element.isJsonArray()) {
- return StreamSupport.stream(
- Spliterators.spliteratorUnknownSize(element.getAsJsonArray().iterator(), Spliterator.ORDERED),
- false)
- .filter(JsonElement::isJsonPrimitive)
- .map(JsonElement::getAsJsonPrimitive)
- .filter(JsonPrimitive::isString)
- .map(JsonPrimitive::getAsString)
- .collect(Collectors.toList());
+ return StreamSupport
+ .stream(Spliterators.spliteratorUnknownSize(element.getAsJsonArray().iterator(), Spliterator.ORDERED),
+ false)
+ .filter(JsonElement::isJsonPrimitive).map(JsonElement::getAsJsonPrimitive)
+ .filter(JsonPrimitive::isString).map(JsonPrimitive::getAsString).collect(Collectors.toList());
} else {
String value = extractStringValueFromElement(element);
return Lists.newArrayList(value);
diff --git a/src/main/resources/boot-message.txt b/src/main/resources/boot-message.txt
index eea540beb..92e4ab029 100644
--- a/src/main/resources/boot-message.txt
+++ b/src/main/resources/boot-message.txt
@@ -1,10 +1,14 @@
-╔═╗╔╗╔╔═╗╔═╗ ╔═╗┌─┐┌─┐┌─┐┌┐ ┬ ┌─┐┌┐┌┌─┐┌─┐
-║ ║║║║╠═╣╠═╝ ║ ├─┤└─┐├─┤├┴┐│ ├─┤││││ ├─┤
-╚═╝╝╚╝╩ ╩╩ ╚═╝┴ ┴└─┘┴ ┴└─┘┴─┘┴ ┴┘└┘└─┘┴ ┴
- ╔═╗╦ ╔═╗╔╦╗╔═╗
- ║ ║ ╠═╣║║║╠═╝
- ╚═╝╩═╝╩ ╩╩ ╩╩
+ _____ _ _ __ ____ ____ __ __ ____ __ ____ _ _
+( _ )( \( ) /__\ ( _ \ ( _ \( )( )( _ \( ) (_ _)( \( )
+ )(_)( ) ( /(__)\ )___/ )(_) ))(__)( ) _ < )(__ _)(_ ) (
+(_____)(_)\_)(__)(__)(__) (____/(______)(____/(____)(____)(_)\_)
+ ___ __ __ __ __ ____
+ / __)( ) /__\ ( \/ )( _ \
+ ( (__ )(__ /(__)\ ) ( )___/
+ \___)(____)(__)(__)(_/\/\_)(__)
+
+
:: Starting :: \ No newline at end of file
diff --git a/src/main/resources/clds/templates/globalProperties.json b/src/main/resources/clds/templates/globalProperties.json
index 775ca1d92..985aba17e 100644
--- a/src/main/resources/clds/templates/globalProperties.json
+++ b/src/main/resources/clds/templates/globalProperties.json
@@ -59,7 +59,7 @@
"Restart": "Restart",
"Rebuild": "Rebuild",
"Migrate": "Migrate",
- "HealthCheck": "Health Check",
+ "Health-Check": "Health Check",
"ModifyConfig": "Modify Config",
"VF Module Create":"VF Module Create",
"VF Module Delete":"VF Module Delete",