1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
package org.mule.impl.model.direct; |
12 | |
|
13 | |
import org.mule.impl.MuleDescriptor; |
14 | |
import org.mule.impl.MuleMessage; |
15 | |
import org.mule.impl.model.AbstractComponent; |
16 | |
import org.mule.impl.model.DefaultMuleProxy; |
17 | |
import org.mule.impl.model.MuleProxy; |
18 | |
import org.mule.umo.UMOEvent; |
19 | |
import org.mule.umo.UMOException; |
20 | |
import org.mule.umo.UMOMessage; |
21 | |
import org.mule.umo.lifecycle.InitialisationException; |
22 | |
import org.mule.umo.model.UMOModel; |
23 | |
|
24 | |
import java.util.List; |
25 | |
|
26 | |
|
27 | |
|
28 | |
|
29 | |
|
30 | |
public class DirectComponent extends AbstractComponent |
31 | |
{ |
32 | |
|
33 | |
|
34 | |
|
35 | |
private static final long serialVersionUID = -8590955440156945732L; |
36 | |
|
37 | 0 | protected List interceptorList = null; |
38 | |
protected MuleProxy proxy; |
39 | |
|
40 | |
public DirectComponent(MuleDescriptor descriptor, UMOModel model) |
41 | |
{ |
42 | 0 | super(descriptor, model); |
43 | 0 | } |
44 | |
|
45 | |
protected void doInitialise() throws InitialisationException |
46 | |
{ |
47 | |
|
48 | |
try |
49 | |
{ |
50 | 0 | Object component = lookupComponent(); |
51 | 0 | proxy = new DefaultMuleProxy(component, descriptor, model, null); |
52 | 0 | proxy.setStatistics(getStatistics()); |
53 | |
} |
54 | 0 | catch (UMOException e) |
55 | |
{ |
56 | 0 | throw new InitialisationException(e, this); |
57 | 0 | } |
58 | 0 | } |
59 | |
|
60 | |
protected UMOMessage doSend(UMOEvent event) throws UMOException |
61 | |
{ |
62 | |
|
63 | 0 | Object obj = proxy.onCall(event); |
64 | 0 | if (obj instanceof UMOMessage) |
65 | |
{ |
66 | 0 | return (UMOMessage) obj; |
67 | |
} |
68 | |
else |
69 | |
{ |
70 | 0 | return new MuleMessage(obj, event.getMessage()); |
71 | |
} |
72 | |
} |
73 | |
|
74 | |
protected void doDispatch(UMOEvent event) throws UMOException |
75 | |
{ |
76 | 0 | proxy.onCall(event); |
77 | 0 | } |
78 | |
|
79 | |
protected void doStop() throws UMOException |
80 | |
{ |
81 | 0 | proxy.stop(); |
82 | 0 | } |
83 | |
|
84 | |
protected void doStart() throws UMOException |
85 | |
{ |
86 | 0 | proxy.start(); |
87 | 0 | } |
88 | |
|
89 | |
protected void doPause() |
90 | |
{ |
91 | 0 | proxy.suspend(); |
92 | 0 | } |
93 | |
|
94 | |
protected void doResume() |
95 | |
{ |
96 | 0 | proxy.resume(); |
97 | 0 | } |
98 | |
|
99 | |
protected void doDispose() |
100 | |
{ |
101 | 0 | proxy.dispose(); |
102 | 0 | } |
103 | |
} |