You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Reinhard Poetz <re...@gmx.net> on 2003/01/17 00:13:34 UTC

RE: [vote] finilizing the pending votes on flow [was Re: [RT] Flow/SitemapIntegration]

Stefano Mazzocchi wrote:

<snip>
> Let me add:
>
>   - make a new method that allows the flow to call a pipeline and pass a
> different output stream. This will allow to use pipelines as tools to
> serialize things, say, to disk or to other means.
>
> What do you think?
</snip>

I think you mean a function in the system.js, don't you?

For my flows I use a self-defined function which makes this for me:

function callPipeline(src) {
    xc = cocoon.componentManager.lookup( myXMLConsumer.ROLE );
    resolver = cocoon.environment.getObjectModel().get("source-resolver");
    srce = resolver.resolveURI(src);
    resolver.toSAX( srce, xc );
    return xc;
}

The component myXMLConsumer has a method <code>public String
getDocument()</code> ... mabe there is a better/more elegant way, but it
works for me ;-)

Regards,
Reinhard

>
> --
> Stefano Mazzocchi                               <st...@apache.org>
> --------------------------------------------------------------------
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
> For additional commands, email: cocoon-dev-help@xml.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


RE: [vote] finilizing the pending votes on flow [was Re: [RT] Flow/SitemapIntegration]

Posted by Reinhard Poetz <re...@gmx.net>.
Thank you very much! I thought that it would work the other way!

Regards,
Reinhard

> -----Original Message-----
> From: Christopher Oliver [mailto:res1cf5x@verizon.net]
> Sent: Friday, January 17, 2003 7:18 AM
> To: cocoon-dev@xml.apache.org
> Subject: Re: [vote] finilizing the pending votes on flow [was Re: [RT]
> Flow/SitemapIntegration]
> 
> 
> Hi Reinhard,
> 
> Just a warning, you should always use the "var" keyword with local 
> variables in JavaScript.  Your function should probably read:
> 
> function callPipeline(src) {
>     var xc = cocoon.componentManager.lookup( myXMLConsumer.ROLE );
>     var resolver = 
> cocoon.environment.getObjectModel().get("source-resolver");
>     var srce = resolver.resolveURI(src);
>     resolver.toSAX( srce, xc );
>     return xc;
> }
> 
> Without "var" you are creating global variables named "xc", "resolver", 
> "srce". .
> 
> Regards,
> 
> Chris
> 
> Reinhard Poetz wrote:
> 
> >For my flows I use a self-defined function which makes this for me:
> >
> >function callPipeline(src) {
> >    xc = cocoon.componentManager.lookup( myXMLConsumer.ROLE );
> >    resolver = 
> cocoon.environment.getObjectModel().get("source-resolver");
> >    srce = resolver.resolveURI(src);
> >    resolver.toSAX( srce, xc );
> >    return xc;
> >}
> >
> >  
> >
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
> For additional commands, email: cocoon-dev-help@xml.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Re: [vote] finilizing the pending votes on flow [was Re: [RT] Flow/SitemapIntegration]

Posted by Christopher Oliver <re...@verizon.net>.
Hi Reinhard,

Just a warning, you should always use the "var" keyword with local 
variables in JavaScript.  Your function should probably read:

function callPipeline(src) {
    var xc = cocoon.componentManager.lookup( myXMLConsumer.ROLE );
    var resolver = cocoon.environment.getObjectModel().get("source-resolver");
    var srce = resolver.resolveURI(src);
    resolver.toSAX( srce, xc );
    return xc;
}

Without "var" you are creating global variables named "xc", "resolver", 
"srce". .

Regards,

Chris

Reinhard Poetz wrote:

>For my flows I use a self-defined function which makes this for me:
>
>function callPipeline(src) {
>    xc = cocoon.componentManager.lookup( myXMLConsumer.ROLE );
>    resolver = cocoon.environment.getObjectModel().get("source-resolver");
>    srce = resolver.resolveURI(src);
>    resolver.toSAX( srce, xc );
>    return xc;
>}
>
>  
>



---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


