cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefano Mazzocchi <stef...@apache.org>
Subject Re: [RT] Component manager, classloader and blocks
Date Fri, 10 Oct 2003 21:12:15 GMT

On Friday, Oct 10, 2003, at 13:22 Europe/Rome, Stephan Michels wrote:

> Hi,
>
> Since some days I thought about how implement blocks with smallest
> amount of work. (small ist beautiful)
>
> Most of the work is already finished, if we look into the 'unreal'
> block in the CVS repository. We have
> a classes, libs, a sitemap, a xconf file and some custom files.
> We could easily pack them into a zip file.

yes

> What need:
>
> For every block we need
> * a block URI, which identifies it.

yes

> * statements about dependecies to other blocks.

yes

> * Component manager, for a separate cocoon.xconf

well, not sure about this.

> * Sitemap proccessor for the root sitemap of the block

yes

> * A classloader for each block, which were exchange if the
>   the block has changed.

Sylvain has an idea on how we can do transparent classloading directly 
with a chain on component managers. Sylvain?

> The simplest form to include the information about the block
> URI and the dependencies is to use the sitemap for it, for example
>
> <map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
>  <map:block uri="http://apache.org/cocoon/block/myblock/1.0">
>   <map:import block="basic" 
> uri="http://apache.org/cocoon/block/basic/1.0"/>
>  </map:block>

-1

a block needs a descriptor that contains metadata for the librarian.

> For the sitemap components we need two component manager for
> handling the 'public' and 'private' components.
>
>  +---------------+        +---------------+
>  | myblock       |        | basic         |
>  | +-----------+ | lookup | +-----------+ |
>  | | public cm |-+--------+>| public cm | |
>  | +-----------+ |        | +-----------+ |
>  |      ^        |        |      ^        |
>  |      | lookup |        |      | lookup |
>  |      |        |        |      |        |
>  | +-----------+ |        | +-----------+ |
>  | | private cm| |        | | private cm| |
>  | +-----------+ |        | +-----------+ |
>  |      ^        |        |      ^        |
>  |      | lookup |        |      | lookup |
>  |      |        |        |      |        |
>  | +----------+  |        | +-----------+ |
>  | | sitemap  |  |        | | sitemap   | |
>  | +----------+  |        | +-----------+ |
>  |               |        |               |
>  +---------------+        +---------------+

sounds resonable.

> Another difficult part is about the dependecies of the CMs between
> subsitemaps (I doesn't have a solution). I think subsitemaps
> are a contrary solution to blocks, perhaps we should rethink the
> subsitemaps.

I don't see this, nor I see a problem with subsitemaps, they'd simply 
cascade back to the parent sitemap as they normally do.

> To prevent component name collisions within, we could use prefixes like
>
>  <match type="basic:wildcard" pattern="*.html"
>   <map:generate type="basic:file" src="{1}.xml"/>
>   <map:transform type="basic:xsl" src="mystyles.xsl"/>
>   <map:transform type="mytransformer"/>
>   <map:serialze type="basic:html"/>

name collision of what? you define the names of the components. those 
are the prefixes already, the classes are the real names of the 
components and they are already fully qualified to avoid collisions.

> If there is no name collision, you can leave out the prefix.
> The problem is that the current CM model doesn't support
> such a kind of prefix, but it doesn't need to, because
> the sitemap processor can resolve the prefix, and know
> which CM to ask for.

I can't see the problem.

> For the classes and libs itself, I think separate them into public
> and private isn't necessary for the first step.

Either we do this right away or it's going to be painful later on. I 
would be against such an half-step (also because classloading 
complexity isn't that much different with the two paths)

> A cheap solution is use following FS within a zip file:
>
> myblock.zip
>  /COB_INF/classes
>  /COB-INF/lib
>  /COB-INF/componts.xconf
>  /sitemap.xmap
>  /[whatever]
>
> Every block get his own classloader, and if the block has changes
> the classloader will be exchanged. Each depending block has
> a parent classloader, which will be consulted if the current
> classloader doesn't know the class.

Yes but keep in mind that classloading and component management must go 
hand in hand.

--
Stefano.


Mime
View raw message