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.OperationalPolicyDelegate;
41 import org.onap.clamp.clds.client.OperationalPolicyDeleteDelegate;
42 import org.onap.clamp.clds.client.PolicyClient;
43 import org.onap.clamp.clds.client.SdcCatalogServices;
44 import org.onap.clamp.clds.client.SdcSendReqDelegate;
45 import org.onap.clamp.clds.client.StringMatchPolicyDelegate;
46 import org.onap.clamp.clds.client.StringMatchPolicyDeleteDelegate;
47 import org.onap.clamp.clds.client.TcaPolicyDelegate;
48 import org.onap.clamp.clds.client.TcaPolicyDeleteDelegate;
49 import org.onap.clamp.clds.dao.CldsDao;
50 import org.onap.clamp.clds.model.refprop.RefProp;
51 import org.onap.clamp.clds.transform.XslTransformer;
52 import org.springframework.beans.factory.annotation.Autowired;
53 import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder;
54 import org.springframework.boot.context.properties.ConfigurationProperties;
55 import org.springframework.context.ApplicationContext;
56 import org.springframework.context.annotation.Bean;
57 import org.springframework.context.annotation.Configuration;
58 import org.springframework.context.annotation.Profile;
61 @Profile("clamp-default")
62 public class CldsConfiguration {
65 private ApplicationContext context;
68 * Clds Identity databse DataSource configuration
70 @Bean(name = "cldsDataSource")
71 @ConfigurationProperties(prefix = "spring.datasource.cldsdb")
72 public DataSource cldsDataSource() {
73 return DataSourceBuilder.create().build();
76 @Bean(name = "jaxrsProviders")
77 public List<?> jaxrsProviders() {
78 return new ArrayList(context.getBeansWithAnnotation(AjscProvider.class).values());
81 @Bean(name = "jaxrsServices")
82 public List<?> jaxrsServices() {
83 return new ArrayList(context.getBeansWithAnnotation(AjscService.class).values());
86 @Bean(name = "cldsDao")
87 public CldsDao getCldsDao() {
88 CldsDao cldsDao = new CldsDao();
89 cldsDao.setDataSource(cldsDataSource());
93 @Bean(name = "cldsBpmnTransformer")
94 public XslTransformer getCldsBpmnXslTransformer() throws TransformerConfigurationException {
95 XslTransformer xslTransformer = new XslTransformer();
96 xslTransformer.setXslResourceName("xsl/clds-bpmn-transformer.xsl");
97 return xslTransformer;
101 public RefProp getRefProp() {
102 return new RefProp();
106 public PolicyClient getPolicyClient() {
107 return new PolicyClient();
110 @Bean(name = "cldsEventDelegate")
111 public CldsEventDelegate getCldsEventDelegate() {
112 return new CldsEventDelegate();
115 @Bean(name = "dcaeReqDelegate")
116 public DcaeReqDelegate getDcaeReqDelegate() {
117 return new DcaeReqDelegate();
120 @Bean(name = "sdcSendReqDelegate")
121 public SdcSendReqDelegate getSdcSendReqDelegate() {
122 return new SdcSendReqDelegate();
125 @Bean(name = "dcaeReqDeleteDelegate")
126 public DcaeReqDeleteDelegate getDcaeReqDeleteDelegate() {
127 return new DcaeReqDeleteDelegate();
130 @Bean(name = "operationalPolicyDelegate")
131 public OperationalPolicyDelegate getOperationalPolicyDelegate() {
132 return new OperationalPolicyDelegate();
135 @Bean(name = "operationalPolicyDeleteDelegate")
136 public OperationalPolicyDeleteDelegate getOperationalPolicyDeleteDelegate() {
137 return new OperationalPolicyDeleteDelegate();
140 @Bean(name = "stringMatchPolicyDelegate")
141 public StringMatchPolicyDelegate getStringMatchPolicyDelegate() {
142 return new StringMatchPolicyDelegate();
145 @Bean(name = "stringMatchPolicyDeleteDelegate")
146 public StringMatchPolicyDeleteDelegate getStringMatchPolicyDeleteDelegate() {
147 return new StringMatchPolicyDeleteDelegate();
150 @Bean(name = "sdcCatalogServices")
151 public SdcCatalogServices getSdcCatalogServices() {
152 return new SdcCatalogServices();
155 @Bean(name = "dcaeDispatcherServices")
156 public DcaeDispatcherServices getDcaeDispatcherServices() {
157 return new DcaeDispatcherServices();
160 @Bean(name = "dcaeInventoryServices")
161 public DcaeInventoryServices getDcaeInventoryServices() {
162 return new DcaeInventoryServices();
165 @Bean(name = "tcaPolicyDelegate")
166 public TcaPolicyDelegate getTcaPolicyDelegate() {
167 return new TcaPolicyDelegate();
170 @Bean(name = "tcaPolicyDeleteDelegate")
171 public TcaPolicyDeleteDelegate getTcaPolicyDeleteDelegate() {
172 return new TcaPolicyDeleteDelegate();