You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Giacomo Pati <Gi...@pwr.ch> on 2000/06/05 11:23:27 UTC

Comments on Resource Management in C2

Hi all

I thought to write this proposal in response to the discussion of using
Context.getResource/getRealPath and alike for locating resources in
Cocoon2. Any comments are very welcome.

Preliminary notes:
A lot of ideas come from Stefanos sitemap-working-draft and I wouldn't
sell'em as my own ideas. I only tried to collect those thoughts together
in one place for discussion. The current sitemap proposal could be found
in the C2 CVS
under xdocs/sitemap-working-draft.xml.

I will also propose to add a attribute "mime-type" to the <read> tag to
make it a real binary generator/serializer to serve _any_ data directly
to the client browser from a resource. Or make it a reader component
which can be
parametrized with a reference to a mime-type definition file (somthing
like Tomcats main web.xml file).

Proposal:
The Cocoon 2 system should comply to the servlet spec 2.2. As for that
it should be able to be deployed easily as a war file. The sitemap
configuration file will be made available to the Cocoon 2 system with a
definition of

  <init-param>
   <param-name>configurations</param-name>
   <param-value>/cocoon.xconf</param-value>
  </init-param>

in the deployment descriptor. The path to the configuration file will be
relative to the ContextPath of the Cocoon 2 servlet. It should be
received by Context.getResource("/cocoon.xconf") (using the example
above). The path to the configuration file becomes the root of all the
resources mentioned in the sitemap. It is like a initial <mount uri="/*"
src:file="/Context-Path/Path-To-Sitemap-File/*"/>. The name of the
sitemap (cocoon.xconf in this example) will be used for all sitemaps
that gets mounted by the <mount> tag.

The <mount> tag describes a path to a "cascading" site in his "uri"
attribute and thus is _not_ rooted at the path of the sitemap containing
the <mount> tag (except if the "local" loader is used, see next
paragraph). If there is a sitemap found at the path the "uri" attribute
of the <mount> tag points to, it inherits all definitions (?or should we
only inherit components?) of the sitemap the <mount> tag was in.
Consider this as a recursive process.

As mentioned in the sitemap-working-draft.xml a concept of loaders for
different protocols (src:jar, src:file:, src:class) will be introduced
to load resources needed by the sitemap components. The "local" loader
is initialized with the root path to the sitemap it belongs to. All
other loaders have their own method to localize the resources they will
deliver.

Thus, if you look at these note it is not relevant (and I think not even
recomended) to use Context.getResource() in the loaders because it could
only be used for resources the "local" loader of the "root" sitemap will
deliver.

Now it's your turn.

Giacomo

-- 
PWR GmbH, Organisation & Entwicklung      Tel:   +41 (0)1 856 2202
Giacomo Pati, CTO/CEO                     Fax:   +41 (0)1 856 2201
Hintereichenstrasse 7                     Mailto:Giacomo.Pati@pwr.ch
CH-8166 Niederweningen                    Web:   http://www.pwr.ch

Re: Comments on Resource Management in C2

Posted by Jeremy Quinn <je...@media.demon.co.uk>.
At 11:19 +0100 09/06/00, Ross Burton wrote:
>> > ADSL?  This will be interesting: how much do you pay, what is the
>bandwidth
>> > and how many users are there per "network".
>>
>> Pay? nothing :) I'm famous enough to go around asking "is there anyone
>> who wants to pay me an ADSL line?" and actually get it...
>>
>> No, serious, it's part of a deal with an italian startup I'm advising
>> for, so they are giving me for free an ADSL line. But I would cost me
>> about 80$/month for 640Kbit, static IP (I hope!).
>
>Pah!  BT are offering 512KB (I think, it's probably less though) for 80 a
>month, IIRC.  Damn - wrong country!

I was temporarily on BT's Demon ADSL trial. They made an astonishing mess
of it.
Plus, worst of all, you cannot receive ANY kind of incoming request, no
serving, no voice over IP, most chat does not work etc etc. Boy oh boy, are
BT scared :)

