Hi,
I would like summarize our story for Domain/Node so that we can be on the
same page moving forward.
A) The key players and steps:
1) The JVM is started
2) Tuscany runtime classes are loaded by the JVM into the one or more class
spaces (within a class space, there is at most one class for a given class
name):
* One class space per JVM (such as Tomcat deep integration or standalone
Tuscany launcher)
* Multiple class spaces (such as Web applications that package the Tuscany
jars)
3) Tuscany runtime is bootstrapped and NodeFactory can be instantiated to
encapsulate the ExtensionPointRegistry which manages all the extension
points and extensions in Tuscany.
* In most cases, NodeFactory.getInstance() returns the shared NodeFactory
* You can also call NodeFactory.newInstance() to creates a new instance
4) TBD: The NodeFactory can be configured with a mapping between domainURIs
and registryURIs so that NodeFactory knows the registryURI for a given
domain.
* The initial mapping can be populated by the hosting environment (for
example, from an property file)
* A map can be added to NodeFactory to allow it to be configured
programmatically.
5) The NodeFactory can eagerly lookup the DomainRegistryFactory and
create/start EndpointRegistry without creating a Node.
* OSGi remote services needs to start to receive remote endpoints before any
node is created.
* SCAClientFactory implementation may need to connect to a domain when it is
created
6) An EndpointRegistry is created (or reused) by a DomainRegistryFactory.
The domainURI and domainRegistryURI are both passed in so that the
DomainRegistryFactory can multiplex multiple SCA domains over the same
physical transport.
* For example, both Tribes and Hazelcast allows us to get a map by name from
the same multicast group. The map name can be used to represent an SCA
domain.
* Zookeeper can have different roots to represent different SCA domains in
the same ZooKeeper server.
7) Nodes can be created from NodeFactory. If a Node doesn't configure with a
domainRegistryURI (If we agree that 4 is a better approach, we can remove
the need to configure domainRegistryURI at Node level), the EndpointRegistry
will be looked up by the domain URI. NodeFactory maintains a list of Nodes
(potentially by domain)
B) NodeFactory/Node as API or SPI
At this point, we try to not add other Tuscany modules in the node-api
module and use reflection APIs to discover and invoke NodeImpl. That creates
some difficulty for the code that wants to use NodeFactory/Node as a SPI.
The later case wants to access more information from NodeFactory/Node, for
example, our client factory could get all the Nodes from the NodeFactory and
list the contributions and composites (including the service endpoints).
Do we want to introduce subinterfaces for NodeFactory/Node as SPIs or it's
OK to add more dependencies into node-api? Some examples could be:
NodeFactory.getExtensionPointRegistry();
NodeFactory.getNodes();
NodeFactory.getNodes(String domainURI);
NodeFactory.getNode(String domainURI, String nodeURI);
Node.getEndpointRegistry();
Node.getDeploymentComposite();
Thanks,
Raymond
---
Raymond Feng
Apache Tuscany PMC Member: http://tuscany.apache.org
Co-author of Tuscany In Action (A book on Tuscany SCA):
http://tuscanyinaction.com/
www.enjoyjava.com
http://twitter.com/raymondfeng