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;
28 import org.onap.clamp.clds.client.*;
29 import org.onap.clamp.clds.dao.CldsDao;
30 import org.onap.clamp.clds.model.refprop.RefProp;
31 import org.onap.clamp.clds.transform.XslTransformer;
32 import org.springframework.beans.factory.annotation.Autowired;
33 import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder;
34 import org.springframework.boot.context.properties.ConfigurationProperties;
35 import org.springframework.context.ApplicationContext;
36 import org.springframework.context.annotation.Bean;
37 import org.springframework.context.annotation.Configuration;
38 import org.springframework.context.annotation.Profile;
40 import javax.sql.DataSource;
41 import javax.xml.transform.TransformerConfigurationException;
42 import java.io.IOException;
43 import java.util.ArrayList;
44 import java.util.List;
47 @Profile("clamp-default")
48 public class CldsConfiguration {
51 private ApplicationContext context;
54 * Clds Identity databse DataSource configuration
56 @Bean(name = "cldsDataSource")
57 @ConfigurationProperties(prefix = "spring.cldsdatasource")
58 public DataSource cldsDataSource() {
59 return DataSourceBuilder
64 @Bean(name = "jaxrsProviders")
65 public List jaxrsProviders() {
66 return new ArrayList(context.getBeansWithAnnotation(AjscProvider.class).values());
69 @Bean(name = "jaxrsServices")
70 public List jaxrsServices() {
71 return new ArrayList(context.getBeansWithAnnotation(AjscService.class).values());
74 @Bean(name = "cldsDao")
75 public CldsDao getCldsDao() {
76 CldsDao cldsDao = new CldsDao();
77 cldsDao.setDataSource(cldsDataSource());
81 @Bean(name = "cldsBpmnTransformer")
82 public XslTransformer getCldsBpmnXslTransformer() throws TransformerConfigurationException {
83 XslTransformer xslTransformer = new XslTransformer();
84 xslTransformer.setXslResourceName("xsl/clds-bpmn-transformer.xsl");
85 return xslTransformer;
89 public RefProp getRefProp() throws IOException {
94 public PolicyClient getPolicyClient() {
95 return new PolicyClient();
98 @Bean(name = "cldsEventDelegate")
99 public CldsEventDelegate getCldsEventDelegate() {
100 return new CldsEventDelegate();
103 @Bean(name = "dcaeReqDelegate")
104 public DcaeReqDelegate getDcaeReqDelegate() {
105 return new DcaeReqDelegate();
108 @Bean(name = "sdcSendReqDelegate")
109 public SdcSendReqDelegate getSdcSendReqDelegate() {
110 return new SdcSendReqDelegate();
113 @Bean(name = "dcaeReqDeleteDelegate")
114 public DcaeReqDeleteDelegate getDcaeReqDeleteDelegate() {
115 return new DcaeReqDeleteDelegate();
118 @Bean(name = "operationalPolicyDelegate")
119 public OperationalPolicyDelegate getOperationalPolicyDelegate() {
120 return new OperationalPolicyDelegate();
123 @Bean(name = "operationalPolicyDeleteDelegate")
124 public OperationalPolicyDeleteDelegate getOperationalPolicyDeleteDelegate() {
125 return new OperationalPolicyDeleteDelegate();
128 @Bean(name = "stringMatchPolicyDelegate")
129 public StringMatchPolicyDelegate getStringMatchPolicyDelegate() {
130 return new StringMatchPolicyDelegate();
133 @Bean(name = "stringMatchPolicyDeleteDelegate")
134 public StringMatchPolicyDeleteDelegate getStringMatchPolicyDeleteDelegate() {
135 return new StringMatchPolicyDeleteDelegate();
138 @Bean(name = "sdcCatalogServices")
139 public SdcCatalogServices getAsdcCatalogServices() {
140 return new SdcCatalogServices();