
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1640879 13f79535-47bb-0310-9956-ffa450edef68
136 lines
No EOL
7.9 KiB
HTML
136 lines
No EOL
7.9 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
|
<HTML>
|
|
<HEAD>
|
|
<LINK type="text/css" rel="stylesheet" href="http://people.apache.org/~svkrish/tuscanySite/style/default.css">
|
|
<LINK rel="SHORTCUT ICON" href="http://cwiki.apache.org/confluence/pages/$images/favicon.ico">
|
|
<TITLE>Java+SCA+implementation.script : Apache Tuscany</TITLE>
|
|
<META http-equiv="Content-Type" content="text/html;charset=UTF-8"></HEAD>
|
|
|
|
<BODY onload="init()">
|
|
|
|
<TABLE valign="top" border="0" cellspacing="0" cellpadding="0" width="100%" background="http://people.apache.org/~svkrish/tuscanySite/images/TuscanyLogoNEW_Text_120px_bg.jpg">
|
|
<TR>
|
|
<TD valing="top" align="left">
|
|
<A href="http://cwiki.apache.org/confluence/pages/$siteroot"><IMG src="http://people.apache.org/~svkrish/tuscanySite/images/TuscanyLogo.jpg" border="0"></A>
|
|
</TD>
|
|
|
|
<TD width="100%">
|
|
|
|
</TD>
|
|
<!-- Adds the edit page link to the top banner-->
|
|
<TD valign="bottom">
|
|
<DIV style="padding: 2px 10px; margin: 0px;">
|
|
<A href="http://cwiki.apache.org/confluence/pages/editpage.action?pageId=55156">
|
|
<IMG src="http://people.apache.org/~svkrish/tuscanySite/images/notep_16.gif" height="16" width="16" border="0" align="absmiddle" title="Edit Page"></A>
|
|
</DIV>
|
|
</TD>
|
|
|
|
</TR>
|
|
</TABLE>
|
|
|
|
<TABLE border="0" cellpadding="2" cellspacing="0" width="100%">
|
|
<TR class="topBar">
|
|
<TD align="left" valign="middle" class="topBarDiv" nowrap="true" width="100%">
|
|
<A href="home.html" title="Apache Tuscany">Apache Tuscany</A> > <A href="" title="Java+SCA+implementation.script">Java+SCA+implementation.script</A>
|
|
</TD>
|
|
|
|
<TD align="left" valign="middle" class="topBarDiv" nowrap="true">
|
|
<A href="http://mail-archives.apache.org/mod_mbox/ws-tuscany-user">User List</A> | <A href="http://mail-archives.apache.org/mod_mbox/ws-tuscany-dev">Dev List</A> | <A href="http://issues.apache.org/jira/browse/Tuscany">Issue Tracker</A>
|
|
</TD>
|
|
</TR>
|
|
</TABLE>
|
|
|
|
<TABLE border="0" cellpadding="0" width="100%" bgcolor="#FFFFFF">
|
|
<TR>
|
|
<TD align="left" valign="top">
|
|
<DIV id="PageContent">
|
|
|
|
<DIV class="pagecontent">
|
|
<DIV class="wiki-content">
|
|
<TABLE class="sectionMacro" border="0" cellpadding="5" cellspacing="0" width="100%"><TBODY><TR>
|
|
<TD class="confluenceTd" valign="top" width="15%">
|
|
<DIV class="panel" style="border-style: solid; border-color: #b4b4b5; "><DIV class="panelHeader" style="border-bottom-style: solid; border-bottom-color: #b4b4b5; background-color: #C3CDA1; "><B>General</B></DIV><DIV class="panelContent" style="background-color: #ECF4D1; ">
|
|
<P><A href="tuscany-sca-java-faq.html" title="Tuscany SCA Java - FAQ">FAQ</A><BR>
|
|
<A href="sca-downloads.html" title="SCA Downloads">Downloads</A><BR>
|
|
<A href="sca-java-whats-new.html" title="SCA Java Whats New">What's New?</A></P>
|
|
</DIV></DIV>
|
|
|
|
<DIV class="panel" style="border-style: solid; border-color: #b4b4b5; "><DIV class="panelHeader" style="border-bottom-style: solid; border-bottom-color: #b4b4b5; background-color: #C3CDA1; "><B>Guides</B></DIV><DIV class="panelContent" style="background-color: #ECF4D1; ">
|
|
<P><A href="sca-java-user-guide.html" title="SCA Java User Guide">User Guide</A><BR>
|
|
<A href="sca-java-extension-guide.html" title="SCA Java Extension Guide">Extension Guide</A><BR>
|
|
<A href="java-sca-architecture-guide.html" title="Java SCA Architecture Guide">Architecture Guide</A><BR>
|
|
<A href="sca-java-development.html" title="SCA Java Development">Developer Guide</A><BR>
|
|
<A href="java-sca-extension-developer-guide.html" title="Java SCA Extension Developer Guide">Extension Developer Guide</A></P>
|
|
</DIV></DIV>
|
|
|
|
<DIV class="panel" style="border-style: solid; border-color: #b4b4b5; "><DIV class="panelHeader" style="border-bottom-style: solid; border-bottom-color: #b4b4b5; background-color: #C3CDA1; "><B>Development</B></DIV><DIV class="panelContent" style="background-color: #ECF4D1; ">
|
|
<P><SPAN class="nobr"><A href="http://cwiki.apache.org/confluence/pages/createpage.action?spaceKey=TUSCANY&title=SCA%20Java%20Doc&linkCreation=true&fromPageId=47581" title="Create Page: SCA Java Doc" class="createlink">Java Doc<SUP><IMG class="rendericon" src="http://cwiki.apache.org/confluence/images/icons/plus.gif" height="7" width="7" align="absmiddle" alt="" border="0"></SUP></A></SPAN><BR>
|
|
<SPAN class="nobr"><A href="https://svn.apache.org/repos/asf/incubator/tuscany/java/sca" title="Visit page outside Confluence" rel="nofollow">Java SCA Source <SUP><IMG class="rendericon" src="http://cwiki.apache.org/confluence/images/icons/linkext7.gif" height="7" width="7" align="absmiddle" alt="" border="0"></SUP></A></SPAN></P>
|
|
</DIV></DIV></TD>
|
|
<TD class="confluenceTd" valign="top" width="85%">
|
|
|
|
<H3><A name="Java%2BSCA%2Bimplementation.script-%3Cimplementation.script%3E"></A><implementation.script></H3>
|
|
|
|
<P>The Tuscany Java SCA runtime supports implementing SCA components in a wide variety of dynamic or scripting languages by using the <implementation.script> SCDL extension.</P>
|
|
|
|
<P>Any language that supports the "Scripting for Java" APIs defined by JSR-223 is supported, this includes Groovy, JavaScript, JRuby, Jython, and many others.</P>
|
|
|
|
<P>To use these languages the SCA assembly SCDL is extended with an "implementation.script" element which has the following options:</P>
|
|
|
|
|
|
<DIV class="code"><DIV class="codeContent">
|
|
<PRE class="code-java"><implementation.script [ script=<SPAN class="code-quote">"" | language="</SPAN>" ] >
|
|
[inline src]
|
|
</implementation.script></PRE>
|
|
</DIV></DIV>
|
|
|
|
<P>The source code for the script maybe defined in a seperate file pointed to by the 'script=' attribute, or the source code maybe embedded within the SCDL inline inside the <implementation.script> element.</P>
|
|
|
|
<P>The 'language=' attribute defines the language of the program. The language attribute is optional when the source code is in a separate file in which case the file extension of the file is used to determine the language.</P>
|
|
|
|
<H4><A name="Java%2BSCA%2Bimplementation.script-Someexamples%3A"></A>Some examples:</H4>
|
|
|
|
|
|
<P>A Ruby program defined in a file 'myScript.rb' in a folder named 'test':</P>
|
|
|
|
<DIV class="code"><DIV class="codeContent">
|
|
<PRE class="code-java"><implementation.script script=<SPAN class="code-quote">"test/myScript.rb"</SPAN>/></PRE>
|
|
</DIV></DIV>
|
|
|
|
|
|
<P>A JavaScript program defined inline:</P>
|
|
|
|
<DIV class="code"><DIV class="codeContent">
|
|
<PRE class="code-java"><implementation.script language=<SPAN class="code-quote">"js"</SPAN>>
|
|
function sayHello(name) {
|
|
<SPAN class="code-keyword">return</SPAN> <SPAN class="code-quote">"Hello "</SPAN> + name;
|
|
}
|
|
</implementation.script></PRE>
|
|
</DIV></DIV>
|
|
|
|
|
|
<P>When using inline scripts which contain special characters such as XML markup you may need to enclose the source within a CDATA region, for example:</P>
|
|
|
|
<DIV class="code"><DIV class="codeContent">
|
|
<PRE class="code-java"><implementation.script language=<SPAN class="code-quote">"js"</SPAN>><![CDATA[
|
|
function sayHello(inXML) {
|
|
<SPAN class="code-keyword">return</SPAN> <sayHelloResponse>Hello { inXML..name }</sayHelloResponse>;
|
|
}
|
|
]]></implementation.script></PRE>
|
|
</DIV></DIV>
|
|
|
|
</TD></TR></TBODY></TABLE>
|
|
</DIV>
|
|
</DIV>
|
|
</DIV>
|
|
</TD>
|
|
</TR>
|
|
</TABLE>
|
|
|
|
<DIV class="footer">
|
|
Copyright © 2003-2007, The Apache Software Foundation
|
|
</DIV>
|
|
|
|
</BODY>
|
|
</HTML> |