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