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 java.io.IOException;
27 import java.util.ArrayList;
28 import java.util.List;
30 import javax.sql.DataSource;
31 import javax.xml.transform.TransformerConfigurationException;
33 import org.onap.clamp.clds.client.CldsEventDelegate;
34 import org.onap.clamp.clds.client.DcaeDispatcherServices;
35 import org.onap.clamp.clds.client.DcaeInventoryServices;
36 import org.onap.clamp.clds.client.DcaeReqDelegate;
37 import org.onap.clamp.clds.client.DcaeReqDeleteDelegate;
38 import org.onap.clamp.clds.client.OperationalPolicyDelegate;
39 import org.onap.clamp.clds.client.OperationalPolicyDeleteDelegate;
40 import org.onap.clamp.clds.client.PolicyClient;
41 import org.onap.clamp.clds.client.SdcCatalogServices;
42 import org.onap.clamp.clds.client.SdcSendReqDelegate;
43 import org.onap.clamp.clds.client.StringMatchPolicyDelegate;
44 import org.onap.clamp.clds.client.StringMatchPolicyDeleteDelegate;
45 import org.onap.clamp.clds.client.TcaPolicyDelegate;
46 import org.onap.clamp.clds.client.TcaPolicyDeleteDelegate;
47 import org.onap.clamp.clds.dao.CldsDao;
48 import org.onap.clamp.clds.model.refprop.RefProp;
49 import org.onap.clamp.clds.transform.XslTransformer;
50 import org.springframework.beans.factory.annotation.Autowired;
51 import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder;
52 import org.springframework.boot.context.properties.ConfigurationProperties;
53 import org.springframework.context.ApplicationContext;
54 import org.springframework.context.annotation.Bean;
55 import org.springframework.context.annotation.Configuration;
56 import org.springframework.context.annotation.Profile;
58 import com.att.ajsc.common.AjscProvider;
59 import com.att.ajsc.common.AjscService;
62 @Profile("clamp-default")
63 public class CldsConfiguration {
66 private ApplicationContext context;
69 * Clds Identity databse DataSource configuration
71 @Bean(name = "cldsDataSource")
72 @ConfigurationProperties(prefix = "spring.datasource.cldsdb")
73 public DataSource cldsDataSource() {
74 return DataSourceBuilder.create().build();
77 @Bean(name = "jaxrsProviders")
78 public List<?> jaxrsProviders() {
79 return new ArrayList(context.getBeansWithAnnotation(AjscProvider.class).values());
82 @Bean(name = "jaxrsServices")
83 public List<?> jaxrsServices() {
84 return new ArrayList(context.getBeansWithAnnotation(AjscService.class).values());
87 @Bean(name = "cldsDao")
88 public CldsDao getCldsDao() {
89 CldsDao cldsDao = new CldsDao();
90 cldsDao.setDataSource(cldsDataSource());
94 @Bean(name = "cldsBpmnTransformer")
95 public XslTransformer getCldsBpmnXslTransformer() throws TransformerConfigurationException {
96 XslTransformer xslTransformer = new XslTransformer();
97 xslTransformer.setXslResourceName("xsl/clds-bpmn-transformer.xsl");
98 return xslTransformer;
102 public RefProp getRefProp() throws IOException {
103 return new RefProp();
107 public PolicyClient getPolicyClient() {
108 return new PolicyClient();
111 @Bean(name = "cldsEventDelegate")
112 public CldsEventDelegate getCldsEventDelegate() {
113 return new CldsEventDelegate();
116 @Bean(name = "dcaeReqDelegate")
117 public DcaeReqDelegate getDcaeReqDelegate() {
118 return new DcaeReqDelegate();
121 @Bean(name = "sdcSendReqDelegate")
122 public SdcSendReqDelegate getSdcSendReqDelegate() {
123 return new SdcSendReqDelegate();
126 @Bean(name = "dcaeReqDeleteDelegate")
127 public DcaeReqDeleteDelegate getDcaeReqDeleteDelegate() {
128 return new DcaeReqDeleteDelegate();
131 @Bean(name = "operationalPolicyDelegate")
132 public OperationalPolicyDelegate getOperationalPolicyDelegate() {
133 return new OperationalPolicyDelegate();
136 @Bean(name = "operationalPolicyDeleteDelegate")
137 public OperationalPolicyDeleteDelegate getOperationalPolicyDeleteDelegate() {
138 return new OperationalPolicyDeleteDelegate();
141 @Bean(name = "stringMatchPolicyDelegate")
142 public StringMatchPolicyDelegate getStringMatchPolicyDelegate() {
143 return new StringMatchPolicyDelegate();
146 @Bean(name = "stringMatchPolicyDeleteDelegate")
147 public StringMatchPolicyDeleteDelegate getStringMatchPolicyDeleteDelegate() {
148 return new StringMatchPolicyDeleteDelegate();
151 @Bean(name = "sdcCatalogServices")
152 public SdcCatalogServices getSdcCatalogServices() {
153 return new SdcCatalogServices();
156 @Bean(name = "dcaeDispatcherServices")
157 public DcaeDispatcherServices getDcaeDispatcherServices() {
158 return new DcaeDispatcherServices();
161 @Bean(name = "dcaeInventoryServices")
162 public DcaeInventoryServices getDcaeInventoryServices() {
163 return new DcaeInventoryServices();
166 @Bean(name = "tcaPolicyDelegate")
167 public TcaPolicyDelegate getTcaPolicyDelegate() {
168 return new TcaPolicyDelegate();
171 @Bean(name = "tcaPolicyDeleteDelegate")
172 public TcaPolicyDeleteDelegate getTcaPolicyDeleteDelegate() {
173 return new TcaPolicyDeleteDelegate();