1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.onehippo.forge.camel.component.hippo;
17
18 import java.util.Collections;
19 import java.util.Map;
20 import java.util.Set;
21
22 import org.apache.camel.Consumer;
23 import org.apache.camel.Processor;
24 import org.apache.camel.Producer;
25 import org.apache.camel.support.DefaultEndpoint;
26
27
28
29
30 public class HippoEventEndpoint extends DefaultEndpoint {
31
32 private final Map<String, Object> properties;
33
34 protected HippoEventEndpoint(final String endpointUri, final HippoEventComponent component, final Map<String, Object> properties) {
35 super(endpointUri, component);
36 this.properties = properties;
37 }
38
39 @Override
40 public Consumer createConsumer(Processor processor) throws Exception {
41 HippoEventConsumer answer = new HippoEventConsumer(this, processor);
42 configureConsumer(answer);
43 return answer;
44 }
45
46 @Override
47 public Producer createProducer() throws Exception {
48 throw new UnsupportedOperationException("Producer is not supported.");
49 }
50
51 @Override
52 public boolean isSingleton() {
53 return true;
54 }
55
56 public Set<String> getPropertyNameSet() {
57 if (properties == null) {
58 return Collections.emptySet();
59 }
60
61 return Collections.unmodifiableSet(properties.keySet());
62 }
63
64 public Object getProperty(String name) {
65 if (properties != null) {
66 return properties.get(name);
67 }
68
69 return null;
70 }
71
72 public boolean hasProperty(String name) {
73 if (properties == null) {
74 return false;
75 }
76
77 return properties.containsKey(name);
78 }
79 }