X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=BRMSGateway%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fpolicy%2Fbrms%2Fapi%2FBrmsPush.java;h=ee94c6f96f3c546fdb225a47f02af3c9947f3dce;hb=068d0f8fe17d13e4f3000b1c9033675068e5532e;hp=a48aac04e3be8e2b1961f56ff184672b516da520;hpb=d5f95d08ffd3f2e16b67aadae7007c7a51dfae19;p=policy%2Fengine.git diff --git a/BRMSGateway/src/main/java/org/onap/policy/brms/api/BrmsPush.java b/BRMSGateway/src/main/java/org/onap/policy/brms/api/BrmsPush.java index a48aac04e..ee94c6f96 100644 --- a/BRMSGateway/src/main/java/org/onap/policy/brms/api/BrmsPush.java +++ b/BRMSGateway/src/main/java/org/onap/policy/brms/api/BrmsPush.java @@ -4,6 +4,7 @@ * ================================================================================ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. * Modified Copyright (C) 2018 Samsung Electronics Co., Ltd. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -59,7 +60,7 @@ import javax.persistence.Persistence; import javax.persistence.TypedQuery; import javax.ws.rs.ProcessingException; import org.apache.commons.io.FileUtils; -import org.apache.commons.lang.StringEscapeUtils; +import org.apache.commons.lang3.StringEscapeUtils; import org.apache.maven.model.Dependency; import org.apache.maven.model.DeploymentRepository; import org.apache.maven.model.DistributionManagement; @@ -95,8 +96,8 @@ import org.onap.policy.utils.PolicyUtils; import org.onap.policy.xacml.api.XACMLErrorConstants; /** - * BRMSPush: Application responsible to push policies to the BRMS PDP Policy Repository (PR). Mavenize and push policy - * to PR + * BRMSPush: Application responsible to push policies to the BRMS PDP Policy Repository (PR). + * Mavenize and push policy to PR * * @version 1.0 */ @@ -106,7 +107,7 @@ public class BrmsPush { private static final String DROOLS_APPS_TEMPLATE_GROUP = "org.onap.policy.drools-applications.controlloop.templates"; private static final String DROOLS_APPS_MODEL_GROUP = - "org.onap.policy.drools-applications.controlloop.common.model-impl"; + "org.onap.policy.models.policy-models-interactions.model-impl"; private static final String META_INF = "META-INF"; private static final String KMODULE_XML_FILE = "kmodule.xml"; private static final String POM_XML_FILE = "pom.xml"; @@ -115,8 +116,8 @@ public class BrmsPush { private static final String RESOURCES = "resources"; private static final Logger LOGGER = FlexLogger.getLogger(BrmsPush.class.getName()); private static final String PROJECTSLOCATION = "RuleProjects"; - private static final String[] GOALS = { "clean", "deploy" }; - private static final String DEFAULT_VERSION = "1.4.0-SNAPSHOT"; + private static final String[] GOALS = {"clean", "deploy"}; + private static final String DEFAULT_VERSION = "1.6.1-SNAPSHOT"; private static final String DEPENDENCY_FILE = "dependency.json"; private static final String PROP_AES_KEY = "org.onap.policy.encryption.aes.key"; public static final String BRMSPERSISTENCE = "brmsEclipselink.persistencexml"; @@ -255,8 +256,8 @@ public class BrmsPush { repUrlList = new ArrayList<>(); repUrlList.add(repUrl); } - repUserName = config.getProperty("repositoryUsername"); - repPassword = PeCryptoUtils.decrypt(config.getProperty("repositoryPassword")); + repUserName = getValue(config.getProperty("repositoryUsername")); + repPassword = PeCryptoUtils.decrypt(getValue(config.getProperty("repositoryPassword"))); if (repUserName == null || repPassword == null) { LOGGER.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "repostoryUserName and respositoryPassword properties are required."); @@ -366,6 +367,13 @@ public class BrmsPush { } + private String getValue(final String value) { + if (value != null && value.matches("[$][{].*[}]$")) { + return System.getenv(value.substring(2, value.length() - 1)); + } + return value; + } + private static void setBackupMonitor(final BackUpMonitor instance) { bm = instance; } @@ -1048,12 +1056,6 @@ public class BrmsPush { msoDependency.setArtifactId("controlloop.common.model-impl.so"); msoDependency.setVersion(version); dependencyList.add(msoDependency); - - final Dependency trafficgeneratorDependency = new Dependency(); - trafficgeneratorDependency.setGroupId(DROOLS_APPS_MODEL_GROUP); - trafficgeneratorDependency.setArtifactId("controlloop.common.model-impl.trafficgenerator"); - trafficgeneratorDependency.setVersion(version); - dependencyList.add(trafficgeneratorDependency); return dependencyList; } @@ -1089,7 +1091,7 @@ public class BrmsPush { if (config.getProperty(GROUP_NAMES).contains(",")) { groupNames = config.getProperty(GROUP_NAMES).replaceAll(" ", "").split(","); } else { - groupNames = new String[] { config.getProperty(GROUP_NAMES).replaceAll(" ", "") }; + groupNames = new String[] {config.getProperty(GROUP_NAMES).replaceAll(" ", "")}; } if (groupNames == null || groupNames.length == 0) { LOGGER.error(XACMLErrorConstants.ERROR_DATA_ISSUE + groupNamesError);