1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
package org.mule.module.atom.endpoint; |
8 | |
|
9 | |
import org.mule.api.MuleException; |
10 | |
import org.mule.api.MuleMessage; |
11 | |
import org.mule.api.endpoint.InboundEndpoint; |
12 | |
import org.mule.endpoint.DefaultInboundEndpoint; |
13 | |
import org.mule.module.atom.transformers.ObjectToFeed; |
14 | |
|
15 | |
import java.util.Date; |
16 | |
import java.util.HashSet; |
17 | |
import java.util.Set; |
18 | |
|
19 | |
|
20 | |
|
21 | |
|
22 | |
public class AtomInboundEndpoint extends DefaultInboundEndpoint |
23 | |
{ |
24 | |
private boolean splitFeed; |
25 | |
|
26 | |
private Date lastUpdate; |
27 | |
|
28 | 0 | private ObjectToFeed inTransform = new ObjectToFeed(); |
29 | |
|
30 | 0 | private Set<String> supportedProtocols = new HashSet<String>(2); |
31 | |
|
32 | |
public AtomInboundEndpoint(boolean splitFeed, Date lastUpdate, InboundEndpoint ie) |
33 | |
{ |
34 | 0 | super(ie.getConnector(), ie.getEndpointURI(), ie.getName(), |
35 | |
ie.getProperties(), ie.getTransactionConfig(), ie.isDeleteUnacceptedMessages(), |
36 | |
ie.getExchangePattern(), ie.getResponseTimeout(), ie.getInitialState(), |
37 | |
ie.getEncoding(), ie.getEndpointBuilderName(), ie.getMuleContext(), ie.getRetryPolicyTemplate(), |
38 | |
ie.getMessageProcessorsFactory(), ie.getMessageProcessors(), ie.getResponseMessageProcessors(), ie.isDisableTransportTransformer(), ie.getMimeType()); |
39 | 0 | this.splitFeed = splitFeed; |
40 | 0 | this.lastUpdate = lastUpdate; |
41 | 0 | } |
42 | |
|
43 | |
public boolean isSplitFeed() |
44 | |
{ |
45 | 0 | return splitFeed; |
46 | |
} |
47 | |
|
48 | |
public Date getLastUpdate() |
49 | |
{ |
50 | 0 | return lastUpdate; |
51 | |
} |
52 | |
|
53 | |
void registerSupportedProtocol(String protocol) |
54 | |
{ |
55 | 0 | supportedProtocols.add(protocol); |
56 | 0 | } |
57 | |
|
58 | |
boolean unregisterProtocol(String protocol) |
59 | |
{ |
60 | 0 | return supportedProtocols.remove(protocol); |
61 | |
} |
62 | |
|
63 | |
@Override |
64 | |
public boolean isProtocolSupported(String protocol) |
65 | |
{ |
66 | 0 | return supportedProtocols.contains(protocol); |
67 | |
} |
68 | |
|
69 | |
public boolean onMessage(MuleMessage message) throws MuleException |
70 | |
{ |
71 | 0 | message.applyTransformers(null, inTransform); |
72 | 0 | return true; |
73 | |
} |
74 | |
} |