|
|||||||||||||||||||
30 day Evaluation License registered to hlship@comcast.net Your 30 day evaluation period has expired. Please visit http://www.cenqua.com to obtain a licensed version of Clover | |||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
EngineServiceInnerProxy.java | - | 100% | 100% | 100% |
|
1 | // Copyright 2005 The Apache Software Foundation | |
2 | // | |
3 | // Licensed under the Apache License, Version 2.0 (the "License"); | |
4 | // you may not use this file except in compliance with the License. | |
5 | // You may obtain a copy of the License at | |
6 | // | |
7 | // http://www.apache.org/licenses/LICENSE-2.0 | |
8 | // | |
9 | // Unless required by applicable law or agreed to in writing, software | |
10 | // distributed under the License is distributed on an "AS IS" BASIS, | |
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
12 | // See the License for the specific language governing permissions and | |
13 | // limitations under the License. | |
14 | ||
15 | package org.apache.tapestry.services.impl; | |
16 | ||
17 | import java.io.IOException; | |
18 | ||
19 | import org.apache.hivemind.util.Defense; | |
20 | import org.apache.tapestry.IRequestCycle; | |
21 | import org.apache.tapestry.engine.IEngineService; | |
22 | import org.apache.tapestry.engine.ILink; | |
23 | ||
24 | /** | |
25 | * Inner proxy that actually resolves the engine service using the | |
26 | * {@link org.apache.tapestry.services.impl.EngineServiceSource}, then replaces itself in the outer | |
27 | * proxy. | |
28 | * | |
29 | * @author Howard M. Lewis Ship | |
30 | * @since 4.0 | |
31 | * @see org.apache.tapestry.services.impl.EngineServiceOuterProxy | |
32 | */ | |
33 | public class EngineServiceInnerProxy implements IEngineService | |
34 | { | |
35 | private final String _serviceName; | |
36 | ||
37 | private final EngineServiceOuterProxy _outerProxy; | |
38 | ||
39 | private final EngineServiceSource _source; | |
40 | ||
41 | 148 | public EngineServiceInnerProxy(String serviceName, EngineServiceOuterProxy outerProxy, |
42 | EngineServiceSource source) | |
43 | { | |
44 | 148 | Defense.notNull(serviceName, "serviceName"); |
45 | 148 | Defense.notNull(outerProxy, "outerProxy"); |
46 | 148 | Defense.notNull(source, "source"); |
47 | ||
48 | 148 | _serviceName = serviceName; |
49 | 148 | _outerProxy = outerProxy; |
50 | 148 | _source = source; |
51 | } | |
52 | ||
53 | 1 | public String toString() |
54 | { | |
55 | 1 | return ImplMessages.engineServiceInnerProxyToString(_serviceName); |
56 | } | |
57 | ||
58 | 131 | private IEngineService resolve() |
59 | { | |
60 | 131 | IEngineService service = _source.resolveEngineService(_serviceName); |
61 | ||
62 | 130 | _outerProxy.installDelegate(service); |
63 | ||
64 | 130 | return service; |
65 | } | |
66 | ||
67 | 74 | public synchronized ILink getLink(IRequestCycle cycle, Object parameter) |
68 | { | |
69 | 74 | return resolve().getLink(cycle, parameter); |
70 | } | |
71 | ||
72 | 57 | public synchronized void service(IRequestCycle cycle) throws IOException |
73 | { | |
74 | 57 | resolve().service(cycle); |
75 | } | |
76 | ||
77 | 1 | public String getName() |
78 | { | |
79 | 1 | return _serviceName; |
80 | } | |
81 | ||
82 | } |
|