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.java< > > > 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/val > > > idat > > > ion/src/test/java/calculator/DuplicateComponentNameTestCase.java<htt > > > p://svn.apache.org/repos/asf/incubator/tuscany/java/sca/itest/valida > > > 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<http > > > ://svn.apache.org/repos/asf/incubator/tuscany/java/sca/samples/calcu > > > 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