<parent>
<groupId>org.onap.aai.resources</groupId>
<artifactId>resources</artifactId>
- <version>1.15.2-SNAPSHOT</version>
+ <version>1.15.3-SNAPSHOT</version>
</parent>
<properties>
<java.version>11</java.version>
<docker.push.registry>localhost:5000</docker.push.registry>
<aai.docker.version>1.0.0</aai.docker.version>
- <netty.handler.version>4.1.63.Final</netty.handler.version>
- <netty.version>4.1.63.Final</netty.version>
<groovy.version>2.5.15</groovy.version>
<!--
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-jersey2</artifactId>
- </dependency>
- <dependency>
- <groupId>javax.jms</groupId>
- <artifactId>javax.jms-api</artifactId>
- <version>2.0.1</version>
+ <version>1.8.13</version>
</dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
- <!-- eelf dependency -->
- <dependency>
- <groupId>com.att.eelf</groupId>
- <artifactId>eelf-core</artifactId>
- </dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-handler</artifactId>
- <version>${netty.handler.version}</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-all</artifactId>
- <version>${netty.version}</version>
</dependency>
<!-- Only used for the WebTestClient -->
package org.onap.aai.TenantIsolation;
-import com.att.eelf.configuration.Configuration;
-
import java.io.BufferedReader;
import java.io.File;
import java.io.FileFilter;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
-import java.util.Properties;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.comparator.LastModifiedFileComparator;
import org.onap.aai.logging.ErrorLogHelper;
import org.onap.aai.util.AAIConfig;
import org.onap.aai.util.AAIConstants;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.PropertySource;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
+import lombok.extern.slf4j.Slf4j;
+
/**
* DataImportTasks
*
*/
+@Slf4j
@Component
@PropertySource(value="file:${server.local.startpath}/etc/appprops/datatoolscrons.properties", ignoreResourceNotFound=true)
public class DataImportTasks {
- private static final Logger LOGGER;
private SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm:ss");
private static final List<String> EXTS = Arrays.asList("tar.gz", "tgz");
- static {
- Properties props = System.getProperties();
- props.setProperty(Configuration.PROPERTY_LOGGING_FILE_NAME, AAIConstants.AAI_LOGBACK_PROPS);
- props.setProperty(Configuration.PROPERTY_LOGGING_FILE_PATH, AAIConstants.AAI_HOME_BUNDLECONFIG);
- LOGGER = LoggerFactory.getLogger(DataImportTasks.class);
- }
-
/**
* Scheduled task to invoke importTask
*/
public void importTask() throws AAIException, Exception {
if (AAIConfig.get("aai.dataimport.enable").equalsIgnoreCase("false")) {
- LOGGER.info("Data Import is not enabled");
+ log.info("Data Import is not enabled");
return;
}
// Check if the process was started via command line
if (isDataImportRunning()) {
- LOGGER.info("There is a dataImport process already running");
+ log.info("There is a dataImport process already running");
return;
}
- LOGGER.info("Started importTask: " + dateFormat.format(new Date()));
+ log.info("Started importTask: " + dateFormat.format(new Date()));
String inputLocation = AAIConstants.AAI_HOME_BUNDLECONFIG + AAIConfig.get("aai.dataimport.input.location");
/**
* The isDataImportRunning method, checks if the data import task was started separately via command line
- *
+ *
* @return true if another process is running, false if not
*/
private static boolean isDataImportRunning() {
}
int exitVal = process.waitFor();
- LOGGER.info("Check if dataImport is running returned: " + exitVal);
+ log.info("Check if dataImport is running returned: " + exitVal);
} catch (Exception e) {
ErrorLogHelper.logError("AAI_8002",
"Exception while running the check to see if dataImport is running " + e.getMessage());
- LOGGER.info("Exception while running the check to see if dataImport is running " + e.getMessage());
+ log.info("Exception while running the check to see if dataImport is running " + e.getMessage());
}
if (count > 0) {
File[] allFilesArr = targetDirFile.listFiles((FileFilter) FileFileFilter.FILE);
if (allFilesArr == null || allFilesArr.length == 0) {
ErrorLogHelper.logError("AAI_8001", "Unable to find payload file at " + targetDir);
- LOGGER.info("Unable to find payload at " + targetDir);
+ log.info("Unable to find payload at " + targetDir);
return null;
}
if (allFilesArr.length > 1) {
/**
* The deletePayload method deletes all the payload files that it finds at targetDirectory
- *
+ *
* @param targetDirFile the directory that contains payload files
* @throws AAIException
*/
File[] allFilesArr = targetDirFile.listFiles((FileFilter) DirectoryFileFilter.DIRECTORY);
if (allFilesArr == null || allFilesArr.length == 0) {
- LOGGER.info("No payload files found at " + targetDirFile.getPath());
+ log.info("No payload files found at " + targetDirFile.getPath());
return;
}
for (File f : allFilesArr) {
FileUtils.deleteDirectory(f);
} catch (IOException e) {
- LOGGER.info("Unable to delete directory " + f.getAbsolutePath() + " " + e.getMessage());
+ log.info("Unable to delete directory " + f.getAbsolutePath() + " " + e.getMessage());
}
}
/**
* The isDataImportRunning method, checks if the data import task was started separately via command line
- *
+ *
* @return true if another process is running, false if not
*/
private static boolean unpackPayloadFile(String payLoadFileName) {
process =
new ProcessBuilder().command("bash", "-c", "gzip –d < " + payLoadFileName + " | tar xf -").start();
int exitVal = process.waitFor();
- LOGGER.info("gzip -d returned: " + exitVal);
+ log.info("gzip -d returned: " + exitVal);
} catch (Exception e) {
ErrorLogHelper.logError("AAI_8002", "Exception while running the unzip " + e.getMessage());
- LOGGER.info("Exception while running the unzip " + e.getMessage());
+ log.info("Exception while running the unzip " + e.getMessage());
return false;
}
/*
* if (payLoadFileName.indexOf(".") > 0)
* payLoadFileName = payLoadFileName.substring(0, payLoadFileName.lastIndexOf("."));
- *
+ *
* try {
* process = new ProcessBuilder().command("bash", "-c", "tar xf " + payLoadFileName).start();
* int exitVal = process.waitFor();
- * LOGGER.info("tar xf returned: " + exitVal);
+ * log.info("tar xf returned: " + exitVal);
* } catch (Exception e) {
* ErrorLogHelper.logError("AAI_8002", "Exception while running the tar xf "+ e.getMessage());
- * LOGGER.info("Exception while running the tar xf "+ e.getMessage());
+ * log.info("Exception while running the tar xf "+ e.getMessage());
* return false;
* }
*/
/**
* The runAddManualDataScript method runs a shell script/command with a variable number of arguments
- *
+ *
* @param script The script/command arguments
*/
private static void runAddManualDataScript(String... script) {
try {
process = new ProcessBuilder().command(script).start();
int exitVal = process.waitFor();
- LOGGER.info("addManualData.sh returned: " + exitVal);
+ log.info("addManualData.sh returned: " + exitVal);
} catch (Exception e) {
ErrorLogHelper.logError("AAI_8002", "Exception while running addManualData.sh " + e.getMessage());
- LOGGER.info("Exception while running addManualData.sh" + e.getMessage());
+ log.info("Exception while running addManualData.sh" + e.getMessage());
}
}
package org.onap.aai.config;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import org.springframework.core.env.MapPropertySource;
import org.springframework.core.env.PropertySource;
+import lombok.extern.slf4j.Slf4j;
+
+@Slf4j
public class PropertyPasswordConfiguration implements ApplicationContextInitializer<ConfigurableApplicationContext> {
private static final Pattern decodePasswordPattern = Pattern.compile("password\\((.*?)\\)");
private PasswordDecoder passwordDecoder = new JettyPasswordDecoder();
- private static final EELFLogger logger = EELFManager.getLogger(PropertyPasswordConfiguration.class.getName());
@Override
public void initialize(ConfigurableApplicationContext applicationContext) {
sslProps.put("server.ssl.key-store-password", keystorePassword);
sslProps.put("schema.service.ssl.key-store-password", keystorePassword);
} else {
- logger.info("Not using AAF Certman password file");
+ log.info("Not using AAF Certman password file");
}
} catch (IOException e) {
- logger.warn("Not using AAF Certman password file, e=" + e.getMessage());
+ log.warn("Not using AAF Certman password file, e=" + e.getMessage());
} finally {
if (passwordStream != null) {
try {
sslProps.put("server.ssl.trust-store-password", truststorePassword);
sslProps.put("schema.service.ssl.trust-store-password", truststorePassword);
} else {
- logger.info("Not using AAF Certman passphrases file");
+ log.info("Not using AAF Certman passphrases file");
}
} catch (IOException e) {
- logger.warn("Not using AAF Certman passphrases file, e=" + e.getMessage());
+ log.warn("Not using AAF Certman passphrases file, e=" + e.getMessage());
} finally {
if (passphrasesStream != null) {
try {
}
if (!sslProps.isEmpty()) {
- logger.info("Using AAF Certman files");
+ log.info("Using AAF Certman files");
PropertySource<?> additionalProperties = new MapPropertySource("additionalProperties", sslProps);
environment.getPropertySources().addFirst(additionalProperties);
}