Please see my comments inline.
Thanks,
Raymond
--------------------------------------------------
From: "ant elder" <[email protected]>
Sent: Thursday, April 09, 2009 5:55 AM
To: <[email protected]>
Subject: Re: SCAClient API spec proposal
[[snip]]
So lets explore this a bit using the testcase below as an example of
what we might want to do. It uses the tests setup and tearDown methods
to createand stop a Tuscany Node and then the in a test method uses an
SCAClient to get a service so that would need someway to find the
already created Node.
Some things are:
- the Tuscany Node doesn't have a domain URI so there isn't any way to
create or match existing Nodes to match the URI passed in on the
SCAClient getService call.
IMO, a Tuscany SCA Node can be running in two modes:
* offline: not connecting to an SCA domain 'manager'
* online: connecting to an SCA domain 'manager'
Please note 'manager' is either a central controller or a distributed group.
In the offline mode, the Node gets its configuration from a document which
would include the URI for the SCA domain.
In the online mode, the Node connects an SCA domain and the URI of the
domain is available to the Node.
- there's no link between the Node and SCAClient instances for the
SCAClient to find the Node so it will probably have to use some static
in the factories
The SCAClient can be instantiated independent of the Node. So the SCAClient
can be run without an active Node. Again, there are different options to
provide
configuration to the SCAClient, such as:
* An XML document (which can list more than one SCA domains)
* An instance of the Node which has knowledge of a subset or the whole of an
SCA domain.
If the domain URI passed from the SCAClient API cannot be resolved to a
known SCA domain, then we should report with NoSuchDomainException.
- we probably want to think about supporting multiple Nodes in a
domain so i'm wondering if we need to have an SCADomain again and have
the SCADomain know about multiple Nodes.
We need to be a bit careful here. The SCA domain is a virtual collection. If
we create a java model for the domain, then it should be able to get all the
metadata for the domain, such as the contributions, domain composite.
Typically, what a Node sees is a portion/fragment of the SCA domain.
Comments?
...ant
public class SCAClientTestCase extends TestCase {
private Node node;
@Override
protected void setUp() throws Exception {
node = NodeFactory.newInstance().createNode();
}
public void testInvoke() throws Exception {
HelloworldService service =
SCAClientFactory.newInstance().getService(HelloworldService.class,
"HelloworldComponent", "urn:someDomainUri");
assertEquals("Hello petra", service.sayHello("petra"));
}
@Override
protected void tearDown() throws Exception {
node.stop();
}
}
...ant