1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
package org.mule.module.atom; |
11 | |
|
12 | |
import org.mule.DefaultMuleMessage; |
13 | |
import org.mule.api.MuleEventContext; |
14 | |
import org.mule.api.MuleException; |
15 | |
import org.mule.api.MuleMessage; |
16 | |
|
17 | |
import org.apache.abdera.protocol.Resolver; |
18 | |
import org.apache.abdera.protocol.server.RequestContext; |
19 | |
import org.apache.abdera.protocol.server.ResponseContext; |
20 | |
import org.apache.abdera.protocol.server.Target; |
21 | |
import org.apache.abdera.protocol.server.TargetBuilder; |
22 | |
import org.apache.abdera.protocol.server.WorkspaceManager; |
23 | |
import org.apache.abdera.protocol.server.RequestContext.Scope; |
24 | |
import org.apache.abdera.protocol.server.context.EmptyResponseContext; |
25 | |
import org.apache.abdera.protocol.server.impl.AbstractProvider; |
26 | |
import org.apache.commons.logging.Log; |
27 | |
import org.apache.commons.logging.LogFactory; |
28 | |
|
29 | 0 | public class MuleProvider extends AbstractProvider |
30 | |
{ |
31 | 0 | private final static Log log = LogFactory.getLog(MuleProvider.class); |
32 | |
|
33 | |
public ResponseContext request(RequestContext request) |
34 | |
{ |
35 | 0 | MuleEventContext ctx = (MuleEventContext) |
36 | |
request.getAttribute(Scope.REQUEST, AbderaServiceComponent.EVENT_CONTEXT); |
37 | |
|
38 | |
try |
39 | |
{ |
40 | 0 | MuleMessage requestMessage = new DefaultMuleMessage(request, ctx.getMuleContext()); |
41 | 0 | MuleMessage res = ctx.sendEvent(requestMessage); |
42 | |
|
43 | 0 | return (ResponseContext) res.getPayload(); |
44 | |
} |
45 | 0 | catch (MuleException e) |
46 | |
{ |
47 | 0 | log.error(e); |
48 | 0 | return new EmptyResponseContext(500); |
49 | |
} |
50 | |
} |
51 | |
|
52 | |
@Override |
53 | |
protected TargetBuilder getTargetBuilder(RequestContext request) |
54 | |
{ |
55 | 0 | return null; |
56 | |
} |
57 | |
|
58 | |
@Override |
59 | |
protected Resolver<Target> getTargetResolver(RequestContext request) |
60 | |
{ |
61 | 0 | return null; |
62 | |
} |
63 | |
|
64 | |
@Override |
65 | |
protected WorkspaceManager getWorkspaceManager(RequestContext request) |
66 | |
{ |
67 | 0 | return null; |
68 | |
} |
69 | |
} |