diff options
5 files changed, 23 insertions, 10 deletions
diff --git a/packages/apex-pdp-package-full/src/main/package/scripts/apexApps.bat b/packages/apex-pdp-package-full/src/main/package/scripts/apexApps.bat index 9798fa545..ad176ce0a 100644 --- a/packages/apex-pdp-package-full/src/main/package/scripts/apexApps.bat +++ b/packages/apex-pdp-package-full/src/main/package/scripts/apexApps.bat @@ -50,12 +50,20 @@ if defined APEX_HOME ( exit /b ) +:: Environment variables for HTTPS +set KEYSTORE=%APEX_HOME%/etc/ssl/policy-keystore" +set KEYSTORE_PASSWD="Pol1cy_0nap" +set TRUSTSTORE=%APEX_HOME%/etc/ssl/policy-truststore" +set TRUSTSTORE_PASSWD="Pol1cy_0nap" + +:: HTTPS parameters +set HTTPS_PARAMETERS=-Djavax.net.ssl.keyStore=%KEYSTORE% -Djavax.net.ssl.keyStorePassword=%KEYSTORE_PASSWD% -Djavax.net.ssl.trustStore=%TRUSTSTORE% -Djavax.net.ssl.trustStorePassword=%TRUSTSTORE_PASSWD% :: script name for output set MOD_SCRIPT_NAME=apexApps :: config for CP apps -SET _CONFIG=-Dlogback.configurationFile=%APEX_HOME%\etc\logback.xml -Dhazelcast.config=%APEX_HOME%\etc\hazelcast.xml -Dhazelcast.mancenter.enabled=false +SET _CONFIG=%HTTPS_PARAMETERS% -Dlogback.configurationFile=%APEX_HOME%\etc\logback.xml -Dhazelcast.config=%APEX_HOME%\etc\hazelcast.xml -Dhazelcast.mancenter.enabled=false :: Maven/APEX version set /p _VERSION=<%APEX_HOME%\etc\app-version.txt diff --git a/packages/apex-pdp-package-full/src/main/package/scripts/apexApps.sh b/packages/apex-pdp-package-full/src/main/package/scripts/apexApps.sh index 52e1f3df9..4c0d0fcdc 100755 --- a/packages/apex-pdp-package-full/src/main/package/scripts/apexApps.sh +++ b/packages/apex-pdp-package-full/src/main/package/scripts/apexApps.sh @@ -33,7 +33,6 @@ ## DO NOT CHANGE CODE BELOW, unless you know what you are doing ## - if [ -z $APEX_HOME ] then APEX_HOME="/opt/app/policy/apex-pdp" @@ -47,6 +46,14 @@ then exit fi +## Environment variables for HTTPS +KEYSTORE="${APEX_HOME}/etc/ssl/policy-keystore" +KEYSTORE_PASSWD="Pol1cy_0nap" +TRUSTSTORE="${APEX_HOME}/etc/ssl/policy-truststore" +TRUSTSTORE_PASSWD="Pol1cy_0nap" + +## HTTPS parameters +HTTPS_PARAMETERS="-Djavax.net.ssl.keyStore=${KEYSTORE} -Djavax.net.ssl.keyStorePassword=${KEYSTORE_PASSWD} -Djavax.net.ssl.trustStore=${TRUSTSTORE} -Djavax.net.ssl.trustStorePassword=${TRUSTSTORE_PASSWD}" ## script name for output MOD_SCRIPT_NAME=`basename $0` @@ -60,12 +67,11 @@ if [ "${BASH_VERSION:0:1}" -lt 4 ] ; then fi ## config for CP apps -_config="-Dlogback.configurationFile=$APEX_HOME/etc/logback.xml -Dhazelcast.config=$APEX_HOME/etc/hazelcast.xml -Dhazelcast.mancenter.enabled=false" +_config="${HTTPS_PARAMETERS} -Dlogback.configurationFile=$APEX_HOME/etc/logback.xml -Dhazelcast.config=$APEX_HOME/etc/hazelcast.xml -Dhazelcast.mancenter.enabled=false" ## Maven/APEX version _version=`cat $APEX_HOME/etc/app-version.txt` - ## system to get CygWin paths system=`uname -s | cut -c1-6` cpsep=":" @@ -77,7 +83,6 @@ fi ## CP for CP apps CLASSPATH="$APEX_HOME/etc${cpsep}$APEX_HOME/etc/hazelcast${cpsep}$APEX_HOME/etc/infinispan${cpsep}$APEX_HOME/lib/*" - ## array of applications with name=command declare -A APEX_APP_MAP APEX_APP_MAP["ws-console"]="java -jar $APEX_HOME/lib/applications/simple-wsclient-$_version-jar-with-dependencies.jar -c" diff --git a/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/handler/ApexEngineHandler.java b/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/handler/ApexEngineHandler.java index 85d666c2b..1c9413020 100644 --- a/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/handler/ApexEngineHandler.java +++ b/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/handler/ApexEngineHandler.java @@ -53,11 +53,11 @@ public class ApexEngineHandler { * @throws ApexStarterException if the apex engine instantiation failed using the properties passed */ - public ApexEngineHandler(final String properties) throws ApexStarterException { + public ApexEngineHandler(final Object properties) throws ApexStarterException { final StandardCoder standardCoder = new StandardCoder(); JsonObject body; try { - body = standardCoder.decode(new StringReader(properties), JsonObject.class); + body = standardCoder.decode(new StringReader(properties.toString()), JsonObject.class); } catch (final CoderException e) { throw new ApexStarterException(e); } diff --git a/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/handler/PdpStateChangeMessageHandler.java b/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/handler/PdpStateChangeMessageHandler.java index 9c53fb196..495bceccd 100644 --- a/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/handler/PdpStateChangeMessageHandler.java +++ b/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/handler/PdpStateChangeMessageHandler.java @@ -97,7 +97,7 @@ public class PdpStateChangeMessageHandler { try { // assumed that the apex policies list contains only one entry. final ApexEngineHandler apexEngineHandler = - new ApexEngineHandler((String) policies.get(0).getProperties().get("content")); + new ApexEngineHandler(policies.get(0).getProperties().get("content")); Registry.registerOrReplace(ApexStarterConstants.REG_APEX_ENGINE_HANDLER, apexEngineHandler); pdpResponseDetails = pdpMessageHandler.createPdpResonseDetails(pdpStateChangeMsg.getRequestId(), PdpResponseStatus.SUCCESS, "Apex engine started. State changed to active."); diff --git a/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/handler/PdpUpdateMessageHandler.java b/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/handler/PdpUpdateMessageHandler.java index 478d1c757..64d465784 100644 --- a/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/handler/PdpUpdateMessageHandler.java +++ b/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/handler/PdpUpdateMessageHandler.java @@ -120,8 +120,8 @@ public class PdpUpdateMessageHandler { if (null != apexEngineHandler && apexEngineHandler.isApexEngineRunning()) { apexEngineHandler.shutdown(); } - apexEngineHandler = new ApexEngineHandler( - (String) pdpUpdateMsg.getPolicies().get(0).getProperties().get("content")); + apexEngineHandler = + new ApexEngineHandler(pdpUpdateMsg.getPolicies().get(0).getProperties().get("content")); Registry.registerOrReplace(ApexStarterConstants.REG_APEX_ENGINE_HANDLER, apexEngineHandler); pdpResponseDetails = pdpMessageHandler.createPdpResonseDetails(pdpUpdateMsg.getRequestId(), PdpResponseStatus.SUCCESS, "Apex engine started and policies are running."); |