org.onap migration
[vid.git] / vid-app-common / src / main / java / org / onap / vid / properties / AsdcClientConfiguration.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * VID
4  * ================================================================================
5  * Copyright (C) 2017 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
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
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=========================================================
19  */
20
21 package org.onap.vid.properties;
22
23 import org.springframework.beans.factory.annotation.Value;
24 import org.springframework.context.annotation.Bean;
25 import org.springframework.context.annotation.Configuration;
26 import org.springframework.context.annotation.PropertySource;
27 import org.springframework.context.annotation.PropertySources;
28 import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
29
30 /**
31  * The Class AsdcClientConfiguration.
32  */
33 @Configuration
34
35 @PropertySources({
36                 @PropertySource(value="asdc.properties",  ignoreResourceNotFound = true),
37                 @PropertySource(value="${container.classpath:}/WEB-INF/conf/asdc.properties", ignoreResourceNotFound = true)
38 })
39 public class AsdcClientConfiguration {
40
41     @Bean
42     public static PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() {
43         return new PropertySourcesPlaceholderConfigurer();
44     }
45
46         @Value("${asdc.client.type}")
47         private AsdcClientType asdcClientType;
48
49         /** The asdc client host. */
50         @Value("${asdc.client.rest.host}")
51         private String asdcClientHost;
52
53         /** The asdc client port. */
54         @Value("${asdc.client.rest.port}")
55         private int asdcClientPort;
56
57         /** The asdc client auth. */
58         @Value("${asdc.client.rest.auth}")
59         public String asdcClientAuth;
60
61         /** The asdc client protocol. */
62         @Value("${asdc.client.rest.protocol}")
63         public String asdcClientProtocol;
64
65         /**
66          * Gets the asdc client type.
67          *
68          * @return the asdc client type
69          */
70         public AsdcClientType getAsdcClientType() {
71                 return asdcClientType;
72         }
73
74         /**
75          * Gets the asdc client host.
76          *
77          * @return the asdc client host
78          */
79         public String getAsdcClientHost() {
80                 return asdcClientHost;
81         }
82
83         /**
84          * Gets the asdc client port.
85          *
86          * @return the asdc client port
87          */
88         public int getAsdcClientPort() {
89                 return asdcClientPort;
90         }
91
92         /**
93          * Gets the asdc client auth.
94          *
95          * @return the asdc client auth
96          */
97         public String getAsdcClientAuth() {
98                 return asdcClientAuth;
99         }
100
101         /**
102          * Gets the asdc client protocol.
103          *
104          * @return the asdc client protocol
105          */
106         public String getAsdcClientProtocol() {
107                 return asdcClientProtocol;
108         }
109
110         /**
111          * The Enum AsdcClientType.
112          */
113         public enum AsdcClientType {
114
115                 /** The in memory. */
116                 IN_MEMORY,
117
118                 /** The rest. */
119                 REST,
120
121                 /** The local. */
122                 LOCAL
123         }
124 }