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.lock.ComponentLockAspect;
30 import org.openecomp.sdc.be.components.lifecycle.LifecycleBusinessLogic;
31 import org.openecomp.sdc.be.config.ConfigurationManager;
32 import org.openecomp.sdc.be.ecomp.converters.AssetMetadataConverter;
33 import org.openecomp.sdc.be.filters.PortalConfiguration;
34 import org.openecomp.sdc.be.filters.ThreadLocalUtils;
35 import org.openecomp.sdc.be.tosca.CommonCsarGenerator;
36 import org.openecomp.sdc.be.tosca.DefaultCsarGenerator;
37 import org.springframework.beans.factory.annotation.Autowired;
38 import org.springframework.context.annotation.Bean;
39 import org.springframework.context.annotation.ComponentScan;
40 import org.springframework.context.annotation.Configuration;
41 import org.springframework.core.annotation.Order;
46 "org.openecomp.sdc.be.user",
47 "org.openecomp.sdc.be.facade.operations",
48 "org.openecomp.sdc.be.impl",
49 "org.openecomp.sdc.be.auditing.impl",
50 "org.openecomp.sdc.be.distribution",
51 "org.openecomp.sdc.be.switchover.detector",
52 "org.openecomp.sdc.be.tosca",
53 "org.openecomp.sdc.be.components.validation",
54 "org.openecomp.sdc.be.catalog.impl",
55 "org.openecomp.sdc.be.components.impl",
56 "org.openecomp.sdc.be.components.path",
57 "org.openecomp.sdc.be.components.merge",
58 "org.openecomp.sdc.be.components.csar",
59 "org.openecomp.sdc.be.components.property",
60 "org.openecomp.sdc.be.components.attribute",
61 "org.openecomp.sdc.be.components.kafka",
62 "org.openecomp.sdc.be.csar.security",
63 "org.openecomp.sdc.be.datamodel.utils",
64 "org.openecomp.sdc.be.components.upgrade",
65 "org.openecomp.sdc.be.externalapi.servlet",
66 "org.openecomp.sdc.be.servlets",
67 "org.openecomp.sdc.be.filters",
68 "org.openecomp.sdc.be.plugins",
69 "org.openecomp.sdc.be.togglz",
70 "org.openecomp.sdc.be.model.cache",
71 "org.openecomp.sdc.be.ui.mapper"})
73 public class CatalogBESpringConfig {
75 private static final int BEFORE_TRANSACTION_MANAGER = 0;
76 private final ComponentLocker componentLocker;
79 public CatalogBESpringConfig(ComponentLocker componentLocker) {
80 this.componentLocker = componentLocker;
83 @Bean(name = "lifecycleBusinessLogic")
84 public LifecycleBusinessLogic lifecycleBusinessLogic() {
85 return new LifecycleBusinessLogic();
88 @Bean(name = "configurationProvider")
89 public ConfigurationProvider configurationProvider() {
90 return new ConfigurationProvider();
93 @Bean(name = "asset-metadata-utils")
94 public AssetMetadataConverter assetMetadataConverter() {
95 return new AssetMetadataConverter();
98 @Bean(name = "componentLockAspect")
99 @Order(BEFORE_TRANSACTION_MANAGER)
100 public ComponentLockAspect componentLockAspect() {
101 return new ComponentLockAspect(componentLocker);
105 public CloseableHttpClient httpClientConnectionManager() {
106 HttpClientFactory httpClientFactory = new HttpClientFactory();
107 return httpClientFactory.createHttpClient();
111 public PortalConfiguration portalConfiguration() throws CipherUtilException {
112 return new PortalConfiguration();
116 public ThreadLocalUtils threadLocalUtils() {
117 return new ThreadLocalUtils();
121 public PortalClient portalClient() throws CipherUtilException {
122 return new PortalClient(httpClientConnectionManager(), portalConfiguration());
125 @Bean(name = "defaultCsarGenerator")
126 public DefaultCsarGenerator defaultCsarGenerator(CommonCsarGenerator commonCsarGenerator) {
127 return new DefaultCsarGenerator(commonCsarGenerator);
131 public org.openecomp.sdc.be.config.Configuration configuration() {
132 return ConfigurationManager.getConfigurationManager().getConfiguration();