diff options
-rw-r--r-- | etc/log4j.xml | 20 | ||||
-rw-r--r-- | pom.xml | 30 | ||||
-rw-r--r-- | src/main/java/org/openecomp/dcae/commonFunction/EventProcessor.java | 7 | ||||
-rw-r--r-- | src/main/java/org/openecomp/dcae/commonFunction/VESLogger.java | 2 | ||||
-rw-r--r-- | 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 @@ <layout class="com.att.nsa.logging.log4j.EcompLayout"><param name="ConversionPattern" value="ECOMP_DEBUG" /></layout> </appender> - - <root> - <level value="DEBUG" /> - <appender-ref ref="FILE" /> - <appender-ref ref="CONSOLE" /> - <appender-ref ref="ECOMP_AUDIT" /> - <appender-ref ref="ECOMP_DEBUG" /> - <appender-ref ref="ECOMP_ERROR" /> - </root> - <logger name="org.openecomp.dcae.commonFunction.input" additivity="false"> <level value="INFO"/> <appender-ref ref="IFILE"/> @@ -169,5 +159,15 @@ <appender-ref ref="FILE" /> <appender-ref ref="CONSOLE" /> </logger> + + + <root> + <level value="DEBUG" /> + <appender-ref ref="FILE" /> + <appender-ref ref="CONSOLE" /> + <appender-ref ref="ECOMP_AUDIT" /> + <appender-ref ref="ECOMP_DEBUG" /> + <appender-ref ref="ECOMP_ERROR" /> + </root> </log4j:configuration> @@ -90,14 +90,14 @@ <dependency> <groupId>com.att.nsa</groupId> <artifactId>nsaServerLibrary</artifactId> - <version>1.0.10</version> - </dependency> + <version>1.0.10</version> </dependency> + <!--<dependency> <groupId>com.att.nsa</groupId> <artifactId>saToolkit</artifactId> <version>1.1.3</version> - </dependency> --> + </dependency> --> <dependency> <groupId>org.slf4j</groupId> @@ -117,9 +117,17 @@ <artifactId>json</artifactId> <version>20160810</version> </dependency> + + <dependency> + <groupId>commons-configuration</groupId> + <artifactId>commons-configuration</artifactId> + <version>1.10</version> + </dependency> + </dependencies> + <!-- <repositories> <repository> <id>external-repository</id> @@ -127,7 +135,6 @@ </repository> </repositories> --> - <build> <pluginManagement> <plugins> @@ -500,7 +507,8 @@ </plugin> <!-- blackduck maven plugin --> - <!-- <plugin> + <!-- + <plugin> <groupId>com.blackducksoftware.integration</groupId> <artifactId>hub-maven-plugin</artifactId> <version>1.4.0</version> @@ -581,9 +589,10 @@ <artifactId>maven-site-plugin</artifactId> </plugin> - <!-- <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>findbugs-maven-plugin</artifactId> + <!-- + <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>findbugs-maven-plugin</artifactId> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-checkstyle-plugin</artifactId> - </plugin> --> + </plugin> --> <plugin> <groupId>org.sonatype.plugins</groupId> @@ -597,13 +606,17 @@ </configuration> </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>sonar-maven-plugin</artifactId> + </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> <version>3.0.0</version> - <executions> + <executions> <execution> <id>copy</id> <phase>compile</phase> @@ -615,7 +628,6 @@ <artifactItem> <groupId>org.openecomp.dcae.controller</groupId> <artifactId>dcae-controller-service-standardeventcollector-manager</artifactId> - <version>${project.version}</version> <type>zip</type> <classifier>runtime</classifier> 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") |