You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by ant elder <an...@apache.org> on 2008/05/07 10:55:41 UTC

Re: Is there are simple straightforward way of creating a Compoisite

On Wed, Apr 30, 2008 at 1:18 PM, Simon Laws <si...@googlemail.com>
wrote:

> snip....
>
> >
> > Cool thats really helpful. Ok so if we can have a Tomcat TuscanyHost
> > (i.e.
> > an extension of org.apache.catalina.core.StandardHost not related to the
> > Tuscany host stuff)  that will get its addChild method called for each
> > webapp and we can get a File to the root of the webbapp so call
> > nodeFactory.createSCANode with that and treat each webapp as a seperate
> > contribution which seems reasonable. That would give us a node per
> > webapp
> > which i'm not sure is good or bad till theres some answers to the "what
> > is a
> > node" question.
>
>
> sounds ok to me.
>
>
> >
> >
> > How do nodes talk to each other or become part of a bigger domain?
> > Theres
> > nothing in SCANode2Factory.newInstance().createSCANode or node.start
> > that
> > mentions anything about any domain?
> >
> >   ...ant
> >
>
> They don't talk to each other, other other than at the application level.
> If you want to have a node read it's configuration from the domain you can
> use the
> following factory method.
>
> public abstract SCANode2 createSCANode(String configurationURI);
>
> and provide the URI of the configuration that you want it to read. e.g.
>
> node = factory.createSCANode("http://localhost:9990/node-image/NodeA");
>
> This URL is provided by the domain and is tailored specifically to provide
> just the right configuration (the list of composite and contribution URLs)
> for the node in question. NodeA in this case.
>
> Simon
>
>
Ok I've been digging around in the code a bit and think i understand that,
but it will only work if there are pre-existing  .composite files describing
each node when the domain starts up, right? Eg like the NodeA.composite,
NodeB.composite etc in the calculator-distributed sample.

This is not quite what we need in the Tomcat case. I shouldn't need to write
a NodeX.composite file for each webapp as we can say each webapp is a node,
use the webapp name for the node name, and use the webapps
meta-inf/sca-deployables or sca-contribution.xml to get all the composites.

So i guess what i want is for the TuscanyStandardHost to start up an inial
empty domain, then as each webapp is discovered to get the domain to create
itself a node configuration from the webapp folder, and then have the
TuscanyStandardHost call domain.createNode for the webapp and store that
node in the webapps context.

Does that sound reasonable? There doesn't seem to be APIs for that right now
so if this approach sounds ok id like to try to add that.

   ...ant

Re: Is there are simple straightforward way of creating a Compoisite

Posted by ant elder <an...@gmail.com>.
On Wed, May 7, 2008 at 11:39 AM, ant elder <an...@gmail.com> wrote:

>
>
> On Wed, May 7, 2008 at 11:29 AM, Simon Laws <si...@googlemail.com>
> wrote:
>
> <snip>
>
>
>>> This is not quite what we need in the Tomcat case. I shouldn't need to
>>> write
>>> a NodeX.composite file for each webapp as we can say each webapp is a
>>> node,
>>> use the webapp name for the node name, and use the webapps
>>> meta-inf/sca-deployables or sca-contribution.xml to get all the
>>> composites.
>>>
>>> So i guess what i want is for the TuscanyStandardHost to start up an
>>> inial
>>
>>
>> What's the  "TuscanyStandardHost"? Does that exist yet?
>>
>
> Its the Tuscany implementation of the Tomcat StandardHost which is what
> gets control when Tomcat starts up and can cerate whatever domains and nodes
> are necessary for the webapps. There is an old one in the runtime-tomcat
> module but i'm right now trying to rewrite it to use all this new domain
> stuff.
>
>    ...ant
>
>
I've committed the updates i had for the TuscanyHost in r654467 its still
using just the old "standalone" SCADomain but it enables you to run SCA
webapps without any Tuscany stuff in the web.xml or webapp lib directory.
You point a Tomcat install at a Tuscany binary distribution install with two
updates to the Tomcat configuration:

- in tomcat conf/catalina.properties add the Tuscany Distro lib directory to
the common.loader path, eg:

