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