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.boot.autoconfigure.jdbc.DataSourceBuilder;
56 import org.springframework.boot.context.properties.ConfigurationProperties;
57 import org.springframework.context.ApplicationContext;
58 import org.springframework.context.annotation.Bean;
59 import org.springframework.context.annotation.Configuration;
60 import org.springframework.context.annotation.Profile;
63 @Profile("clamp-default")
64 public class CldsConfiguration {
67 private ApplicationContext context;
70 * Clds Identity databse DataSource configuration
72 @Bean(name = "cldsDataSource")
73 @ConfigurationProperties(prefix = "spring.datasource.cldsdb")
74 public DataSource cldsDataSource() {
75 return DataSourceBuilder.create().build();
78 @Bean(name = "jaxrsProviders")
79 public List<?> jaxrsProviders() {
80 return new ArrayList(context.getBeansWithAnnotation(AjscProvider.class).values());
83 @Bean(name = "jaxrsServices")
84 public List<?> jaxrsServices() {
85 return new ArrayList(context.getBeansWithAnnotation(AjscService.class).values());
88 @Bean(name = "cldsDao")
89 public CldsDao getCldsDao() {
90 CldsDao cldsDao = new CldsDao();
91 cldsDao.setDataSource(cldsDataSource());
95 @Bean(name = "cldsBpmnTransformer")
96 public XslTransformer getCldsBpmnXslTransformer() throws TransformerConfigurationException {
97 XslTransformer xslTransformer = new XslTransformer();
98 xslTransformer.setXslResourceName("xsl/clds-bpmn-transformer.xsl");
99 return xslTransformer;
103 public RefProp getRefProp() {
104 return new RefProp();
108 public PolicyClient getPolicyClient() {
109 return new PolicyClient();
112 @Bean(name = "cldsEventDelegate")
113 public CldsEventDelegate getCldsEventDelegate() {
114 return new CldsEventDelegate();
117 @Bean(name = "dcaeReqDelegate")
118 public DcaeReqDelegate getDcaeReqDelegate() {
119 return new DcaeReqDelegate();
122 @Bean(name = "sdcSendReqDelegate")
123 public SdcSendReqDelegate getSdcSendReqDelegate() {
124 return new SdcSendReqDelegate();
127 @Bean(name = "dcaeReqDeleteDelegate")
128 public DcaeReqDeleteDelegate getDcaeReqDeleteDelegate() {
129 return new DcaeReqDeleteDelegate();
132 @Bean(name = "operationalPolicyDelegate")
133 public OperationalPolicyDelegate getOperationalPolicyDelegate() {
134 return new OperationalPolicyDelegate();
137 @Bean(name = "operationalPolicyDeleteDelegate")
138 public OperationalPolicyDeleteDelegate getOperationalPolicyDeleteDelegate() {
139 return new OperationalPolicyDeleteDelegate();
142 @Bean(name = "stringMatchPolicyDelegate")
143 public StringMatchPolicyDelegate getStringMatchPolicyDelegate() {
144 return new StringMatchPolicyDelegate();
147 @Bean(name = "stringMatchPolicyDeleteDelegate")
148 public StringMatchPolicyDeleteDelegate getStringMatchPolicyDeleteDelegate() {
149 return new StringMatchPolicyDeleteDelegate();
152 @Bean(name = "sdcCatalogServices")
153 public SdcCatalogServices getSdcCatalogServices() {
154 return new SdcCatalogServices();
157 @Bean(name = "dcaeDispatcherServices")
158 public DcaeDispatcherServices getDcaeDispatcherServices() {
159 return new DcaeDispatcherServices();
162 @Bean(name = "dcaeInventoryServices")
163 public DcaeInventoryServices getDcaeInventoryServices() {
164 return new DcaeInventoryServices();
167 @Bean(name = "tcaPolicyDelegate")
168 public TcaPolicyDelegate getTcaPolicyDelegate() {
169 return new TcaPolicyDelegate();
172 @Bean(name = "tcaPolicyDeleteDelegate")
173 public TcaPolicyDeleteDelegate getTcaPolicyDeleteDelegate() {
174 return new TcaPolicyDeleteDelegate();
177 @Bean(name = "holmesPolicyDelegate")
178 public HolmesPolicyDelegate getHolmesPolicyDelegate() {
179 return new HolmesPolicyDelegate();
182 @Bean(name = "holmesPolicyDeleteDelegate")
183 public HolmesPolicyDeleteDelegate getHolmesPolicyDeleteDelegate() {
184 return new HolmesPolicyDeleteDelegate();