You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lenya.apache.org by Andreas Hartmann <an...@apache.org> on 2005/03/13 01:11:58 UTC
[heads-up] Cron block progress
Hi Lenya devs,
yippee ... I got my first publish job scheduled using the Cron block.
To achieve this, I wrote a UsecaseCronJob which instanciates a usecase,
parameterizes and executes it. The AbstractUsecase has a method
schedule(Date)
which you can call to schedule the current job with the current parameters
at a certain date. It works only for non-workflow usecases yet (see below).
Everything is very simple and straightforward.
Problems yet to solve:
- I had to comment out a {fallback:...} call in the global sitemap because
the fallback module relies on the request URL to determine the publication.
In the case of a scheduled job, the request URL is empty (not triggered
from a client request). Maybe we have to pass the publication id as a
parameter to the fallback module:
{fallback:{1}:...}
This would be better SoC anyway.
BTW, the call to the sitemap is made by the DocumentTypeResolver which
calls the URIParameterizer.
- Role initialization:
I didn't yet find a way to pass the identity to the called usecase.
Therefore the workflow conditions won't pass.
- Persistence:
I didn't yet try to make a job persistent.
Feel free to play with scheduling.
-- Andreas
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org
Re: [heads-up] Cron block progress
Posted by Andreas Hartmann <an...@apache.org>.
Andreas Hartmann wrote:
> Hi Lenya devs,
>
> yippee ... I got my first publish job scheduled using the Cron block.
> To achieve this, I wrote a UsecaseCronJob which instanciates a usecase,
> parameterizes and executes it. The AbstractUsecase has a method
>
> schedule(Date)
>
> which you can call to schedule the current job with the current parameters
> at a certain date. It works only for non-workflow usecases yet (see below).
> Everything is very simple and straightforward.
>
>
> Problems yet to solve:
>
> - I had to comment out a {fallback:...} call in the global sitemap because
> the fallback module relies on the request URL to determine the
> publication.
Fixed. The UsecaseCronJob now creates a custom request based on the original
request and adds it to the object model. The request URL issues should now
be fixed.
-- Andreas
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org
Re: [heads-up] Cron block progress
Posted by Andreas Hartmann <an...@apache.org>.
Andreas Hartmann wrote:
[...]
> - Role initialization:
> I didn't yet find a way to pass the identity to the called usecase.
> Therefore the workflow conditions won't pass.
Fixed. The original access control information is now properly added
to the session before invoking the usecase.
This means you can schedule publish jobs in the default publication
if you change a line in global-sitemap.xmap (I didn't check it in
because it is a hack and may affect publication templates):
<!-- uri-parameter/{publication-id}/{parameter}/{area}/{uri} -->
<map:match pattern="uri-parameter/*/*/*/**">
<map:mount uri-prefix="uri-parameter/{1}/{2}/"
src="lenya/pubs/{1}/parameter-{2}.xmap" check-reload="true"
reload-method="synchron"/>
<!-- FIXME: throws exception when scheduler is used -->
<!--
<map:mount uri-prefix="uri-parameter/{1}/{2}/"
src="{fallback:parameter-{2}.xmap}" check-reload="true" reload-method="synchron"/>
-->
</map:match>
-- Andreas
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org
Re: [heads-up] Cron block progress
Posted by Andreas Hartmann <an...@apache.org>.
Andreas Hartmann wrote:
> Hi Lenya devs,
>
> yippee ... I got my first publish job scheduled using the Cron block.
Maybe I should explain a little why I'm so keen on replacing the
current scheduler.
1) The current scheduler is a separate servlet, which requires
communication over HTTP. This could be done transparently through
a proxy object, but is quite complex nevertheless. Because the
proxy object could not access the source resolver, a whole
HTTP call would have to be implemented in plain Java.
2) The scheduler has no access to the service manager. When a task
is invoked, it cannot lookup services. This is a big limitation.
In fact, the scheduler is the one big stone in our way to
Avalon.
With the cron block, we can schedule ServiceableCronJobs which have
access to Avalon services. For instance, the UsecaseCronJob can
resolve a usecase (which is an Avalon service).
As soon as we use the cron block for tasks as well, we can entirely
get rid of the old scheduler. Then we can avalonize the task
manager, which in turn enables us to avalonize tasks. When we
arrive at that stage, we can avalonize the publication API, which
means we can for instance pass the ServiceManager to documents.
Then we can implement methods like
Document.getDocumentType()
because the document can access the DocumentTypeResolver directly.
Note: At the moment it is not possible to access the document type
of a document in a task (!). All Cocoon-related information has
to be passed from the menu!
A document will also be able to resolve its own source. This allows
us to implement functions like document.save(), which simplifies
to setup transactions etc. At the moment, it is not possible to
use sources in the dublin core without removing document.getDublinCore()
from the API.
I hope that makes things a little bit clearer.
-- Andreas
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org
Re: [heads-up] Cron block progress
Posted by Andreas Hartmann <an...@apache.org>.
Andreas Hartmann wrote:
[...]
> - Persistence:
> I didn't yet try to make a job persistent.
Now the scheduler uses a JDBC job store based on the HSQL DB
that ships with Cocoon. I added a publish job, restarted Jetty,
and the job was executed properly.
This means we have a functional usecase scheduler based on the
cron block. Feel free to experiment and add your comments!
-- Andreas
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org
Re: [heads-up] Cron block progress
Posted by Andreas Hartmann <an...@apache.org>.
Andreas Hartmann wrote:
> Hi Lenya devs,
>
> yippee ... I got my first publish job scheduled using the Cron block.
> To achieve this, I wrote a UsecaseCronJob which instanciates a usecase,
> parameterizes and executes it. The AbstractUsecase has a method
>
> schedule(Date)
>
> which you can call to schedule the current job with the current parameters
> at a certain date.
Now there is a separate service o.a.l.cms.usecase.scheduling.UsecaseScheduler
for this purpose.
-- Andreas
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org