package org.onap.aai.modelloader.notification;
import java.io.IOException;
+import java.io.InputStream;
import java.nio.file.Files;
-import java.nio.file.Paths;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Properties;
import org.onap.sdc.api.results.IDistributionClientResult;
import org.onap.sdc.utils.DistributionActionResultEnum;
import org.onap.sdc.utils.DistributionStatusEnum;
+import org.springframework.stereotype.Component;
/**
* This class is responsible for publishing the status of actions performed working with artifacts.
*/
+@Component
public class NotificationPublisher {
private static Logger logger = LoggerFactory.getInstance().getLogger(NotificationPublisher.class);
public NotificationPublisher() {
Properties configProperties = new Properties();
- try {
- configProperties.load(Files.newInputStream(Paths.get(ModelLoaderConfig.propertiesFile())));
+ try (InputStream configInputStream = Files.newInputStream(ModelLoaderConfig.propertiesFile())) {
+ configProperties.load(configInputStream);
} catch (IOException e) {
String errorMsg = "Failed to load configuration: " + e.getMessage();
logger.error(ModelLoaderMsgs.DISTRIBUTION_EVENT_ERROR, e, errorMsg);