2 * Copyright © 2019 Bell Canada
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package org.onap.ccsdk.cds.sdclistener.dto;
18 import io.grpc.ManagedChannel;
19 import io.grpc.ManagedChannelBuilder;
20 import org.onap.ccsdk.cds.sdclistener.client.SdcListenerAuthClientInterceptor;
21 import org.onap.sdc.api.IDistributionClient;
22 import org.springframework.beans.factory.annotation.Autowired;
23 import org.springframework.beans.factory.annotation.Value;
24 import org.springframework.boot.context.properties.ConfigurationProperties;
25 import org.springframework.stereotype.Component;
28 @ConfigurationProperties("listenerservice")
29 public class SdcListenerDto {
31 @Value("${listenerservice.config.grpcAddress}")
32 private String grpcAddress;
34 @Value("${listenerservice.config.grpcPort}")
38 private SdcListenerAuthClientInterceptor sdcListenerAuthClientInterceptor;
40 private IDistributionClient distributionClient;
41 private ManagedChannel managedChannel;
42 private String distributionId;
44 public IDistributionClient getDistributionClient() {
45 return distributionClient;
48 public void setDistributionClient(IDistributionClient distributionClient) {
49 this.distributionClient = distributionClient;
52 public void setDistributionId(String id) {
53 this.distributionId = id;
56 public String getDistributionId() {
57 return distributionId;
60 public void setManagedChannelForGrpc() {
61 managedChannel = ManagedChannelBuilder.forAddress(grpcAddress, grpcPort)
63 .intercept(sdcListenerAuthClientInterceptor)
67 public ManagedChannel getManagedChannelForGrpc() {
68 return managedChannel;