From 5e759d1a8c83f3ee9d7bcf91249e82ef36dec35a Mon Sep 17 00:00:00 2001 From: "Venkatesh Kumar, Vijay (vv770d)" Date: Wed, 3 May 2017 13:52:30 -0400 Subject: [DCAE-14]VES op format & dynamic config Change-Id: I0ed0cada8c3d6276f8e4adda8ad4451b2222bc76 Signed-off-by: Venkatesh Kumar, Vijay (vv770d) --- etc/log4j.xml | 20 ++++++------ pom.xml | 30 ++++++++++++------ .../dcae/commonFunction/EventProcessor.java | 7 ++-- .../openecomp/dcae/commonFunction/VESLogger.java | 2 +- src/main/scripts/VESrestfulCollector.sh | 37 +++++++++++++++------- 5 files changed, 60 insertions(+), 36 deletions(-) diff --git a/etc/log4j.xml b/etc/log4j.xml index 19023b6..247dbab 100644 --- a/etc/log4j.xml +++ b/etc/log4j.xml @@ -97,16 +97,6 @@ - - - - - - - - - - @@ -169,5 +159,15 @@ + + + + + + + + + + diff --git a/pom.xml b/pom.xml index 18206fa..7f76f77 100644 --- a/pom.xml +++ b/pom.xml @@ -90,14 +90,14 @@ com.att.nsa nsaServerLibrary - 1.0.10 - + 1.0.10 + + --> org.slf4j @@ -117,9 +117,17 @@ json 20160810 + + + commons-configuration + commons-configuration + 1.10 + + + - @@ -500,7 +507,8 @@ - + --> org.sonatype.plugins @@ -597,13 +606,17 @@ + + org.codehaus.mojo + sonar-maven-plugin + org.apache.maven.plugins maven-dependency-plugin 3.0.0 - + copy compile @@ -615,7 +628,6 @@ org.openecomp.dcae.controller dcae-controller-service-standardeventcollector-manager - ${project.version} zip runtime diff --git a/src/main/java/org/openecomp/dcae/commonFunction/EventProcessor.java b/src/main/java/org/openecomp/dcae/commonFunction/EventProcessor.java index a5e90b9..5f27217 100644 --- a/src/main/java/org/openecomp/dcae/commonFunction/EventProcessor.java +++ b/src/main/java/org/openecomp/dcae/commonFunction/EventProcessor.java @@ -69,8 +69,6 @@ public class EventProcessor implements Runnable { //EventPublisher Ep=new EventPublisher(); while (event != null) { // As long as the producer is running we remove elements from the queue. - - //UUID uuid = UUID.fromString(event.get("VESuniqueId").toString()); String uuid = event.get("VESuniqueId").toString(); LoggingContext localLC = VESLogger.getLoggingContextForThread(uuid.toString()); localLC .put ( EcompFields.kBeginTimestampMs, SaClock.now () ); @@ -110,10 +108,9 @@ public class EventProcessor implements Runnable { final SimpleDateFormat sdf = new SimpleDateFormat("EEE, MM dd yyyy hh:mm:ss z"); sdf.setTimeZone(TimeZone.getTimeZone("GMT")); - JSONArray additionalParametersarray = new JSONArray().put(new JSONObject().put("collectorTimeStamp", sdf.format(currentTime))); - JSONObject additionalParameter = new JSONObject().put("additionalParameters",additionalParametersarray ); + JSONObject collectorTimeStamp = new JSONObject().put("collectorTimeStamp",sdf.format(currentTime) ); JSONObject commonEventHeaderkey = event.getJSONObject("event").getJSONObject("commonEventHeader"); - commonEventHeaderkey.put("internalHeaderFields", additionalParameter); + commonEventHeaderkey.put("internalHeaderFields", collectorTimeStamp); event.getJSONObject("event").put("commonEventHeader",commonEventHeaderkey); log.debug("Modified event:" + event); diff --git a/src/main/java/org/openecomp/dcae/commonFunction/VESLogger.java b/src/main/java/org/openecomp/dcae/commonFunction/VESLogger.java index 7a70013..9b16d01 100644 --- a/src/main/java/org/openecomp/dcae/commonFunction/VESLogger.java +++ b/src/main/java/org/openecomp/dcae/commonFunction/VESLogger.java @@ -116,7 +116,7 @@ public class VESLogger { build(); // Establish the request-specific UUID, as long as we are here... threadLC.put("requestId", aUuid); - threadLC.put ( "statusCode", "COMPLETED" ); + threadLC.put ( "statusCode", "COMPLETE" ); threadLC.put ( EcompFields.kEndTimestamp, SaClock.now () ); return threadLC; } diff --git a/src/main/scripts/VESrestfulCollector.sh b/src/main/scripts/VESrestfulCollector.sh index a6d2d27..7935cb9 100644 --- a/src/main/scripts/VESrestfulCollector.sh +++ b/src/main/scripts/VESrestfulCollector.sh @@ -38,16 +38,6 @@ collector_start() { BASEDIR=`dirname $0` cd $BASEDIR/.. - # use JAVA_HOME if provided - if [ -z "$JAVA_HOME" ]; then - echo "ERROR: JAVA_HOME not setup" - echo "Startup Aborted!!" - exit 1 - #JAVA=java - else - JAVA=$JAVA_HOME/bin/java - fi - # run java. The classpath is the etc dir for config files, and the lib dir # for all the jars. nohup $JAVA -cp "etc${PATHSEP}lib/*" $JAVA_OPTS -Dhttps.protocols=TLSv1.1,TLSv1.2 $MAINCLASS $* & @@ -87,9 +77,20 @@ fi ## Pre-setting +# use JAVA_HOME if provided +if [ -z "$JAVA_HOME" ]; then + echo "ERROR: JAVA_HOME not setup" + echo "Startup Aborted!!" + exit 1 + #JAVA=java +else + JAVA=$JAVA_HOME/bin/java +fi + + MAINCLASS=org.openecomp.dcae.commonFunction.CommonStartup -# determin a path separator that works for this platform +# determine a path separator that works for this platform PATHSEP=":" case "$(uname -s)" in @@ -108,6 +109,20 @@ case "$(uname -s)" in esac +if [ -z "$CONSUL_HOST" ] || [ -z "$CONFIG_BINDING_SERVICE" ] || [ -z "$DOCKER_HOST" ]; then + echo "INFO: USING STANDARD CONTROLLER CONFIGURATION" +else + + echo "INFO: DYNAMIC CONFIG INTERFACE SUPPORTED" + CONFIG_UPDATER=org.openecomp.dcae.commonFunction.DynamicPropertyReader + $JAVA -cp "etc${PATHSEP}lib/*" $CONFIG_UPDATER $* + if [ $? -ne 0 ]; then + echo "ERROR: Failed to read dynamic configuration from consul" + else + echo "INFO: Dynamic config updated successfully!" + fi +fi + case $1 in "start") -- cgit 1.2.3-korg