001: /*
002: * Copyright (c) 1998-2008 Caucho Technology -- all rights reserved
003: *
004: * This file is part of Resin(R) Open Source
005: *
006: * Each copy or derived work must preserve the copyright notice and this
007: * notice unmodified.
008: *
009: * Resin Open Source is free software; you can redistribute it and/or modify
010: * it under the terms of the GNU General Public License as published by
011: * the Free Software Foundation; either version 2 of the License, or
012: * (at your option) any later version.
013: *
014: * Resin Open Source is distributed in the hope that it will be useful,
015: * but WITHOUT ANY WARRANTY; without even the implied warranty of
016: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, or any warranty
017: * of NON-INFRINGEMENT. See the GNU General Public License for more
018: * details.
019: *
020: * You should have received a copy of the GNU General Public License
021: * along with Resin Open Source; if not, write to the
022: * Free SoftwareFoundation, Inc.
023: * 59 Temple Place, Suite 330
024: * Boston, MA 02111-1307 USA
025: *
026: * @author Scott Ferguson
027: */
028:
029: package com.caucho.el;
030:
031: import javax.el.ELContext;
032: import javax.el.ELException;
033: import javax.el.ELResolver;
034: import javax.el.PropertyNotFoundException;
035: import javax.el.PropertyNotWritableException;
036: import java.beans.FeatureDescriptor;
037: import java.util.Iterator;
038: import java.util.logging.Logger;
039:
040: /**
041: * Abstract variable resolver. Supports chaining and the "Var"
042: * special variable.
043: */
044: public class AbstractVariableResolver extends ELResolver {
045: private static final Logger log = Logger
046: .getLogger(AbstractVariableResolver.class.getName());
047:
048: private ELResolver _next;
049:
050: /**
051: * Creates the resolver
052: */
053: public AbstractVariableResolver() {
054: }
055:
056: /**
057: * Creates the resolver
058: */
059: public AbstractVariableResolver(ELResolver next) {
060: _next = next;
061: }
062:
063: /**
064: * Returns the next resolver.
065: */
066: public ELResolver getNext() {
067: return _next;
068: }
069:
070: /**
071: * Returns the named variable value.
072: */
073: @Override
074: public Object getValue(ELContext context, Object base,
075: Object property) {
076: return null;
077: }
078:
079: //
080: // ELResolver stubs
081: //
082:
083: @Override
084: public Class<?> getCommonPropertyType(ELContext context, Object base) {
085: return null;
086: }
087:
088: public Iterator<FeatureDescriptor> getFeatureDescriptors(
089: ELContext context, Object base) {
090: return null;
091: }
092:
093: public Class<?> getType(ELContext context, Object base,
094: Object property) {
095: Object value = getValue(context, base, property);
096:
097: if (value == null)
098: return null;
099: else
100: return value.getClass();
101: }
102:
103: public boolean isReadOnly(ELContext context, Object base,
104: Object property) throws PropertyNotFoundException,
105: ELException {
106: return true;
107: }
108:
109: public void setValue(ELContext context, Object base,
110: Object property, Object value)
111: throws PropertyNotFoundException,
112: PropertyNotWritableException, ELException {
113: }
114:
115: public String toString() {
116: return "AbstractVariableResolver[]";
117: }
118: }
|