Jeremy
-- 
   ___________________________________________________________________

   Jeremy Quinn                                           Karma Divers
                                                       webSpace Design
                                            HyperMedia Research Centre

   <ma...@mac.com>     		 <http://www.media.demon.co.uk>
    <phone:+44.[0].20.7737.6831>        <pa...@sms.genie.co.uk>

Re: Comments on Resource Management in C2

Posted by Stefano Mazzocchi <st...@apache.org>.
Ross Burton wrote:
> 
> > > ADSL?  This will be interesting: how much do you pay, what is the
> bandwidth
> > > and how many users are there per "network".
> >
> > Pay? nothing :) I'm famous enough to go around asking "is there anyone
> > who wants to pay me an ADSL line?" and actually get it...
> >
> > No, serious, it's part of a deal with an italian startup I'm advising
> > for, so they are giving me for free an ADSL line. But I would cost me
> > about 80$/month for 640Kbit, static IP (I hope!).
> 
> Pah!  BT are offering 512KB (I think, it's probably less though) for £80 a
> month, IIRC.  Damn - wrong country!

Well, I heard rumors you can get a "free" ADSL line if you put a banner
on top of your screen... but I think it's the most stupid idea ever:
just take you old 486 out of the closet and use it as a connection
server with no screen attached and you are done.

But, hey, italian startups are real morons sometimes :)

-- 
Stefano Mazzocchi      One must still have chaos in oneself to be
                          able to give birth to a dancing star.
<st...@apache.org>                             Friedrich Nietzsche
--------------------------------------------------------------------
 Missed us in Orlando? MX-Mozilla-Status: 0009ON Europe in London!
------------------------- http://ApacheCon.Com ---------------------



Re: Comments on Resource Management in C2

Posted by Stefano Mazzocchi <st...@apache.org>.
Ross Burton wrote:
> 
> > > ADSL?  This will be interesting: how much do you pay, what is the
> bandwidth
> > > and how many users are there per "network".
> >
> > Pay? nothing :) I'm famous enough to go around asking "is there anyone
> > who wants to pay me an ADSL line?" and actually get it...
> >
> > No, serious, it's part of a deal with an italian startup I'm advising
> > for, so they are giving me for free an ADSL line. But I would cost me
> > about 80$/month for 640Kbit, static IP (I hope!).
> 
> Pah!  BT are offering 512KB (I think, it's probably less though) for £80 a
> month, IIRC.  Damn - wrong country!

Well, I heard rumors you can get a "free" ADSL line if you put a banner
on top of your screen... but I think it's the most stupid idea ever:
just take you old 486 out of the closet and use it as a connection
server with no screen attached and you are done.

But, hey, italian startups are real morons sometimes :)

-- 
Stefano Mazzocchi      One must still have chaos in oneself to be
                          able to give birth to a dancing star.
<st...@apache.org>                             Friedrich Nietzsche
--------------------------------------------------------------------
 Missed us in Orlando? Make it up with ApacheCON Europe in London!
------------------------- http://ApacheCon.Com ---------------------



Re: Comments on Resource Management in C2

Posted by Ross Burton <ro...@mail.com>.
> > ADSL?  This will be interesting: how much do you pay, what is the
bandwidth
> > and how many users are there per "network".
>
> Pay? nothing :) I'm famous enough to go around asking "is there anyone
> who wants to pay me an ADSL line?" and actually get it...
>
> No, serious, it's part of a deal with an italian startup I'm advising
> for, so they are giving me for free an ADSL line. But I would cost me
> about 80$/month for 640Kbit, static IP (I hope!).

Pah!  BT are offering 512KB (I think, it's probably less though) for £80 a
month, IIRC.  Damn - wrong country!

Ross


Re: Comments on Resource Management in C2

Posted by Stefano Mazzocchi <st...@apache.org>.
Ross Burton wrote:
> 
> > > Ross Burton, finally with a phone line after 10 days of waiting!
> > Don't tell me... I'm still waiting for my ADSL line to be activated...
> 
> ADSL?  This will be interesting: how much do you pay, what is the bandwidth
> and how many users are there per "network".

Pay? nothing :) I'm famous enough to go around asking "is there anyone
who wants to pay me an ADSL line?" and actually get it...

