aboutsummaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorDan Timoney <dtimoney@att.com>2021-10-29 14:40:13 -0400
committerDan Timoney <dtimoney@att.com>2021-10-29 15:31:05 -0400
commitfcc85dc1e3c199c72a173dee04c216a17b7e86a7 (patch)
tree0ae58f20a19ef662c2bd8be8ab8990463693a2ff /services
parent012d5a145fa2b04554f53079731062f6c46f2d90 (diff)
Sync local changes to support GRA microservice
Sync changes made downstream to support GRA microservice Issue-ID: CCSDK-3504 Change-Id: I5fd99b978edb9598c5fe38f188635b365ad4e24c Signed-off-by: Dan Timoney <dtimoney@att.com>
Diffstat (limited to 'services')
-rw-r--r--services/src/main/java/org/onap/ccsdk/apps/filters/AuditLogFilter.java3
-rw-r--r--services/src/main/java/org/onap/ccsdk/apps/filters/ContentTypeFilter.java2
-rw-r--r--services/src/main/java/org/onap/ccsdk/apps/filters/PayloadLoggingFilter.java3
-rw-r--r--services/src/main/java/org/onap/ccsdk/apps/services/SvcLogicFactory.java247
4 files changed, 130 insertions, 125 deletions
diff --git a/services/src/main/java/org/onap/ccsdk/apps/filters/AuditLogFilter.java b/services/src/main/java/org/onap/ccsdk/apps/filters/AuditLogFilter.java
index b6d52c52..45ce55f4 100644
--- a/services/src/main/java/org/onap/ccsdk/apps/filters/AuditLogFilter.java
+++ b/services/src/main/java/org/onap/ccsdk/apps/filters/AuditLogFilter.java
@@ -7,7 +7,6 @@ import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.slf4j.MDC;
import org.springframework.stereotype.Component;
-@Component
public class AuditLogFilter extends AuditLogServletFilter {
private static final String MDC_HTTP_METHOD_KEY = "HttpMethod";
@@ -40,4 +39,4 @@ public class AuditLogFilter extends AuditLogServletFilter {
return null;
}
-} \ No newline at end of file
+}
diff --git a/services/src/main/java/org/onap/ccsdk/apps/filters/ContentTypeFilter.java b/services/src/main/java/org/onap/ccsdk/apps/filters/ContentTypeFilter.java
index 20f9ec47..f2f638f6 100644
--- a/services/src/main/java/org/onap/ccsdk/apps/filters/ContentTypeFilter.java
+++ b/services/src/main/java/org/onap/ccsdk/apps/filters/ContentTypeFilter.java
@@ -62,7 +62,7 @@ public class ContentTypeFilter implements Filter {
contentType = "application/json";
} else if ("application/yang-data+xml".equalsIgnoreCase(contentType)) {
contentType = "application/xml";
- } else if (contentType.startsWith("text/plain")) {
+ } else if (contentType.startsWith("text/plain") || contentType.startsWith("*/*")) {
// Use Accept header, if present, to determine content type.
boolean acceptsXml = false;
boolean acceptsJson = false;
diff --git a/services/src/main/java/org/onap/ccsdk/apps/filters/PayloadLoggingFilter.java b/services/src/main/java/org/onap/ccsdk/apps/filters/PayloadLoggingFilter.java
index e53c50a7..dd591fb7 100644
--- a/services/src/main/java/org/onap/ccsdk/apps/filters/PayloadLoggingFilter.java
+++ b/services/src/main/java/org/onap/ccsdk/apps/filters/PayloadLoggingFilter.java
@@ -36,7 +36,6 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
-@Component
public class PayloadLoggingFilter extends AbstractServletFilter implements Filter {
private static final Logger log = LoggerFactory.getLogger(PayloadLoggingFilter.class);
@@ -319,4 +318,4 @@ public class PayloadLoggingFilter extends AbstractServletFilter implements Filte
}
}
}
-} \ No newline at end of file
+}
diff --git a/services/src/main/java/org/onap/ccsdk/apps/services/SvcLogicFactory.java b/services/src/main/java/org/onap/ccsdk/apps/services/SvcLogicFactory.java
index 9ab5656c..54d612f6 100644
--- a/services/src/main/java/org/onap/ccsdk/apps/services/SvcLogicFactory.java
+++ b/services/src/main/java/org/onap/ccsdk/apps/services/SvcLogicFactory.java
@@ -20,8 +20,11 @@
package org.onap.ccsdk.apps.services;
+import java.io.File;
import java.io.FileInputStream;
+import java.io.FileReader;
import java.io.IOException;
+import java.io.InputStream;
import java.util.List;
import java.util.Properties;
@@ -41,6 +44,8 @@ import org.onap.ccsdk.sli.core.dblib.DBLIBResourceProvider;
import org.onap.ccsdk.sli.core.dblib.DBResourceManager;
import org.onap.ccsdk.sli.core.dblib.DbLibService;
import org.onap.ccsdk.sli.core.sli.ConfigurationException;
+import org.onap.ccsdk.sli.core.sli.SvcLogicAdaptor;
+import org.onap.ccsdk.sli.core.sli.SvcLogicException;
import org.onap.ccsdk.sli.core.sli.SvcLogicJavaPlugin;
import org.onap.ccsdk.sli.core.sli.SvcLogicLoader;
import org.onap.ccsdk.sli.core.sli.SvcLogicRecorder;
@@ -67,147 +72,149 @@ import org.springframework.stereotype.Service;
@Configuration
@Service
public class SvcLogicFactory {
- private static final Logger log = LoggerFactory.getLogger(SvcLogicFactory.class);
-
- @Autowired
- List<SvcLogicRecorder> recorders;
-
- @Autowired
- List<SvcLogicJavaPlugin> plugins;
-
- @Autowired
- List<SvcLogicResource> svcLogicResources;
+ private static final Logger log = LoggerFactory.getLogger(SvcLogicFactory.class);
+ private static final String SDNC_CONFIG_DIR = "SDNC_CONFIG_DIR";
+ private static final String CONTRAIL_PROPERTIES = "contrail-adaptor.properties";
+
+ @Autowired
+ List<SvcLogicRecorder> recorders;
+
+ @Autowired
+ List<SvcLogicJavaPlugin> plugins;
+
+ @Autowired
+ List<SvcLogicResource> svcLogicResources;
+
+
+ @Bean
+ public SvcLogicStore getStore() throws Exception {
+ SvcLogicPropertiesProvider propProvider = new SvcLogicPropertiesProvider() {
+
+ @Override
+ public Properties getProperties() {
+ Properties props = new Properties();
+
+ String propPath = System.getProperty("serviceLogicProperties", "");
+
+ if ("".equals(propPath)) {
+ propPath = System.getenv("SVCLOGIC_PROPERTIES");
+ }
+
+ if ((propPath == null) || propPath.length() == 0) {
+ propPath = "src/main/resources/svclogic.properties";
+ }
+ System.out.println(propPath);
+ try (FileInputStream fileInputStream = new FileInputStream(propPath)) {
+ props = new EnvProperties();
+ props.load(fileInputStream);
+ } catch (final IOException e) {
+ log.error("Failed to load properties for file: {}", propPath,
+ new ConfigurationException("Failed to load properties for file: " + propPath, e));
+ }
+ return props;
+ }
+ };
+ SvcLogicStore store = SvcLogicStoreFactory.getSvcLogicStore(propProvider.getProperties());
+ return store;
+ }
- @Bean
- public SvcLogicStore getStore() throws Exception {
- SvcLogicPropertiesProvider propProvider = new SvcLogicPropertiesProvider() {
+ @Bean
+ public SvcLogicLoader createLoader() throws Exception {
+ String serviceLogicDirectory = System.getProperty("serviceLogicDirectory");
+ if (serviceLogicDirectory == null) {
+ serviceLogicDirectory = "src/main/resources";
+ }
- @Override
- public Properties getProperties() {
- Properties props = new Properties();
+ System.out.println("serviceLogicDirectory is " + serviceLogicDirectory);
+ SvcLogicLoader loader = new SvcLogicLoader(serviceLogicDirectory, getStore());
+ try {
+ loader.loadAndActivate();
+ } catch (IOException e) {
+ log.error("Cannot load directed graphs", e);
+ }
+ return loader;
+ }
- String propPath = System.getProperty("serviceLogicProperties", "");
+ @Bean
+ public SvcLogicServiceBase createService() throws Exception {
+ HashMapResolver resolver = new HashMapResolver();
+ for (SvcLogicRecorder recorder : recorders) {
+ log.info("Registering SvcLogicRecorder {}", recorder.getClass().getName());
+ resolver.addSvcLogicRecorder(recorder.getClass().getName(), recorder);
- if ("".equals(propPath)) {
- propPath = System.getenv("SVCLOGIC_PROPERTIES");
}
+ for (SvcLogicJavaPlugin plugin : plugins) {
+ log.info("Registering SvcLogicJavaPlugin {}", plugin.getClass().getName());
+ resolver.addSvcLogicSvcLogicJavaPlugin(plugin.getClass().getName(), plugin);
- if ((propPath == null) || propPath.length() == 0) {
- propPath = "src/main/resources/svclogic.properties";
}
- System.out.println(propPath);
- try (FileInputStream fileInputStream = new FileInputStream(propPath)) {
- props = new EnvProperties();
- props.load(fileInputStream);
- } catch (final IOException e) {
- log.error("Failed to load properties for file: {}", propPath,
- new ConfigurationException("Failed to load properties for file: " + propPath, e));
+ for (SvcLogicResource svcLogicResource : svcLogicResources) {
+ log.info("Registering SvcLogicResource {}", svcLogicResource.getClass().getName());
+ resolver.addSvcLogicResource(svcLogicResource.getClass().getName(), svcLogicResource);
}
- return props;
- }
- };
- SvcLogicStore store = SvcLogicStoreFactory.getSvcLogicStore(propProvider.getProperties());
- return store;
- }
-
- @Bean
- public SvcLogicLoader createLoader() throws Exception {
- String serviceLogicDirectory = System.getProperty("serviceLogicDirectory");
- if (serviceLogicDirectory == null) {
- serviceLogicDirectory = "src/main/resources";
+
+ return new SvcLogicServiceImplBase(getStore(), resolver);
}
- System.out.println("serviceLogicDirectory is " + serviceLogicDirectory);
- SvcLogicLoader loader = new SvcLogicLoader(serviceLogicDirectory, getStore());
+ @Bean
+ public Slf4jRecorder slf4jRecorderNode() {
+ return new Slf4jRecorder();
+ }
- try {
- loader.loadAndActivate();
- } catch (IOException e) {
- log.error("Cannot load directed graphs", e);
+ // Beans from sli/core
+
+ @Bean
+ public SliPluginUtils sliPluginUtil() {
+ return new SliPluginUtils();
}
- return loader;
- }
- @Bean
- public SvcLogicServiceBase createService() throws Exception {
- HashMapResolver resolver = new HashMapResolver();
- for (SvcLogicRecorder recorder : recorders) {
- resolver.addSvcLogicRecorder(recorder.getClass().getName(), recorder);
+ @Bean
+ public SliStringUtils sliStringUtils() {
+ return new SliStringUtils();
+ }
+ // Beans from sli/adaptors
+
+ @Bean
+ AAIService aaiService() {
+ return new AAIService(new AAIServiceProvider());
+ }
+
+ @Bean
+ public ConfigResource configResource() {
+ return new ConfigResource(new MdsalResourcePropertiesProviderImpl());
+ }
+
+ @Bean
+ public OperationalResource operationalResource() {
+ return new OperationalResource(new MdsalResourcePropertiesProviderImpl());
}
- for (SvcLogicJavaPlugin plugin : plugins) {
- resolver.addSvcLogicSvcLogicJavaPlugin(plugin.getClass().getName(), plugin);
+ @Bean
+ public PublisherApi publisherApi() {
+ return new PublisherApiImpl();
}
- for (SvcLogicResource svcLogicResource : svcLogicResources) {
- resolver.addSvcLogicResource(svcLogicResource.getClass().getName(), svcLogicResource);
+
+ @Bean
+ public NetboxClient netboxClient() {
+ return new NetboxClientImpl();
}
- return new SvcLogicServiceImplBase(getStore(), resolver);
- }
-
- @Bean
- public Slf4jRecorder slf4jRecorderNode() {
- return new Slf4jRecorder();
- }
-
- // Beans from sli/core
-
- @Bean
- public SliPluginUtils sliPluginUtil() {
- return new SliPluginUtils();
- }
-
- @Bean
- public SliStringUtils sliStringUtils() {
- return new SliStringUtils();
- }
-
- // Beans from sli/adaptors
-
- @Bean AAIService aaiService() {
- return new AAIService(new AAIServiceProvider());
- }
-
- @Bean
- public ConfigResource configResource() {
- return new ConfigResource(new MdsalResourcePropertiesProviderImpl());
- }
-
- @Bean
- public OperationalResource operationalResource() {
- return new OperationalResource(new MdsalResourcePropertiesProviderImpl());
- }
-
- @Bean
- public PublisherApi publisherApi() {
- return new PublisherApiImpl();
- }
-
-
- @Bean
- public NetboxClient netboxClient() {
- return new NetboxClientImpl();
- }
-
-
- @Bean
- public SqlResource sqlResource() {
- return new SqlResource();
- }
-
-
- @Bean
- public RestapiCallNode restapiCallNode() {
- return new RestapiCallNode();
- }
-
- @Bean
- public PropertiesNode propertiesNode() {
- return new PropertiesNode();
- }
+ @Bean
+ public SqlResource sqlResource() {
+ return new SqlResource();
+ }
+ @Bean
+ public RestapiCallNode restapiCallNode() {
+ return new RestapiCallNode();
+ }
+
+ @Bean
+ public PropertiesNode propertiesNode() {
+ return new PropertiesNode();
+ }
}