diff options
author | coreyg <coreyg@13f79535-47bb-0310-9956-ffa450edef68> | 2014-11-21 09:30:19 +0000 |
---|---|---|
committer | coreyg <coreyg@13f79535-47bb-0310-9956-ffa450edef68> | 2014-11-21 09:30:19 +0000 |
commit | 200a40b332420f94992eb39a6d0ea1cf1490ffc4 (patch) | |
tree | 1c76ef1d254c7bfc91128a313d319bd60da9d01e /site/trunk/site-publish/java-sca-implementationscript.html | |
parent | 85f53ab6ab4f664d63774c94b672a875c9e52b8a (diff) |
Adding tuscany's website to their svn repo for svnpubsub
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1640879 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'site/trunk/site-publish/java-sca-implementationscript.html')
-rw-r--r-- | site/trunk/site-publish/java-sca-implementationscript.html | 170 |
1 files changed, 170 insertions, 0 deletions
diff --git a/site/trunk/site-publish/java-sca-implementationscript.html b/site/trunk/site-publish/java-sca-implementationscript.html new file mode 100644 index 0000000000..e8b5125f81 --- /dev/null +++ b/site/trunk/site-publish/java-sca-implementationscript.html @@ -0,0 +1,170 @@ + +<!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/display/TUSCANY/$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/viewpage.action?spaceKey=TUSCANY&title=$siteroot"><IMG src="http://people.apache.org/~svkrish/tuscanySite/images/TuscanyLogoNEW_Text_120px_bg.jpg" height="91" width="25" border="0"></A> + </TD> + <TD> + <A href="http://cwiki.apache.org/confluence/pages/viewpage.action?spaceKey=TUSCANY&title=$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="home.html" title="Home">Home</A> > <A href="java-sca-subproject.html" title="Java SCA Subproject">Java SCA Subproject</A> > <A href="java-sca-documentation-menu.html" title="Java SCA Documentation Menu">Java SCA Documentation Menu</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: #C3CDA1; "><DIV class="panelHeader" style="border-bottom-style: solid; border-bottom-color: #C3CDA1; background-color: #C3CDA1; "><B>General</B></DIV><DIV class="panelContent" style="background-color: #ECF4D1; "> +<P><A href="home.html" title="Home">Home</A><BR> +<SPAN class="nobr"><A href="http://www.apache.org/licenses/LICENSE-2.0.html" title="Visit page outside Confluence" rel="nofollow">License <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><BR> +<A href="tuscany-downloads.html" title="Tuscany Downloads">Downloads</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>Resources</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> +<SPAN class="nobr"><A href="http://cwiki.apache.org/confluence/pages/createpage.action?spaceKey=TUSCANY&title=Java%20SCA%20Documentation&linkCreation=true&fromPageId=55228" title="Create Page: Java SCA Documentation" class="createlink">Documentation <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">Source Code<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="JavaSCAimplementation.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="JavaSCAimplementation.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> + +<P>The previous example demonstrated using JavaScript's <SPAN class="nobr"><A href="http://www.ecma-international.org/publications/standards/Ecma-357.htm" title="Visit page outside Confluence" rel="nofollow">E4X<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> language extension for manipulating XML. Many dynamic languages have enhanced XML capabilities like this which can make working with XML much easier than in a more traditional language such as Java. For example, along with JavaScript's E4X, Ruby has ReXML and Groovy has its markup builders. </P> + +<P>Tuscany tries to simplify this for the script program developer and will try to automatically ensure arguments are in the native XML format of the language when the component is wired to a WSDL interface. </P> + +<P>As an example of this the following shows a composite that can replace the Tuscany helloworld-ws-service sample and requires no other files other than the asscociated WSDL document packaged with the contribution:</P> + +<DIV class="code"><DIV class="codeContent"> +<PRE class="code-java"><composite xmlns=<SPAN class="code-quote">"http:<SPAN class="code-comment">//www.osoa.org/xmlns/sca/1.0"</SPAN> +</SPAN> targetNamespace=<SPAN class="code-quote">"http:<SPAN class="code-comment">//helloworld"</SPAN> +</SPAN> xmlns:hw=<SPAN class="code-quote">"http:<SPAN class="code-comment">//helloworld"</SPAN> +</SPAN> name=<SPAN class="code-quote">"helloworldws"</SPAN>> + + <service name=<SPAN class="code-quote">"HelloWorldService"</SPAN> promote=<SPAN class="code-quote">"HelloWorldServiceComponent"</SPAN>> + <<SPAN class="code-keyword">interface</SPAN>.wsdl <SPAN class="code-keyword">interface</SPAN>=<SPAN class="code-quote">"http:<SPAN class="code-comment">//helloworld#wsdl.<SPAN class="code-keyword">interface</SPAN>(HelloWorld)"</SPAN> /> +</SPAN> <binding.ws uri=""/> + </service> + + <component name=<SPAN class="code-quote">"HelloWorldServiceComponent"</SPAN>> + <implementation.script language=<SPAN class="code-quote">"js"</SPAN>><![CDATA[ + + function getGreetings(xmlIn) { + <SPAN class="code-keyword">return</SPAN> <ns1:getGreetings xmlns:ns1=<SPAN class="code-quote">"http:<SPAN class="code-comment">//helloworld"</SPAN>> +</SPAN> <ns1:name>Hello { xmlIn..name }</ns1:name> + </ns1:getGreetings> + } + + ]]></implementation.script> + </component> + +</composite></PRE> +</DIV></DIV> + +<TABLE cellpadding="5" width="85%" cellspacing="8px" class="noteMacro" border="0" align="center"><COLGROUP><COL width="24"><COL></COLGROUP><TR><TD valign="top"><IMG src="http://cwiki.apache.org/confluence/images/icons/emoticons/warning.gif" width="16" height="16" align="absmiddle" alt="" border="0"></TD><TD><B class="strong">Best practice?</B><BR> +<P>Using inline scripts can make creating simple components very easier however there are issues around whether or not this is good practice. <BR> +Depending on the circumstance consideration should be given as to if it would be better to define the script in a seperate file.</P></TD></TR></TABLE> + +<TABLE cellpadding="5" width="85%" cellspacing="8px" class="noteMacro" border="0" align="center"><COLGROUP><COL width="24"><COL></COLGROUP><TR><TD valign="top"><IMG src="http://cwiki.apache.org/confluence/images/icons/emoticons/warning.gif" width="16" height="16" align="absmiddle" alt="" border="0"></TD><TD><B class="strong">0.90</B><BR> +<P>In release 0.90 and before, inline scripts are not supported and scripts require an associated .componentType side file</P></TD></TR></TABLE> + +</TD></TR></TBODY></TABLE> + </DIV> + </DIV> + </DIV> + </TD> + </TR> + </TABLE> + + <DIV class="footer"> + Copyright © 2003-2007, The Apache Software Foundation + </DIV> + + </BODY> +</HTML>
\ No newline at end of file |