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}")
37 private String artifactUrl;
40 private SdcListenerAuthClientInterceptor sdcListenerAuthClientInterceptor;
42 private IDistributionClient distributionClient;
43 private ManagedChannel managedChannel;
44 private String distributionId;
46 public IDistributionClient getDistributionClient() {
47 return distributionClient;
50 public void setDistributionClient(IDistributionClient distributionClient) {
51 this.distributionClient = distributionClient;
54 public void setDistributionId(String id) {
55 this.distributionId = id;
58 public String getDistributionId() {
59 return distributionId;
62 public void setManagedChannelForGrpc() {
63 managedChannel = ManagedChannelBuilder.forAddress(grpcAddress, grpcPort)
65 .intercept(sdcListenerAuthClientInterceptor)
69 public ManagedChannel getManagedChannelForGrpc() {
70 return managedChannel;
73 public String getArtifactUrl() {
77 public void setArtifactUrl(String artifactUrl) {
78 this.artifactUrl = artifactUrl;