You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Gary Larsen <ga...@envisn.com> on 2008/02/04 21:15:10 UTC

Run Action from Java?

I'm running Cocoon 2.1.9.

 

The application periodically runs some background processing with
CocoonQuartzJobScheduler.

 

I want to send an email at the end of processing and thought that a SendMail
action would be the easiest solution.  Can I run this Action from Java, or
do something similar to a flowscript sendPage()?

 

Thanks,

gary


RE: Run Action from Java?

Posted by Gary Larsen <ga...@envisn.com>.
I posted to early.  Looking at TestCronJob.java is helping me out.

Thanks for pointing me in the right direction.

gary


> Hi Karen,
> 
> Thanks for your response.  I've attempted to do more research but I'm
> still
> having a problem understanding Cocoon components.
> 


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


RE: Run Action from Java?

Posted by Gary Larsen <ga...@envisn.com>.
Hi Karen,

Thanks for your response.  I've attempted to do more research but I'm still
having a problem understanding Cocoon components.

Here is the component that gets executed by CocoonQuartzJobScheduler:

    <component role="com.envisn.nv.config.ConfigurationManager"
              class="com.envisn.nv.config.ConfigurationManagerImpl"
              pool-min="1" pool-max="1" >
    </component>

This class extends Configurable, Contextualizable & ConfigurableCronJob,
and with the contextualize() method has access to the Cocoon context:

    Map objectModel = ContextHelper.getObjectModel(context);
    this.cocoonContext = ObjectModelHelper.getContext(objectModel);


How does the <pipeline> config work?  How do I call the pipeline from the
class?  Is there another interface/class the needs to be
implemented/extended?

I do have the match pattern working in the sitemap but I'm stuck on how to
call it from the component.

Thanks for your patience. I've built some custom generators and transformers
but this is new to me.

gary



> Hello Gary!
> you can add at your component declaration in cocoon.xconf a pipeline tag
> [<pipeline/>] to execute your match
> for example:
> <component role="org.apache.cocoon.components.cron.CronJob/task_to_run"
> class="MyClass"
> logger="cron.task_to_run">
> <pipeline>sendmail</pipeline>
> </component>
> then inside "MyClass" you can to call the pipeline with request parameters
> and into sitemap.xmap to do a match pattern to: sendmail.
> 


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


Re: Run Action from Java?

Posted by Karen Torres <kt...@agssa.net>.
Hello Gary!
you can add at your component declaration in cocoon.xconf a pipeline tag 
[<pipeline/>] to execute your match
for example:
<component role="org.apache.cocoon.components.cron.CronJob/task_to_run"
class="MyClass"
logger="cron.task_to_run">
<pipeline>sendmail</pipeline>
</component>
then inside "MyClass" you can to call the pipeline with request parameters
and into sitemap.xmap to do a match pattern to: sendmail.

Gary Larsen escribió:
>
> I’m running Cocoon 2.1.9.
>
> The application periodically runs some background processing with 
> CocoonQuartzJobScheduler.
>
> I want to send an email at the end of processing and thought that a 
> SendMail action would be the easiest solution. Can I run this Action 
> from Java, or do something similar to a flowscript sendPage()?
>
> Thanks,
>
> gary
>


-- 
Saludos,

Karen Torres N. 


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