You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by js...@apache.org on 2007/09/27 04:20:36 UTC

svn commit: r579871 - in /incubator/tuscany/sandbox/sebastien/java/sca/domain-and-node: ./ bin/ org/ org/apache/ org/apache/tuscany/ org/apache/tuscany/sca/ org/apache/tuscany/sca/domain/ org/apache/tuscany/sca/node/ samples/

Author: jsdelfino
Date: Wed Sep 26 19:20:34 2007
New Revision: 579871

URL: http://svn.apache.org/viewvc?rev=579871&view=rev
Log:
Domain and node API mockup to help with discussion.

Added:
    incubator/tuscany/sandbox/sebastien/java/sca/domain-and-node/
    incubator/tuscany/sandbox/sebastien/java/sca/domain-and-node/.classpath   (with props)
    incubator/tuscany/sandbox/sebastien/java/sca/domain-and-node/.project   (with props)
    incubator/tuscany/sandbox/sebastien/java/sca/domain-and-node/bin/
    incubator/tuscany/sandbox/sebastien/java/sca/domain-and-node/org/
    incubator/tuscany/sandbox/sebastien/java/sca/domain-and-node/org/apache/
    incubator/tuscany/sandbox/sebastien/java/sca/domain-and-node/org/apache/tuscany/
    incubator/tuscany/sandbox/sebastien/java/sca/domain-and-node/org/apache/tuscany/sca/
    incubator/tuscany/sandbox/sebastien/java/sca/domain-and-node/org/apache/tuscany/sca/domain/
    incubator/tuscany/sandbox/sebastien/java/sca/domain-and-node/org/apache/tuscany/sca/domain/SCADomain.java   (with props)
    incubator/tuscany/sandbox/sebastien/java/sca/domain-and-node/org/apache/tuscany/sca/domain/SCADomainFactory.java   (with props)
    incubator/tuscany/sandbox/sebastien/java/sca/domain-and-node/org/apache/tuscany/sca/node/
    incubator/tuscany/sandbox/sebastien/java/sca/domain-and-node/org/apache/tuscany/sca/node/SCANode.java   (with props)
    incubator/tuscany/sandbox/sebastien/java/sca/domain-and-node/org/apache/tuscany/sca/node/SCANodeFactory.java   (with props)
    incubator/tuscany/sandbox/sebastien/java/sca/domain-and-node/samples/
    incubator/tuscany/sandbox/sebastien/java/sca/domain-and-node/samples/Calculator.java   (with props)
    incubator/tuscany/sandbox/sebastien/java/sca/domain-and-node/samples/SampleCalculatorNode.java   (with props)
    incubator/tuscany/sandbox/sebastien/java/sca/domain-and-node/samples/SampleCalculatorNodeWithClient.java   (with props)
    incubator/tuscany/sandbox/sebastien/java/sca/domain-and-node/samples/SampleClient.java   (with props)
    incubator/tuscany/sandbox/sebastien/java/sca/domain-and-node/samples/SampleDomain.java   (with props)
    incubator/tuscany/sandbox/sebastien/java/sca/domain-and-node/samples/SampleDomainWithClient.java   (with props)

