|
|||||||||||||||||||
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover 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 | 169 |
public EngineServiceInnerProxy(String serviceName, EngineServiceOuterProxy outerProxy,
|
42 |
EngineServiceSource source) |
|
43 |
{ |
|
44 | 169 |
Defense.notNull(serviceName, "serviceName");
|
45 | 169 |
Defense.notNull(outerProxy, "outerProxy");
|
46 | 169 |
Defense.notNull(source, "source");
|
47 |
|
|
48 | 169 |
_serviceName = serviceName; |
49 | 169 |
_outerProxy = outerProxy; |
50 | 169 |
_source = source; |
51 |
} |
|
52 |
|
|
53 | 1 |
public String toString()
|
54 |
{ |
|
55 | 1 |
return ImplMessages.engineServiceInnerProxyToString(_serviceName);
|
56 |
} |
|
57 |
|
|
58 | 142 |
private IEngineService resolve()
|
59 |
{ |
|
60 | 142 |
IEngineService service = _source.resolveEngineService(_serviceName); |
61 |
|
|
62 | 141 |
_outerProxy.installDelegate(service); |
63 |
|
|
64 | 141 |
return service;
|
65 |
} |
|
66 |
|
|
67 | 80 |
public synchronized ILink getLink(IRequestCycle cycle, Object parameter) |
68 |
{ |
|
69 | 80 |
return resolve().getLink(cycle, parameter);
|
70 |
} |
|
71 |
|
|
72 | 62 |
public synchronized void service(IRequestCycle cycle) throws IOException |
73 |
{ |
|
74 | 62 |
resolve().service(cycle); |
75 |
} |
|
76 |
|
|
77 | 1 |
public String getName()
|
78 |
{ |
|
79 | 1 |
return _serviceName;
|
80 |
} |
|
81 |
|
|
82 |
} |
|