To deal with the need to be able to update contributions in a node and based
on a suggestion by Sebastien [1] to restrict the capabilities of a node I've
checked in some changes to the node API so that it now looks as follows.
public String getURI();
public SCADomain getDomain();
public void addContribution(String contributionURI, URL contributionURL)
throws NodeException;
public void removeContribution(String contributionURI) throws
NodeException;
public void addToDomainLevelComposite(QName compositeQName) throws
NodeException;
public void addToDomainLevelComposite(String compositePath) throws
NodeException;
public void start() throws NodeException;
public void stop() throws NodeException;
public void destroy() throws NodeException;
This is not much different from before other than I've removed the methods
for stating composites that were a recent addition. However the semantics
have changed a little and now assume the following
Constructing a node creates the node runtime itself and adds the node to a
domain if a domain URL has been provided
Contributions can be added as required.
Any composites that you want to run must be explicitly added to the domain
level composite. Each must be marked as deployable in the contribution that
it belongs to**
The operations that modify the contributions and composites can only be used
when the node is stopped
Starting a node causes all deployed composited to be processed and the
components started.
Stopping the node stops all running components and further changes can be
made to the node again.
Destroying the node deletes the node runtime and removes the node from the
domain.
** Composites are marked as deployable either using the
sca-composite.xmlfile, as specified in the SCA assembly spec, or by
placing the composite
file in the sca-deployables directory inside the contribution, a feature
specific to Tuscany.
I've updated the various samples to work with the new api, for example,
dealing with the node api is as follows
SCANodeFactory nodeFactory = SCANodeFactory.newInstance();
// sca-contribution.xml test
nodeA = nodeFactory.createSCANode("http://localhost:8100/nodeA",
"http://localhost:9999");
nodeA.addContribution("contribA", cl.getResource("nodeA/"));
nodeA.addToDomainLevelComposite(new QName("http://sample",
"CalculatorA"));
nodeA.start();
// sca-deployables test
nodeB = nodeFactory.createSCANode("http://localhost:8200/nodeB",
"http://localhost:9999");
nodeB.addContribution("contribB", cl.getResource("nodeB/"));
nodeB.addToDomainLevelComposite(new QName("http://sample",
"CalculatorB"));
nodeB.start();
// sca-deployables test
nodeC = nodeFactory.createSCANode("http://localhost:8300/nodeC",
"http://localhost:9999");
nodeC.addContribution("contribC", cl.getResource("nodeC/"));
nodeC.addToDomainLevelComposite(new QName("http://sample",
"CalculatorC"));
nodeC.start();
Doing the same from the domain api works as follows.
SCADomainFactory domainFactory = SCADomainFactory.newInstance();
domain = domainFactory.createSCADomain("http://localhost:9999
");]
SCANodeFactory nodeFactory = SCANodeFactory.newInstance();
nodeA = nodeFactory.createSCANode("http://localhost:8100/nodeA",
"http://localhost:9999");
nodeB = nodeFactory.createSCANode("http://localhost:8200/nodeB",
"http://localhost:9999");
nodeC = nodeFactory.createSCANode("http://localhost:8300/nodeC",
"http://localhost:9999");
domain.addContribution("contribA", cl.getResource("nodeA/"));
domain.addContribution("contribB", cl.getResource("nodeB/"));
domain.addContribution("contribC", cl.getResource("nodeC/"));
domain.addToDomainLevelComposite(new QName("http://sample",
"CalculatorA"));
domain.addToDomainLevelComposite(new QName("http://sample",
"CalculatorB"));
domain.addToDomainLevelComposite(new QName("http://sample",
"CalculatorC"));
domain.startComposite(new QName("http://sample",
"CalculatorA"));
domain.startComposite(new QName("http://sample",
"CalculatorB"));
domain.startComposite(new QName("http://sample",
"CalculatorC"));
I'm going to start adding the rest of the features that the spec describes
for the domain, for example,
Update Contribution
More competent management of contribution dependencies when the domain
passes contributions to nodes
getDomainLevelComposite, getQNameDefinition
Add deployment composite, Update deployment composite functions
So I'll post fixes incrementally as I go along.
Regards
Simon
[1] http://www.mail-archive.com/[email protected]/msg25264.html