|
|||||||||||||||||||
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 | |||||||||||||||
ParsedScript.java | - | 100% | 75% | 90.9% |
|
1 |
// Copyright 2004, 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.script;
|
|
16 |
|
|
17 |
import java.util.Map;
|
|
18 |
|
|
19 |
import org.apache.hivemind.Location;
|
|
20 |
import org.apache.hivemind.Resource;
|
|
21 |
import org.apache.tapestry.IRequestCycle;
|
|
22 |
import org.apache.tapestry.IScript;
|
|
23 |
import org.apache.tapestry.IScriptProcessor;
|
|
24 |
import org.apache.tapestry.coerce.ValueConverter;
|
|
25 |
import org.apache.tapestry.services.ExpressionEvaluator;
|
|
26 |
|
|
27 |
/**
|
|
28 |
* A top level container for a number of {@link IScriptToken script tokens}.
|
|
29 |
*
|
|
30 |
* @author Howard Lewis Ship
|
|
31 |
* @since 0.2.9
|
|
32 |
*/
|
|
33 |
|
|
34 |
public class ParsedScript extends AbstractToken implements IScript |
|
35 |
{ |
|
36 |
private Resource _scriptResource;
|
|
37 |
|
|
38 |
private ExpressionEvaluator _evaluator;
|
|
39 |
|
|
40 |
/** @since 4.0 */
|
|
41 |
|
|
42 |
private ValueConverter _valueConverter;
|
|
43 |
|
|
44 | 17 |
public ParsedScript(ExpressionEvaluator evaluator, ValueConverter valueConverter,
|
45 |
Location location) |
|
46 |
{ |
|
47 | 17 |
super(location);
|
48 |
|
|
49 | 17 |
_evaluator = evaluator; |
50 | 17 |
_valueConverter = valueConverter; |
51 | 17 |
_scriptResource = location.getResource(); |
52 |
} |
|
53 |
|
|
54 | 3 |
public Resource getScriptResource()
|
55 |
{ |
|
56 | 3 |
return _scriptResource;
|
57 |
} |
|
58 |
|
|
59 |
/**
|
|
60 |
* Creates the {@link ScriptSessionImpl}and invokes
|
|
61 |
* {@link org.apache.tapestry.script.AbstractToken#writeChildren(java.lang.StringBuffer, org.apache.tapestry.script.ScriptSession)}.
|
|
62 |
*/
|
|
63 | 18 |
public void execute(IRequestCycle cycle, IScriptProcessor processor, Map symbols) |
64 |
{ |
|
65 | 18 |
ScriptSession session = new ScriptSessionImpl(_scriptResource, cycle, processor,
|
66 |
_evaluator, _valueConverter, symbols); |
|
67 |
|
|
68 | 18 |
writeChildren(null, session);
|
69 |
} |
|
70 |
|
|
71 |
/**
|
|
72 |
* Does nothing; never invoked.
|
|
73 |
*/
|
|
74 | 0 |
public void write(StringBuffer buffer, ScriptSession session) |
75 |
{ |
|
76 |
|
|
77 |
} |
|
78 |
|
|
79 |
} |
|