tuscany-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Simon Laws" <simonsl...@googlemail.com>
Subject Re: Is there are simple straightforward way of creating a Compoisite
Date Mon, 28 Apr 2008 15:53:51 GMT
On Mon, Apr 28, 2008 at 4:14 PM, Marian, Radu <radu.marian@bankofamerica.com>
wrote:

> Hello,
>
> I have spent quite a few time through ContributionServiceImpl class and
> could not find a simple way to add a Composite to the contributiion -
> given the InputStream of the composite URL.  I understand tuscany team
> wants to provide the ease of use for compoistes to be discovered from
> the file system.... However - IMO - the api should not prevent one from
> loading/adding a composite from an InputStream.
>
> Why is everything have to be served from local file system?  Does the
> sca spec mandate that?
>
> Thanks,
> Radu.
>

Hi Radu

You catch us at a point of transition. The spec doesn't mandate that
contributions/composites be read from the local files system although most
of our samples do this as they use the DefaultSCADomain implementation from
the host-embedded module.

There has been work recently on new code to allow for easier and more
consistent processing of contributions and composites and for deployment of
these out to the nodes where they will run. Hence there is a new runtime
interface, see node2-api [1], that can be used to fire up the Tuscany
runtime classes and run a composite.

A node expects to be provided with a single composite and all of the
contributions required to run that composite. This information can be
provided in a number of ways

    /**
     * Creates a new SCA node.
     *
     * @param configurationURI the URI of the node configuration
     * @return a new SCA node.
     */
    public abstract SCANode2 createSCANode(String configurationURI);

    /**
     * Creates a new SCA node.
     *
     * @param compositeURI the URI of the composite to use
     * @param contributions the URI of the contributions that provides the
composites and related artifacts
     * @return a new SCA node.
     */
    public abstract SCANode2 createSCANode(String compositeURI,
SCAContribution... contributions);

    /**
     * Creates a new SCA node.
     *
     * @param compositeURI the URI of the composite to use
     * @param compositeContent the XML content of the composite to use
     * @param contributions the URI of the contributions that provides the
composites and related artifacts
     * @return a new SCA node.
     */
    public abstract SCANode2 createSCANode(String compositeURI, String
compositeContent, SCAContribution... contributions);

If you did want to use this to load contributions from the file system you
can, see [2] for an example (although we don't have the helper methods in
place just yet to make this really easy). Alternatively you can start a node
up and have it read it's configuration across the network, for example, see
one of the nodes from the distributed calculator sample [3]. There isn't an
interface here that takes an input stream but you can provide a composite as
a string which of course can come from where ever you want it to.

You will note in the distributed calculator sample that there is
"LaunchDomain.java" also. This launches a web app that provides the
environment in which you can manage you contributions and which will vend
them out across the network to nodes using an Atom feed.

There is very little documentation on all of this yet. It's very much on the
TODO list. It's all pretty new and we'd love to hear any comments you have
or ideas for improvement.

Hope that helps

Simon

[1]
http://svn.apache.org/repos/asf/incubator/tuscany/java/sca/modules/node2-api/src/main/java/org/apache/tuscany/sca/node/SCANode2Factory.java
[2]
http://svn.apache.org/repos/asf/incubator/tuscany/java/sca/itest/validation/src/test/java/calculator/DuplicateComponentNameTestCase.java
[3]
http://svn.apache.org/repos/asf/incubator/tuscany/java/sca/samples/calculator-distributed/src/main/java/node/LaunchCalculatorNodeA.java

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message