Hi Doug
Comments in-line...
Hope that helps
Simon
On Wed, Jun 18, 2008 at 2:17 PM, Doug Tidwell <[EMAIL PROTECTED]> wrote:
> Resending to the updated address, apologies if yesterday's message
> eventually shows up here as well....
> ----- Forwarded by Doug Tidwell/Raleigh/IBM on 06/18/2008 09:14 AM -----
>
> From:
> Doug Tidwell/Raleigh/IBM
> To:
> [EMAIL PROTECTED]
> Date:
> 06/17/2008 12:23 PM
> Subject:
> Reworking the calculator samples
>
>
> Gang, I've written a graphical front-end to the calculator samples.
> There's a Swing front-end with the usual calculator buttons, and I've
> added a menu that lets you select the .composite file you want to use. I'm
> using this in a hands-on lab to emphasize that you can change the
> infrastructure beneath an application without changing the application. To
> build this, I've taken the code from the existing calculator demos and
> integrated them into a single Eclipse project. I'm currently working on
> deploying the calculator as a Web service.
>
> What surprised me is that whenever I run the application, I get an error
> if there's anything wrong with any .composite file in the Eclipse project.
This has been a peculiarity of the standalone SCADomain implementation for a
while. What is does when you give it the name of a composite file is search
the classpath for that file path and then it uses the directory where it
finds that file path as the contribution. This results in it loading and
validating all the composites in that contribution. It will however only run
the composite you specify. It is a little odd.
> My assumption was that Tuscany wouldn't load a .composite file unless I
> created an SCADomain with it. As it is, Tuscany loads every .composite
> file it can find, then complains if something's wrong with one of them,
> whether I use that .composite file or not. Is this an implementation
> decision, or did I miss something in the spec that says an SCA runtime
> should work this way?
I know you said you are on 1.1 but if you were on 1.2 you could use the new
Node api to create a runtime and be more precise about which composite to
run. This allows you to place composites in separate contribution sub
directories. For example
SCANode2 node =
SCANode2Factory.newInstance().createSCANode("target/classesmy/contribution/myapp.composite",
new SCAContribution("test", "target/classes/mycontribution"));
node.start();
MyClient myClient = ((SCAClient)node).getService(MyClient.class,
"MyClientComponent");
Should have a similar effect. Here
"target/classes/mycontribution/myapp.composite" is the path to the node (you
can't specify the composite QName here yet but maybe in the future)
new SCAContribution("test", "target/classes/mycontribution") is the name and
location of the contribution.
>
> I'd appreciate any insight on this. I'm working around the problem easily
> enough, but the behavior surprised me. I'm using tuscany-1.1-incubating,
> fwiw.
>
> ...And yes, I'll post all the materials for the hands-on workshop soon, I
> promise.