On 4/27/06, Don Brown <[EMAIL PROTECTED]> wrote:
I propose a new commons sandbox project, JSExtensions, aimed at providing a library of server-side Javascript (Rhino ATM) extensions that better integrate Java into the Javascript environment. This is implemented in two areas: - Making the Java collections more natural to Javascript - Extending the Java API to add convenience properties and methods
Sounds fine to me. Interesting implementation, too. ;-) -- Martin Cooper The inital code will come from Struts Flow[1], a Struts sandbox project that
brought server-side Javascript to Struts. In its development, I looked at Groovy and saw how they improved the Java API [2] to make it better integrated and more natural in the Groovy environment. I brought its ideas over to Struts Flow [3], attempting to do the same for Javascript. This code is better suited as an individual project, usable by other Javascript-using Apache projects like Cocoon. In addition, these changes make Javascript equally appropriate for standalone shell scripting-type tasks. As a quick example, here is the eachLine() extension method on the java.io.File object, printing each line's contents to System.out: file = new java.io.File("foo.txt"); file.eachLine(function(line) { print(line) }); To be clear, this proposal has nothing to do with client-side Javascript, only server-side Javascript through Rhino and soon Java 6. The code already runs and uses a special unit testing framework for testing. Looking forward to the feedback. Don [1] http://struts.apache.org/struts-sandbox/struts-flow/ [2] http://groovy.codehaus.org/groovy-jdk.html [3] http://struts.apache.org/struts-sandbox/struts-flow/FileExtensions.html(one example)