[jboss-cvs] jboss-seam/src/main/org/jboss/seam/core ...
Gavin King
gavin.king at jboss.com
Fri Oct 27 17:32:34 EDT 2006
User: gavin
Date: 06/10/27 17:32:34
Modified: src/main/org/jboss/seam/core Dispatcher.java Events.java
Expressions.java LocalDispatcher.java
Log:
event parameters
Revision Changes Path
1.10 +6 -4 jboss-seam/src/main/org/jboss/seam/core/Dispatcher.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: Dispatcher.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/core/Dispatcher.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- Dispatcher.java 23 Oct 2006 18:58:48 -0000 1.9
+++ Dispatcher.java 27 Oct 2006 21:32:34 -0000 1.10
@@ -135,16 +135,18 @@
static final long serialVersionUID = 2074586442931427819L;
private String type;
+ private Object[] parameters;
- public AsynchronousEvent(String type)
+ public AsynchronousEvent(String type, Object[] parameters)
{
this.type = type;
+ this.parameters = parameters;
}
@Override
public void call()
{
- Events.instance().raiseEvent(type);
+ Events.instance().raiseEvent(type, parameters);
}
}
@@ -158,9 +160,9 @@
( (Asynchronous) timer.getInfo() ).execute(timer);
}
- public Timer scheduleEvent(String type, Long duration, Date expiration, Long intervalDuration)
+ public Timer scheduleEvent(String type, Long duration, Date expiration, Long intervalDuration, Object... parameters)
{
- return schedule( duration, expiration, intervalDuration, new AsynchronousEvent(type) );
+ return schedule( duration, expiration, intervalDuration, new AsynchronousEvent(type, parameters) );
}
public Timer scheduleInvocation(InvocationContext invocation, Component component)
1.9 +11 -11 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.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- Events.java 11 Oct 2006 04:42:12 -0000 1.8
+++ Events.java 27 Oct 2006 21:32:34 -0000 1.9
@@ -89,7 +89,7 @@
list.add(methodBinding);
}
- public void raiseEvent(String type)
+ public void raiseEvent(String type, Object... parameters)
{
log.debug("Processing event:" + type);
List<MethodBinding> list = listeners.get(type);
@@ -97,7 +97,7 @@
{
for (MethodBinding listener: list )
{
- listener.invoke();
+ listener.invoke(parameters);
}
}
List<Init.ObserverMethod> observers = Init.instance().getObservers(type);
@@ -106,29 +106,29 @@
for (ObserverMethod observer: observers)
{
Object listener = Component.getInstance( observer.component.getName(), true );
- observer.component.callComponentMethod(listener, observer.method);
+ observer.component.callComponentMethod(listener, observer.method, parameters);
}
}
}
- public void raiseAsynchronousEvent(String type)
+ public void raiseAsynchronousEvent(String type, Object... parameters)
{
- Dispatcher.instance().scheduleEvent(type, 0l, null, null);
+ Dispatcher.instance().scheduleEvent(type, 0l, null, null, parameters);
}
- public void raiseTimedEvent(String type, long duration)
+ public void raiseTimedEvent(String type, long duration, Object... parameters)
{
- Dispatcher.instance().scheduleEvent(type, duration, null, null);
+ Dispatcher.instance().scheduleEvent(type, duration, null, null, parameters);
}
- public void raiseTimedEvent(String type, Date expiration)
+ public void raiseTimedEvent(String type, Date expiration, Object... parameters)
{
- Dispatcher.instance().scheduleEvent(type, null, expiration, null);
+ Dispatcher.instance().scheduleEvent(type, null, expiration, null, parameters);
}
- public void raiseTimedEvent(String type, Date expiration, long intervalDuration)
+ public void raiseTimedEvent(String type, Date expiration, long intervalDuration, Object... parameters)
{
- Dispatcher.instance().scheduleEvent(type, null, expiration, intervalDuration);
+ Dispatcher.instance().scheduleEvent(type, null, expiration, intervalDuration, parameters);
}
public void raiseTimedEvent(String type, long duration, long intervalDuration)
1.8 +16 -14 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.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- Expressions.java 26 Oct 2006 19:12:39 -0000 1.7
+++ Expressions.java 27 Oct 2006 21:32:34 -0000 1.8
@@ -1,4 +1,4 @@
-//$Id: Expressions.java,v 1.7 2006/10/26 19:12:39 gavin Exp $
+//$Id: Expressions.java,v 1.8 2006/10/27 21:32:34 gavin Exp $
package org.jboss.seam.core;
import static org.jboss.seam.InterceptionType.NEVER;
@@ -33,7 +33,6 @@
return new ValueBinding()
{
-
private transient javax.faces.el.ValueBinding cachedValueBinding;
public String getExpressionString()
@@ -86,32 +85,36 @@
{
return new MethodBinding()
{
-
private transient javax.faces.el.MethodBinding cachedMethodBinding;
public String getExpressionString()
{
- return getFacesMethodBinding().getExpressionString();
+ return expression;
}
- public Class getType()
+ public Object invoke(Object... args)
{
- return getFacesMethodBinding().getType( FacesContext.getCurrentInstance() );
+ return getFacesMethodBinding(args).invoke( FacesContext.getCurrentInstance(), args );
}
- public Object invoke(Object... args)
+ private javax.faces.el.MethodBinding getFacesMethodBinding(Object... args)
{
- return getFacesMethodBinding().invoke( FacesContext.getCurrentInstance(), args );
+ Class[] types = new Class[args.length];
+ for (int i=0; i<args.length;i++)
+ {
+ if (args[i]==null)
+ {
+ throw new IllegalArgumentException("Null parameter");
+ }
+ types[i] = args[i].getClass();
}
- javax.faces.el.MethodBinding getFacesMethodBinding()
- {
if (cachedMethodBinding==null)
{
FacesContext context = FacesContext.getCurrentInstance();
cachedMethodBinding = context==null ?
- new UnifiedELMethodBinding(expression, null) :
- context.getApplication().createMethodBinding(expression, null);
+ new UnifiedELMethodBinding(expression, types) :
+ context.getApplication().createMethodBinding(expression, types);
}
return cachedMethodBinding;
}
@@ -138,7 +141,6 @@
public static interface MethodBinding<T> extends Serializable
{
public String getExpressionString();
- public Class<T> getType();
public T invoke(Object... args);
}
1.7 +1 -1 jboss-seam/src/main/org/jboss/seam/core/LocalDispatcher.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: LocalDispatcher.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/core/LocalDispatcher.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- LocalDispatcher.java 25 Oct 2006 15:14:35 -0000 1.6
+++ LocalDispatcher.java 27 Oct 2006 21:32:34 -0000 1.7
@@ -13,7 +13,7 @@
public interface LocalDispatcher
{
public Timer scheduleInvocation(InvocationContext invocation, Component component);
- public Timer scheduleEvent(String type, Long duration, Date expiration, Long intervalDuration);
+ public Timer scheduleEvent(String type, Long duration, Date expiration, Long intervalDuration, Object... parameters);
public Object call(Callable task);
}
More information about the jboss-cvs-commits
mailing list