2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
19 * Modifications copyright (c) 2019 Nokia
20 * ================================================================================
22 package org.openecomp.sdc.config;
24 import org.apache.http.impl.client.CloseableHttpClient;
25 import org.onap.portalsdk.core.onboarding.exception.CipherUtilException;
26 import org.onap.sdc.security.PortalClient;
27 import org.openecomp.sdc.be.auditing.impl.ConfigurationProvider;
28 import org.openecomp.sdc.be.components.impl.ComponentLocker;
29 import org.openecomp.sdc.be.components.impl.aaf.RoleAuthorizationHandler;
30 import org.openecomp.sdc.be.components.impl.lock.ComponentLockAspect;
31 import org.openecomp.sdc.be.components.lifecycle.LifecycleBusinessLogic;
32 import org.openecomp.sdc.be.config.ConfigurationManager;
33 import org.openecomp.sdc.be.ecomp.converters.AssetMetadataConverter;
34 import org.openecomp.sdc.be.filters.FilterConfiguration;
35 import org.openecomp.sdc.be.filters.PortalConfiguration;
36 import org.openecomp.sdc.be.filters.ThreadLocalUtils;
37 import org.openecomp.sdc.be.tosca.CommonCsarGenerator;
38 import org.openecomp.sdc.be.tosca.DefaultCsarGenerator;
39 import org.springframework.beans.factory.annotation.Autowired;
40 import org.springframework.context.annotation.Bean;
41 import org.springframework.context.annotation.ComponentScan;
42 import org.springframework.context.annotation.Configuration;
43 import org.springframework.core.annotation.Order;
48 "org.openecomp.sdc.be.user",
49 "org.openecomp.sdc.be.facade.operations",
50 "org.openecomp.sdc.be.impl",
51 "org.openecomp.sdc.be.auditing.impl",
52 "org.openecomp.sdc.be.distribution",
53 "org.openecomp.sdc.be.switchover.detector",
54 "org.openecomp.sdc.be.tosca",
55 "org.openecomp.sdc.be.components.validation",
56 "org.openecomp.sdc.be.catalog.impl",
57 "org.openecomp.sdc.be.components.impl",
58 "org.openecomp.sdc.be.components.path",
59 "org.openecomp.sdc.be.components.merge",
60 "org.openecomp.sdc.be.components.csar",
61 "org.openecomp.sdc.be.components.property",
62 "org.openecomp.sdc.be.components.attribute",
63 "org.openecomp.sdc.be.components.kafka",
64 "org.openecomp.sdc.be.csar.security",
65 "org.openecomp.sdc.be.datamodel.utils",
66 "org.openecomp.sdc.be.components.upgrade",
67 "org.openecomp.sdc.be.externalapi.servlet",
68 "org.openecomp.sdc.be.servlets",
69 "org.openecomp.sdc.be.filters",
70 "org.openecomp.sdc.be.plugins",
71 "org.openecomp.sdc.be.togglz",
72 "org.openecomp.sdc.be.model.cache",
73 "org.openecomp.sdc.be.ui.mapper"})
75 public class CatalogBESpringConfig {
77 private static final int BEFORE_TRANSACTION_MANAGER = 0;
78 private final ComponentLocker componentLocker;
81 public CatalogBESpringConfig(ComponentLocker componentLocker) {
82 this.componentLocker = componentLocker;
85 @Bean(name = "lifecycleBusinessLogic")
86 public LifecycleBusinessLogic lifecycleBusinessLogic() {
87 return new LifecycleBusinessLogic();
90 @Bean(name = "configurationProvider")
91 public ConfigurationProvider configurationProvider() {
92 return new ConfigurationProvider();
95 @Bean(name = "asset-metadata-utils")
96 public AssetMetadataConverter assetMetadataConverter() {
97 return new AssetMetadataConverter();
100 @Bean(name = "componentLockAspect")
101 @Order(BEFORE_TRANSACTION_MANAGER)
102 public ComponentLockAspect componentLockAspect() {
103 return new ComponentLockAspect(componentLocker);
107 public RoleAuthorizationHandler roleAuthorizationHandler() {
108 return new RoleAuthorizationHandler();
112 public CloseableHttpClient httpClientConnectionManager() {
113 HttpClientFactory httpClientFactory = new HttpClientFactory();
114 return httpClientFactory.createHttpClient();
118 public PortalConfiguration portalConfiguration() throws CipherUtilException {
119 return new PortalConfiguration();
123 public FilterConfiguration filterConfiguration() {
124 return new FilterConfiguration(configuration());
128 public ThreadLocalUtils threadLocalUtils() {
129 return new ThreadLocalUtils();
133 public PortalClient portalClient() throws CipherUtilException {
134 return new PortalClient(httpClientConnectionManager(), portalConfiguration());
137 @Bean(name = "defaultCsarGenerator")
138 public DefaultCsarGenerator defaultCsarGenerator(CommonCsarGenerator commonCsarGenerator) {
139 return new DefaultCsarGenerator(commonCsarGenerator);
143 public org.openecomp.sdc.be.config.Configuration configuration() {
144 return ConfigurationManager.getConfigurationManager().getConfiguration();