common.loader=${catalina.home}/lib,${catalina.home}/lib/*.jar,/tuscany-sca-2.0-incubating-SNAPSHOT/lib/*.jar

- in tomcat conf/server.xml add the TuscanyHost class name to the localhost
definition, eg:
      <Host name="localhost"  appBase="webapps"
            className="org.apache.tuscany.sca.runtime.tomcat.TuscanyHost"
            unpackWARs="true" autoDeploy="true"
            xmlValidation="false" xmlNamespaceAware="false">

Ideally we'd update org.apache.tuscany.sca.runtime.tomcat.TuscanyHost to use
the new distributed domain stuff, but Ive not been able to make much
progress with getting that to work, I'll start a new thread about that.

   ...ant

Re: Is there are simple straightforward way of creating a Compoisite

Posted by ant elder <an...@gmail.com>.
On Wed, May 7, 2008 at 11:29 AM, Simon Laws <si...@googlemail.com>
wrote:

<snip>


> > This is not quite what we need in the Tomcat case. I shouldn't need to
> > write
> > a NodeX.composite file for each webapp as we can say each webapp is a
> > node,
> > use the webapp name for the node name, and use the webapps
> > meta-inf/sca-deployables or sca-contribution.xml to get all the
> > composites.
> >
> > So i guess what i want is for the TuscanyStandardHost to start up an
> > inial
>
>
> What's the  "TuscanyStandardHost"? Does that exist yet?
>

Its the Tuscany implementation of the Tomcat StandardHost which is what gets
control when Tomcat starts up and can cerate whatever domains and nodes are
necessary for the webapps. There is an old one in the runtime-tomcat module
but i'm right now trying to rewrite it to use all this new domain stuff.

   ...ant

Re: Is there are simple straightforward way of creating a Compoisite

Posted by ant elder <an...@gmail.com>.
On Wed, May 7, 2008 at 11:29 AM, Simon Laws <si...@googlemail.com>
wrote:

>
> I'm not clear if the domain here is intended to be local to the webapp
> container, in which case it could reasonably do webapp processing on the
> local file system, or if it is a more general domain out there in the
> network somewhere. Asking the question in a different way, what is the use
> case here?
>
> 1. User creates a war including SCA artifacts
> 2. User contributes the war to the domain (Using the domian GUI)
> 3. Domain deploys the war to a webapp container chosen by the user
>
> or
>
> 1. User creates a war including SCA artifacts
> 2. User deploys the war to the webapp container, e.g. copies the war to
> the webapps folder
> 3. Tuscany/webapp integration configures Tuscany to run the artifacts in
> the war as part of a domain.
>
>
The second of those.

   ...ant

Re: Is there are simple straightforward way of creating a Compoisite

Posted by Simon Laws <si...@googlemail.com>.
On Wed, May 7, 2008 at 9:55 AM, ant elder <an...@apache.org> wrote:

> On Wed, Apr 30, 2008 at 1:18 PM, Simon Laws <si...@googlemail.com>
> wrote:
>
> > snip....
> >
> > >
> > > Cool thats really helpful. Ok so if we can have a Tomcat TuscanyHost
> > > (i.e.
> > > an extension of org.apache.catalina.core.StandardHost not related to
> the
> > > Tuscany host stuff)  that will get its addChild method called for each
> > > webapp and we can get a File to the root of the webbapp so call
> > > nodeFactory.createSCANode with that and treat each webapp as a
> seperate
> > > contribution which seems reasonable. That would give us a node per
> > > webapp
> > > which i'm not sure is good or bad till theres some answers to the
> "what
> > > is a
> > > node" question.
> >
> >
> > sounds ok to me.
> >
> >
> > >
> > >
> > > How do nodes talk to each other or become part of a bigger domain?
> > > Theres
> > > nothing in SCANode2Factory.newInstance().createSCANode or node.start
> > > that
> > > mentions anything about any domain?
> > >
> > >   ...ant
> > >
> >
> > They don't talk to each other, other other than at the application
> level.
> > If you want to have a node read it's configuration from the domain you
> can
> > use the
> > following factory method.
> >
> > public abstract SCANode2 createSCANode(String configurationURI);
> >
> > and provide the URI of the configuration that you want it to read. e.g.
> >
> > node = factory.createSCANode("http://localhost:9990/node-image/NodeA");
> >
> > This URL is provided by the domain and is tailored specifically to
> provide
> > just the right configuration (the list of composite and contribution
> URLs)
> > for the node in question. NodeA in this case.
> >
> > Simon
> >
> >
> Ok I've been digging around in the code a bit and think i understand that,
> but it will only work if there are pre-existing  .composite files
> describing
> each node when the domain starts up, right? Eg like the NodeA.composite,
> NodeB.composite etc in the calculator-distributed sample.


Agreed, that's the difference here compared to the old domain implementation
where nodes could "register" themselves. It was this registration process
that was causing the startup problems before. There are way of solving this
kind of problem, for example, there are several group membership protocols
out there, but the focus most recently has been on getting the contribution
model sorted rather than automating the creation of the node list.


>
> This is not quite what we need in the Tomcat case. I shouldn't need to
> write
> a NodeX.composite file for each webapp as we can say each webapp is a
> node,
> use the webapp name for the node name, and use the webapps
> meta-inf/sca-deployables or sca-contribution.xml to get all the
> composites.
>
> So i guess what i want is for the TuscanyStandardHost to start up an inial


What's the  "TuscanyStandardHost"? Does that exist yet?


> empty domain, then as each webapp is discovered to get the domain to
> create
> itself a node configuration from the webapp folder, and then have the
> TuscanyStandardHost call domain.createNode for the webapp and store that
> node in the webapps context.


I'm not clear if the domain here is intended to be local to the webapp
container, in which case it could reasonably do webapp processing on the
local file system, or if it is a more general domain out there in the
network somewhere. Asking the question in a different way, what is the use
case here?

1. User creates a war including SCA artifacts
2. User contributes the war to the domain (Using the domian GUI)
3. Domain deploys the war to a webapp container chosen by the user

or

1. User creates a war including SCA artifacts
2. User deploys the war to the webapp container, e.g. copies the war to the
webapps folder
3. Tuscany/webapp integration configures Tuscany to run the artifacts in the
war as part of a domain.

or something else.


>
> Does that sound reasonable? There doesn't seem to be APIs for that right
> now
> so if this approach sounds ok id like to try to add that.
>
>   ...ant
>

Simon