1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
package org.apache.tapestry.services.impl; |
16 | |
|
17 | |
import java.io.IOException; |
18 | |
import java.io.Serializable; |
19 | |
|
20 | |
import org.apache.hivemind.util.Defense; |
21 | |
import org.apache.tapestry.IRequestCycle; |
22 | |
import org.apache.tapestry.engine.IEngineService; |
23 | |
import org.apache.tapestry.engine.ILink; |
24 | |
|
25 | |
|
26 | |
|
27 | |
|
28 | |
|
29 | |
|
30 | |
|
31 | |
|
32 | |
|
33 | |
|
34 | |
public class EngineServiceInnerProxy implements IEngineService, Serializable |
35 | |
{ |
36 | |
private static final long serialVersionUID = -8128030027597659447L; |
37 | |
|
38 | |
private final String _serviceName; |
39 | |
|
40 | |
private final EngineServiceOuterProxy _outerProxy; |
41 | |
|
42 | |
private final EngineServiceSource _source; |
43 | |
|
44 | |
public EngineServiceInnerProxy(String serviceName, EngineServiceOuterProxy outerProxy, |
45 | |
EngineServiceSource source) |
46 | 0 | { |
47 | 0 | Defense.notNull(serviceName, "serviceName"); |
48 | 0 | Defense.notNull(outerProxy, "outerProxy"); |
49 | 0 | Defense.notNull(source, "source"); |
50 | |
|
51 | 0 | _serviceName = serviceName; |
52 | 0 | _outerProxy = outerProxy; |
53 | 0 | _source = source; |
54 | 0 | } |
55 | |
|
56 | |
public String toString() |
57 | |
{ |
58 | 0 | return ImplMessages.engineServiceInnerProxyToString(_serviceName); |
59 | |
} |
60 | |
|
61 | |
private IEngineService resolve() |
62 | |
{ |
63 | 0 | IEngineService service = _source.resolveEngineService(_serviceName); |
64 | |
|
65 | 0 | _outerProxy.installDelegate(service); |
66 | |
|
67 | 0 | return service; |
68 | |
} |
69 | |
|
70 | |
public synchronized ILink getLink(boolean post, Object parameter) |
71 | |
{ |
72 | 0 | return resolve().getLink(post, parameter); |
73 | |
} |
74 | |
|
75 | |
public synchronized void service(IRequestCycle cycle) throws IOException |
76 | |
{ |
77 | 0 | resolve().service(cycle); |
78 | 0 | } |
79 | |
|
80 | |
public String getName() |
81 | |
{ |
82 | 0 | return _serviceName; |
83 | |
} |
84 | |
|
85 | |
} |