2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
6 * Copyright © 2017-2018 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
12 * http://www.apache.org/licenses/LICENSE-2.0
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=========================================================
21 package org.onap.aai.event;
24 import org.apache.camel.Consumer;
25 import org.apache.camel.Processor;
26 import org.apache.camel.Producer;
27 import org.apache.camel.impl.DefaultEndpoint;
28 import org.apache.camel.spi.Metadata;
29 import org.apache.camel.spi.UriEndpoint;
30 import org.apache.camel.spi.UriParam;
31 import org.apache.camel.spi.UriPath;
32 import org.eclipse.jetty.util.security.Password;
35 * Represents a EventBus endpoint.
37 @UriEndpoint(scheme = "event-bus", syntax = "event-bus:name",
38 consumerClass = EventBusConsumer.class, title = "event-bus")
39 public class EventBusEndpoint extends DefaultEndpoint {
41 @Metadata(required = "true")
44 @UriParam(label = "eventTopic")
45 @Metadata(required = "true")
46 private String eventTopic;
47 @UriParam(label = "groupName")
48 @Metadata(required = "true")
49 private String groupName;
50 @UriParam(label = "groupId")
51 @Metadata(required = "true")
52 private String groupId;
53 @UriParam(label = "apiKey")
54 private String apiKey;
55 @UriParam(label = "apiSecret")
56 private String apiSecret;
57 @UriParam(label = "url")
58 @Metadata(required = "true")
60 @UriParam(label = "poolSize")
61 @Metadata(required = "true", defaultValue="20")
62 private int poolSize = 20;
63 @UriParam(label = "pollingDelay")
64 @Metadata(required = "true", defaultValue="30000")
65 private int pollingDelay = 30000;
67 public EventBusEndpoint() {}
69 public EventBusEndpoint(String uri, EventBusComponent component) {
70 super(uri, component);
73 public EventBusEndpoint(String endpointUri) {
77 public Producer createProducer() throws Exception {
78 return new EventBusProducer(this);
81 public Consumer createConsumer(Processor processor) throws Exception {
82 return new EventBusConsumer(this, processor);
85 public boolean isSingleton() {
89 public void setName(String name) {
93 public String getName() {
97 public String getEventTopic() {
101 public void setEventTopic(String eventTopic) {
102 this.eventTopic = eventTopic;
105 public String getGroupName() {
109 public void setGroupName(String groupName) {
110 this.groupName = groupName;
113 public String getGroupId() {
117 public void setGroupId(String groupId) {
118 this.groupId = groupId;
121 public String getApiKey() {
122 return apiKey == null ? null : Password.deobfuscate(apiKey);
125 public void setApiKey(String apiKey) {
126 this.apiKey = apiKey;
129 public String getApiSecret() {
130 return apiSecret == null ? null : Password.deobfuscate(apiSecret);
133 public void setApiSecret(String apiSecret) {
134 this.apiSecret = apiSecret;
137 public int getPoolSize() {
141 public void setPoolSize(int poolsize) {
142 this.poolSize = poolsize;
145 public int getPollingDelay() {
149 public void setPollingDelay(int pollingDelay) {
150 this.pollingDelay = pollingDelay;
153 public String getUrl() {
157 public void setUrl(String url) {