RE: [vote] finilizing the pending votes on flow [was Re: [RT] Flow/SitemapIntegration]

Posted by Reinhard Pötz <re...@gmx.net>.
> -----Original Message-----
> From: Stefano Mazzocchi [mailto:stefano@apache.org] 
> 
> 
> Reinhard Poetz wrote:
> 
> > There remains one open question for me: How to I get 'feedback' 
> > whether the called pipeline did its job well or not? And if 
> not, how 
> > to I get information about what happend (error message/status 
> > information)?
> > 
> > What do you think?
> 
> I think you are getting right to the bone of the problem and I don't 
> think I have a clear-cut solution... but I gotta go now, have to meet 
> Pier at a pub downtown and we don't want to make a nice english beer 
> wait, don't we? :)

Of course not ;-)

A further issue are asynchronous calls of pipelines in the case 

 - you do not want to wait for response of the backend 
 - or the backend is at the moment of calling it not available
 - or you want to guarantee the call of the backend

Regards,
Reinhard


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Re: [vote] finilizing the pending votes on flow [was Re: [RT] Flow/SitemapIntegration]

Posted by Stefano Mazzocchi <st...@apache.org>.
Reinhard Poetz wrote:

> There remains one open question for me: How to I get 'feedback' whether the
> called pipeline did its job well or not? And if not, how to I get
> information about what happend (error message/status information)?
> 
> What do you think?

I think you are getting right to the bone of the problem and I don't 
think I have a clear-cut solution... but I gotta go now, have to meet 
Pier at a pub downtown and we don't want to make a nice english beer 
wait, don't we? :)

-- 
Stefano Mazzocchi                               <st...@apache.org>
--------------------------------------------------------------------



---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


RE: [vote] finilizing the pending votes on flow [was Re: [RT] Flow/SitemapIntegration]

Posted by Reinhard Poetz <re...@gmx.net>.
> > For my flows I use a self-defined function which makes this for me:
> >
> > function callPipeline(src) {
> >     xc = cocoon.componentManager.lookup( myXMLConsumer.ROLE );
> >     resolver =
> cocoon.environment.getObjectModel().get("source-resolver");
> >     srce = resolver.resolveURI(src);
> >     resolver.toSAX( srce, xc );
> >     return xc;
> > }
> >
> > The component myXMLConsumer has a method <code>public String
> > getDocument()</code> ... mabe there is a better/more elegant way, but it
> > works for me ;-)
>
> nonono, careful. You are calling a pipeline to have its data as an
> object model to play with. While this is fair, I don't like it at all
> and would not want it included in system.js. It looks like an hack from
> miles away (sorry, no offense, just stating my impressions honestly)

After having a second look at my sources I think I don't really need the
part generating the string. This would reduce it to following lines:

function callPipeline( src ) {
  var xc = cocoon.componentManager.lookup( anyXMLConsumer.ROLE );
  var resolver = cocoon.environment.getObjectModel().get(
"source-resolver" );
  var srce = resolver.resolveURI( src );
  resolver.toSAX( srce, xc );
}

Then the pipeline called with "src" makes everything on its own.
  1. gather the necessary information from somewhere (input modules,
database, ...)
  2. save the information (send a mail, write to cvs, write to disc, ...)

There remains one open question for me: How to I get 'feedback' whether the
called pipeline did its job well or not? And if not, how to I get
information about what happend (error message/status information)?

What do you think?

Reinhard







---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


RE: [vote] finilizing the pending votes on flow [was Re: [RT] Flow/SitemapIntegration]

