[jboss-cvs] jboss-seam/src/remoting/org/jboss/seam/remoting ...
Shane Bryzak
sbryzak at redhat.com
Tue Jul 3 23:36:48 EDT 2007
User: sbryzak2
Date: 07/07/03 23:36:48
Modified: src/remoting/org/jboss/seam/remoting Call.java
ExecutionHandler.java remote.js
Log:
JBSEAM-1061
Revision Changes Path
1.4 +72 -40 jboss-seam/src/remoting/org/jboss/seam/remoting/Call.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: Call.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/remoting/org/jboss/seam/remoting/Call.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- Call.java 25 Jun 2007 22:58:17 -0000 1.3
+++ Call.java 4 Jul 2007 03:36:48 -0000 1.4
@@ -10,6 +10,7 @@
import org.jboss.seam.Component;
import org.jboss.seam.annotations.remoting.WebRemote;
+import org.jboss.seam.core.Expressions;
import org.jboss.seam.remoting.wrapper.ConversionException;
import org.jboss.seam.remoting.wrapper.ConversionScore;
import org.jboss.seam.remoting.wrapper.Wrapper;
@@ -24,6 +25,7 @@
private String id;
private String componentName;
private String methodName;
+ private String expression;
private List<Wrapper> params = new ArrayList<Wrapper> ();
@@ -48,6 +50,18 @@
}
/**
+ *
+ * @param id
+ * @param expression
+ */
+ public Call(String id, String expression)
+ {
+ this.id = id;
+ this.expression = expression;
+ this.context = new CallContext();
+ }
+
+ /**
* Return the call context.
*
* @return CallContext
@@ -105,6 +119,19 @@
public void execute()
throws Exception
{
+ if (componentName != null)
+ {
+ processInvocation();
+ }
+ else if (expression != null)
+ {
+ processExpression();
+ }
+ }
+
+ private void processInvocation()
+ throws Exception
+ {
// Find the component we're calling
Component component = Component.forName(componentName);
@@ -148,6 +175,11 @@
result = m.invoke(instance, convertParams(m.getGenericParameterTypes()));
}
+ private void processExpression()
+ {
+ result = Expressions.instance().createValueExpression(expression).getValue();
+ }
+
/**
* Convert our parameter values to an Object array of the specified target
* types.
1.9 +15 -8 jboss-seam/src/remoting/org/jboss/seam/remoting/ExecutionHandler.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: ExecutionHandler.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/remoting/org/jboss/seam/remoting/ExecutionHandler.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- ExecutionHandler.java 4 Jul 2007 00:33:57 -0000 1.8
+++ ExecutionHandler.java 4 Jul 2007 03:36:48 -0000 1.9
@@ -61,9 +61,8 @@
@Override
public void process() throws Exception
{
- final List<Call> calls = unmarshalCalls(env);
-
// Extract the calls from the request
+ List<Call> calls = unmarshalCalls(env);
// Execute each of the calls
for (Call call : calls)
@@ -133,7 +132,8 @@
List<Element> callElements = env.element("body").elements("call");
- for (Element e : callElements) {
+ for (Element e : callElements)
+ {
Call call = new Call(e.attributeValue("id"),
e.attributeValue("component"),
e.attributeValue("method"));
@@ -168,6 +168,13 @@
calls.add(call);
}
+ List<Element> exprElements = env.element("body").elements("eval");
+ for (Element e : exprElements)
+ {
+ Call call = new Call(e.attributeValue("id"), e.attributeValue("expr"));
+ calls.add(call);
+ }
+
return calls;
}
catch (Exception ex)
1.7 +16 -0 jboss-seam/src/remoting/org/jboss/seam/remoting/remote.js
(In the diff below, changes in quantity of whitespace are not shown.)
Index: remote.js
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/remoting/org/jboss/seam/remoting/remote.js,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- remote.js 17 Jun 2007 21:53:56 -0000 1.6
+++ remote.js 4 Jul 2007 03:36:48 -0000 1.7
@@ -435,6 +435,22 @@
Seam.Remoting.__callId = 0;
+Seam.Remoting.eval = function(expression, callback)
+{
+ var callId = "" + Seam.Remoting.__callId++;
+ var data = "<eval expr=\"";
+ data += expression;
+ data += "\" id=\"";
+ data += callId;
+ data += "\"/>";
+ var call = {data: data, id: callId, callback: callback};
+
+ var envelope = Seam.Remoting.createEnvelope(Seam.Remoting.createHeader(), data);
+ Seam.Remoting.pendingCalls.put(call.id, call);
+
+ call.asyncReq = Seam.Remoting.sendAjaxRequest(envelope, Seam.Remoting.PATH_EXECUTE, Seam.Remoting.processResponse, false);
+}
+
Seam.Remoting.createCall = function(component, methodName, params, callback)
{
var callId = "" + Seam.Remoting.__callId++;
More information about the jboss-cvs-commits
mailing list