2 * ============LICENSE_START=======================================================
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
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 * ECOMP is a trademark and service mark of AT&T Intellectual Property.
23 package org.onap.aai.event;
26 import org.apache.camel.Consumer;
27 import org.apache.camel.Processor;
28 import org.apache.camel.Producer;
29 import org.apache.camel.impl.DefaultEndpoint;
30 import org.apache.camel.spi.Metadata;
31 import org.apache.camel.spi.UriEndpoint;
32 import org.apache.camel.spi.UriParam;
33 import org.apache.camel.spi.UriPath;
34 import org.eclipse.jetty.util.security.Password;
37 * Represents a EventBus endpoint.
39 @UriEndpoint(scheme = "event-bus", syntax = "event-bus:name",
40 consumerClass = EventBusConsumer.class, title = "event-bus")
41 public class EventBusEndpoint extends DefaultEndpoint {
43 @Metadata(required = "true")
46 @UriParam(label = "eventTopic")
47 @Metadata(required = "true")
48 private String eventTopic;
49 @UriParam(label = "groupName")
50 @Metadata(required = "true")
51 private String groupName;
52 @UriParam(label = "groupId")
53 @Metadata(required = "true")
54 private String groupId;
55 @UriParam(label = "apiKey")
56 private String apiKey;
57 @UriParam(label = "apiSecret")
58 private String apiSecret;
59 @UriParam(label = "url")
60 @Metadata(required = "true")
62 @UriParam(label = "poolSize")
63 @Metadata(required = "true", defaultValue="20")
64 private int poolSize = 20;
65 @UriParam(label = "pollingDelay")
66 @Metadata(required = "true", defaultValue="30000")
67 private int pollingDelay = 30000;
69 public EventBusEndpoint() {}
71 public EventBusEndpoint(String uri, EventBusComponent component) {
72 super(uri, component);
75 public EventBusEndpoint(String endpointUri) {
79 public Producer createProducer() throws Exception {
80 return new EventBusProducer(this);
83 public Consumer createConsumer(Processor processor) throws Exception {
84 return new EventBusConsumer(this, processor);
87 public boolean isSingleton() {
91 public void setName(String name) {
95 public String getName() {
99 public String getEventTopic() {
103 public void setEventTopic(String eventTopic) {
104 this.eventTopic = eventTopic;
107 public String getGroupName() {
111 public void setGroupName(String groupName) {
112 this.groupName = groupName;
115 public String getGroupId() {
119 public void setGroupId(String groupId) {
120 this.groupId = groupId;
123 public String getApiKey() {
124 return apiKey == null ? null : Password.deobfuscate(apiKey);
127 public void setApiKey(String apiKey) {
128 this.apiKey = apiKey;
131 public String getApiSecret() {
132 return apiSecret == null ? null : Password.deobfuscate(apiSecret);
135 public void setApiSecret(String apiSecret) {
136 this.apiSecret = apiSecret;
139 public int getPoolSize() {
143 public void setPoolSize(int poolsize) {
144 this.poolSize = poolsize;
147 public int getPollingDelay() {
151 public void setPollingDelay(int pollingDelay) {
152 this.pollingDelay = pollingDelay;
155 public String getUrl() {
159 public void setUrl(String url) {