[jboss-cvs] jboss-seam/src/main/org/jboss/seam/core ...
Gavin King
gavin.king at jboss.com
Tue May 1 12:43:51 EDT 2007
User: gavin
Date: 07/05/01 12:43:51
Modified: src/main/org/jboss/seam/core Events.java
Expressions.java Filter.java Init.java
Interpolator.java ManagedHibernateSession.java
ManagedPersistenceContext.java Pages.java
PooledTask.java Validators.java
Log:
migrate to unified EL everywhere
Revision Changes Path
1.22 +8 -7 jboss-seam/src/main/org/jboss/seam/core/Events.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: Events.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/core/Events.java,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -b -r1.21 -r1.22
--- Events.java 1 Mar 2007 03:10:20 -0000 1.21
+++ Events.java 1 May 2007 16:43:51 -0000 1.22
@@ -16,9 +16,9 @@
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;
import org.jboss.seam.contexts.Contexts;
-import org.jboss.seam.core.Expressions.MethodBinding;
+import org.jboss.seam.core.Expressions.MethodExpression;
import org.jboss.seam.core.Init.ObserverMethod;
-import org.jboss.seam.core.Init.ObserverMethodBinding;
+import org.jboss.seam.core.Init.ObserverMethodExpression;
import org.jboss.seam.log.LogProvider;
import org.jboss.seam.log.Logging;
import org.jboss.seam.util.Resources;
@@ -46,19 +46,20 @@
}
}
- public void addListener(String type, String methodBindingExpression)
+ public void addListener(String type, String methodBindingExpression, Class... argTypes)
{
- MethodBinding methodBinding = Expressions.instance().createMethodBinding(methodBindingExpression);
- Init.instance().addObserverMethodBinding(type, methodBinding);
+ MethodExpression methodBinding = Expressions.instance().createMethodExpression(methodBindingExpression, Object.class, argTypes);
+ Init.instance().addObserverMethodExpression(type, methodBinding);
}
public void raiseEvent(String type, Object... parameters)
{
+ //TODO: find a way to map event parameters to params in an EL-defined listener
log.debug("Processing event:" + type);
- List<Init.ObserverMethodBinding> list = Init.instance().getObserverMethodBindings(type);
+ List<Init.ObserverMethodExpression> list = Init.instance().getObserverMethodExpressions(type);
if (list!=null)
{
- for (ObserverMethodBinding listener: list )
+ for (ObserverMethodExpression listener: list )
{
listener.getMethodBinding().invoke(parameters);
}
1.23 +63 -148 jboss-seam/src/main/org/jboss/seam/core/Expressions.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: Expressions.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/core/Expressions.java,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -b -r1.22 -r1.23
--- Expressions.java 27 Apr 2007 22:12:50 -0000 1.22
+++ Expressions.java 1 May 2007 16:43:51 -0000 1.23
@@ -1,4 +1,4 @@
-//$Id: Expressions.java,v 1.22 2007/04/27 22:12:50 pmuir Exp $
+//$Id: Expressions.java,v 1.23 2007/05/01 16:43:51 gavin Exp $
package org.jboss.seam.core;
import static org.jboss.seam.InterceptionType.NEVER;
@@ -8,7 +8,8 @@
import java.io.Serializable;
-import javax.el.ValueExpression;
+import javax.el.ELContext;
+import javax.el.ExpressionFactory;
import javax.faces.context.FacesContext;
import org.hibernate.validator.ClassValidator;
@@ -20,7 +21,6 @@
import org.jboss.seam.annotations.Intercept;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;
-import org.jboss.seam.util.UnifiedELMethodBinding;
/**
* Factory for method and value bindings
@@ -35,159 +35,90 @@
implements Serializable
{
- public ValueBinding createValueBinding(final String expression)
+ public ExpressionFactory getExpressionFactory()
{
-
- return new ValueBinding()
- {
- private static final long serialVersionUID = -8655967672318993009L;
-
- private transient javax.faces.el.ValueBinding cachedValueBinding;
- private transient ValueExpression cachedValueExpression;
-
- public String getExpressionString()
- {
- return expression;
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ return facesContext==null ? EXPRESSION_FACTORY : facesContext.getApplication().getExpressionFactory();
}
- public Class getType()
- {
- if ( isFacesContext() )
+ public ELContext getELContext()
{
- return getFacesValueBinding().getType( FacesContext.getCurrentInstance() );
- }
- else
- {
- return getValueExpression().getType(EL_CONTEXT);
- }
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ return facesContext==null ? EL_CONTEXT : facesContext.getELContext();
}
- public Object getValue()
- {
- if ( isFacesContext() )
+ public ValueExpression<Object> createValueExpression(String expression)
{
- return getFacesValueBinding().getValue( FacesContext.getCurrentInstance() );
- }
- else
- {
- return getValueExpression().getValue(EL_CONTEXT);
- }
+ return createValueExpression(expression, Object.class);
}
- public boolean isReadOnly()
+ public MethodExpression<Object> createMethodExpression(String expression)
{
- if ( isFacesContext() )
- {
- return getFacesValueBinding().isReadOnly( FacesContext.getCurrentInstance() );
- }
- else
- {
- return getValueExpression().isReadOnly(EL_CONTEXT);
- }
+ return createMethodExpression(expression, Object.class);
}
- public void setValue(Object value)
+ public <T> ValueExpression<T> createValueExpression(final String expression, final Class<T> type)
{
- if ( isFacesContext() )
+ //TODO: cache the VEs
+ return new ValueExpression<T>()
{
- getFacesValueBinding().setValue( FacesContext.getCurrentInstance(), value );
- }
- else
+ private javax.el.ValueExpression createExpression()
{
- getValueExpression().setValue(EL_CONTEXT, value);
+ return getExpressionFactory().createValueExpression( getELContext(), expression, type );
}
- }
-
- boolean isFacesContext()
+ public T getValue()
{
- return FacesContext.getCurrentInstance()!=null;
+ return (T) createExpression().getValue( getELContext() );
}
-
- ValueExpression getValueExpression()
- {
- if (cachedValueExpression==null)
+ public void setValue(T value)
{
- cachedValueExpression = EXPRESSION_FACTORY.createValueExpression(EL_CONTEXT, expression, Object.class);
+ createExpression().setValue( getELContext(), value );
}
- return cachedValueExpression;
- }
-
- javax.faces.el.ValueBinding getFacesValueBinding()
- {
- if (cachedValueBinding==null)
+ public String getExpressionString()
{
- cachedValueBinding = FacesContext.getCurrentInstance().getApplication().createValueBinding(expression);
- }
- return cachedValueBinding;
+ return expression;
}
-
- @Override
- public String toString()
+ public Class<T> getType()
{
- return getExpressionString();
+ return (Class<T>) createExpression().getType( getELContext() );
}
-
};
}
- public MethodBinding createMethodBinding(final String expression)
- {
- return new MethodBinding()
+ public <T> MethodExpression<T> createMethodExpression(final String expression, final Class<T> type, final Class... argTypes)
{
- private static final long serialVersionUID = 7314202661786534543L;
-
- private transient javax.faces.el.MethodBinding cachedMethodBinding;
-
- public String getExpressionString()
+ //TODO: cache the MEs
+ return new MethodExpression<T>()
{
- return expression;
- }
-
- public Object invoke(Object... args)
+ private javax.el.MethodExpression createExpression()
{
- return getFacesMethodBinding(args).invoke( FacesContext.getCurrentInstance(), args );
+ return getExpressionFactory().createMethodExpression( getELContext(), expression, type, argTypes );
}
-
- public Object invoke(Class[] argTypes, Object... args)
+ public T invoke(Object... args)
{
- return getFacesMethodBinding(argTypes, args).invoke(FacesContext.getCurrentInstance(), args);
+ return (T) createExpression().invoke( getELContext(), args );
}
-
- private javax.faces.el.MethodBinding getFacesMethodBinding(Object... args)
- {
- Class[] types = new Class[args.length];
- for (int i=0; i<args.length;i++)
- {
- if (args[i]==null)
+ public String getExpressionString()
{
- throw new IllegalArgumentException("Null parameter");
- }
- types[i] = args[i].getClass();
+ return expression;
}
- return getFacesMethodBinding(types, args);
+ };
}
- private javax.faces.el.MethodBinding getFacesMethodBinding(Class[] types, Object... args)
- {
- FacesContext context = FacesContext.getCurrentInstance();
- if (cachedMethodBinding==null || (context == null && !(cachedMethodBinding instanceof UnifiedELMethodBinding)))
+ public static interface ValueExpression<T> extends Serializable
{
- cachedMethodBinding = context==null ?
- new UnifiedELMethodBinding(expression, types) :
- context.getApplication().createMethodBinding(expression, types);
- }
- return cachedMethodBinding;
+ public T getValue();
+ public void setValue(T value);
+ public String getExpressionString();
+ public Class<T> getType();
}
- @Override
- public String toString()
+ public static interface MethodExpression<T> extends Serializable
{
- return getExpressionString();
+ public T invoke(Object... args);
+ public String getExpressionString();
}
- };
-
- }
/**
* Validate that a value can be assigned to the property
@@ -226,7 +157,7 @@
modelExpression = propertyExpression.substring(0, bracket) + '}';
}
- Object modelInstance = createValueBinding(modelExpression).getValue(); //TODO: cache the ValueBinding object!
+ Object modelInstance = getExpressionFactory().createValueExpression( getELContext(), modelExpression, Object.class).getValue( getELContext() ); //TODO: cache the ValueBinding object!
return getValidator(modelInstance, componentName).getPotentialInvalidValues(propertyName, value);
}
@@ -250,22 +181,6 @@
return ( component==null ? Model.forClass( instance.getClass() ) : component ).getValidator();
}
- public static interface ValueBinding<T> extends Serializable
- {
- public String getExpressionString();
- public Class<T> getType();
- public T getValue();
- public boolean isReadOnly();
- public void setValue(T value);
- }
-
- public static interface MethodBinding<T> extends Serializable
- {
- public String getExpressionString();
- public T invoke(Object... args);
- public T invoke(Class[] argTypes, Object... args);
- }
-
public static Expressions instance()
{
return (Expressions) Component.getInstance(Expressions.class, ScopeType.APPLICATION);
1.5 +8 -8 jboss-seam/src/main/org/jboss/seam/core/Filter.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: Filter.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/core/Filter.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- Filter.java 25 Feb 2007 04:49:57 -0000 1.4
+++ Filter.java 1 May 2007 16:43:51 -0000 1.5
@@ -8,7 +8,7 @@
import org.jboss.seam.annotations.Create;
import org.jboss.seam.annotations.Intercept;
import org.jboss.seam.annotations.Scope;
-import org.jboss.seam.core.Expressions.ValueBinding;
+import org.jboss.seam.core.Expressions.ValueExpression;
/**
* Support for declarative application of
@@ -24,8 +24,8 @@
public class Filter
{
private String name;
- private Map<String, ValueBinding> parameters;
- private ValueBinding enabled;
+ private Map<String, ValueExpression> parameters;
+ private ValueExpression enabled;
@Create
public void create(Component component)
@@ -42,11 +42,11 @@
*
* @see org.hibernate.Filter#setParameter(String, Object)
*/
- public Map<String, ValueBinding> getParameters()
+ public Map<String, ValueExpression> getParameters()
{
return parameters;
}
- public void setParameters(Map<String, ValueBinding> parameters)
+ public void setParameters(Map<String, ValueExpression> parameters)
{
this.parameters = parameters;
}
@@ -68,7 +68,7 @@
public boolean isFilterEnabled()
{
- ValueBinding enabledValueBinding = getEnabled();
+ ValueExpression enabledValueBinding = getEnabled();
if (enabledValueBinding==null)
{
return true;
@@ -86,12 +86,12 @@
return "Filter(" + name + ")";
}
- public ValueBinding getEnabled()
+ public ValueExpression getEnabled()
{
return enabled;
}
- public void setEnabled(ValueBinding enabled)
+ public void setEnabled(ValueExpression enabled)
{
this.enabled = enabled;
}
1.45 +31 -30 jboss-seam/src/main/org/jboss/seam/core/Init.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: Init.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/core/Init.java,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -b -r1.44 -r1.45
--- Init.java 28 Mar 2007 15:12:39 -0000 1.44
+++ Init.java 1 May 2007 16:43:51 -0000 1.45
@@ -1,4 +1,4 @@
-//$Id: Init.java,v 1.44 2007/03/28 15:12:39 gavin Exp $
+//$Id: Init.java,v 1.45 2007/05/01 16:43:51 gavin Exp $
package org.jboss.seam.core;
@@ -23,8 +23,8 @@
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;
import org.jboss.seam.contexts.Contexts;
-import org.jboss.seam.core.Expressions.MethodBinding;
-import org.jboss.seam.core.Expressions.ValueBinding;
+import org.jboss.seam.core.Expressions.MethodExpression;
+import org.jboss.seam.core.Expressions.ValueExpression;
import org.jboss.seam.util.Transactions;
/**
@@ -50,10 +50,10 @@
//private String transactionManagerName;
private Map<String, List<ObserverMethod>> observerMethods = new HashMap<String, List<ObserverMethod>>();
- private Map<String, List<ObserverMethodBinding>> observerMethodBindings = new HashMap<String, List<ObserverMethodBinding>>();
+ private Map<String, List<ObserverMethodExpression>> observerMethodBindings = new HashMap<String, List<ObserverMethodExpression>>();
private Map<String, FactoryMethod> factories = new HashMap<String, FactoryMethod>();
- private Map<String, FactoryBinding> factoryMethodBindings = new HashMap<String, FactoryBinding>();
- private Map<String, FactoryBinding> factoryValueBindings = new HashMap<String, FactoryBinding>();
+ private Map<String, FactoryExpression> factoryMethodExpressions = new HashMap<String, FactoryExpression>();
+ private Map<String, FactoryExpression> factoryValueExpressions = new HashMap<String, FactoryExpression>();
private Set<String> autocreateVariables = new HashSet<String>();
private Set<String> installedFilters = new HashSet<String>();
@@ -137,25 +137,26 @@
}
}
- public static class FactoryBinding {
+ public static class FactoryExpression
+ {
private String expression;
private ScopeType scope;
- FactoryBinding(String expression, ScopeType scope)
+ FactoryExpression(String expression, ScopeType scope)
{
this.expression = expression;
this.scope = scope;
}
- public MethodBinding getMethodBinding()
+ public MethodExpression getMethodBinding()
{
//TODO: figure out some way to cache this!!
- return Expressions.instance().createMethodBinding(expression);
+ return Expressions.instance().createMethodExpression(expression);
}
- public ValueBinding getValueBinding()
+ public ValueExpression getValueBinding()
{
//TODO: figure out some way to cache this!!
- return Expressions.instance().createValueBinding(expression);
+ return Expressions.instance().createValueExpression(expression);
}
public ScopeType getScope()
{
@@ -173,19 +174,19 @@
return factories.get(variable);
}
- public FactoryBinding getFactoryMethodBinding(String variable)
+ public FactoryExpression getFactoryMethodExpression(String variable)
{
- return factoryMethodBindings.get(variable);
+ return factoryMethodExpressions.get(variable);
}
- public FactoryBinding getFactoryValueBinding(String variable)
+ public FactoryExpression getFactoryValueExpression(String variable)
{
- return factoryValueBindings.get(variable);
+ return factoryValueExpressions.get(variable);
}
private void checkDuplicateFactory(String variable)
{
- if ( factories.containsKey(variable) || factoryMethodBindings.containsKey(variable) || factoryValueBindings.containsKey(variable) )
+ if ( factories.containsKey(variable) || factoryMethodExpressions.containsKey(variable) || factoryValueExpressions.containsKey(variable) )
{
//throw new IllegalStateException("duplicate factory for: " + variable);
}
@@ -197,16 +198,16 @@
factories.put( variable, new FactoryMethod(method, component) );
}
- public void addFactoryMethodBinding(String variable, String methodBindingExpression, ScopeType scope)
+ public void addFactoryMethodExpression(String variable, String methodBindingExpression, ScopeType scope)
{
checkDuplicateFactory(variable);
- factoryMethodBindings.put( variable, new FactoryBinding(methodBindingExpression, scope) );
+ factoryMethodExpressions.put( variable, new FactoryExpression(methodBindingExpression, scope) );
}
- public void addFactoryValueBinding(String variable, String valueBindingExpression, ScopeType scope)
+ public void addFactoryValueExpression(String variable, String valueBindingExpression, ScopeType scope)
{
checkDuplicateFactory(variable);
- factoryValueBindings.put( variable, new FactoryBinding(valueBindingExpression, scope) );
+ factoryValueExpressions.put( variable, new FactoryExpression(valueBindingExpression, scope) );
}
public static class ObserverMethod
@@ -244,16 +245,16 @@
}
}
- public static class ObserverMethodBinding
+ public static class ObserverMethodExpression
{
- private MethodBinding methodBinding;
+ private MethodExpression methodBinding;
- ObserverMethodBinding(MethodBinding method)
+ ObserverMethodExpression(MethodExpression method)
{
this.methodBinding = method;
}
- public MethodBinding getMethodBinding()
+ public MethodExpression getMethodBinding()
{
return methodBinding;
}
@@ -270,7 +271,7 @@
return observerMethods.get(eventType);
}
- public List<ObserverMethodBinding> getObserverMethodBindings(String eventType)
+ public List<ObserverMethodExpression> getObserverMethodExpressions(String eventType)
{
return observerMethodBindings.get(eventType);
}
@@ -286,15 +287,15 @@
observerList.add( new ObserverMethod(method, component, create) );
}
- public void addObserverMethodBinding(String eventType, MethodBinding methodBinding)
+ public void addObserverMethodExpression(String eventType, MethodExpression methodBinding)
{
- List<ObserverMethodBinding> observerList = observerMethodBindings.get(eventType);
+ List<ObserverMethodExpression> observerList = observerMethodBindings.get(eventType);
if (observerList==null)
{
- observerList = new ArrayList<ObserverMethodBinding>();
+ observerList = new ArrayList<ObserverMethodExpression>();
observerMethodBindings.put(eventType, observerList);
}
- observerList.add( new ObserverMethodBinding(methodBinding) );
+ observerList.add( new ObserverMethodExpression(methodBinding) );
}
public boolean isJbpmInstalled()
1.22 +1 -1 jboss-seam/src/main/org/jboss/seam/core/Interpolator.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: Interpolator.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/core/Interpolator.java,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -b -r1.21 -r1.22
--- Interpolator.java 10 Feb 2007 06:03:47 -0000 1.21
+++ Interpolator.java 1 May 2007 16:43:51 -0000 1.22
@@ -85,7 +85,7 @@
String expression = "#{" + tokens.nextToken() + "}";
try
{
- Object value = Expressions.instance().createValueBinding(expression).getValue();
+ Object value = Expressions.instance().createValueExpression(expression).getValue();
if (value!=null) builder.append(value);
}
catch (Exception e)
1.33 +6 -6 jboss-seam/src/main/org/jboss/seam/core/ManagedHibernateSession.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: ManagedHibernateSession.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/core/ManagedHibernateSession.java,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -b -r1.32 -r1.33
--- ManagedHibernateSession.java 25 Feb 2007 19:21:09 -0000 1.32
+++ ManagedHibernateSession.java 1 May 2007 16:43:51 -0000 1.33
@@ -1,4 +1,4 @@
-//$Id: ManagedHibernateSession.java,v 1.32 2007/02/25 19:21:09 gavin Exp $
+//$Id: ManagedHibernateSession.java,v 1.33 2007/05/01 16:43:51 gavin Exp $
package org.jboss.seam.core;
import static org.jboss.seam.InterceptionType.NEVER;
@@ -24,7 +24,7 @@
import org.jboss.seam.annotations.Scope;
import org.jboss.seam.annotations.Unwrap;
import org.jboss.seam.contexts.Lifecycle;
-import org.jboss.seam.core.Expressions.ValueBinding;
+import org.jboss.seam.core.Expressions.ValueExpression;
import org.jboss.seam.log.LogProvider;
import org.jboss.seam.log.Logging;
import org.jboss.seam.persistence.HibernateSessionProxy;
@@ -51,7 +51,7 @@
private Session session;
private String sessionFactoryJndiName;
private String componentName;
- private ValueBinding<SessionFactory> sessionFactory;
+ private ValueExpression<SessionFactory> sessionFactory;
private List<Filter> filters = new ArrayList<Filter>(0);
public boolean clearDirty()
@@ -93,7 +93,7 @@
private void enableFilter(Filter f)
{
org.hibernate.Filter filter = session.enableFilter( f.getName() );
- for ( Map.Entry<String, ValueBinding> me: f.getParameters().entrySet() )
+ for ( Map.Entry<String, ValueExpression> me: f.getParameters().entrySet() )
{
filter.setParameter( me.getKey(), me.getValue().getValue() );
}
@@ -210,12 +210,12 @@
* A value binding expression that returns a SessionFactory,
* if it is to be obtained as a Seam component reference
*/
- public void setSessionFactory(ValueBinding<SessionFactory> sessionFactory)
+ public void setSessionFactory(ValueExpression<SessionFactory> sessionFactory)
{
this.sessionFactory = sessionFactory;
}
- public ValueBinding<SessionFactory> getSessionFactory()
+ public ValueExpression<SessionFactory> getSessionFactory()
{
return sessionFactory;
}
1.39 +5 -5 jboss-seam/src/main/org/jboss/seam/core/ManagedPersistenceContext.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: ManagedPersistenceContext.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/core/ManagedPersistenceContext.java,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -b -r1.38 -r1.39
--- ManagedPersistenceContext.java 25 Feb 2007 19:06:22 -0000 1.38
+++ ManagedPersistenceContext.java 1 May 2007 16:43:51 -0000 1.39
@@ -1,4 +1,4 @@
-//$Id: ManagedPersistenceContext.java,v 1.38 2007/02/25 19:06:22 gavin Exp $
+//$Id: ManagedPersistenceContext.java,v 1.39 2007/05/01 16:43:51 gavin Exp $
package org.jboss.seam.core;
import static org.jboss.seam.InterceptionType.NEVER;
@@ -25,7 +25,7 @@
import org.jboss.seam.annotations.Unwrap;
import org.jboss.seam.contexts.Contexts;
import org.jboss.seam.contexts.Lifecycle;
-import org.jboss.seam.core.Expressions.ValueBinding;
+import org.jboss.seam.core.Expressions.ValueExpression;
import org.jboss.seam.log.LogProvider;
import org.jboss.seam.log.Logging;
import org.jboss.seam.persistence.EntityManagerProxy;
@@ -52,7 +52,7 @@
private EntityManager entityManager;
private String persistenceUnitJndiName;
private String componentName;
- private ValueBinding<EntityManagerFactory> entityManagerFactory;
+ private ValueExpression<EntityManagerFactory> entityManagerFactory;
private List<Filter> filters = new ArrayList<Filter>(0);
public boolean clearDirty()
@@ -174,12 +174,12 @@
* A value binding expression that returns an EntityManagerFactory,
* for use of JPA outside of Java EE 5 / Embeddable EJB3.
*/
- public ValueBinding<EntityManagerFactory> getEntityManagerFactory()
+ public ValueExpression<EntityManagerFactory> getEntityManagerFactory()
{
return entityManagerFactory;
}
- public void setEntityManagerFactory(ValueBinding<EntityManagerFactory> entityManagerFactory)
+ public void setEntityManagerFactory(ValueExpression<EntityManagerFactory> entityManagerFactory)
{
this.entityManagerFactory = entityManagerFactory;
}
1.113 +31 -32 jboss-seam/src/main/org/jboss/seam/core/Pages.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: Pages.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/core/Pages.java,v
retrieving revision 1.112
retrieving revision 1.113
diff -u -b -r1.112 -r1.113
--- Pages.java 30 Mar 2007 02:18:05 -0000 1.112
+++ Pages.java 1 May 2007 16:43:51 -0000 1.113
@@ -1,4 +1,5 @@
package org.jboss.seam.core;
+
import static org.jboss.seam.InterceptionType.NEVER;
import static org.jboss.seam.annotations.Install.BUILT_IN;
@@ -34,8 +35,8 @@
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;
import org.jboss.seam.contexts.Contexts;
-import org.jboss.seam.core.Expressions.MethodBinding;
-import org.jboss.seam.core.Expressions.ValueBinding;
+import org.jboss.seam.core.Expressions.MethodExpression;
+import org.jboss.seam.core.Expressions.ValueExpression;
import org.jboss.seam.log.LogProvider;
import org.jboss.seam.log.Logging;
import org.jboss.seam.pages.Action;
@@ -58,6 +59,7 @@
import org.jboss.seam.util.Resources;
import org.jboss.seam.util.Strings;
import org.jboss.seam.util.XML;
+
/**
* Holds metadata for pages defined in pages.xml, including
* page actions and page descriptions.
@@ -480,23 +482,21 @@
boolean result = false;
- String outcome = (String) facesContext.getExternalContext()
- .getRequestParameterMap()
- .get("actionOutcome");
+ String outcome = facesContext.getExternalContext()
+ .getRequestParameterMap().get("actionOutcome");
String fromAction = outcome;
if (outcome==null)
{
- String actionId = (String) facesContext.getExternalContext()
- .getRequestParameterMap()
- .get("actionMethod");
+ String actionId = facesContext.getExternalContext()
+ .getRequestParameterMap().get("actionMethod");
if (actionId!=null)
{
if ( !SafeActions.instance().isActionSafe(actionId) ) return result;
String expression = SafeActions.toAction(actionId);
result = true;
- MethodBinding actionBinding = Expressions.instance().createMethodBinding(expression);
- outcome = toString( actionBinding.invoke() );
+ MethodExpression actionExpression = Expressions.instance().createMethodExpression(expression);
+ outcome = toString( actionExpression.invoke() );
fromAction = expression;
handleOutcome(facesContext, outcome, fromAction);
}
@@ -552,15 +552,15 @@
{
for ( Param pageParameter: page.getParameters() )
{
- ValueBinding valueBinding = pageParameter.getValueBinding();
+ ValueExpression valueExpression = pageParameter.getValueExpression();
Object value;
- if (valueBinding==null)
+ if (valueExpression==null)
{
value = Contexts.getPageContext().get( pageParameter.getName() );
}
else
{
- value = valueBinding.getValue();
+ value = valueExpression.getValue();
}
if (value!=null)
{
@@ -605,8 +605,8 @@
*/
private Object getPageParameterValue(FacesContext facesContext, Param pageParameter)
{
- ValueBinding valueBinding = pageParameter.getValueBinding();
- if (valueBinding==null)
+ ValueExpression valueExpression = pageParameter.getValueExpression();
+ if (valueExpression==null)
{
return Contexts.getPageContext().get( pageParameter.getName() );
}
@@ -656,13 +656,13 @@
{
for ( Param pageParameter: page.getParameters() )
{
- ValueBinding valueBinding = pageParameter.getValueBinding();
- if (valueBinding!=null)
+ ValueExpression valueExpression = pageParameter.getValueExpression();
+ if (valueExpression!=null)
{
Object object = Contexts.getPageContext().get( pageParameter.getName() );
if (object!=null)
{
- valueBinding.setValue(object);
+ valueExpression.setValue(object);
}
}
}
@@ -945,7 +945,7 @@
{
Input input = new Input();
input.setName( child.attributeValue("name") );
- input.setValue( Expressions.instance().createValueBinding( child.attributeValue("value") ) );
+ input.setValue( Expressions.instance().createValueExpression( child.attributeValue("value") ) );
String scopeName = child.attributeValue("scope");
if (scopeName!=null)
{
@@ -964,8 +964,7 @@
if (methodExpression==null) return null;
if ( methodExpression.startsWith("#{") )
{
- MethodBinding methodBinding = Expressions.instance().createMethodBinding(methodExpression);
- action.setMethodBinding(methodBinding);
+ action.setMethodExpression( Expressions.instance().createMethodExpression(methodExpression) );
}
else
{
@@ -974,7 +973,7 @@
String expression = element.attributeValue("if");
if (expression!=null)
{
- action.setValueBinding( Expressions.instance().createValueBinding(expression) );
+ action.setValueExpression( Expressions.instance().createValueExpression(expression) );
}
return action;
}
@@ -994,7 +993,7 @@
String expression = endConversation.attributeValue("if");
if (expression!=null)
{
- control.setEndConversationCondition( Expressions.instance().createValueBinding(expression) );
+ control.setEndConversationCondition( Expressions.instance().createValueExpression(expression, Boolean.class) );
}
}
@@ -1015,7 +1014,7 @@
String expression = beginConversation.attributeValue("if");
if (expression!=null)
{
- control.setBeginConversationCondition( Expressions.instance().createValueBinding(expression) );
+ control.setBeginConversationCondition( Expressions.instance().createValueExpression(expression, Boolean.class) );
}
}
@@ -1046,7 +1045,7 @@
{
taskId = "#{param.taskId}";
}
- control.setTaskId( Expressions.instance().createValueBinding(taskId) );
+ control.setTaskId( Expressions.instance().createValueExpression(taskId, String.class) );
}
Element startTask = element.element("start-task");
@@ -1058,7 +1057,7 @@
{
taskId = "#{param.taskId}";
}
- control.setTaskId( Expressions.instance().createValueBinding(taskId) );
+ control.setTaskId( Expressions.instance().createValueExpression(taskId, String.class) );
}
if ( control.isBeginTask() && control.isEndTask() )
@@ -1096,7 +1095,7 @@
{
processId = "#{param.processId}";
}
- control.setProcessId( Expressions.instance().createValueBinding(processId) );
+ control.setProcessId( Expressions.instance().createValueExpression(processId, Long.class) );
}
if ( control.isCreateProcess() && control.isResumeProcess() )
@@ -1114,7 +1113,7 @@
String outcomeExpression = element.attributeValue("evaluate");
if (outcomeExpression!=null)
{
- navigation.setOutcome( Expressions.instance().createValueBinding(outcomeExpression) );
+ navigation.setOutcome( Expressions.instance().createValueExpression(outcomeExpression) );
}
List<Element> cases = element.elements("rule");
@@ -1170,13 +1169,13 @@
Param param = new Param(name);
if (valueExpression!=null)
{
- param.setValueBinding(Expressions.instance().createValueBinding(valueExpression));
+ param.setValueExpression(Expressions.instance().createValueExpression(valueExpression));
}
param.setConverterId(element.attributeValue("converterId"));
String converterExpression = element.attributeValue("converter");
if (converterExpression!=null)
{
- param.setConverterValueBinding(Expressions.instance().createValueBinding(converterExpression));
+ param.setConverterValueExpression(Expressions.instance().createValueExpression(converterExpression));
}
return param;
}
@@ -1192,7 +1191,7 @@
String expression = element.attributeValue("if");
if (expression!=null)
{
- rule.setCondition( Expressions.instance().createValueBinding(expression) );
+ rule.setCondition( Expressions.instance().createValueExpression(expression) );
}
parseConversationControl( element, rule.getConversationControl() );
@@ -1245,7 +1244,7 @@
{
Output output = new Output();
output.setName( child.attributeValue("name") );
- output.setValue( Expressions.instance().createValueBinding( child.attributeValue("value") ) );
+ output.setValue( Expressions.instance().createValueExpression( child.attributeValue("value") ) );
String scopeName = child.attributeValue("scope");
if (scopeName==null)
{
1.16 +2 -4 jboss-seam/src/main/org/jboss/seam/core/PooledTask.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: PooledTask.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/core/PooledTask.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- PooledTask.java 14 Dec 2006 13:08:57 -0000 1.15
+++ PooledTask.java 1 May 2007 16:43:51 -0000 1.16
@@ -81,10 +81,8 @@
@Transactional
public TaskInstance getTaskInstance()
{
- String taskId = (String) FacesContext.getCurrentInstance()
- .getExternalContext()
- .getRequestParameterMap()
- .get("taskId");
+ String taskId = FacesContext.getCurrentInstance().getExternalContext()
+ .getRequestParameterMap().get("taskId");
return taskId==null ?
null :
ManagedJbpmContext.instance().getTaskInstanceForUpdate( Long.parseLong(taskId) );
1.5 +1 -1 jboss-seam/src/main/org/jboss/seam/core/Validators.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: Validators.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/core/Validators.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- Validators.java 18 Mar 2007 13:46:04 -0000 1.4
+++ Validators.java 1 May 2007 16:43:51 -0000 1.5
@@ -141,7 +141,7 @@
}
String modelExpression = propertyExpression.substring(0, dot) + '}';
- Object model = context.getApplication().createValueBinding(modelExpression).getValue(context);
+ Object model = Expressions.instance().createValueExpression(modelExpression).getValue();
ClassValidator validator = getValidator( model.getClass(), componentName );
return validator.getPotentialInvalidValues(propertyName, value);
}
More information about the jboss-cvs-commits
mailing list