1e43adceba9e2c536dbf0ffda6c80d1b05da847c
[so.git] / bpmn / MSOCommonBPMN / src / main / java / org / onap / so / client / restproperties / PolicyRestPropertiesImpl.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP - SO
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.so.client.restproperties;
22
23 import java.net.MalformedURLException;
24 import java.net.URL;
25
26 import org.onap.so.bpmn.core.UrnPropertiesReader;
27 import org.onap.so.client.policy.PolicyRestProperties;
28
29 public class PolicyRestPropertiesImpl implements PolicyRestProperties {
30
31         public static final String POLICY_ENDPOINT = "policy.endpoint";
32         public static final String POLICY_ENVIRONMENT = "policy.environment";
33         public static final String POLICY_AUTH = "policy.auth";
34         public static final String POLICY_CLIENT_AUTH = "policy.client.auth";
35
36         public PolicyRestPropertiesImpl() {
37         }
38         
39         @Override
40         public URL getEndpoint() {
41                 try {
42                         return new URL(UrnPropertiesReader.getVariable(POLICY_ENDPOINT));
43                 } catch (MalformedURLException e) {
44                         return null;
45                 }
46         }
47
48         @Override
49         public String getSystemName() {
50                 return "MSO";
51         }
52         
53         public String getClientAuth() {
54                 return UrnPropertiesReader.getVariable(POLICY_CLIENT_AUTH);
55         }
56         
57         public String getAuth() {
58                 return UrnPropertiesReader.getVariable(POLICY_AUTH);
59         }
60         
61         public String getEnvironment() {
62                 return UrnPropertiesReader.getVariable(POLICY_ENVIRONMENT);
63         }
64
65 }