cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andreas Hartmann <andr...@apache.org>
Subject Design question: Simple objects depending on services
Date Wed, 02 Mar 2005 09:14:23 GMT
Hi Cocoon developers,

I've got a basic question on the design of Cocoon-based applications
(especially Lenya).

We have the following situation:

- In Lenya, documents are represented by Document objects.
   They are produced by a factory, something like
   factory.getDocument(url). You can have quite a lot of documents
   in an application (several thousands), but usually just a few are
   represented as objects during a request.

- A lot of operations need the document type of a document. It
   is determined by the Avalon service DocumentTypeResolver which
   sends a cocoon:// call that is matched in a certain sitemap.
   The document type is resolved for instance with the SourceTypeAction.


The problem we're facing is that the DocumentTypeResolver has to
be used anytime we need the document type of a document. I guess
it would be more convenient to have

     document.getDocumentType();

But if the document type is passed to the document during creation,
we'll end up with a lot of unnecessary calls to the DocumentTypeResolver
which leads to a bad performance.

Is there any way to "lazy load" the document type by the document?
Is it a good practise to pass the ServiceManager to the document,
or should that be avoided? I guess it is not wise to implement
a document as a service?

Is there some similar code in the Cocoon codebase which I could
examine?

Thanks in advance!

-- Andreas


Mime
View raw message