summaryrefslogtreecommitdiffstats
path: root/sandbox/ant/container.script/doc
diff options
context:
space:
mode:
authordims <dims@13f79535-47bb-0310-9956-ffa450edef68>2008-06-17 00:23:01 +0000
committerdims <dims@13f79535-47bb-0310-9956-ffa450edef68>2008-06-17 00:23:01 +0000
commitbdd0a41aed7edf21ec2a65cfa17a86af2ef8c48a (patch)
tree38a92061c0793434c4be189f1d70c3458b6bc41d /sandbox/ant/container.script/doc
Move Tuscany from Incubator to top level.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@668359 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sandbox/ant/container.script/doc')
-rw-r--r--sandbox/ant/container.script/doc/sca-java-container-script.xml119
1 files changed, 119 insertions, 0 deletions
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document>
+
+ <properties>
+ <title>Tuscany</title>
+ <bannertitle>Tuscany SCA Java Scripting Language Implementation</bannertitle>
+ </properties>
+
+ <body>
+
+<section name="Scripting Language Implementation">
+
+<p>
+The Tuscany Java SCA runtime has a script container allowing SCA components to be implemented with a variety of scripting languages.
+</p>
+<p>
+To use the script container you use the &lt;implementation.script&gt; element in the component SCDL. The &lt;implementation.script&gt; 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.
+</p>
+<p>
+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 <a href='http://jakarta.apache.org/bsf/' target='_blank'>Apache BSF script engine</a>, so any script language supported by BSF can be used as an SCA component implementation.
+</p>
+
+<p>
+</p>
+
+<p>
+</p>
+
+<p>
+</p>
+
+<p>
+</p>
+
+<p>
+The following example shows the files necessary to implement a simple HelloWorld style SCA component using the script container and a JavaScript program.
+</p>
+
+<p>
+The composite SCDL:
+</p>
+<p>
+<table width="100%" class="ex" cellspacing="0" bgcolor="#f4f4f4">
+<tr><td>
+<pre>
+&lt;composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ name="HelloWorldComposite"&gt;
+
+ &lt;component name="HelloWorldComponent"&gt;
+ &lt;implementation.script script="HelloWorld.js"/&gt;
+ &lt;/component&gt;
+
+&lt;/composite&gt;
+</pre>
+</td></tr>
+</table>
+</p>
+
+<p>
+and the associated JavaScript program, 'HelloWorld.js':
+</p>
+<p>
+<table width="100%" class="ex" cellspacing="0" bgcolor="#f4f4f4">
+<tr><td>
+<pre>
+function sayHello(s) {
+ return "Hello " + s;
+}
+</pre>
+</td></tr>
+</table>
+</p>
+
+<p>
+This next example shows a HelloWorld program using the Ruby language, and the use of the &lt;implementation.script&gt; element 'class' attribute to specifying the class of the component implementation:
+</p>
+<p>
+The composite SCDL:
+</p>
+<p>
+<table width="100%" class="ex" cellspacing="0" bgcolor="#f4f4f4">
+<tr><td>
+<pre>
+&lt;composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ name="HelloWorldComposite"&gt;
+
+ &lt;component name="HelloWorldComponent"&gt;
+ &lt;implementation.script script="HelloWorld.rb" class="Helloworld"/&gt;
+ &lt;/component&gt;
+
+&lt;/composite&gt;
+</pre>
+</td></tr>
+</table>
+</p>
+
+<p>
+and the associated Ruby program, 'HelloWorld.rb':
+</p>
+<p>
+<table width="100%" class="ex" cellspacing="0" bgcolor="#f4f4f4">
+<tr><td>
+<pre>
+class Helloworld
+
+ def sayHello(s)
+ return "Hello to " + s + " from the Ruby World!"
+ end
+
+end
+</pre>
+</td></tr>
+</table>
+</p>
+
+
+ </section>
+ </body>
+</document>