2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.openecomp.sdc.be.dao.config;
23 import org.openecomp.sdc.be.dao.DAOJanusGraphStrategy;
24 import org.openecomp.sdc.be.dao.JanusGraphClientStrategy;
25 import org.openecomp.sdc.be.dao.impl.HealingPipelineDao;
26 import org.openecomp.sdc.be.dao.janusgraph.HealingJanusGraphGenericDao;
27 import org.openecomp.sdc.be.dao.janusgraph.JanusGraphClient;
28 import org.openecomp.sdc.be.dao.janusgraph.transactions.SimpleJanusGraphTransactionManager;
29 import org.springframework.beans.factory.annotation.Qualifier;
30 import org.springframework.context.annotation.Bean;
31 import org.springframework.context.annotation.ComponentScan;
32 import org.springframework.context.annotation.Configuration;
33 import org.springframework.context.annotation.Primary;
34 import org.springframework.transaction.PlatformTransactionManager;
35 import org.springframework.transaction.annotation.EnableTransactionManagement;
39 "org.openecomp.sdc.be.dao.jsongraph",
41 @EnableTransactionManagement
42 public class JanusGraphSpringConfig {
44 @Bean(name = "janusgraph-generic-dao")
46 public HealingJanusGraphGenericDao janusGraphGenericDao(@Qualifier("janusgraph-client") JanusGraphClient janusGraphClient, @Qualifier("healingPipelineDao") HealingPipelineDao healingPipelineDao) {
47 return new HealingJanusGraphGenericDao(healingPipelineDao, janusGraphClient);
50 @Bean(name = "janusgraph-client", initMethod = "createGraph")
52 public JanusGraphClient janusGraphClient(@Qualifier("dao-client-strategy")
53 JanusGraphClientStrategy janusGraphClientStrategy) {
54 return new JanusGraphClient(janusGraphClientStrategy);
57 @Bean(name = "dao-client-strategy")
58 public JanusGraphClientStrategy janusGraphClientStrategy() {
59 return new DAOJanusGraphStrategy();
63 public PlatformTransactionManager txManager() {
64 return new SimpleJanusGraphTransactionManager(janusGraphClient(janusGraphClientStrategy()));
67 @Bean(name = "healingPipelineDao")
68 public HealingPipelineDao healingPipeline(){
69 HealingPipelineDao healingPipelineDao = new HealingPipelineDao();
70 healingPipelineDao.setHealVersion(1);
71 healingPipelineDao.initHealVersion();
72 return healingPipelineDao;