You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by sg...@apache.org on 2006/01/07 16:26:15 UTC
svn commit: r366777 [3/3] - in /jakarta/turbine/fulcrum/trunk/script: ./
src/ src/java/ src/java/org/ src/java/org/apache/
src/java/org/apache/fulcrum/ src/java/org/apache/fulcrum/script/
src/java/org/apache/fulcrum/script/impl/ src/test/ src/test/org/...
Added: jakarta/turbine/fulcrum/trunk/script/xdocs/index.xml
URL: http://svn.apache.org/viewcvs/jakarta/turbine/fulcrum/trunk/script/xdocs/index.xml?rev=366777&view=auto
==============================================================================
--- jakarta/turbine/fulcrum/trunk/script/xdocs/index.xml (added)
+++ jakarta/turbine/fulcrum/trunk/script/xdocs/index.xml Sat Jan 7 07:25:56 2006
@@ -0,0 +1,66 @@
+<?xml version="1.0"?>
+
+<document>
+
+ <properties>
+ <title>Fulcrum Script Service</title>
+ <author email="siegfried.goeschl@it20one.at">Siegfried Goeschl</author>
+ </properties>
+
+ <body>
+
+ <section name="What is the Fulcrum Script Service?">
+
+ <p>
+ The Fulcrum Script Service provides an integration of the
+ JSR 223 specifiation to integrate scripting languages.
+ Basically this is the successor of the existing Fulcrum BSF
+ and Fulcrum Groovy service.
+ </p>
+
+ <subsection name="Features">
+ <p>
+ The Fulcrum Script Service provides the following features:
+ <ul>
+ <li>optional caching of scripts to improve performance</li>
+ <li>optional script compilation depending on the scripting engine</li>
+ <li>seamless integration with the existing Avalon infrastructure</li>
+ </ul>
+ </p>
+ </subsection>
+
+ <subsection name="Scripting Language Support">
+ <table>
+ <tr>
+ <th>Language</th>
+ <th>Status</th>
+ <th>Description</th>
+ </tr>
+ <tr>
+ <td><a href="http://www.mozilla.org/rhino">Rhino JavaScript</a></td>
+ <td>Done</td>
+ <td>Works nicely</td>
+ </tr>
+ <tr>
+ <td><a href="http://groovy.codehaus.org">Groovy</a></td>
+ <td>Done</td>
+ <td>Currently no support for Invocable</td>
+ </tr>
+ <tr>
+ <td><a href="https://pnuts.dev.java.net">pnuts</a></td>
+ <td>Open</td>
+ <td>Currently no JDK 1.4 support for JSR 223 integration</td>
+ </tr>
+ <tr>
+ <td><a href="http://www.beanshell.org">Beanshell</a></td>
+ <td>Open</td>
+ <td>Currently no JSR 223 integration available</td>
+ </tr>
+ </table>
+ </subsection>
+
+ </section>
+
+ </body>
+
+</document>
Added: jakarta/turbine/fulcrum/trunk/script/xdocs/integration.xml
URL: http://svn.apache.org/viewcvs/jakarta/turbine/fulcrum/trunk/script/xdocs/integration.xml?rev=366777&view=auto
==============================================================================
--- jakarta/turbine/fulcrum/trunk/script/xdocs/integration.xml (added)
+++ jakarta/turbine/fulcrum/trunk/script/xdocs/integration.xml Sat Jan 7 07:25:56 2006
@@ -0,0 +1,75 @@
+<?xml version="1.0"?>
+
+<document>
+
+ <properties>
+ <title>Fulcrum Script Service</title>
+ <author email="siegfried.goeschl@it20one.at">Siegfried Goeschl</author>
+ </properties>
+
+ <body>
+
+ <section name="Invoking a script">
+
+ <p>
+ For invoking a script you have two options - either you invoke the
+ script directly using the ScriptService or you can use a ScriptRunnable
+ (which relies on the ScriptService).
+ </p>
+
+ <subsection name="Using the ScriptService">
+ <p>
+ This example invokes a script called "CompilableInterface" and
+ passed two parameters for executing the script.
+ </p>
+ <source>
+ <![CDATA[
+Object result = null;
+SimpleNamespace args = new SimpleNamespace();
+args.put("count",new Integer(i));
+args.put("currentTime",new Long(System.currentTimeMillis()));
+result = scriptService.eval("CompilableInterface", args);
+ ]]>
+ </source>
+ </subsection>
+
+ <subsection name="Using the ScriptRunnable">
+ <p>
+ This example creates a ScriptRunnable to invoke a
+ script called "MultiThreaded".
+ </p>
+ <source>
+ <![CDATA[
+Hashtable args = new Hashtable();
+args.put("foo", new Double(0));
+ScriptRunnable runnable = scriptService.createRunnable( scriptService, "MultiThreaded", args );
+runnable.run();
+result = runnable.getResult();
+ ]]>
+ </source>
+ </subsection>
+
+ </section>
+
+ <section name="Accessing Avalon Infrastructure from within a script">
+ <p>
+ The Fulcrum Script Service passes a ScriptAvalonContext to the script
+ </p>
+ <source>
+ <![CDATA[
+var logger = avalonContext.getLogger();
+var applicationDir = avalonContext.getApplicationDir();
+var tempDir = avalonContext.getTempDir();
+var serviceManager = avalonContext.getServiceManager();
+var parameters = avalonContext.getParameters();
+var configuration = avalonContext.getConfiguration();
+var isDebug = configuration.getChild("isDebug").getValueAsBoolean(false);
+serviceManager.lookup("org.apache.fulcrum.script.ScriptService").exists("Avalon");
+ ]]>
+ </source>
+
+ </section>
+
+ </body>
+
+</document>
Added: jakarta/turbine/fulcrum/trunk/script/xdocs/navigation.xml
URL: http://svn.apache.org/viewcvs/jakarta/turbine/fulcrum/trunk/script/xdocs/navigation.xml?rev=366777&view=auto
==============================================================================
--- jakarta/turbine/fulcrum/trunk/script/xdocs/navigation.xml (added)
+++ jakarta/turbine/fulcrum/trunk/script/xdocs/navigation.xml Sat Jan 7 07:25:56 2006
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<project
+ name="Fulcrum Groovy Service"
+ href="http://jakarta.apache.org/turbine/fulcrum/yaafi/">
+
+ <body>
+ <links>
+ <item name="Home" href="../../../it20one-service-maven/target/docs/index.html"/>
+ <item name="Fulcrum" href="http://jakarta.apache.org/turbine/fulcrum/"/>
+ <item name="JSR 223" href="http://www.jcp.org/aboutJava/communityprocess/pr/jsr223/"/>
+ </links>
+
+ <menu name="Overview">
+ <item name="Overview" href="/index.html"/>
+ <item name="Configuration" href="/configuration.html"/>
+ <item name="Integration" href="/integration.html"/>
+ <item name="Technical" href="/technical.html"/>
+ <item name="Resources" href="/resources.html"/>
+ </menu>
+ </body>
+</project>
Added: jakarta/turbine/fulcrum/trunk/script/xdocs/resources.xml
URL: http://svn.apache.org/viewcvs/jakarta/turbine/fulcrum/trunk/script/xdocs/resources.xml?rev=366777&view=auto
==============================================================================
--- jakarta/turbine/fulcrum/trunk/script/xdocs/resources.xml (added)
+++ jakarta/turbine/fulcrum/trunk/script/xdocs/resources.xml Sat Jan 7 07:25:56 2006
@@ -0,0 +1,21 @@
+<?xml version="1.0"?>
+
+<document>
+
+ <properties>
+ <title>Fulcrum Script Service</title>
+ <author email="siegfried.goeschl@it20one.at">Siegfried Goeschl</author>
+ </properties>
+
+ <body>
+
+ <section name="Resources">
+ <ul>
+ <li><a href="http://opal.cabochon.com/~stevey/sokoban/">Stevey's JVM Language Soko-Shootout</a></li>
+ <li><a href="http://www.javaworld.com/javaworld/jw-03-2005/jw-0314-scripting.html">Choosing a Java scripting language</a></li>
+ </ul>
+ </section>
+
+ </body>
+
+</document>
Added: jakarta/turbine/fulcrum/trunk/script/xdocs/technical.xml
URL: http://svn.apache.org/viewcvs/jakarta/turbine/fulcrum/trunk/script/xdocs/technical.xml?rev=366777&view=auto
==============================================================================
--- jakarta/turbine/fulcrum/trunk/script/xdocs/technical.xml (added)
+++ jakarta/turbine/fulcrum/trunk/script/xdocs/technical.xml Sat Jan 7 07:25:56 2006
@@ -0,0 +1,61 @@
+<?xml version="1.0"?>
+
+<document>
+
+ <properties>
+ <title>Fulcrum Script Service</title>
+ <author email="siegfried.goeschl@it20one.at">Siegfried Goeschl</author>
+ </properties>
+
+ <body>
+
+ <section name="Script Compilation">
+ <p>
+ Depending on the ScriptEngine of your choice you have
+ various options to compile a script
+ <ul>
+ <li>transforming the script into an AST (abstract syntax tree) on the fly</li>
+ <li>compiling the script into Java bytecode on the fly thereby creating a Java class dynamically</li>
+ <li>precompile the script to Java bytecode thereby creating a Java class file</li>
+ </ul>
+ </p>
+ </section>
+
+ <section name="Script Management">
+ <p>
+ The scripts are managesd by the Fulcrum ResourcManager Service. This
+ gives you the locator functionality, optional decryption and location
+ transparency
+ </p>
+ </section>
+
+ <section name="Locator">
+
+ <p>
+ The locator gives you easy customization of scripts. Let's
+ say you would like to invoke the script 'foo.js' for a customer
+ 'BAR' using the following script layout
+ </p>
+
+ <source>
+ <![CDATA[
+scripts
+ -- foo.js
+ -- BAR
+ -- foo.js
+ ]]>
+ </source>
+
+ <p>
+ In the case of invoking 'foo.js' the script 'foo.js' would be executed.
+ In the case of invoking 'BAR/foo.js' the script 'BAR/foo.js' would be executed.
+ In the case of invoking 'FOO/foo.js' the locator is looking for 'FOO/foo.js'. Since
+ it isn't found it steps up a directory to execute 'foo.js'. The trick was taken from
+ the Fulcrum XSLT service which uses a simlilar fallback mechanism.
+ </p>
+
+ </section>
+
+ </body>
+
+</document>
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org