No, serious, it's part of a deal with an italian startup I'm advising
for, so they are giving me for free an ADSL line. But I would cost me
about 80$/month for 640Kbit, static IP (I hope!).

Users? I'll probably the only one :)

No, serious, not many at all, but I've been told by some Telecom Italia
engineers I know the nation has enough fiber underground to substain
full ADSL (8Mbit!!) for almost every house... the problems, as usual
would be routing and paying for it :)

I used to say that Italy is a IT third world country... in fact we are
just late... but it results in faster and less expensive growths, given
than more industrialized countries (US, Japan) do the trial/error cycles
before us :)

And consider that Italy is probably the only nation where wireless
phones outnumber wired phones. This results in incredible profit for
telecos and lots of money to reinvest in infrastructures and R&D.

Pirelli built the first all-optical amplifier which has a bandwidth up
to 5 THz (yes, tera, that's right!) and I've seen terabits sent in a
single fibre using wavelength multiplexing. (remember I study
optoelectronics, so this is my original field :)

The bandwidth is there, we just have to go a few orders of magniture
faster in routing those packets and video streaming would be piece of
cake.

Well, in theory anyway :)

-- 
Stefano Mazzocchi      One must still have chaos in oneself to be
                          able to give birth to a dancing star.
<st...@apache.org>                             Friedrich Nietzsche
--------------------------------------------------------------------
 Missed us in Orlando? Make it up with ApacheCON Europe in London!
------------------------- http://ApacheCon.Com ---------------------



Re: Comments on Resource Management in C2

Posted by Ross Burton <ro...@mail.com>.
> > Ross Burton, finally with a phone line after 10 days of waiting!
> Don't tell me... I'm still waiting for my ADSL line to be activated...

ADSL?  This will be interesting: how much do you pay, what is the bandwidth
and how many users are there per "network".

Ross


Re: Comments on Resource Management in C2

Posted by Stefano Mazzocchi <st...@apache.org>.
Ross Burton wrote:
> 
> > > can we use getMimeType() from the Servlet API directly and let Tomcat
> > > handle it? it could be possible, given a better AJP protocol, to go back
> > > to Apache and let him handle the MIME type.
> >
> > Right, I've overlooked that, sorry. So we should have access to the
> > ServletContext in the <read> tag.
> 
> Ermm.. there is no ServletContext in offline mode...

Not a real one, but we can provide a fake alternative for that...
 
> Ross Burton, finally with a phone line after 10 days of waiting!

Don't tell me... I'm still waiting for my ADSL line to be activated...

-- 
Stefano Mazzocchi      One must still have chaos in oneself to be
                          able to give birth to a dancing star.
<st...@apache.org>                             Friedrich Nietzsche
--------------------------------------------------------------------
 Missed us in Orlando? Make it up with ApacheCON Europe in London!
------------------------- http://ApacheCon.Com ---------------------



Re: Comments on Resource Management in C2

Posted by Ross Burton <ro...@mail.com>.
> > Ermm.. there is no ServletContext in offline mode...
>
> So you have to give a mime-type to the <read> tag to prevent it to grab
> the ServletContext. Otherwise we have to wrap the ServletContext with a
> CocoonServletContext as we do with the reques/response objects.

What the heck, both.  A context would be handy to have (!), by generalising
the Servlet context we are off to a good start.   Being able to state the
mime type in the <read> tag is essential.  However, a magic mime detector (a
la Apache) would be very cool though...  :-)

Ross


Re: Comments on Resource Management in C2

Posted by Giacomo Pati <Gi...@pwr.ch>.
Ross Burton wrote:
> 
> > > can we use getMimeType() from the Servlet API directly and let Tomcat
> > > handle it? it could be possible, given a better AJP protocol, to go back
> > > to Apache and let him handle the MIME type.
> >
> > Right, I've overlooked that, sorry. So we should have access to the
> > ServletContext in the <read> tag.
> 
> Ermm.. there is no ServletContext in offline mode...

