Commit b1f6efd2 authored by Emmanuel Bourg's avatar Emmanuel Bourg

Merge tag 'upstream/3.0.0'

Upstream version 3.0.0
parents f2aeeeb4 0ac36b34
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can
* obtain a copy of the License at
* https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html
* or packager/legal/LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at packager/legal/LICENSE.txt.
*
* GPL Classpath Exception:
* Oracle designates this particular file as subject to the "Classpath"
* exception as provided by Oracle in the GPL Version 2 section of the License
* file that accompanied this code.
*
* Modifications:
* If applicable, add the following below the License Header, with the fields
* enclosed by brackets [] replaced by your own identifying information:
* "Portions Copyright [year] [name of copyright owner]"
*
* Contributor(s):
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*/
package javax.el;
/**
* Resolves a bean by its known name.
* This class can be extended to return a bean object given its name,
* to set a value to an existing bean, or to create a bean with the value.
* @see BeanNameELResolver
*
* @since EL 3.0
*/
public abstract class BeanNameResolver {
/**
* Returns whether the given name is resolved by the BeanNameResolver
*
* @param beanName The name of the bean.
* @return true if the name is resolved by this BeanNameResolver; false
* otherwise.
*/
public boolean isNameResolved(String beanName) {
return false;
}
/**
* Returns the bean known by its name.
* @param beanName The name of the bean.
* @return The bean with the given name. Can be <code>null</code>.
*
*/
public Object getBean(String beanName) {
return null;
}
/**
* Sets a value to a bean of the given name.
* If the bean of the given name
* does not exist and if {@link #canCreateBean} is <code>true</code>,
* one is created with the given value.
* @param beanName The name of the bean
* @param value The value to set the bean to. Can be <code>null</code>.
* @throws PropertyNotWritableException if the bean cannot be
* modified or created.
*/
public void setBeanValue(String beanName, Object value)
throws PropertyNotWritableException {
throw new PropertyNotWritableException();
}
/**
* Indicates if the bean of the given name is read-only or writable
* @param beanName The name of the bean
* @return <code>true</code> if the bean can be set to a new value.
* <code>false</code> otherwise.
*/
public boolean isReadOnly(String beanName) {
return true;
}
/**
* Allow creating a bean of the given name if it does not exist.
* @param beanName The name of the bean
* @return <code>true</code> if bean creation is supported
* <code>false</code> otherwise.
*/
public boolean canCreateBean(String beanName) {
return false;
}
}
This diff is collapsed.
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can
* obtain a copy of the License at
* https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html
* or packager/legal/LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at packager/legal/LICENSE.txt.
*
* GPL Classpath Exception:
* Oracle designates this particular file as subject to the "Classpath"
* exception as provided by Oracle in the GPL Version 2 section of the License
* file that accompanied this code.
*
* Modifications:
* If applicable, add the following below the License Header, with the fields
* enclosed by brackets [] replaced by your own identifying information:
* "Portions Copyright [year] [name of copyright owner]"
*
* Contributor(s):
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*/
package javax.el;
/**
* <p>A runtime representation of a Class in the EL expressions.
* It encapsulates the java.lang.Class instance.</p>
*
* <p>This class is used only in {@link StaticFieldELResolver} and will
* probably only be of interest to EL implementors, and not EL users.
*
* @since EL 3.0
*/
public class ELClass {
private Class<?> klass;
/**
* Constructor
* @param klass The Class instance
*/
public ELClass(Class<?> klass) {
this.klass = klass;
}
/**
* Returns the Class instance
* @return The Class instance
*/
public Class<?> getKlass() {
return this.klass;
}
}
This diff is collapsed.
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can
* obtain a copy of the License at
* https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html
* or packager/legal/LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at packager/legal/LICENSE.txt.
*
* GPL Classpath Exception:
* Oracle designates this particular file as subject to the "Classpath"
* exception as provided by Oracle in the GPL Version 2 section of the License
* file that accompanied this code.
*
* Modifications:
* If applicable, add the following below the License Header, with the fields
* enclosed by brackets [] replaced by your own identifying information:
* "Portions Copyright [year] [name of copyright owner]"
*
* Contributor(s):
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*
*
* This file incorporates work covered by the following copyright and
* permission notice:
*
* Copyright 2004 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package javax.el;
/**
* An event which indicates that an {@link ELContext} has been created.
* The source object is the ELContext that was created.
*
* @see ELContext
* @see ELContextListener
* @since JSP 2.1
*/
public class ELContextEvent extends java.util.EventObject {
/**
* Constructs an ELContextEvent object to indicate that an
* <code>ELContext</code> has been created.
*
* @param source the <code>ELContext</code> that was created.
*/
public ELContextEvent(ELContext source) {
super(source);
}
/**
* Returns the <code>ELContext</code> that was created.
* This is a type-safe equivalent of the {@link #getSource} method.
*
* @return the ELContext that was created.
*/
public ELContext getELContext() {
return (ELContext) getSource();
}
}
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can
* obtain a copy of the License at
* https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html
* or packager/legal/LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at packager/legal/LICENSE.txt.
*
* GPL Classpath Exception:
* Oracle designates this particular file as subject to the "Classpath"
* exception as provided by Oracle in the GPL Version 2 section of the License
* file that accompanied this code.
*
* Modifications:
* If applicable, add the following below the License Header, with the fields
* enclosed by brackets [] replaced by your own identifying information:
* "Portions Copyright [year] [name of copyright owner]"
*
* Contributor(s):
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*
*
* This file incorporates work covered by the following copyright and
* permission notice:
*
* Copyright 2004 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package javax.el;
/**
* The listener interface for receiving notification when an
* {@link ELContext} is created.
*
* @see ELContext
* @see ELContextEvent
* @since JSP 2.1
*/
public interface ELContextListener extends java.util.EventListener {
/**
* Invoked when a new <code>ELContext</code> has been created.
*
* @param ece the notification event.
*/
public void contextCreated(ELContextEvent ece);
}
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can
* obtain a copy of the License at
* https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html
* or packager/legal/LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at packager/legal/LICENSE.txt.
*
* GPL Classpath Exception:
* Oracle designates this particular file as subject to the "Classpath"
* exception as provided by Oracle in the GPL Version 2 section of the License
* file that accompanied this code.
*
* Modifications:
* If applicable, add the following below the License Header, with the fields
* enclosed by brackets [] replaced by your own identifying information:
* "Portions Copyright [year] [name of copyright owner]"
*
* Contributor(s):
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*
*
* This file incorporates work covered by the following copyright and
* permission notice:
*
* Copyright 2004 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package javax.el;
/**
* Represents any of the exception conditions that can arise during
* expression evaluation.
*
* @since JSP 2.1
*/
public class ELException extends RuntimeException {
//-------------------------------------
/**
* Creates an <code>ELException</code> with no detail message.
*/
public ELException () {
super ();
}
//-------------------------------------
/**
* Creates an <code>ELException</code> with the provided detail message.
*
* @param pMessage the detail message
*/
public ELException (String pMessage) {
super (pMessage);
}
//-------------------------------------
/**
* Creates an <code>ELException</code> with the given cause.
*
* @param pRootCause the originating cause of this exception
*/
public ELException (Throwable pRootCause) {
super( pRootCause );
}
//-------------------------------------
/**
* Creates an ELException with the given detail message and root cause.
*
* @param pMessage the detail message
* @param pRootCause the originating cause of this exception
*/
public ELException (String pMessage,
Throwable pRootCause) {
super (pMessage, pRootCause);
}
}
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can
* obtain a copy of the License at
* https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html
* or packager/legal/LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at packager/legal/LICENSE.txt.
*
* GPL Classpath Exception:
* Oracle designates this particular file as subject to the "Classpath"
* exception as provided by Oracle in the GPL Version 2 section of the License
* file that accompanied this code.
*
* Modifications:
* If applicable, add the following below the License Header, with the fields
* enclosed by brackets [] replaced by your own identifying information:
* "Portions Copyright [year] [name of copyright owner]"
*
* Contributor(s):
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*/
package javax.el;
import java.lang.reflect.Method;
/**
* <p>Manages EL parsing and evaluation environment. The ELManager maintains an
* instance of ExpressionFactory and StandardELContext, for
* parsing and evaluating EL expressions.</p>
*
* @since EL 3.0
*/
public class ELManager {
private StandardELContext elContext;
/**
* Return the ExpressionFactory instance used for EL evaluations.
* @return The ExpressionFactory
*/
public static ExpressionFactory getExpressionFactory() {
return ELUtil.getExpressionFactory();
}
/**
* Return the ELContext used for parsing and evaluating EL expressions.
* If there is currently no ELContext, a default instance of
* StandardELContext is returned.
*
* @return The ELContext used for parsing and evaluating EL expressions..
*/
public StandardELContext getELContext() {
if (elContext == null) {
elContext = new StandardELContext(getExpressionFactory());
}
return elContext;
}
/**
* Set the ELContext used for parsing and evaluating EL expressions.
* The supplied ELContext will not be modified, except for the context
* object map.
* @param context The new ELContext.
* @return The previous ELContext, null if none.
*/
public ELContext setELContext(ELContext context) {
ELContext prev = elContext;
elContext = new StandardELContext(context);
return prev;
}
/**
* Register a BeanNameResolver.
* Construct a BeanNameELResolver with the BeanNameResolver and add it
* to the list of ELResolvers.
* Once registered, the BeanNameResolver cannot be removed.
* @param bnr The BeanNameResolver to be registered.
*/
public void addBeanNameResolver(BeanNameResolver bnr) {
getELContext().addELResolver(new BeanNameELResolver(bnr));
}
/**
* Add an user defined ELResolver to the list of ELResolvers.
* Can be called multiple times. The new ELResolver is
* placed ahead of the default ELResolvers. The list of the ELResolvers
* added this way are ordered chronologically.
*
* @param elr The ELResolver to be added to the list of ELResolvers in
* ELContext.
* @see StandardELContext#addELResolver
*/
public void addELResolver(ELResolver elr) {
getELContext().addELResolver(elr);
}
/**
* Maps a static method to an EL function.
* @param prefix The namespace of the functions, can be "".
* @param function The name of the function.
* @param meth The static method to be invoked when the function is used.
*/
public void mapFunction(String prefix, String function, Method meth) {
getELContext().getFunctionMapper().mapFunction(prefix, function, meth);
}
/**
* Assign a ValueExpression to an EL variable, replacing
* any previous assignment to the same variable.
* The assignment for the variable is removed if
* the expression is <code>null</code>.
*
* @param variable The variable name
* @param expression The ValueExpression to be assigned
* to the variable.
*/
public void setVariable(String variable, ValueExpression expression) {
getELContext().getVariableMapper().setVariable(variable, expression);
}
/**
* Import a static field or method. The class of the static member must be
* loadable from the classloader, at class resolution time.
* @param staticMemberName The full class name of the class to be imported
* @throws ELException if the name is not a full class name.
*/
public void importStatic(String staticMemberName) throws ELException {
getELContext().getImportHandler().importStatic(staticMemberName);
}
/**
* Import a class. The imported class must be loadable from the classloader
* at the expression evaluation time.
* @param className The full class name of the class to be imported
* @throws ELException if the name is not a full class name.
*/
public void importClass(String className) throws ELException {
getELContext().getImportHandler().importClass(className);
}
/**
* Import a package. At the expression evaluation time, the imported package
* name will be used to construct the full class name, which will then be
* used to load the class. Inherently, this is less efficient than
* importing a class.
* @param packageName The package name to be imported
*/
public void importPackage(String packageName) {
getELContext().getImportHandler().importPackage(packageName);
}
/**
* Define a bean in the local bean repository
* @param name The name of the bean
* @param bean The bean instance to be defined. If null, the definition
* of the bean is removed.
*/
public Object defineBean(String name, Object bean) {
Object ret = getELContext().getBeans().get(name);
getELContext().getBeans().put(name, bean);
return ret;
}
/**
* Register an evaluation listener.
*
* @param listener The evaluation listener to be added.
*/
public void addEvaluationListener(EvaluationListener listener) {
getELContext().addEvaluationListener(listener);
}
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can
* obtain a copy of the License at
* https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html
* or packager/legal/LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at packager/legal/LICENSE.txt.
*
* GPL Classpath Exception:
* Oracle designates this particular file as subject to the "Classpath"
* exception as provided by Oracle in the GPL Version 2 section of the License
* file that accompanied this code.
*
* Modifications:
* If applicable, add the following below the License Header, with the fields
* enclosed by brackets [] replaced by your own identifying information:
* "Portions Copyright [year] [name of copyright owner]"
*
* Contributor(s):
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*/
package javax.el;
/**
* The listener interface for receiving notification when an
* EL expression is evaluated.
*
* @since EL 3.0
*/
public abstract class EvaluationListener {
/**
* Receives notification before an EL expression is evaluated
* @param context The ELContext
* @param expression The EL expression string to be evaluated
*/
public void beforeEvaluation(ELContext context, String expression) {
}
/**
* Receives notification after an EL expression is evaluated
* @param context The ELContext
* @param expression The EL expression string to be evaluated
*/
public void afterEvaluation(ELContext context, String expression) {
}