Added: incubator/tuscany/sandbox/sebastien/java/sca/domain-and-node/.classpath
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/sebastien/java/sca/domain-and-node/.classpath?rev=579871&view=auto
==============================================================================
--- incubator/tuscany/sandbox/sebastien/java/sca/domain-and-node/.classpath (added)
+++ incubator/tuscany/sandbox/sebastien/java/sca/domain-and-node/.classpath Wed Sep 26 19:20:34 2007
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" path=""/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+	<classpathentry combineaccessrules="false" kind="src" path="/tuscany-sca-api"/>
+	<classpathentry kind="output" path="bin"/>
+</classpath>

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/domain-and-node/.classpath
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/tuscany/sandbox/sebastien/java/sca/domain-and-node/.project
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/sebastien/java/sca/domain-and-node/.project?rev=579871&view=auto
==============================================================================
--- incubator/tuscany/sandbox/sebastien/java/sca/domain-and-node/.project (added)
+++ incubator/tuscany/sandbox/sebastien/java/sca/domain-and-node/.project Wed Sep 26 19:20:34 2007
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>domain-and-node</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+	</natures>
+</projectDescription>

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/domain-and-node/.project
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/tuscany/sandbox/sebastien/java/sca/domain-and-node/org/apache/tuscany/sca/domain/SCADomain.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/sebastien/java/sca/domain-and-node/org/apache/tuscany/sca/domain/SCADomain.java?rev=579871&view=auto
==============================================================================
--- incubator/tuscany/sandbox/sebastien/java/sca/domain-and-node/org/apache/tuscany/sca/domain/SCADomain.java (added)
+++ incubator/tuscany/sandbox/sebastien/java/sca/domain-and-node/org/apache/tuscany/sca/domain/SCADomain.java Wed Sep 26 19:20:34 2007
@@ -0,0 +1,139 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+
+package org.apache.tuscany.sca.domain;
+
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.ServiceReference;
+
+
+/**
+ * Represents an SCA domain.
+ * 
+ * @version $Rev$ $Date$
+ */
+public interface SCADomain {
+
+    /**
+     * Start the SCA domain service.
+     */
+    public void start();
+
+    /**
+     * Stop the SCA domain service.
+     */
+    public void stop();
+
+    /**
+     * Returns the URI of the SCA Domain. That URI is the endpoint of the
+     * SCA domain administration service.
+     * 
+     * @return the URI of the SCA Domain
+     */
+    public String getURI();
+    
+    /**
+     * Add an SCA contribution to the domain.
+     *  
+     * @param url the URL of the contribution
+     */
+    void addContribution(URL url);
+    
+    /**
+     * Remove a contribution from the domain.
+     * 
+     * @param url the URL of the contribution
+     */
+    void removeContribution(URL url);
+
+    /**
+     * Add a deployable composite to the domain.
+     * 
+     * @param qname the QName of the composite
+     */
+    void addComposite(QName qname);
+    
+    /**
+     * Remove a deployable composite from the domain.
+     * 
+     * @param qname the QName of the composite.
+     */
+    void removeComposite(QName qname);
+    
+    /**
+     * Start a composite. The domain is responsible for starting all the
+     * components in the composite. It may decompose the composite into
+     * one ore more smaller composites and load these composites into
+     * different SCA nodes.
+     * 
+     * @param qname The QName of the composite.
+     */
+    void startComposite(QName qname);
+    
+    /**
+     * Stop a composite. The domain will stop all the components from the
+     * specified composite.
+     * 
+     * @param qname The QName of the composite.
+     */
+    void stopComposite(QName qname);
+    
+    /**
+     * Cast a type-safe reference to a CallableReference. Converts a type-safe
+     * reference to an equivalent CallableReference; if the target refers to a
+     * service then a ServiceReference will be returned, if the target refers to
+     * a callback then a CallableReference will be returned.
+     * 
+     * @param target a reference proxy provided by the SCA runtime
+     * @param <B> the Java type of the business interface for the reference
+     * @param <R> the type of reference to be returned
+     * @return a CallableReference equivalent for the proxy
+     * @throws IllegalArgumentException if the supplied instance is not a
+     *             reference supplied by the SCA runtime
+     */
+    public <B, R extends CallableReference<B>> R cast(B target) throws IllegalArgumentException;
+
+    /**
+     * Returns a proxy for a service provided by a component in the SCA domain.
+     * 
+     * @param businessInterface the interface that will be used to invoke the
+     *            service
+     * @param serviceName the name of the service
+     * @param <B> the Java type of the business interface for the service
+     * @return an object that implements the business interface
+     */
+    public <B> B getService(Class<B> businessInterface, String serviceName);
+
+    /**
+     * Returns a ServiceReference for a service provided by a component in the
+     * SCA domain.
+     * 
+     * @param businessInterface the interface that will be used to invoke the
+     *            service
+     * @param serviceName the name of the service
+     * @param <B> the Java type of the business interface for the service
+     * @return a ServiceReference for the designated service
+     */
+    public <B> ServiceReference<B> getServiceReference(Class<B> businessInterface, String referenceName);
+
+}

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/domain-and-node/org/apache/tuscany/sca/domain/SCADomain.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/domain-and-node/org/apache/tuscany/sca/domain/SCADomain.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/sandbox/sebastien/java/sca/domain-and-node/org/apache/tuscany/sca/domain/SCADomainFactory.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/sebastien/java/sca/domain-and-node/org/apache/tuscany/sca/domain/SCADomainFactory.java?rev=579871&view=auto
==============================================================================
--- incubator/tuscany/sandbox/sebastien/java/sca/domain-and-node/org/apache/tuscany/sca/domain/SCADomainFactory.java (added)
+++ incubator/tuscany/sandbox/sebastien/java/sca/domain-and-node/org/apache/tuscany/sca/domain/SCADomainFactory.java Wed Sep 26 19:20:34 2007
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+
+package org.apache.tuscany.sca.domain;
+
+/**
+ * A factory for SCA domains.
+ * 
+ * @version $Rev$ $Date$
+ */
+public abstract class SCADomainFactory {
+    
+        
+    /**
+     * Returns a new SCA domain factory instance.
+     *  
+     * @return a new SCA domain factory
+     */
+    public static SCADomainFactory newInstance() {
+        return null;
+    }
+
+    /**
+     * Creates a new SCA domain.
+     * 
+     * @param domainURI the URI of the domain, this is the endpoint
+     * URI of the domain administration service
+     * @return a new SCA domain
+     */
+    public abstract SCADomain createSCADomain(String domainURI);
+    
+    /**
+     * Returns an existing SCA domain.
+     * 
+     * @param domainURI the URI of the domain, this is the endpoint
+     * URI of the domain administration service
+     * @return the SCA domain
+     */
+    public abstract SCADomain getSCADomain(String domainURI);
+    
+}

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/domain-and-node/org/apache/tuscany/sca/domain/SCADomainFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/domain-and-node/org/apache/tuscany/sca/domain/SCADomainFactory.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/sandbox/sebastien/java/sca/domain-and-node/org/apache/tuscany/sca/node/SCANode.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/sebastien/java/sca/domain-and-node/org/apache/tuscany/sca/node/SCANode.java?rev=579871&view=auto
==============================================================================
--- incubator/tuscany/sandbox/sebastien/java/sca/domain-and-node/org/apache/tuscany/sca/node/SCANode.java (added)
+++ incubator/tuscany/sandbox/sebastien/java/sca/domain-and-node/org/apache/tuscany/sca/node/SCANode.java Wed Sep 26 19:20:34 2007
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+
+package org.apache.tuscany.sca.node;
+
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.domain.SCADomain;
+
+
+/**
+ * Represents an SCA processing node. An SCA node belongs to an SCA domain.
+ * A node is loaded with a single SCA composite. It can start and stop that composite. 
+ * 
+ * @version $Rev$ $Date$
+ */
+public interface SCANode {
+
+    /**
+     * Start the SCA node service.
+     */
+    public void start();
+
+    /**
+     * Stop the SCA node service.
+     */
+    public void stop();
+
+    /**
+     * Configure the node with a deployable composite and the contributions
+     * that it requires.
+     * @param composite
+     * @param contributions
+     */
+    public void configure(QName composite, URL... contributions);
+
+    /**
+     * Returns the URI of the SCA node. That URI is the endpoint of the
+     * SCA node administration service.
+     * 
+     * @return the URI of the SCA node
+     */
+    public String getURI();
+    
+    /**
+     * Returns the SCA domain that the node belongs to.
+     * 
+     * @return the SCA domain that the node belongs to 
+     */
+    public SCADomain getSCADomain();
+    
+    /**
+     * Start the deployable composite loaded in the node.
+     */
+    void startComposite();
+    
+    /**
+     * Stop the deployable composite loaded in the node.
+     */
+    void stopComposite();
+    
+}

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/domain-and-node/org/apache/tuscany/sca/node/SCANode.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/domain-and-node/org/apache/tuscany/sca/node/SCANode.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/sandbox/sebastien/java/sca/domain-and-node/org/apache/tuscany/sca/node/SCANodeFactory.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/sebastien/java/sca/domain-and-node/org/apache/tuscany/sca/node/SCANodeFactory.java?rev=579871&view=auto
==============================================================================
--- incubator/tuscany/sandbox/sebastien/java/sca/domain-and-node/org/apache/tuscany/sca/node/SCANodeFactory.java (added)
+++ incubator/tuscany/sandbox/sebastien/java/sca/domain-and-node/org/apache/tuscany/sca/node/SCANodeFactory.java Wed Sep 26 19:20:34 2007
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+
+package org.apache.tuscany.sca.node;
+
+/**
+ * A factory for SCA processing nodes. An SCA processing node can be loaded
+ * with an SCA composite.
+ * 
+ * @version $Rev$ $Date$
+ */
+public abstract class SCANodeFactory {
+    
+        
+    /**
+     * Returns a new SCA node factory instance.
+     *  
+     * @return a new SCA node factory
+     */
+    public static SCANodeFactory newInstance() {
+        return null;
+    }
+
+    /**
+     * Creates a new SCA node.
+     * 
+     * @param nodeURI the URI of the node, this is the endpoint URI of the
+     * node administration service
+     * @param domainURI the URI of the domain that the node belongs to
+     * @return a new SCA node.
+     */
+    public abstract SCANode createSCANode(String nodeURI, String domainURI);
+    
+}

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/domain-and-node/org/apache/tuscany/sca/node/SCANodeFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/domain-and-node/org/apache/tuscany/sca/node/SCANodeFactory.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/sandbox/sebastien/java/sca/domain-and-node/samples/Calculator.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/sebastien/java/sca/domain-and-node/samples/Calculator.java?rev=579871&view=auto
==============================================================================
--- incubator/tuscany/sandbox/sebastien/java/sca/domain-and-node/samples/Calculator.java (added)
+++ incubator/tuscany/sandbox/sebastien/java/sca/domain-and-node/samples/Calculator.java Wed Sep 26 19:20:34 2007
@@ -0,0 +1,7 @@
+package samples;
+
+public interface Calculator {
+    
+    public double add(double a, double b);
+
+}

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/domain-and-node/samples/Calculator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/domain-and-node/samples/Calculator.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/sandbox/sebastien/java/sca/domain-and-node/samples/SampleCalculatorNode.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/sebastien/java/sca/domain-and-node/samples/SampleCalculatorNode.java?rev=579871&view=auto
==============================================================================
--- incubator/tuscany/sandbox/sebastien/java/sca/domain-and-node/samples/SampleCalculatorNode.java (added)
+++ incubator/tuscany/sandbox/sebastien/java/sca/domain-and-node/samples/SampleCalculatorNode.java Wed Sep 26 19:20:34 2007
@@ -0,0 +1,47 @@
+package samples;
+
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+
+/**
+ * Start an SCA node, configure it with a composite, let it run.
+ *
+ * @version $Rev$ $Date$
+ */
+public class SampleCalculatorNode {
+    
+    public static void main(String[] args) throws Exception {
+        
+        // Get a node factory
+        SCANodeFactory nodeFactory = SCANodeFactory.newInstance();
+        
+        // Create an SCA node
+        SCANode node = nodeFactory.createSCANode("http://mythinkpad:1234/mynode", "http://mydomain:7890/thebigdomain");
+        
+        // Start the node
+        node.start();
+        
+        // Configure the node to run the Calculator composite, out of the
+        // sample-calculator JAR contribution
+        node.configure(new QName("http://calc", "Calculator"), new URL("file://home/bob/tuscany/sample-calculator-ws-1.0.jar"));
+        
+        // Start the composite we just loaded into the node
+        node.startComposite();
+
+        // This composite exposes a Calculator Web Service, sit there and
+        // let client invoke the service
+        System.out.println("Press enter to shutdown...");
+        System.in.read();
+
+        // Stop the composite
+        node.stopComposite();
+        
+        // Stop the node
+        node.stop();
+    }
+
+}

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/domain-and-node/samples/SampleCalculatorNode.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/domain-and-node/samples/SampleCalculatorNode.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/sandbox/sebastien/java/sca/domain-and-node/samples/SampleCalculatorNodeWithClient.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/sebastien/java/sca/domain-and-node/samples/SampleCalculatorNodeWithClient.java?rev=579871&view=auto
==============================================================================
--- incubator/tuscany/sandbox/sebastien/java/sca/domain-and-node/samples/SampleCalculatorNodeWithClient.java (added)
+++ incubator/tuscany/sandbox/sebastien/java/sca/domain-and-node/samples/SampleCalculatorNodeWithClient.java Wed Sep 26 19:20:34 2007
@@ -0,0 +1,53 @@
+package samples;
+
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.domain.SCADomain;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+
+/**
+ * Start an SCA node, configure it with a composite, get a proxy to the
+ * Calculator service that runs in it, invoke it.
+ *
+ * @version $Rev$ $Date$
+ */
+public class SampleCalculatorNodeWithClient {
+    
+    public static void main(String[] args) throws Exception {
+        
+        // Get a node factory
+        SCANodeFactory nodeFactory = SCANodeFactory.newInstance();
+        
+        // Create my SCA node
+        SCANode node = nodeFactory.createSCANode("http://mythinkpad:1234/mynode", "http://mydomain:7890/thebigdomain");
+        
+        // Start the node
+        node.start();
+        
+        // Configure the node to run the Calculator composite, out of the
+        // sample-calculator JAR contribution
+        node.configure(new QName("http://calc", "Calculator"), new URL("file://home/bob/tuscany/sample-calculator-1.0.jar"));
+        
+        // Start the composite we just loaded into the node
+        node.startComposite();
+        
+        // Get a handle to the SCA domain that the node belongs to
+        SCADomain domain = node.getSCADomain();
+        
+        // Get a proxy to the Calculator service
+        Calculator calculator = domain.getService(Calculator.class, "CalculatorServiceComponent");
+        
+        // Invoke the Calculator service
+        System.out.println("result = " + calculator.add(1, 2));
+
+        // Stop the composite
+        node.stopComposite();
+        
+        // Stop the node
+        node.stop();
+    }
+
+}

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/domain-and-node/samples/SampleCalculatorNodeWithClient.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/domain-and-node/samples/SampleCalculatorNodeWithClient.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/sandbox/sebastien/java/sca/domain-and-node/samples/SampleClient.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/sebastien/java/sca/domain-and-node/samples/SampleClient.java?rev=579871&view=auto
==============================================================================
--- incubator/tuscany/sandbox/sebastien/java/sca/domain-and-node/samples/SampleClient.java (added)
+++ incubator/tuscany/sandbox/sebastien/java/sca/domain-and-node/samples/SampleClient.java Wed Sep 26 19:20:34 2007
@@ -0,0 +1,29 @@
+package samples;
+
+import org.apache.tuscany.sca.domain.SCADomain;
+import org.apache.tuscany.sca.domain.SCADomainFactory;
+
+/**
+ * A sample client that gets a handle to a domain, gets a service proxy and
+ * invokes it.
+ *
+ * @version $Rev$ $Date$
+ */
+public class SampleClient {
+    
+    public static void main(String[] args) throws Exception {
+        
+        // Get a domain factory
+        SCADomainFactory domainFactory = SCADomainFactory.newInstance();
+        
+        // Get a handle to the SCA domain
+        SCADomain domain = domainFactory.getSCADomain("http://mydomain:7890/mybigdomain");
+        
+        // Get a proxy to the Calculator service
+        Calculator calculator = domain.getService(Calculator.class, "CalculatorServiceComponent");
+
+        // Invoke the Calculator service
+        System.out.println("result = " + calculator.add(1, 2));
+    }
+
+}

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/domain-and-node/samples/SampleClient.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/domain-and-node/samples/SampleClient.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/sandbox/sebastien/java/sca/domain-and-node/samples/SampleDomain.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/sebastien/java/sca/domain-and-node/samples/SampleDomain.java?rev=579871&view=auto
==============================================================================
--- incubator/tuscany/sandbox/sebastien/java/sca/domain-and-node/samples/SampleDomain.java (added)
+++ incubator/tuscany/sandbox/sebastien/java/sca/domain-and-node/samples/SampleDomain.java Wed Sep 26 19:20:34 2007
@@ -0,0 +1,50 @@
+package samples;
+
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.domain.SCADomain;
+import org.apache.tuscany.sca.domain.SCADomainFactory;
+
+/**
+ * Start an embedded local domain, add a contribution to it, add a
+ * deployable composite, start the composite, let it run.
+ *
+ * @version $Rev$ $Date$
+ */
+public class SampleDomain {
+    
+    public static void main(String[] args) throws Exception {
+        
+        // Get a domain factory
+        SCADomainFactory domainFactory = SCADomainFactory.newInstance();
+        
+        // Create an SCA domain
+        SCADomain domain = domainFactory.createSCADomain("http://mydomain:7890/asmalldomain");
+        
+        // Start the domain admin service
+        domain.start();
+
+        // Add the calculator JAR contribution to the domain 
+        domain.addContribution(new URL("file://home/bob/tuscany/sample-calculator-ws-1.0.jar"));
+        
+        // Add the Calculator deployable composite to the domain composite
+        domain.addComposite(new QName("http://calc", "Calculator"));
+        
+        // Start the Calculator composite
+        domain.startComposite(new QName("http://calc", "Calculator"));
+        
+        // The Calculator composite exposes a Web Service, let it run and let
+        // clients invoke it
+        System.out.println("Press enter to shutdown...");
+        System.in.read();
+
+        // Stop the composite
+        domain.stopComposite(new QName("http://calc", "Calculator"));
+        
+        // Stop the domain admin service
+        domain.stop();
+    }
+
+}

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/domain-and-node/samples/SampleDomain.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/domain-and-node/samples/SampleDomain.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/sandbox/sebastien/java/sca/domain-and-node/samples/SampleDomainWithClient.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/sebastien/java/sca/domain-and-node/samples/SampleDomainWithClient.java?rev=579871&view=auto
==============================================================================
--- incubator/tuscany/sandbox/sebastien/java/sca/domain-and-node/samples/SampleDomainWithClient.java (added)
+++ incubator/tuscany/sandbox/sebastien/java/sca/domain-and-node/samples/SampleDomainWithClient.java Wed Sep 26 19:20:34 2007
@@ -0,0 +1,52 @@
+package samples;
+
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.domain.SCADomain;
+import org.apache.tuscany.sca.domain.SCADomainFactory;
+
+/**
+ * Start a SCA domain, add a contribution to it, add a
+ * deployable composite, start it, get a proxy to a service
+ * and invoke it.
+ *
+ * @version $Rev$ $Date$
+ */
+public class SampleDomainWithClient {
+    
+    public static void main(String[] args) throws Exception {
+        
+        // Get a domain factory
+        SCADomainFactory domainFactory = SCADomainFactory.newInstance();
+        
+        // Create an SCA domain
+        SCADomain domain = domainFactory.createSCADomain("http://mydomain:7890/asmalldomain");
+        
+        // Start the domain admin service
+        domain.start();
+
+        // Add the calculator JAR contribution to the domain 
+        domain.addContribution(new URL("file://home/bob/tuscany/sample-calculator-ws-1.0.jar"));
+        
+        // Add the Calculator deployable composite to the domain composite
+        domain.addComposite(new QName("http://calc", "Calculator"));
+        
+        // Start the Calculator composite
+        domain.startComposite(new QName("http://calc", "Calculator"));
+
+        // Get a proxy to the Calculator service
+        Calculator calculator = domain.getService(Calculator.class, "CalculatorServiceComponent");
+        
+        // Invoke it
+        System.out.println("result = " + calculator.add(1, 2));
+
+        // Stop the composite
+        domain.stopComposite(new QName("http://calc", "Calculator"));
+        
+        // Stop the domain admin service
+        domain.stop();
+    }
+
+}

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/domain-and-node/samples/SampleDomainWithClient.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/domain-and-node/samples/SampleDomainWithClient.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org