From bdd0a41aed7edf21ec2a65cfa17a86af2ef8c48a Mon Sep 17 00:00:00 2001 From: dims Date: Tue, 17 Jun 2008 00:23:01 +0000 Subject: Move Tuscany from Incubator to top level. git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@668359 13f79535-47bb-0310-9956-ffa450edef68 --- .../doc/sca-java-container-script.xml | 119 +++++++++++++++++++++ 1 file changed, 119 insertions(+) create mode 100644 sandbox/ant/container.script/doc/sca-java-container-script.xml (limited to 'sandbox/ant/container.script/doc/sca-java-container-script.xml') diff --git a/sandbox/ant/container.script/doc/sca-java-container-script.xml b/sandbox/ant/container.script/doc/sca-java-container-script.xml new file mode 100644 index 0000000000..ec100de245 --- /dev/null +++ b/sandbox/ant/container.script/doc/sca-java-container-script.xml @@ -0,0 +1,119 @@ + + + + + Tuscany + Tuscany SCA Java Scripting Language Implementation + + + + +
+ +

+The Tuscany Java SCA runtime has a script container allowing SCA components to be implemented with a variety of scripting languages. +

+

+To use the script container you use the <implementation.script> element in the component SCDL. The <implementation.script> element has two attributes, 'script' and 'class'. The 'script' attribute is required and defines the location of the script program. The 'class' attribute is optional and enables specifying the class or prototype to be used if the script language supports such concepts. +

+

+The language the script is implemented in is defined by the suffix of the script attribute value. For example, the '.js' suffix indicates a JavaScript program, or '.py' indicates a Python program. The script container uses the Apache BSF script engine, so any script language supported by BSF can be used as an SCA component implementation. +

+ +

+

+ +

+

+ +

+

+ +

+

+ +

+The following example shows the files necessary to implement a simple HelloWorld style SCA component using the script container and a JavaScript program. +

+ +

+The composite SCDL: +

+

+ + +
+
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+    name="HelloWorldComposite">
+
+    <component name="HelloWorldComponent">
+        <implementation.script script="HelloWorld.js"/>
+    </component>
+
+</composite>
+
+
+

+ +

+and the associated JavaScript program, 'HelloWorld.js': +

+

+ + +
+
+function sayHello(s) {
+    return "Hello " + s;
+}
+
+
+

+ +

+This next example shows a HelloWorld program using the Ruby language, and the use of the <implementation.script> element 'class' attribute to specifying the class of the component implementation: +

+

+The composite SCDL: +

+

+ + +
+
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+    name="HelloWorldComposite">
+
+    <component name="HelloWorldComponent">
+        <implementation.script script="HelloWorld.rb" class="Helloworld"/>
+    </component>
+
+</composite>
+
+
+

+ +

+and the associated Ruby program, 'HelloWorld.rb': +

+

+ + +
+
+class Helloworld
+
+   def sayHello(s) 
+      return "Hello to " + s + " from the Ruby World!"
+   end
+
+end
+
+
+

+ + +
+ +
-- cgit v1.2.3