* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
import org.apache.maven.shared.invoker.InvocationResult;
import org.apache.maven.shared.invoker.Invoker;
import org.codehaus.plexus.util.IOUtil;
import org.apache.maven.shared.invoker.InvocationResult;
import org.apache.maven.shared.invoker.Invoker;
import org.codehaus.plexus.util.IOUtil;
import org.codehaus.plexus.util.WriterFactory;
import org.eclipse.persistence.config.PersistenceUnitProperties;
import org.onap.policy.api.PEDependency;
import org.codehaus.plexus.util.WriterFactory;
import org.eclipse.persistence.config.PersistenceUnitProperties;
import org.onap.policy.api.PEDependency;
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 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.3.0-SNAPSHOT";
+ private static final String[] GOALS = { "clean", "deploy" };
+ private static final String DEFAULT_VERSION = "1.4.0-SNAPSHOT";
private static final String DEPENDENCY_FILE = "dependency.json";
private static final String BRMSPERSISTENCE = "brmsEclipselink.persistencexml";
private static final String DEPENDENCY_FILE = "dependency.json";
private static final String BRMSPERSISTENCE = "brmsEclipselink.persistencexml";
* @param propertiesFile the properties file
* @param handler the {@link BackUpHandler}
* @throws PolicyException PolicyException related to the operation
* @param propertiesFile the properties file
* @param handler the {@link BackUpHandler}
* @throws PolicyException PolicyException related to the operation
uebList = uebList.trim();
pubTopic = pubTopic.trim();
pubBuilder = new CambriaClientBuilders.PublisherBuilder();
uebList = uebList.trim();
pubTopic = pubTopic.trim();
pubBuilder = new CambriaClientBuilders.PublisherBuilder();
String apiKey = config.getProperty("UEB_API_KEY");
String apiSecret = config.getProperty("UEB_API_SECRET");
if (apiKey != null && !apiKey.isEmpty() && apiSecret != null && !apiSecret.isEmpty()) {
String apiKey = config.getProperty("UEB_API_KEY");
String apiSecret = config.getProperty("UEB_API_SECRET");
if (apiKey != null && !apiKey.isEmpty() && apiSecret != null && !apiSecret.isEmpty()) {
final ArrayList<PEDependency> userDependencies = new ArrayList<>();
for (final Map.Entry<String, String> entry : responseAttributes.entrySet()) {
final String key = entry.getKey();
final ArrayList<PEDependency> userDependencies = new ArrayList<>();
for (final Map.Entry<String, String> entry : responseAttributes.entrySet()) {
final String key = entry.getKey();
String userControllerName = null;
// Check User Specific values.
try {
final PEDependency dependency = PolicyUtils.jsonStringToObject(value, PEDependency.class);
userControllerName = key.replaceFirst("$controller:", "");
String userControllerName = null;
// Check User Specific values.
try {
final PEDependency dependency = PolicyUtils.jsonStringToObject(value, PEDependency.class);
userControllerName = key.replaceFirst("$controller:", "");
addToGroup(userControllerName, dependency);
} catch (final Exception e) {
LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error while resolving Controller: " + e);
addToGroup(userControllerName, dependency);
} catch (final Exception e) {
LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error while resolving Controller: " + e);
- private void updateUserDependencies(ArrayList<PEDependency> userDependencies, String value) {
- //update the user dependencies supplied as parameter to this method
+ private void updateUserDependencies(final ArrayList<PEDependency> userDependencies, String value) {
+ // update the user dependencies supplied as parameter to this method
value = value.substring(1, value.length() - 1).trim();
final List<String> dependencyStrings = Arrays.asList(value.split(Pattern.quote("},{")));
for (final String dependencyString : dependencyStrings) {
try {
userDependencies.add(PolicyUtils.jsonStringToObject(dependencyString, PEDependency.class));
} catch (final Exception e) {
value = value.substring(1, value.length() - 1).trim();
final List<String> dependencyStrings = Arrays.asList(value.split(Pattern.quote("},{")));
for (final String dependencyString : dependencyStrings) {
try {
userDependencies.add(PolicyUtils.jsonStringToObject(dependencyString, PEDependency.class));
} catch (final Exception e) {
- private void parseJarContents(String artifactId, JarFile jar, Enumeration<?> enumEntries) {
+ private void parseJarContents(final String artifactId, final JarFile jar, final Enumeration<?> enumEntries) {
final JarEntry jarEntry = (JarEntry) enumEntries.nextElement();
File file = null;
final String fileName = jarEntry.getName().substring(jarEntry.getName().lastIndexOf("/") + 1);
if (jarEntry.getName().endsWith(".drl")) {
final JarEntry jarEntry = (JarEntry) enumEntries.nextElement();
File file = null;
final String fileName = jarEntry.getName().substring(jarEntry.getName().lastIndexOf("/") + 1);
if (jarEntry.getName().endsWith(".drl")) {
- final String path = PROJECTSLOCATION + File.separator + artifactId + File.separator + "src"
- + File.separator + "main" + File.separator + RESOURCES + File.separator + RULES;
+ final String path = PROJECTSLOCATION + File.separator + artifactId + File.separator + "src" + File.separator
+ + "main" + File.separator + RESOURCES + File.separator + RULES;
new File(path).mkdirs();
if (syncFlag && policyMap.containsKey(fileName.replace(".drl", ""))) {
file = new File(path + File.separator + fileName);
new File(path).mkdirs();
if (syncFlag && policyMap.containsKey(fileName.replace(".drl", ""))) {
file = new File(path + File.separator + fileName);
new File(path).mkdirs();
file = new File(path + File.separator + fileName);
} else if (jarEntry.getName().endsWith(KMODULE_XML_FILE)) {
new File(path).mkdirs();
file = new File(path + File.separator + fileName);
} else if (jarEntry.getName().endsWith(KMODULE_XML_FILE)) {
- final String path = PROJECTSLOCATION + File.separator + artifactId + File.separator + "src"
- + File.separator + "main" + File.separator + RESOURCES + File.separator + META_INF;
+ final String path = PROJECTSLOCATION + File.separator + artifactId + File.separator + "src" + File.separator
+ + "main" + File.separator + RESOURCES + File.separator + META_INF;
* @throws PolicyException PolicyException related to the operation
*/
public void pushRules() throws PolicyException {
* @throws PolicyException PolicyException related to the operation
*/
public void pushRules() throws PolicyException {
if (config.getProperty(GROUP_NAMES).contains(",")) {
groupNames = config.getProperty(GROUP_NAMES).replaceAll(" ", "").split(",");
} else {
if (config.getProperty(GROUP_NAMES).contains(",")) {
groupNames = config.getProperty(GROUP_NAMES).replaceAll(" ", "").split(",");
} else {
}
if (groupNames == null || groupNames.length == 0) {
LOGGER.error(XACMLErrorConstants.ERROR_DATA_ISSUE + groupNamesError);
}
if (groupNames == null || groupNames.length == 0) {
LOGGER.error(XACMLErrorConstants.ERROR_DATA_ISSUE + groupNamesError);