KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > scriptella > driver > janino > JaninoScript


1 /*
2  * Copyright 2006-2007 The Scriptella Project Team.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package scriptella.driver.janino;
17
18 import scriptella.spi.ParametersCallback;
19
20 /**
21  * A base class for Janino <script> elements.
22  * <p>Public members of this class are available in Janino scripting elements.
23  *
24  * @author Fyodor Kupolov
25  * @version 1.0
26  */

27 public abstract class JaninoScript {
28     /**
29      * This field in not a part of the public API.
30      */

31     private ParametersCallback parametersCallback;
32
33     /**
34      * This method in not a part of the public API.
35      */

36     protected final ParametersCallback getParametersCallback() {
37         return parametersCallback;
38     }
39
40     /**
41      * This method in not a part of the public API.
42      */

43     final void setParametersCallback(ParametersCallback parametersCallback) {
44         this.parametersCallback = parametersCallback;
45     }
46
47     /**
48      * This method in not a part of the public API.
49      */

50     protected abstract void execute() throws Exception JavaDoc;
51
52
53     /**
54      * Obtains a parameter value for specified name.
55      * <p>This method is available inside Janino &lt;script&gt; element.
56      *
57      * @param name parameter name
58      * @return parameter value.
59      */

60     public final Object JavaDoc get(String JavaDoc name) {
61         return parametersCallback.getParameter(name);
62     }
63
64
65 }
66
Popular Tags