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