| <?xml version="1.0"?> |
| |
| <!-- |
| |
| Licensed to the Apache Software Foundation (ASF) under one or more |
| contributor license agreements. See the NOTICE file distributed with |
| this work for additional information regarding copyright ownership. |
| The ASF licenses this file to You under the Apache License, Version 2.0 |
| (the "License"); you may not use this file except in compliance with |
| the License. You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
| --> |
| |
| <document> |
| |
| <properties> |
| <author email="chuck@topsail.org">Chuck Murcko</author> |
| <author email="victor.j.orlikowski@alumni.duke.edu">Victor Orlikowski</author> |
| <author email="rony@apache.org">Rony G. Flatscher</author> |
| <title>Bean Scripting Framework</title> |
| </properties> |
| |
| <body> |
| |
| <section name="Bean Scripting Framework"> |
| |
| <p> |
| Bean Scripting Framework (BSF) is a set of Java classes which provides scripting |
| language support within Java applications, and access to Java |
| objects and methods from scripting languages. BSF allows one to |
| write JSPs in languages other than Java while providing access to the Java |
| class library. In addition, BSF permits any Java application to be implemented |
| in part (or dynamically extended) by a language that is embedded within it. |
| This is achieved by providing an API that permits calling scripting |
| language engines from within Java, as well as an object registry that exposes |
| Java objects to these scripting language engines. |
| </p> |
| |
| <p> |
| There are now two different versions of Apache BSF. These have different APIs. |
| <br /> |
| The original version of BSF is represented by the BSF 2.x releases (current version 2.4), |
| and uses an API which was originally developed at IBM. |
| <br /> |
| The new version of Apache BSF is represent by the 3.x releases. |
| The 3.x version uses the API defined as part of JSR-223 (javax.script), |
| which is included in Java 6 onwards. |
| However BSF 3.x will run on Java 1.4+, allowing access to JSR-223 scripting |
| for Java 1.4 and Java 5. |
| Apache BSF 3.x is also useful for Java 6 as it contains a command-line utility for |
| testing JSR-223 scripts as well as some utility classes for working with XML. |
| </p> |
| </section> |
| |
| <section name="Supported Languages - 2.x"> |
| |
| <p> |
| BSF 2.x supports several scripting languages currently: |
| |
| <ul> |
| <li> |
| <a href="http://www.mozilla.org/rhino/">Javascript (using Rhino ECMAScript, from the Mozilla project)</a> |
| </li> |
| |
| <li> |
| <a href="http://www-306.ibm.com/software/awdtools/netrexx/">NetRexx</a> (an extension of the IBM REXX scripting language in Java) |
| </li> |
| |
| <li> |
| <a href="http://commons.apache.org/jexl/">Commons JEXL</a> |
| </li> |
| |
| <li> |
| <a href="http://jython.sourceforge.net/">Python (using Jython) </a> |
| </li> |
| |
| <li> |
| <a href="http://tcljava.sourceforge.net/">Tcl (using Jacl)</a> |
| </li> |
| |
| <li> |
| <a href="http://xalan.apache.org">XSLT Stylesheets (as a component of Apache XML project's Xalan and Xerces)</a> |
| </li> |
| </ul> |
| </p> |
| |
| <p> In addition, the following languages are supported with their own BSF engines: |
| |
| <ul> |
| <li> |
| Java (using <a href="http://www.beanshell.org/">BeanShell</a>, from the BeanShell project) |
| </li> |
| |
| <li> |
| <a href="http://groovy.codehaus.org/">Groovy</a> |
| </li> |
| |
| <li> |
| <a href="http://groovy.codehaus.org/Groovy+Monkey">Groovy Monkey</a> |
| </li> |
| |
| <li> |
| <a href="http://www.ulfdittmer.com/jlog/index.html">JLog</a> (<a href="http://jlogic.sourceforge.net/">PROLOG implemented in Java</a>) |
| </li> |
| |
| <li> |
| <a href="http://jruby.codehaus.org/">JRuby</a> |
| </li> |
| |
| <li> |
| <a href="http://www.judoscript.org">JudoScript</a> |
| </li> |
| |
| <li> |
| <a href="http://objectscript.sourceforge.net/">ObjectScript</a> |
| </li> |
| |
| <li> |
| <a href="http://www.oorexx.org/">ooRexx (Open Object Rexx)</a>, using |
| <a href="http://wi.wu-wien.ac.at/rgf/rexx/bsf4oorexx/current/">BSF4ooRexx</a>. |
| </li> |
| |
| </ul> |
| </p> |
| |
| <p> |
| Information on where to obtain scripting languages for use with BSF is |
| available on the <a href="projects.html">Related Projects</a> page. |
| </p> |
| |
| </section> |
| |
| <section name="Documentation (2.x)"> |
| |
| <p> |
| You can view the <a href="manual.html">documentation for BSF 2.4</a>. |
| </p> |
| |
| <p> |
| Documentation and examples are included in the source and binary distributions. |
| </p> |
| |
| </section> |
| |
| <section name="Documentation (3.x)"> |
| |
| <p> |
| The following references describe the standard API (javax.script) which is implemented by BSF 3.x: |
| <ul> |
| <li><a href="http://jcp.org/aboutJava/communityprocess/final/jsr223/index.html">JSR-223 Scripting for the Java Platform</a> - specification (PDF)</li> |
| <li><a href="http://java.sun.com/javase/6/docs/api/javax/script/package-summary.html">Javadoc for javax.script classes</a> in Java 6</li> |
| <li><a href="http://java.sun.com/developer/technicalArticles/J2SE/Desktop/scripting/">Scripting for the Java platform (Sun technical article)</a></li> |
| </ul> |
| </p> |
| <p> |
| Apache BSF 3.x includes an implementation of JSR-223 (javax.script) and runs on Java 1.4 and Java 5. |
| (Java 6 includes javax.script as standard.) |
| Note that although the implementation follows the JSR-223 specification, it has not been tested against |
| the JSR-223 TCK. |
| Apache BSF 3.x can therefore not strictly be described as a compatible implementation of JSR-223, |
| however it is believed to be complete. |
| </p> |
| <p> |
| Apache BSF 3.x also includes some utility classes for working with XML. |
| These can be used with any used with any implementation of the javax.scripting package, including the one in Java 6+. |
| </p> |
| <p> |
| There is also a command-line utility which can be used to run scripts in any language engine which supports JSR-223. |
| </p> |
| <p> |
| Note that Apache BSF does not contain any language engines; these have to be downloaded separately. |
| Version 3.0 was shipped with a set of engine factories, however this is no longer present in later versions of BSF. |
| This is because many languages are now provided with their own factories. |
| <br/> |
| Also, having all the factories in a single jar can cause problems at run-time. |
| If other jars contain factories that implement a different version of the same language |
| it may be difficult or impossible to choose which version is loaded. |
| <br/> |
| If the language implementation is not present, the factory class may fail to load; |
| with some implementations of javax.script (e.g. Sun Java 6) this may prevent any factories from loading. |
| </p> |
| <p> |
| An example language which includes the necessary engine factory is: |
| <a href="http://commons.apache.org/jexl/">Apache Jexl 2.0</a> (requires Java 5). |
| Some other scripting languages also come with their own factories already included. |
| For example <a href="http://groovy.codehaus.org/">Groovy</a> and <a href="http://jruby.org/">JRuby</a>. |
| </p> |
| <p> |
| Many other languages are supported by the 3rd party engine factories available at |
| <a href="https://scripting.dev.java.net/">https://scripting.dev.java.net/</a>. |
| This provides a combined archive from which the appropriate jar for the language can be extracted. |
| </p> |
| |
| </section> |
| |
| </body> |
| </document> |
| |