Simon,

Thanks for all your help again - very timely too!

As far as web app contributions.  Our intent is to separated business
metadata as much as possible from infrastructure metadata.  

By business metadata I mean - xsd, wsdl, xq, sql, bpel - basically
anything dealing with business message structure or business process
(long running or not), e.t.c, and of course - .composite files too since
it has references to business metatada.

By infrastructure metadata I mean the binaries (java classes) that are
generic enough to serve a given business use case.  So the
infrastructure metadata contribution is loaded in my case as follows:
          URL urlServiceProviderClassesDir =
getServletContext().getResource("/WEB-INF/classes");

Subsequently all business metadata is hosted centrally and separately
from service provider deployment units.  So the business metatdata is
loaded through the .composite as follows:
          URL urlComposite = new
URL("http://localhost:7001/domain/metadata/<service.provider/versionN>/C
onsumerFacade.composite");
        String sCompositeContents =
UtilityHelper.getStringFromResource(urlComposite);
        SCANode2Factory nodeFactory = SCANode2Factory.newInstance();
        SCANode2Factory.SCAContribution contribution = 
                new SCANode2Factory.SCAContribution("Service Provider
Classes", urlServiceProviderClassesDir.toString());
          node = nodeFactory.createSCANode(urlComposite.toString(),
sCompositeContents, contribution);
        
          node.start();
        lifeCycleProcessor =
((SCAClient)node).getService(LifeCycleProcessorImpl.class,
"ConsumerFacadeLifecycleComponent");

I am looking forward to dynamically execute the process piece (in my
case not bpel - short running process).  So that I can reuse the same
infrastructure over and over for other type of service provider
implmentations - the only thing that would change is the .composite.

Note - in my poc I am not using any data binding nor OR frameworks -
xquery works directly on the xml.  Java class method signature is a
simple xml string in xml string out.  This helps keeping infrastructure
metadata reusable but also stimulates reuse of the separated business
metadata.

Hope that perspective helps provide one of many feedbacks...   I am
currently develping this poc and would like to contribute it in a form
of a sample or tutorial to tuscany.  But need to fine tune my rusted dev
skills ... it takes time.

Regards,
Radu Marian
CRM Services Architecture Team
Bank of America, Charlotte NC
(980) 387-6233
[EMAIL PROTECTED]

-----Original Message-----
From: Simon Laws [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, April 29, 2008 1:29 PM
To: tuscany-user@ws.apache.org
Subject: Re: Is there are simple straightforward way of creating a
Compoisite

On Tue, Apr 29, 2008 at 4:49 PM, Marian, Radu
<[EMAIL PROTECTED]>
wrote:

> Simon,
>
> Thanks for your reply.  I have actually changed the code to:
>        SCANode2Factory nodeFactory = SCANode2Factory.newInstance();
>        SCANode2Factory.SCAContribution contribution = new 
> SCANode2Factory.SCAContribution("Service Provider Classes", 
> urlServiceProviderClassesDir.toString());
>        node = nodeFactory.createSCANode(urlComposite.toString(),
> sCompositeContents, contribution);
>
>        node.start();
>        lifeCycleProcessor =
> ((SCAClient)node).getService(LifeCycleProcessorImpl.class,
> "ConsumerFacadeLifecycleComponent");
>
> Works ok - I am in the middle of debugging.
>
> Question - do I need to configure TuscanyServletFilter in web.xml?  I 
> am using node2 api.
>
> Thanks,
> Radu Marian
> CRM Services Architecture Team
> Bank of America, Charlotte NC
> (980) 387-6233
> [EMAIL PROTECTED]
>
> -----Original Message-----
> From: Simon Laws [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, April 29, 2008 10:49 AM
> To: tuscany-user@ws.apache.org
> Subject: Re: Is there are simple straightforward way of creating a 
> Compoisite
>
> On Mon, Apr 28, 2008 at 6:27 PM, Simon Laws 
> <[EMAIL PROTECTED]>
> wrote:
>
> >
> >
> > On Mon, Apr 28, 2008 at 5:36 PM, Marian, Radu < 
> > [EMAIL PROTECTED]> wrote:
> >
> > > Simon,
> > >
> > > Thanks for your prompt response.  I hope the following api will 
> > > let me do what I need - compositeContent :
> > >     /**
> > >     * 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);
> > >
> > > However I could not find it in the latest 1.2 release... :( sorce 
> > > code or binaries...
> > >
> > > Any idea?  Should I get a nightly?
> > >
> > > Regards,
> > > Radu Marian
> > > CRM Services Architecture Team
> > > Bank of America, Charlotte NC
> > > (980) 387-6233
> > > [EMAIL PROTECTED]
> > >
> > > -----Original Message-----
> > > From: Simon Laws [mailto:[EMAIL PROTECTED]
> > > Sent: Monday, April 28, 2008 11:54 AM
> > > To: tuscany-user@ws.apache.org
> > > Subject: Re: Is there are simple straightforward way of creating a

> > > Compoisite
> > >
> > > On Mon, Apr 28, 2008 at 4:14 PM, Marian, Radu 
> > > <[EMAIL PROTECTED]>
> > > 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
> > > /n
> > > ode2
> > > -api/src/main/java/org/apache/tuscany/sca/node/SCANode2Factory.jav
> > > a< 
> > > http://svn.apache.org/repos/asf/incubator/tuscany/java/sca/modules
> > > /n 
> > > ode2-api/src/main/java/org/apache/tuscany/sca/node/SCANode2Factory
> > > .j
> > > ava>
> > > [2]
> > > http://svn.apache.org/repos/asf/incubator/tuscany/java/sca/itest/v
> > > al
> > > idat
> > > ion/src/test/java/calculator/DuplicateComponentNameTestCase.java<h
> > > tt 
> > > p://svn.apache.org/repos/asf/incubator/tuscany/java/sca/itest/vali
> > > da 
> > > tion/src/test/java/calculator/DuplicateComponentNameTestCase.java>
> > > [3]
> > > http://svn.apache.org/repos/asf/incubator/tuscany/java/sca/samples
> > > /c
> > > alcu
> > > lator-distributed/src/main/java/node/LaunchCalculatorNodeA.java<ht
> > > tp 
> > > ://svn.apache.org/repos/asf/incubator/tuscany/java/sca/samples/cal
> > > cu 
> > > lator-distributed/src/main/java/node/LaunchCalculatorNodeA.java>
> > >
> >
> > Yes, apologies Radu, I should have mentioned that it isn't in the 
> > latest release. It is a work in progress and has only recently gone
> into the API.
> > As you can also guess  the "node2" code is intended to replace
"node"
> > shortly as node2 is new and takes a slightly different view on the 
> > way
>
> > that the runtime should be started.
> >
> > To try it out I would normally advise you to either check the trunk 
> > source code out of subversion or take one of our nightly builds.
> > However I've just been to check the nightly build link from our 
> > download page and it's not working today (for me at least) as there 
> > seems to be a problem with the continuum build system. Your only 
> > option at the moment is to take the code from subversion in the mean

> > time. There are instructions here [1]. If you can't face that let us
> know and I'm sure we can sort something out.
> >
> > Regards
> >
> > Simon
> >
> > [1]
> > http://incubator.apache.org/tuscany/sca-java-development-guide.html
> >
>
>
> Hi Radu
>
> With reference to your mail over on the other thread [1] (confused me 
> for a moment;-).  I have a question. You pasted the code...
>
>        SCANode2Factory nodeFactory = SCANode2Factory.newInstance();
>        SCANode2Factory.SCAContribution[] contributions = new 
> SCANode2Factory.SCAContribution[0];
>        SCANode2 node =
> nodeFactory.createSCANode(urlComposite.toURI().toString(),
> sCompositeContents, contributions);
>
>
> Is this complete? I would expect to see you adding some details to the

> contribution for example, for a contribution on your local disc you 
> could do...
>
> SCANode2Factory.SCAContribution  contributions = new 
> SCANode2Factory.SCAContribution("TestContribution",
>
>
> new
> File("src/main/resources/DuplicateComponentName").toURL().toString());
>
> Of course using an array if you need to add more than one
contribution.
> The contribution should contain the artifacts that the composite 
> requires, such as the component implementations, and WSDL or XSD/XML 
> files etc.
>
> Regards
>
> Simon
>
> [1]
> http://www.mail-archive.com/tuscany-user%40ws.apache.org/msg03030.html
>

Hi Radu

The tuscany web app support doesn't use this evolving node
implementation just yet. I don't imagine it would be difficult to plug
it in but we would need to decide how it's going to work in the context
of a webapp. For example, what does a contribution mean in a webapp?
There have been lots of threads about this kind of thing in the past and
I can point you at a few but I would welcome your thoughts first if you
are looking in this direction.

Our current host-webapp support uses the old runtime implementation from
host-embedded IIRC and treats the webapp itself as a contribution. It
plugs into the webapp through a filter configuration in web.xml.

Regards

Simon

Reply via email to