Hello,

I have the following usage scenarios that I currently use
EmbeddedSCADomain's ContributionService to accomplish. When I look at
the new set of workspace modules, I wonder how it can be accomplished
by using this new set of workspace related apis. And what the
pros/cons if I switch to use workspace:

Scenario 1: I need to load a SCA contribution to iterate the
deployables , each deployable composite needs to resolve the
componentType: from java annotation, from componentType file, from
QName of another composite file which may be imported from another
contribution by using <import namespace>

The way I support it today is like what itest/contribution-import-export does:

        ContributionService contributionService =
domain.getContributionService();
        ...
        Contribution consumerContribution =
            contributionService.contribute(...);
        Composite consumerComposite =
consumerContribution.getDeployables().get(0);
        domain.getDomainComposite().getIncludes().add(consumerComposite);
        domain.buildComposite(consumerComposite);


Scenario 2: I need to start a contribution 's deployable composite
with a domain.

Again I use the same approach as in itest/contribution-import-export,
besides the above code I add the following

        // Start Components from my composite
        domain.getCompositeActivator().activate(consumerComposite);
        domain.getCompositeActivator().start(consumerComposite);



Now I am looking into how to accomplish the above by using workspace
related APIs. I started looking at a workspace test case:
http://svn.apache.org/repos/asf/incubator/tuscany/java/sca/itest/domain/src/test/java/org/apache/tuscany/sca/itest/domain/ContributionSPIsTestCase.java

I have the following observations:

1. The bootstraping of Tuscany extension points are outside the workspace.

I can see a lot code in init() to do bootstraping. I think I would
prefer the bootstrapping are tied with a given domain, as all the
workspace usage for a given domain should have the same bootstrapping
on the object model and what kind of bindingTypes or
implementationTypes are supported. If it can be done it that way, then
I do not need to bootstrap everytime I use workspace, and I can keep
both bootstrapping of scenario 1 and 2 consistent, even though it may
happen that scenario1 bootstrapping is only a subset of scenario 2's .

If we are worried that one fit for all bootstrapping is an overhead
for scenario 1, maybe we can have some 2 stage bootstrapping:
composite model resolved, composite start. Or we can even break into 3
: composite model load from scdl  no resolving componentType,
composite model resolved, composite start...

2. Some detailed questions related to what I see in the
ContributionSPIsTestCase:

I can see contribution can be added to workspace by
workspace.getContributions().add(contribution);

I am not sure if at this stage I will be able to get the composite
model object that I need for scenario 1, or I need to go extra steps
to get the Composite model resolved.
e.g. I can see some code like: List<Contribution> dependencies =
analyzer.buildContributionDependencies(workspace,
workspace.getContributions().get(0));  is it needed for me to get the
resolved model or it is just something to play with to get a
dependency graph.

3. I can also see getting composite started will have more codes than
using domain.  One thing I realized that there is no association of a
Node to a Domain. (sorry if I missed it ). I would assume the Node
will be associated with a SCADomain as then we can call
SCADomain.getService to locate the services hosted on the Domain. And
also it will make it possible that we can have multiple domain in one
single JVM , each may have different contributions , so its hosted
services are different and behaviors are different as there can be
different definitions.xml in a contribution for intent or policy or
others..

            // 
====================================================================
            // run the chosen composite

            SCANode2Factory nodeFactory = SCANode2Factory.newInstance();
            SCAContribution contribution0 = new
SCAContribution(contributionsToDeploy.get(0).getURI(),
contributionsToDeploy.get(0).getLocation());
            SCAContribution contribution1 = new
SCAContribution(contributionsToDeploy.get(1).getURI(),
contributionsToDeploy.get(1).getLocation());

            // FIXME - need a more flexible constructor on the node so
we can pass in a
            //         dynamic list of contributions
            SCANode2 node =
nodeFactory.createSCANode(chosenDeployableLocation, contribution0,
contribution1);

            node.start();
            SCAClient client = (SCAClient)node;
            CalculatorService calculatorService =
                client.getService(CalculatorService.class,
"CalculatorServiceComponentA");

4. Another interest I have is about model validation for contribution
or composite.   I see another different thread discussing on
validation 
(http://www.mail-archive.com/tuscany-dev@ws.apache.org/msg29510.html),
I wonder if the same answers can be applied to using workspace.... or
it is different approach.

Thank you. Looking forward to some answers.

Yang

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to