Posted by Reinhard Poetz <re...@gmx.net>.
Ugo Cei wrote:
>
>
> Reinhard Poetz wrote:
> > Therefore I'll come up with a solution of using the flow as
> controller for
> > XMLForms - a 'pre-alpha' version is already running at my laptop. I know
> > that my solution is far from being perfect (continuations can
> be very tricky
> > ...) but I want to learn and the feedback will make me learn
> new things and
> > this will make our/my solutions better.
>
> Do you mean something like this?
>
> var form = getForm("progetto-form", progetto,
> 	"context://flows/workflow-schema.xml");
> while (true) {
> 	form.save(cocoon.environment.getObjectModel(), "request");
> 	sendPageAndWait("progetto-form",  { "username" : user.name });
> 	form.populate(cocoon.environment.getObjectModel());
> 	form.validate("progetto");
> 	if (form.getViolations() != null &&
> 	    form.getViolations().size() > 0) {
> 		continue;
> 	break;
> }
>


Yes. (Additionally?) I use continuations to move forward/backward within the
flow. This works well but sometimes I get some strange results after using
the previous/next button of the *browser*.
My next step will be controlling Ivelin's XMLForm example with a flow
script. If this works I'll submit a patch that enables others to have a look
at it.

Reinhard




---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Re: [vote] finilizing the pending votes on flow [was Re: [RT] Flow/SitemapIntegration]

Posted by Ugo Cei <u....@cbim.it>.
Reinhard Poetz wrote:
> Therefore I'll come up with a solution of using the flow as controller for
> XMLForms - a 'pre-alpha' version is already running at my laptop. I know
> that my solution is far from being perfect (continuations can be very tricky
> ...) but I want to learn and the feedback will make me learn new things and
> this will make our/my solutions better.

Do you mean something like this?

var form = getForm("progetto-form", progetto,
	"context://flows/workflow-schema.xml");
while (true) {
	form.save(cocoon.environment.getObjectModel(), "request");
	sendPageAndWait("progetto-form",  { "username" : user.name });
	form.populate(cocoon.environment.getObjectModel());
	form.validate("progetto");
	if (form.getViolations() != null &&
	    form.getViolations().size() > 0) {
		continue;
	break;
}


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Re: [vote] finilizing the pending votes on flow [was Re: [RT] Flow/SitemapIntegration]

Posted by Ugo Cei <u....@cbim.it>.
[I'm resending this, since the first time I managed to inadvertently cut 
the last part of the message.]

Reinhard Poetz wrote:

 > Therefore I'll come up with a solution of using the flow as 
controller for
 > XMLForms - a 'pre-alpha' version is already running at my laptop. I  know
 > that my solution is far from being perfect (continuations can be very 
tricky
 > ...) but I want to learn and the feedback will make me learn new 
things and
 > this will make our/my solutions better.

Do you mean something like this?

var form = getForm("progetto-form", progetto,
     "context://flows/workflow-schema.xml");
while (true) {
     form.save(cocoon.environment.getObjectModel(), "request");
     sendPageAndWait("progetto-form",  { "username" : user.name });
     form.populate(cocoon.environment.getObjectModel());
     form.validate("progetto");
     if (form.getViolations() != null &&
         form.getViolations().size() > 0) {
         continue;
     break;
}

I'm working on this for a customer. At the moment it basically works for 
single page forms, but there's a lot of code duplication that I'd like 
to factor out before submitting anything to the public.

How about joining efforts instead of duplicating them?

	Ugo


-- 
Ugo Cei - http://www.beblogging.com/blog/


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


RE: [vote] finilizing the pending votes on flow [was Re: [RT] Flow/SitemapIntegration]

Posted by Reinhard Poetz <re...@gmx.net>.

> -----Original Message-----
> From: Stefano Mazzocchi [mailto:stefano@apache.org]
> Sent: Friday, January 17, 2003 1:27 PM
> To: cocoon-dev@xml.apache.org
> Subject: Re: [vote] finilizing the pending votes on flow [was Re: [RT]
> Flow/SitemapIntegration]
>
>
> Reinhard Poetz wrote:
> > Stefano Mazzocchi wrote:
> >
> > <snip>
> >
> >>Let me add:
> >>
> >>  - make a new method that allows the flow to call a pipeline and pass a
> >>different output stream. This will allow to use pipelines as tools to
> >>serialize things, say, to disk or to other means.
> >>
> >>What do you think?
> >
> > </snip>
> >
> > I think you mean a function in the system.js, don't you?
>
> Yes, exactly. A function equivalent to sendPageAndContinue() that I can
> use to call a pipeline but to use it orthogonally from the normal stream
> of data that flows from the request to the response.
>
> This is very useful, for example, to save stuff to disk or to CVS or to
> any other repository and will finally, IMO, give an end to the need for
> a forked pipeline that goes in two different places.
>
> > For my flows I use a self-defined function which makes this for me:
> >
> > function callPipeline(src) {
> >     xc = cocoon.componentManager.lookup( myXMLConsumer.ROLE );
> >     resolver =
> cocoon.environment.getObjectModel().get("source-resolver");
> >     srce = resolver.resolveURI(src);
> >     resolver.toSAX( srce, xc );
> >     return xc;
> > }
> >
> > The component myXMLConsumer has a method <code>public String
> > getDocument()</code> ... mabe there is a better/more elegant way, but it
> > works for me ;-)
>
> nonono, careful. You are calling a pipeline to have its data as an
> object model to play with. While this is fair, I don't like it at all
> and would not want it included in system.js. It looks like an hack from
> miles away (sorry, no offense, just stating my impressions honestly)

I had the same impression but no idea of making it better. I'm looking
forward to reading your RT.
(I have no problem with other ideas and valuable feedback from people who
have the same/different needs - I think that's the big difference between
commercial software and open source software because commercial software is
nearly always focused and once written and working only reviewed if problems
arise.)

Therefore I'll come up with a solution of using the flow as controller for
XMLForms - a 'pre-alpha' version is already running at my laptop. I know
that my solution is far from being perfect (continuations can be very tricky
...) but I want to learn and the feedback will make me learn new things and
this will make our/my solutions better.

One note: If I look back the last two years it's really incredible what I
learned about design patterns (coming from the M$ visual programming world I
have never heard of it before), java programming, xml, xslt, ...  only by
studying Cocoon and Avalon concepts/source code/examples and
following/taking part in disussions. I don't know which university/school
can offer an education at this level - maybe I'm wrong.

What are the experiences of others?

Reinhard

>
> What I want is something different.
>
> I'll come up with an RT later today or tomorrow.
>
> For now, consider it separated from this vote since it has not been
> discussed well and I want more feedback on it.
>
> --
> Stefano Mazzocchi                               <st...@apache.org>
> --------------------------------------------------------------------


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Re: [vote] finilizing the pending votes on flow [was Re: [RT] Flow/SitemapIntegration]

Posted by Stefano Mazzocchi <st...@apache.org>.
Reinhard Poetz wrote:
> Stefano Mazzocchi wrote:
> 
> <snip>
> 
>>Let me add:
>>
>>  - make a new method that allows the flow to call a pipeline and pass a
>>different output stream. This will allow to use pipelines as tools to
>>serialize things, say, to disk or to other means.
>>
>>What do you think?
> 
> </snip>
> 
> I think you mean a function in the system.js, don't you?

Yes, exactly. A function equivalent to sendPageAndContinue() that I can 
use to call a pipeline but to use it orthogonally from the normal stream 
of data that flows from the request to the response.

This is very useful, for example, to save stuff to disk or to CVS or to 
any other repository and will finally, IMO, give an end to the need for 
a forked pipeline that goes in two different places.

> For my flows I use a self-defined function which makes this for me:
> 
> function callPipeline(src) {
>     xc = cocoon.componentManager.lookup( myXMLConsumer.ROLE );
>     resolver = cocoon.environment.getObjectModel().get("source-resolver");
>     srce = resolver.resolveURI(src);
>     resolver.toSAX( srce, xc );
>     return xc;
> }
> 
> The component myXMLConsumer has a method <code>public String
> getDocument()</code> ... mabe there is a better/more elegant way, but it
> works for me ;-)

nonono, careful. You are calling a pipeline to have its data as an 
object model to play with. While this is fair, I don't like it at all 
and would not want it included in system.js. It looks like an hack from 
miles away (sorry, no offense, just stating my impressions honestly)

What I want is something different.

I'll come up with an RT later today or tomorrow.

For now, consider it separated from this vote since it has not been 
discussed well and I want more feedback on it.

-- 
Stefano Mazzocchi                               <st...@apache.org>
--------------------------------------------------------------------



---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org