So you have to give a mime-type to the <read> tag to prevent it to grab
the ServletContext. Otherwise we have to wrap the ServletContext with a
CocoonServletContext as we do with the reques/response objects.

What do you think?

Giacomo
-- 
PWR GmbH, Organisation & Entwicklung      Tel:   +41 (0)1 856 2202
Giacomo Pati, CTO/CEO                     Fax:   +41 (0)1 856 2201
Hintereichenstrasse 7                     Mailto:Giacomo.Pati@pwr.ch
CH-8166 Niederweningen                    Web:   http://www.pwr.ch

Re: Comments on Resource Management in C2

Posted by Ross Burton <ro...@mail.com>.
> > can we use getMimeType() from the Servlet API directly and let Tomcat
> > handle it? it could be possible, given a better AJP protocol, to go back
> > to Apache and let him handle the MIME type.
>
> Right, I've overlooked that, sorry. So we should have access to the
> ServletContext in the <read> tag.

Ermm.. there is no ServletContext in offline mode...

Ross Burton, finally with a phone line after 10 days of waiting!


Re: Comments on Resource Management in C2

Posted by Giacomo Pati <Gi...@pwr.ch>.
Stefano Mazzocchi wrote:
> 
> Giacomo Pati wrote:
> >
> > I will also propose to add a attribute "mime-type" to the <read> tag to
> > make it a real binary generator/serializer to serve _any_ data directly
> > to the client browser from a resource. Or make it a reader component
> > which can be
> > parametrized with a reference to a mime-type definition file (somthing
> > like Tomcats main web.xml file).
> 
> can we use getMimeType() from the Servlet API directly and let Tomcat
> handle it? it could be possible, given a better AJP protocol, to go back
> to Apache and let him handle the MIME type.

Right, I've overlooked that, sorry. So we should have access to the
ServletContext in the <read> tag.

> > The name of the
> > sitemap (cocoon.xconf in this example) will be used for all sitemaps
> > that gets mounted by the <mount> tag.
> 
> what about
> 
>  <mount uri="/"
> src:file="/Context-Path/Path-to-Sitemap-File/sitemap.xml"/>

+1

> I think we should remove the use of matching from the "mount" element
> since this is just like partition mounting for FS. It's implicitly
> matching all the subrequests and with this you can specify how you name
> the sitemap. (if the file is not present, I say we default to
> "cocoon.sitemap")

You mean hard code it to String sitemapName = "cocoon.sitemap"? What
against using the name of the "root" sitemap?

> 
> > The <mount> tag describes a path to a "cascading" site in his "uri"
> > attribute and thus is _not_ rooted at the path of the sitemap containing
> > the <mount> tag (except if the "local" loader is used, see next
> > paragraph). If there is a sitemap found at the path the "uri" attribute
> > of the <mount> tag points to, it inherits all definitions (?or should we
> > only inherit components?) of the sitemap the <mount> tag was in.
> > Consider this as a recursive process.
> 
> Right.

Should we inherit all definitions or only the components?

> 
> > As mentioned in the sitemap-working-draft.xml a concept of loaders for
> > different protocols (src:jar, src:file:, src:class) will be introduced
> > to load resources needed by the sitemap components. The "local" loader
> > is initialized with the root path to the sitemap it belongs to. All
> > other loaders have their own method to localize the resources they will
> > deliver.
> >
> > Thus, if you look at these note it is not relevant (and I think not even
> > recomended) to use Context.getResource() in the loaders because it could
> > only be used for resources the "local" loader of the "root" sitemap will
> > deliver.
> 
> You are right, I overlooked that.
> 
> But for the "local" loader, we should use getResource() anyway.

Where does a "local" loader of a cascaded sitemap points to? Into the
ContextPath or into the mounted path?

Giacomo

-- 
PWR GmbH, Organisation & Entwicklung      Tel:   +41 (0)1 856 2202
Giacomo Pati, CTO/CEO                     Fax:   +41 (0)1 856 2201
Hintereichenstrasse 7                     Mailto:Giacomo.Pati@pwr.ch
CH-8166 Niederweningen                    Web:   http://www.pwr.ch

