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.security.GeneralSecurityException;
30 import java.util.ArrayList;
31 import java.util.List;
33 import javax.sql.DataSource;
34 import javax.xml.transform.TransformerConfigurationException;
36 import org.onap.clamp.clds.client.CldsEventDelegate;
37 import org.onap.clamp.clds.client.DcaeDispatcherServices;
38 import org.onap.clamp.clds.client.DcaeInventoryServices;
39 import org.onap.clamp.clds.client.HolmesPolicyDelegate;
40 import org.onap.clamp.clds.client.HolmesPolicyDeleteDelegate;
41 import org.onap.clamp.clds.client.OperationalPolicyDelegate;
42 import org.onap.clamp.clds.client.OperationalPolicyDeleteDelegate;
43 import org.onap.clamp.clds.client.SdcSendReqDelegate;
44 import org.onap.clamp.clds.client.TcaPolicyDelegate;
45 import org.onap.clamp.clds.client.TcaPolicyDeleteDelegate;
46 import org.onap.clamp.clds.client.req.policy.PolicyClient;
47 import org.onap.clamp.clds.client.req.sdc.SdcCatalogServices;
48 import org.onap.clamp.clds.client.req.sdc.SdcReq;
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.beans.factory.annotation.Qualifier;
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 {
64 private ApplicationContext context;
67 * Clds Identity database DataSource configuration
71 @Bean(name = "cldsDataSource")
72 @ConfigurationProperties(prefix = "spring.datasource.cldsdb")
73 public DataSource cldsDataSource() {
74 return new EncodedPasswordBasicDataSource();
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(@Qualifier("cldsDataSource") DataSource dataSource) {
89 CldsDao cldsDao = new CldsDao();
90 cldsDao.setDataSource(dataSource);
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() {
103 return new RefProp();
107 public SdcReq getSdcReq() {
112 public PolicyClient getPolicyClient() {
113 return new PolicyClient();
116 @Bean(name = "cldsEventDelegate")
117 public CldsEventDelegate getCldsEventDelegate() {
118 return new CldsEventDelegate();
121 @Bean(name = "sdcSendReqDelegate")
122 public SdcSendReqDelegate getSdcSendReqDelegate() {
123 return new SdcSendReqDelegate();
126 @Bean(name = "operationalPolicyDelegate")
127 public OperationalPolicyDelegate getOperationalPolicyDelegate() {
128 return new OperationalPolicyDelegate();
131 @Bean(name = "operationalPolicyDeleteDelegate")
132 public OperationalPolicyDeleteDelegate getOperationalPolicyDeleteDelegate() {
133 return new OperationalPolicyDeleteDelegate();
136 @Bean(name = "sdcCatalogServices")
137 public SdcCatalogServices getSdcCatalogServices() {
138 return new SdcCatalogServices();
141 @Bean(name = "dcaeDispatcherServices")
142 public DcaeDispatcherServices getDcaeDispatcherServices() {
143 return new DcaeDispatcherServices();
146 @Bean(name = "dcaeInventoryServices")
147 public DcaeInventoryServices getDcaeInventoryServices() {
148 return new DcaeInventoryServices();
151 @Bean(name = "tcaPolicyDelegate")
152 public TcaPolicyDelegate getTcaPolicyDelegate() {
153 return new TcaPolicyDelegate();
156 @Bean(name = "tcaPolicyDeleteDelegate")
157 public TcaPolicyDeleteDelegate getTcaPolicyDeleteDelegate() {
158 return new TcaPolicyDeleteDelegate();
161 @Bean(name = "holmesPolicyDelegate")
162 public HolmesPolicyDelegate getHolmesPolicyDelegate() {
163 return new HolmesPolicyDelegate();
166 @Bean(name = "holmesPolicyDeleteDelegate")
167 public HolmesPolicyDeleteDelegate getHolmesPolicyDeleteDelegate() {
168 return new HolmesPolicyDeleteDelegate();