001    /*
002     * Licensed to the Apache Software Foundation (ASF) under one or more
003     * contributor license agreements.  See the NOTICE file distributed with
004     * this work for additional information regarding copyright ownership.
005     * The ASF licenses this file to You under the Apache License, Version 2.0
006     * (the "License"); you may not use this file except in compliance with
007     * the License.  You may obtain a copy of the License at
008     *
009     *     http://www.apache.org/licenses/LICENSE-2.0
010     *
011     * Unless required by applicable law or agreed to in writing, software
012     * distributed under the License is distributed on an "AS IS" BASIS,
013     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014     * See the License for the specific language governing permissions and
015     * limitations under the License.
016     */
017    package org.apache.commons.scxml.env.jsp;
018    
019    import javax.servlet.jsp.el.ELException;
020    import javax.servlet.jsp.el.VariableResolver;
021    
022    import org.apache.commons.scxml.Context;
023    import org.apache.commons.scxml.env.SimpleContext;
024    
025    /**
026     * EL Context for SCXML interpreter.
027     *
028     */
029    public class ELContext extends SimpleContext implements VariableResolver {
030    
031        /** Serial version UID. */
032        private static final long serialVersionUID = 1L;
033    
034        /**
035         * Constructor.
036         *
037         */
038        public ELContext() {
039            super();
040        }
041    
042        /**
043         * Constructor.
044         *
045         * @param parent A parent Context, can be null
046         */
047        public ELContext(final Context parent) {
048            super(parent);
049        }
050    
051        /**
052         * Resolves the specified variable. Returns null if the variable is
053         * not found.
054         *
055         * @param pName The variable to resolve
056         * @return Object The value of the variable, or null, if it does not
057         *                exist
058         * @throws ELException While resolving the variable
059         * @see javax.servlet.jsp.el.VariableResolver#resolveVariable(String)
060         */
061        public Object resolveVariable(final String pName) throws ELException {
062            return get(pName);
063        }
064    
065    }
066