You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Joose Vettenranta <jo...@iki.fi> on 2004/02/13 10:02:08 UTC

Flow and actions correct way?

Hi,

just been wondering flow-scripts and wiki didn't help much. So, is 
actions correct way to do stuff and possibility in flow? I mean, like

SendPageAndWait("foo");
if (cocoon.act("xsp-action", "xsp/checkfoo.xsp", "foo" : foo))
  // true
else
  // false

Or is that just wrong (or did I even use cocoon.act -function 
correctly?)

I'm thinking of replacing little complex sitemap matching stuff with 
little simplier flow-script. So I am kinda thinking that flow-script 
replaces sitemap.xmap for page matching...

Thanks,

Joose

--
"Always remember that you are unique, just like everyone else!"
* http://iki.fi/joose/ * joose@iki.fi * +358 44 561 0270 *


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


Re: Flow and actions correct way?

Posted by Upayavira <uv...@upaya.co.uk>.
Reinhard Poetz wrote:

>From: Upayavira [mailto:uv@upaya.co.uk] 
>
>  
>
>>Antonio Gallardo wrote:
>>
>>    
>>
>>>Joose Vettenranta dijo:
>>> 
>>>
>>>      
>>>
>>>>When creating java-class that can be called from inside 
>>>>        
>>>>
>>flow, does it 
>>    
>>
>>>>have to be compiled against some cocoon class, or can be 
>>>>        
>>>>
>>separed? How 
>>    
>>
>>>>can I get information from request, or does that have to 
>>>>        
>>>>
>>been wrapped 
>>    
>>
>>>>through flow? What I like to do, is to make an action like class, 
>>>>which would take input as parameters and take input from request. 
>>>>Although, flow has cocoon.get.request() stuff, so that 
>>>>        
>>>>
>>could be used 
>>    
>>
>>>>as a wrapper.
>>>>   
>>>>
>>>>        
>>>>
>>You should probably use the the cocoon.createObject() method, 
>>which will 
>>treat your object as if it were an Avalon component. Then, if your 
>>object implements certain interfaces (e.g. SitemapModelComponent?) it 
>>will have certain methods called to pass it stuff, such as the 
>>ObjectModel, which will enable it to get at the Java Request 
>>object. I 
>>would caution against using the cocoon object within Java, it just 
>>doens't make sense.
>>
>>HTH.
>>    
>>
>
>IIUC only Avalon interfaces are supported by cocoon.createObject(), 
>not Cocoon internal interfaces like SitemapModelComponent.
>  
>
Hmm. You are right. The interfaces that are available are:

    LogEnabled, Contextualizable, Composable,  Serviceable, 
RoleManageable, Configurable, Parameterizable, Initializable, Startable

IIRC, none of these would give us the request object. Or am I missing 
something?