Re: Comments on Resource Management in C2

Posted by Stefano Mazzocchi <st...@apache.org>.
Giacomo Pati wrote:
> 
> Hi all
> 
> I thought to write this proposal in response to the discussion of using
> Context.getResource/getRealPath and alike for locating resources in
> Cocoon2. Any comments are very welcome.
> 
> Preliminary notes:
> A lot of ideas come from Stefanos sitemap-working-draft and I wouldn't
> sell'em as my own ideas. I only tried to collect those thoughts together
> in one place for discussion. The current sitemap proposal could be found
> in the C2 CVS
> under xdocs/sitemap-working-draft.xml.
> 
> I will also propose to add a attribute "mime-type" to the <read> tag to
> make it a real binary generator/serializer to serve _any_ data directly
> to the client browser from a resource. Or make it a reader component
> which can be
> parametrized with a reference to a mime-type definition file (somthing
> like Tomcats main web.xml file).

can we use getMimeType() from the Servlet API directly and let Tomcat
handle it? it could be possible, given a better AJP protocol, to go back
to Apache and let him handle the MIME type.

To me, it's important to keep all the informations in one place, but at
the same time, I like the idea of having the possibility to override the
default behavior from special needs (like output XML as text/plain to
show the source and not the structure).

So, +1 to <read ... mime-type=""/>, but if not specified we should use
the servlet API to find out... this means, no general mime-type
configurations for Cocoon.
 
> Proposal:
> The Cocoon 2 system should comply to the servlet spec 2.2. As for that
> it should be able to be deployed easily as a war file. The sitemap
> configuration file will be made available to the Cocoon 2 system with a
> definition of
> 
>   <init-param>
>    <param-name>configurations</param-name>
>    <param-value>/cocoon.xconf</param-value>
>   </init-param>
> 
> in the deployment descriptor. The path to the configuration file will be
> relative to the ContextPath of the Cocoon 2 servlet. It should be
> received by Context.getResource("/cocoon.xconf") (using the example
> above). The path to the configuration file becomes the root of all the
> resources mentioned in the sitemap. It is like a initial <mount uri="/*"
> src:file="/Context-Path/Path-To-Sitemap-File/*"/>. The name of the
> sitemap (cocoon.xconf in this example) will be used for all sitemaps
> that gets mounted by the <mount> tag.

what about

 <mount uri="/"
src:file="/Context-Path/Path-to-Sitemap-File/sitemap.xml"/>

I think we should remove the use of matching from the "mount" element
since this is just like partition mounting for FS. It's implicitly
matching all the subrequests and with this you can specify how you name
the sitemap. (if the file is not present, I say we default to
"cocoon.sitemap")

> The <mount> tag describes a path to a "cascading" site in his "uri"
> attribute and thus is _not_ rooted at the path of the sitemap containing
> the <mount> tag (except if the "local" loader is used, see next
> paragraph). If there is a sitemap found at the path the "uri" attribute
> of the <mount> tag points to, it inherits all definitions (?or should we
> only inherit components?) of the sitemap the <mount> tag was in.
> Consider this as a recursive process.

Right.
 
> As mentioned in the sitemap-working-draft.xml a concept of loaders for
> different protocols (src:jar, src:file:, src:class) will be introduced
> to load resources needed by the sitemap components. The "local" loader
> is initialized with the root path to the sitemap it belongs to. All
> other loaders have their own method to localize the resources they will
> deliver.
> 
> Thus, if you look at these note it is not relevant (and I think not even
> recomended) to use Context.getResource() in the loaders because it could
> only be used for resources the "local" loader of the "root" sitemap will
> deliver.

You are right, I overlooked that.

But for the "local" loader, we should use getResource() anyway.

-- 
Stefano Mazzocchi      One must still have chaos in oneself to be
                          able to give birth to a dancing star.
<st...@apache.org>                             Friedrich Nietzsche
--------------------------------------------------------------------
 Missed us in Orlando? Make it up with ApacheCON Europe in London!
------------------------- http://ApacheCon.Com ---------------------