Doug Tidwell wrote:
Friends, I'm working on a demo to illustrate the flexibility SCA provides
to client applications. I want to take the exact same code and use it to
invoke different services using different access methods, etc., without
changing the code. As I see it, there are three ways to do this. In
order of elegance, imho, here are the three approaches:
Put the name of the .composite file into a Java .properties file. When I
call SCADomain.newInstance("x.composite"), I replace "x.composite" with
the property from the file. I can change the .properties file, re-run the
code, and I get different behavior from the client application.
Change the classpath so that the Java runtime finds one .composite file
instead of another.
Change the .composite file itself to point to a different service.
Any advice on how I should do this? I prefer solution #1 because it's the
most maintainable. I can use an XForms interface to read the different
.composite files and select one or the other.
The main thing I want to show is how to invoke different services in
different ways without changing the client application at all.
Cheers,
-Doug
p.s. I'll post the demo here as it matures, of course....
Great to hear that you're working on a new demo!! We have an sca/demos
directory in SVN for demos, we could use more/better ones. Best will be
to contribute pieces of your demo as you go attached to JIRA issues, and
we'll be happy to help integrate them in SVN and the Tuscany build.
To invoke different services in different ways without changing the
client app at all, how about:
- Using SCA includes, x.composite will contain an <include
name="ns:YComposite">. An included composite can contain just wires,
this will allow you to switch a whole wiring configuration easily, just
go change x.composite to include YComposite or ZComposite for example
- Using SCA composite implementations, x.composite will contain an
<implementation.composite name="ns:YComposite">. This will allow you to
switch the implementation of a big part of your application easily as well.
--
Jean-Sebastien
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]