(I guess assuptions can sometimes be dangerous :-(

Upayavira



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


RE: Flow and actions correct way?

Posted by Reinhard Poetz <re...@apache.org>.
From: Upayavira [mailto:uv@upaya.co.uk] 

> Antonio Gallardo wrote:
> 
> >Joose Vettenranta dijo:
> >  
> >
> >>When creating java-class that can be called from inside 
> flow, does it 
> >>have to be compiled against some cocoon class, or can be 
> separed? How 
> >>can I get information from request, or does that have to 
> been wrapped 
> >>through flow? What I like to do, is to make an action like class, 
> >>which would take input as parameters and take input from request. 
> >>Although, flow has cocoon.get.request() stuff, so that 
> could be used 
> >>as a wrapper.
> >>    
> >>
> You should probably use the the cocoon.createObject() method, 
> which will 
> treat your object as if it were an Avalon component. Then, if your 
> object implements certain interfaces (e.g. SitemapModelComponent?) it 
> will have certain methods called to pass it stuff, such as the 
> ObjectModel, which will enable it to get at the Java Request 
> object. I 
> would caution against using the cocoon object within Java, it just 
> doens't make sense.
> 
> HTH.

IIUC only Avalon interfaces are supported by cocoon.createObject(), 
not Cocoon internal interfaces like SitemapModelComponent.

--
Reinhard


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


Re: Flow and actions correct way?

Posted by Upayavira <uv...@upaya.co.uk>.
Antonio Gallardo wrote:

>Joose Vettenranta dijo:
>  
>
>>When creating java-class that can be called from inside flow, does it
>>have to be compiled against some cocoon class, or can be separed? How
>>can I get information from request, or does that have to been wrapped
>>through flow? What I like to do, is to make an action like class, which
>>would take input as parameters and take input from request. Although,
>>flow has cocoon.get.request() stuff, so that could be used as a
>>wrapper.
>>    
>>
You should probably use the the cocoon.createObject() method, which will 
treat your object as if it were an Avalon component. Then, if your 
object implements certain interfaces (e.g. SitemapModelComponent?) it 
will have certain methods called to pass it stuff, such as the 
ObjectModel, which will enable it to get at the Java Request object. I 
would caution against using the cocoon object within Java, it just 
doens't make sense.

HTH.

Upayavira

>Yep. You can pass it as a parameter from Flow.
>  
>
>>And if I want to save data to database, should I use already existing
>>class mod-db-insert or create one of my own, if I have to create my
>>own, how can I plug in to cocoon's resource pool to get connections?
>>    
>>
>
>Here you can use the OJB block for DB stuff.
>
>Best Regards,
>
>Antonio Gallardo
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>For additional commands, e-mail: users-help@cocoon.apache.org
>
>
>  
>



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


Re: Flow and actions correct way?

Posted by Antonio Gallardo <ag...@agssa.net>.
Joose Vettenranta dijo:
> When creating java-class that can be called from inside flow, does it
> have to be compiled against some cocoon class, or can be separed? How
> can I get information from request, or does that have to been wrapped
> through flow? What I like to do, is to make an action like class, which
> would take input as parameters and take input from request. Although,
> flow has cocoon.get.request() stuff, so that could be used as a
> wrapper.

Yep. You can pass it as a parameter from Flow.
>
> And if I want to save data to database, should I use already existing
> class mod-db-insert or create one of my own, if I have to create my
> own, how can I plug in to cocoon's resource pool to get connections?

Here you can use the OJB block for DB stuff.

Best Regards,

Antonio Gallardo



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


Re: Flow and actions correct way?

Posted by Joose Vettenranta <jo...@iki.fi>.
When creating java-class that can be called from inside flow, does it 
have to be compiled against some cocoon class, or can be separed? How 
can I get information from request, or does that have to been wrapped 
through flow? What I like to do, is to make an action like class, which 
would take input as parameters and take input from request. Although, 
flow has cocoon.get.request() stuff, so that could be used as a 
wrapper.

And if I want to save data to database, should I use already existing 
class mod-db-insert or create one of my own, if I have to create my 
own, how can I plug in to cocoon's resource pool to get connections?

Thanks,

Joose


13.2.2004 kello 13:25, Antonio Gallardo kirjoitti:

  Hi Joose:
>
> I think you would find a solution using just Flow. You can change your
> action to a Java class that can be called from inside flow.
>
> Best Regards,
>
> Antonio Gallardo
>
> Joose Vettenranta dijo:
>> Hi,
>>
>> just been wondering flow-scripts and wiki didn't help much. So, is
>> actions correct way to do stuff and possibility in flow? I mean, like
>>
>> SendPageAndWait("foo");
>> if (cocoon.act("xsp-action", "xsp/checkfoo.xsp", "foo" : foo))
>>   // true
>> else
>>   // false
>>
>> Or is that just wrong (or did I even use cocoon.act -function
>> correctly?)
>>
>> I'm thinking of replacing little complex sitemap matching stuff with
>> little simplier flow-script. So I am kinda thinking that flow-script
>> replaces sitemap.xmap for page matching...
>>
>> Thanks,
>>
>> Joose
>>
>> --
>> "Always remember that you are unique, just like everyone else!"
>> * http://iki.fi/joose/ * joose@iki.fi * +358 44 561 0270 *
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>> For additional commands, e-mail: users-help@cocoon.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>
--
"Always remember that you are unique, just like everyone else!"
* http://iki.fi/joose/ * joose@iki.fi * +358 44 561 0270 *


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


Re: Flow and actions correct way?

Posted by Antonio Gallardo <ag...@agssa.net>.
Hi Joose:

I think you would find a solution using just Flow. You can change your
action to a Java class that can be called from inside flow.

Best Regards,

Antonio Gallardo

Joose Vettenranta dijo:
> Hi,
>
> just been wondering flow-scripts and wiki didn't help much. So, is
> actions correct way to do stuff and possibility in flow? I mean, like
>
> SendPageAndWait("foo");
> if (cocoon.act("xsp-action", "xsp/checkfoo.xsp", "foo" : foo))
>   // true
> else
>   // false
>
> Or is that just wrong (or did I even use cocoon.act -function
> correctly?)
>
> I'm thinking of replacing little complex sitemap matching stuff with
> little simplier flow-script. So I am kinda thinking that flow-script
> replaces sitemap.xmap for page matching...
>
> Thanks,
>
> Joose
>
> --
> "Always remember that you are unique, just like everyone else!"
> * http://iki.fi/joose/ * joose@iki.fi * +358 44 561 0270 *
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>


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