Distributed SCA Domain (TUSCANY) edited by Simon Laws
      Page: 
http://cwiki.apache.org/confluence/display/TUSCANY/Distributed+SCA+Domain
   Changes: 
http://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=66885&originalVersion=1&revisedVersion=2






Content:
---------------------------------------------------------------------

{section:border=true}
{column:width=15%}
{include: SCA Java Subproject Menu}
{include: Java SCA Menu New}
{column}
{column:width=85%}

{note:title:Notification}{center}This page is under construction\- You are 
welcome to help and complete it{center}{note}

h1. Distributed SCA Domain

Using a distributed SCA domain that works across multiple JVMs is not much 
harder than using the [Standalone SCA Domain].

!multi-node-abstract.png|align=centre!

Here each running node has a representation of the domain so we create an 
instance of 

{code}
org.apache.tuscany.sca.domain.SCADomain.
{code}

Note that the package name is different compared to the standalone SCA domain. 
This time we are dealing with a distributed domain rather than a standalone 
domain. 

Again there are a number of newInstance() operations to choose from. The first 
two are the same as in the standalone case

{code}
public static SCADomain newInstance() 
{code}

Starts a standalone domain with a default domain URI and will treat the 
classpath as the contribution to this domain.  All .composite files on the 
classpath will will read any deployable components created accordingly. 

Deployable components are defined by either

1/ placing the .composite file in the  META-INF/sca-deployables/directory
2/ By specifying the composite as deployable in the 
META-INF/sca-contribution.xml file
    
{code}
    public static SCADomain newInstance(String composite)
{code}

Starts a standalone domain with a default domain URI and will try and find the 
named composite file in the classpath and use it's location as the contribution 
location. It will deploy the named composite. 


The third variation has changed to take account of the distributed domain.

{code}
public static SCADomain newInstance(String domainURI, String nodeURI, String 
contributionLocation, String... composites)
{code}

This starts a local node with the identifier "nodeURI". This must be a unique 
uri that identifies this node. If this uri is a valid url of the form 
http://hostname:portnumber/  it is used by the node implementation as the root 
address for the management services that the node starts up. 

In the future, when distributed domain support has been enabled in webapps, 
this will also indicate to SCA what the host name and port number of the web 
app container is. 

The domainURI is the URL of the domain manager. This is a separate java 
application that the nodes contact in order to register service information and 
in order to find information about other services in the domain.

The contributionLocation and composite parameters are as before. 

When the node starts is will load the contribution, deploy any deployable 
composites and then register information about any external services with the 
domain manager. 

We can see how this works by taking a look at the calculator-distributed 
sample. 

!calculator-distributed.png|align=centre!

We have a sample domain manager implementation in the calculator-distributed 
sample. If you go to the sample you can run this using the following command

{code}
ant runDomainNode
{code}

This starts some domain management services at the endpoint http://myhost:8877. 
So the domain name in this case is http://myhost:8877.

If you take a look at node.CalculatorNode.java you can see how each node in the 
domain is started. 

{code}
SCADomain scaDomain = SCADomain.newInstance(domainName, nodeName, null, 
nodeName + "/Calculator.composite");
{code}

Where domainName will be "http://myhost:8877"; and the node name will be "nodeA" 
or "nodeB" or "nodeC". In the calculator-distributed sample you can start the 
node implementation using the ant build file again, for example

{code}
ant RunNode http://localhost:8877 nodeB
{code}

Once started we can used the SCADomain interface as before. For example, a 
service proxy can be created and an operation called. 

{code}
CalculatorService calculatorService = 
scaDomain.getService(CalculatorService.class, "CalculatorServiceComponent");
double result = calculatorService.add(3, 2));
{code}

Putting this all together the following picture gives an idea of what is going 
on under the covers.

!distributed-overview.png|align=centre!

{column}
{section}


---------------------------------------------------------------------
CONFLUENCE INFORMATION
This message is automatically generated by Confluence

Unsubscribe or edit your notifications preferences
   http://cwiki.apache.org/confluence/users/viewnotifications.action

If you think it was sent incorrectly contact one of the administrators
   http://cwiki.apache.org/confluence/administrators.action

If you want more information on Confluence, or have a bug to report see
   http://www.atlassian.com/software/confluence



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

Reply via email to