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.
17 package org.onap.ccsdk.cds.sdclistener.dto;
19 import io.grpc.ManagedChannel;
20 import io.grpc.ManagedChannelBuilder;
21 import org.onap.ccsdk.cds.sdclistener.client.SdcListenerAuthClientInterceptor;
22 import org.onap.sdc.api.IDistributionClient;
23 import org.springframework.beans.factory.annotation.Autowired;
24 import org.springframework.beans.factory.annotation.Value;
25 import org.springframework.boot.context.properties.ConfigurationProperties;
26 import org.springframework.stereotype.Component;
29 @ConfigurationProperties("listenerservice")
30 public class SdcListenerDto {
32 @Value("${listenerservice.config.grpcAddress}")
33 private String grpcAddress;
35 @Value("${listenerservice.config.grpcPort}")
38 private String artifactUrl;
41 private SdcListenerAuthClientInterceptor sdcListenerAuthClientInterceptor;
43 private IDistributionClient distributionClient;
44 private ManagedChannel managedChannel;
45 private String distributionId;
47 public IDistributionClient getDistributionClient() {
48 return distributionClient;
51 public void setDistributionClient(IDistributionClient distributionClient) {
52 this.distributionClient = distributionClient;
55 public void setDistributionId(String id) {
56 this.distributionId = id;
59 public String getDistributionId() {
60 return distributionId;
63 public void setManagedChannelForGrpc() {
64 managedChannel = ManagedChannelBuilder.forAddress(grpcAddress, grpcPort)
66 .intercept(sdcListenerAuthClientInterceptor)
70 public ManagedChannel getManagedChannelForGrpc() {
71 return managedChannel;
74 public String getArtifactUrl() {
78 public void setArtifactUrl(String artifactUrl) {
79 this.artifactUrl = artifactUrl;