KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > tapestry > script > ParsedScript


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 JavaDoc;
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     public ParsedScript(ExpressionEvaluator evaluator, ValueConverter valueConverter,
45             Location location)
46     {
47         super(location);
48
49         _evaluator = evaluator;
50         _valueConverter = valueConverter;
51         _scriptResource = location.getResource();
52     }
53
54     public Resource getScriptResource()
55     {
56         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     public void execute(IRequestCycle cycle, IScriptProcessor processor, Map JavaDoc symbols)
64     {
65         ScriptSession session = new ScriptSessionImpl(_scriptResource, cycle, processor,
66                 _evaluator, _valueConverter, symbols);
67
68         writeChildren(null, session);
69     }
70
71     /**
72      * Does nothing; never invoked.
73      */

74     public void write(StringBuffer JavaDoc buffer, ScriptSession session)
75     {
76
77     }
78
79 }
Popular Tags