Cleanup project's name in Sonar
[aai/router-core.git] / src / main / java / org / onap / aai / event / EventBusEndpoint.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.event;
24
25
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;
35
36 /**
37  * Represents a EventBus endpoint.
38  */
39 @UriEndpoint(scheme = "event-bus", syntax = "event-bus:name",
40     consumerClass = EventBusConsumer.class, title = "event-bus")
41 public class EventBusEndpoint extends DefaultEndpoint {
42   @UriPath
43   @Metadata(required = "true")
44   private String name;
45
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")
61   private String url;
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;
68   
69   public EventBusEndpoint() {}
70
71   public EventBusEndpoint(String uri, EventBusComponent component) {
72     super(uri, component);
73   }
74
75   public EventBusEndpoint(String endpointUri) {
76     super(endpointUri);
77   }
78
79   public Producer createProducer() throws Exception {
80     return new EventBusProducer(this);
81   }
82
83   public Consumer createConsumer(Processor processor) throws Exception {
84     return new EventBusConsumer(this, processor);
85   }
86
87   public boolean isSingleton() {
88     return false;
89   }
90
91   public void setName(String name) {
92     this.name = name;
93   }
94
95   public String getName() {
96     return name;
97   }
98
99   public String getEventTopic() {
100     return eventTopic;
101   }
102
103   public void setEventTopic(String eventTopic) {
104     this.eventTopic = eventTopic;
105   }
106
107   public String getGroupName() {
108     return groupName;
109   }
110
111   public void setGroupName(String groupName) {
112     this.groupName = groupName;
113   }
114
115   public String getGroupId() {
116     return groupId;
117   }
118
119   public void setGroupId(String groupId) {
120     this.groupId = groupId;
121   }
122
123   public String getApiKey() {
124     return apiKey == null ? null : Password.deobfuscate(apiKey);
125   }
126
127   public void setApiKey(String apiKey) {
128     this.apiKey = apiKey;
129   }
130
131   public String getApiSecret() {
132     return apiSecret == null ? null : Password.deobfuscate(apiSecret);
133   }
134
135   public void setApiSecret(String apiSecret) {
136     this.apiSecret = apiSecret;
137   }
138   
139   public int getPoolSize() {
140         return poolSize;
141   }
142
143   public void setPoolSize(int poolsize) {
144         this.poolSize = poolsize;
145   }
146
147   public int getPollingDelay() {
148           return pollingDelay;
149   }
150
151   public void setPollingDelay(int pollingDelay) {
152           this.pollingDelay = pollingDelay;
153   }
154
155   public String getUrl() {
156           return url;
157   }
158
159   public void setUrl(String url) {
160     this.url = url;
161   }
162 }
163