2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights
7 * ================================================================================
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 * ============LICENSE_END============================================
20 * ===================================================================
21 * ECOMP is a trademark and service mark of AT&T Intellectual Property.
24 package org.onap.clamp.clds.config;
26 import com.att.ajsc.common.AjscProvider;
27 import com.att.ajsc.common.AjscService;
29 import java.util.ArrayList;
30 import java.util.List;
32 import javax.sql.DataSource;
33 import javax.xml.transform.TransformerConfigurationException;
35 import org.onap.clamp.clds.client.CldsEventDelegate;
36 import org.onap.clamp.clds.client.DcaeDispatcherServices;
37 import org.onap.clamp.clds.client.DcaeInventoryServices;
38 import org.onap.clamp.clds.client.DcaeReqDelegate;
39 import org.onap.clamp.clds.client.DcaeReqDeleteDelegate;
40 import org.onap.clamp.clds.client.HolmesPolicyDelegate;
41 import org.onap.clamp.clds.client.HolmesPolicyDeleteDelegate;
42 import org.onap.clamp.clds.client.OperationalPolicyDelegate;
43 import org.onap.clamp.clds.client.OperationalPolicyDeleteDelegate;
44 import org.onap.clamp.clds.client.PolicyClient;
45 import org.onap.clamp.clds.client.SdcCatalogServices;
46 import org.onap.clamp.clds.client.SdcSendReqDelegate;
47 import org.onap.clamp.clds.client.StringMatchPolicyDelegate;
48 import org.onap.clamp.clds.client.StringMatchPolicyDeleteDelegate;
49 import org.onap.clamp.clds.client.TcaPolicyDelegate;
50 import org.onap.clamp.clds.client.TcaPolicyDeleteDelegate;
51 import org.onap.clamp.clds.dao.CldsDao;
52 import org.onap.clamp.clds.model.refprop.RefProp;
53 import org.onap.clamp.clds.transform.XslTransformer;
54 import org.springframework.beans.factory.annotation.Autowired;
55 import org.springframework.beans.factory.annotation.Qualifier;
56 import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder;
57 import org.springframework.boot.context.properties.ConfigurationProperties;
58 import org.springframework.context.ApplicationContext;
59 import org.springframework.context.annotation.Bean;
60 import org.springframework.context.annotation.Configuration;
61 import org.springframework.context.annotation.Profile;
64 @Profile("clamp-default")
65 public class CldsConfiguration {
68 private ApplicationContext context;
71 * Clds Identity database DataSource configuration
73 @Bean(name = "cldsDataSource")
74 @ConfigurationProperties(prefix = "spring.datasource.cldsdb")
75 public DataSource cldsDataSource() {
76 return DataSourceBuilder.create().build();
79 @Bean(name = "jaxrsProviders")
80 public List<?> jaxrsProviders() {
81 return new ArrayList(context.getBeansWithAnnotation(AjscProvider.class).values());
84 @Bean(name = "jaxrsServices")
85 public List<?> jaxrsServices() {
86 return new ArrayList(context.getBeansWithAnnotation(AjscService.class).values());
89 @Bean(name = "cldsDao")
90 public CldsDao getCldsDao(@Qualifier("cldsDataSource") DataSource dataSource) {
91 CldsDao cldsDao = new CldsDao();
92 cldsDao.setDataSource(dataSource);
96 @Bean(name = "cldsBpmnTransformer")
97 public XslTransformer getCldsBpmnXslTransformer() throws TransformerConfigurationException {
98 XslTransformer xslTransformer = new XslTransformer();
99 xslTransformer.setXslResourceName("xsl/clds-bpmn-transformer.xsl");
100 return xslTransformer;
104 public RefProp getRefProp() {
105 return new RefProp();
109 public PolicyClient getPolicyClient() {
110 return new PolicyClient();
113 @Bean(name = "cldsEventDelegate")
114 public CldsEventDelegate getCldsEventDelegate() {
115 return new CldsEventDelegate();
118 @Bean(name = "dcaeReqDelegate")
119 public DcaeReqDelegate getDcaeReqDelegate() {
120 return new DcaeReqDelegate();
123 @Bean(name = "sdcSendReqDelegate")
124 public SdcSendReqDelegate getSdcSendReqDelegate() {
125 return new SdcSendReqDelegate();
128 @Bean(name = "dcaeReqDeleteDelegate")
129 public DcaeReqDeleteDelegate getDcaeReqDeleteDelegate() {
130 return new DcaeReqDeleteDelegate();
133 @Bean(name = "operationalPolicyDelegate")
134 public OperationalPolicyDelegate getOperationalPolicyDelegate() {
135 return new OperationalPolicyDelegate();
138 @Bean(name = "operationalPolicyDeleteDelegate")
139 public OperationalPolicyDeleteDelegate getOperationalPolicyDeleteDelegate() {
140 return new OperationalPolicyDeleteDelegate();
143 @Bean(name = "stringMatchPolicyDelegate")
144 public StringMatchPolicyDelegate getStringMatchPolicyDelegate() {
145 return new StringMatchPolicyDelegate();
148 @Bean(name = "stringMatchPolicyDeleteDelegate")
149 public StringMatchPolicyDeleteDelegate getStringMatchPolicyDeleteDelegate() {
150 return new StringMatchPolicyDeleteDelegate();
153 @Bean(name = "sdcCatalogServices")
154 public SdcCatalogServices getSdcCatalogServices() {
155 return new SdcCatalogServices();
158 @Bean(name = "dcaeDispatcherServices")
159 public DcaeDispatcherServices getDcaeDispatcherServices() {
160 return new DcaeDispatcherServices();
163 @Bean(name = "dcaeInventoryServices")
164 public DcaeInventoryServices getDcaeInventoryServices() {
165 return new DcaeInventoryServices();
168 @Bean(name = "tcaPolicyDelegate")
169 public TcaPolicyDelegate getTcaPolicyDelegate() {
170 return new TcaPolicyDelegate();
173 @Bean(name = "tcaPolicyDeleteDelegate")
174 public TcaPolicyDeleteDelegate getTcaPolicyDeleteDelegate() {
175 return new TcaPolicyDeleteDelegate();
178 @Bean(name = "holmesPolicyDelegate")
179 public HolmesPolicyDelegate getHolmesPolicyDelegate() {
180 return new HolmesPolicyDelegate();
183 @Bean(name = "holmesPolicyDeleteDelegate")
184 public HolmesPolicyDeleteDelegate getHolmesPolicyDeleteDelegate() {
185 return new HolmesPolicyDeleteDelegate();