Hi Simone,
many thanks for your reply. Would you by any chance have an example of a very simple process done in a .js and .java version? 

I take it that I can still reference the java classes from my sitemap as I would do the flowscripts?:


 <map:flow language="java">
  <map:script src=""/>
 </map:flow>

How would I reference method calls from the site map to java methods? In _javascript_ it would be:

<map:call function="terms">
<map:parameter name="page_Name" value="account"/>
</map:call>

Would I be correct in thinking that I would do:

<map:call login.user="terms">
<map:parameter name="page_Name" value="account"/>
</map:call>

How would I read the parameter into the class/method from the sitemap? Like so?:

private String artistID = cocoon.parameters.artistID;

Would I pass it from the sitemap the same was as shown above?: <map:parameter name="page_Name" value="account"/>

What about persisting data? I have a variable which persists a user object after a user has logged in:

var userGlobal = cocoon.session.getAttribute("user");

Would the javaflow equiv be:

private Object userGlobal = cocoon.session.getAttribute("user"); ???

How do i represent forms in javaflow:

var form = new Form("forms/artistOrder.xml");
form.showForm("artistLyricsPopUp1.xml",{"artistID":artistID,"artist_name":artist_name,"artist_info":artist_info,"track_lyrics":track_lyrics,"track_title":track_title,"userGlobal":userGlobal});
var model = form.getModel();
var bizData = {"next" : model.next, "delItem" : model.delItem, "quantity" : model.quantity}

and finally would I be correct in thinking that continuation is still represented as:

cocoon.sendPageAndWait("artistDetails2.xml",{"artistID":artistID});

many thanks

Andrew

Hi Andrew,
JavaFlow is the same thing as FlowScript, but instead of writing _javascript_ files, you write common java classes. The rest is basically the same, you have sendPage, sendPageAndWait, can instantiate and send forms etc.. etc..

The main advantages of JavaFlow are :
- You use java, which is typed, so you son't have problems with overloading, polymorphism etc..
- You have compile time checking, that you don't have in _javascript_ since it's not compiled.
- You use common java developement tools, like any java editor and debugger (Eclipse works for me), even remotely on a test server and not only the embedded venkmann debugger only on the delevoper machine.
- You avoid common _javascript_ nightmares ( if (c && (c == 'true' || c == true)) ) etc.. etc..

It also have drawbacks :
- _javascript_ is usually considered easier to write
- The BCEL rewritings that are made automatically on java classes to make them continuation aware are sometimes weird.

I personally find myself much more happy with javaflow, since compile time code checking is a must, and since i usually write flows that  use a java backend, and it's much more simpler to use it directly in java than in _javascript_. This is expecially true if you have a complex backend (with polymorphism and/or other design patterns) where untyped _javascript_ (and the consequent rhino guesses) can cause hard to find bugs or even disasters. Also, quite commonly the backend and frontend are developed by different teams, with _javascript_ you have no way to check if a change in the backend can cause problems to frontend flows, while with javaflow automatic refactoring is applied also in flows, and backend guys can quickly check if they broke something.

Simone



Andrew Madu wrote:
Hi Jason,

Or you could move
to JavaFlow if you'd rather go that way.

do you know of any good documentation that describes the conversion process required to get from flowscript to javaflow? I've had a quick look at the javaflow docs under cocoon and they make little sense to me at this moment.

Does JavaFlow support continuations?

Andrew


Reply via email to