KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > beehive > netui > script > el > NetUIReadVariableResolver


1 /*
2  * Copyright 2004 The Apache Software Foundation.
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  * $Header:$
17  */

18 package org.apache.beehive.netui.script.el;
19
20 import javax.servlet.jsp.el.VariableResolver JavaDoc;
21
22 import org.apache.beehive.netui.script.IllegalExpressionException;
23 import org.apache.beehive.netui.util.logging.Logger;
24
25 /**
26  *
27  */

28 public class NetUIReadVariableResolver
29     extends NetUIVariableResolver {
30
31     private static final Logger LOGGER = Logger.getInstance(NetUIReadVariableResolver.class);
32
33     private VariableResolver JavaDoc _vr = null;
34
35     public NetUIReadVariableResolver(VariableResolver JavaDoc vr) {
36         assert vr != null;
37         _vr = vr;
38     }
39
40     public Object JavaDoc resolveVariable(String JavaDoc name) {
41
42         try {
43             return _vr.resolveVariable(name);
44         } catch(javax.servlet.jsp.el.ELException JavaDoc ele) {
45             RuntimeException JavaDoc re = new RuntimeException JavaDoc("Could not resolve variable named \"" + name + "\"", new IllegalExpressionException());
46
47             if(LOGGER.isErrorEnabled())
48                 LOGGER.error("", re);
49
50             throw re;
51         }
52     }
53
54     public String JavaDoc[] getAvailableVariables() {
55         return new String JavaDoc[]{"actionForm", "pageFlow", "globalApp", "request", "session", "application", "pageContext", "bundle", "container", "url", "pageInput"};
56     }
57 }
58
Popular Tags