Cleanup project's name in Sonar
[aai/router-core.git] / src / main / java / org / onap / aai / rest / RestClientEndpoint.java
1 /**
2  * ============LICENSE_START=======================================================
3  * org.onap.aai
4  * ================================================================================
5  * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
6  * Copyright © 2017 Amdocs
7  * ================================================================================
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  *       http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  * ============LICENSE_END=========================================================
20  *
21  * ECOMP is a trademark and service mark of AT&T Intellectual Property.
22  */
23 package org.onap.aai.rest;
24
25 import org.apache.camel.Consumer;
26 import org.apache.camel.Processor;
27 import org.apache.camel.Producer;
28 import org.apache.camel.impl.DefaultEndpoint;
29 import org.apache.camel.spi.Metadata;
30 import org.apache.camel.spi.UriEndpoint;
31 import org.apache.camel.spi.UriParam;
32 import org.apache.camel.spi.UriPath;
33
34 import java.util.Map;
35
36
37 /**
38  * Represents a RestClient endpoint.
39  */
40 @UriEndpoint(scheme = "ecomp-rest", syntax = "ecomp-rest:op",
41     consumerClass = RestClientConsumer.class, label = "RestClient2", title = "")
42 public class RestClientEndpoint extends DefaultEndpoint {
43
44   public static final String CONTEXT_PARAM_CLIENT_CERT = "ecomp-client-cert";
45   public static final String CONTEXT_PARAM_KEYSTORE = "ecomp-keystore";
46   public static final String CONTEXT_PARAM_KEYSTORE_PWD = "ecomp-keystore-password";
47
48   public static final String IN_HEADER_URL = "ecomp-url";
49
50   public static final String OUT_HEADER_RESPONSE_CODE = "ecomp-response-code";
51   public static final String OUT_HEADER_RESPONSE_MSG = "ecomp-response-message";
52
53   @UriPath
54   @Metadata(required = "true")
55   private String op;
56
57   @UriParam
58   private String ecompClientCert;
59
60   @UriParam
61   private String ecompKeystore;
62
63   @UriParam
64   private String ecompKeystorePassword;
65
66
67   public RestClientEndpoint() {}
68
69   public RestClientEndpoint(String uri, RestClientComponent component) {
70     super(uri, component);
71   }
72
73   public RestClientEndpoint(String endpointUri) {
74     super(endpointUri);
75   }
76
77   @Override
78   protected void setProperties(Object bean, Map<String, Object> parameters) throws Exception {
79     super.setProperties(bean, parameters);
80   }
81
82   public Producer createProducer() throws Exception {
83     return new RestClientProducer(this);
84   }
85
86   public Consumer createConsumer(Processor processor) throws Exception {
87     return new RestClientConsumer(this, processor);
88   }
89
90   public boolean isSingleton() {
91     return true;
92   }
93
94   public String getOp() {
95     return op;
96   }
97
98   public void setOp(String op) {
99     this.op = op;
100   }
101
102   public String getEcompClientCert() {
103     return ecompClientCert;
104   }
105
106   public void setEcompClientCert(String ecompClientCert) {
107     this.ecompClientCert = ecompClientCert;
108   }
109
110   public String getEcompKeystore() {
111     return ecompKeystore;
112   }
113
114   public void setEcompKeystore(String ecompKeystore) {
115     this.ecompKeystore = ecompKeystore;
116   }
117
118   public String getEcompKeystorePassword() {
119     return ecompKeystorePassword;
120   }
121
122   public void setEcompKeystorePassword(String ecompKeystorePassword) {
123     this.ecompKeystorePassword = ecompKeystorePassword;
124   }
125 }