jakarta-bsf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rony G. Flatscher" <Rony.Flatsc...@wu-wien.ac.at>
Subject ooRexx, BSF4Rexx ...
Date Tue, 07 Jun 2005 21:09:38 GMT
Hi there,

for people who know Rexx (http://www.RexxLA.org) or the free opensource 
ooRexx ("Open Object Rexx", http://www.ooRexx.org) an updated version of 
BSF4Rexx has been made available at (see "readmeBSF4Rexx.txt" and 


"dist.20050607" also contains a zip-archive to support OpenOffice.org in 
an even simpler manner than was shown on the symposium. (It may serve as 
a model for other BSF languages on how to automate OpenOffice.org 1.1, 
even if the OOo developers don't know it or realize what BSF could do 
for them.)

Enclosed you'll find a little ooRexx program using BSF4Rexx to checkout 
a directory from a Subversion repository! Should be a little "teaser" as 
that script should be executable on any platform with ooRexx and 
BSF4Rexx on it. (The ooRexx message operator is the tilde '~', left of 
it is the receiving object, right of it the message name.) Please note, 
that no type information is necessary, if using ooRexx.



P.S.: The source code of "ooRexx" was made available by IBM (from its 
commercial product Object REXX) to the non-profit organisation "Rexx 
Language Association" (a.k.a. RexxLA) at the end of 2004, which has made 
it available in opensource (IBM's CPL 1.0 license) at 
"http://www.ooRexx.org" in the spring of 2005.

ooRexx is available already for various Linuxes, Solaris and Windows 
(including a full implementation of MS ActiveX scripting interfaces, 
making it a full-blown WSH engine; so you can use it in place of 
VBScript or JScript). Work has begun on further portings and enhancing 
the language itself. Just follow the link to SourceForge from the ooRexx 

P.P.S.: A "teaser" ooRexx program that uses Java classes as if they were 
ooRexx classes, sending ooRexx messages that yield the invocation of the 
respective Java methods. (Please note: no type information necessary 
thanks to BSF.) One can refer to ooRexx classes by prepending the class 
name with a dot (.):


/* ---rgf, 2005-06-07, needs BSF4Rexx as of 2005-06-07 or higher */

/*  Java-svn classes from <http://tmate.org/svn/> (as of 2005-06-06)
    CLASSPATH needs to have path to 'javasvn.jar' and 'jsch.jar'

reposURL=""   -- home of the Java classes needed for this
reposURL=""   -- use only trunk, ~10 MB
-- check out only one particular, small directoy (~15 KB)

targetDir=directory()"\jsvn"  -- check out into current directory

   -- create a blank delimited string of Java class names we wish to import into ooRexx
 s = "org.tmatesoft.svn.core.internal.io.dav.DAVRepositoryFactory"       -
     "org.tmatesoft.svn.core.internal.io.svn.SVNRepositoryFactoryImpl"   -
     "org.tmatesoft.svn.core.internal.ws.fs.FSEntryFactory"              -
     "org.tmatesoft.svn.core.io.SVNRepositoryLocation"                   -
     "org.tmatesoft.svn.core.ISVNWorkspace"                              -
     "org.tmatesoft.svn.core.SVNWorkspaceManager"                        -

do i=1 to words(s)         -- loop over words in string "s" (blank delimited)
   w=word(s, i)            -- extract the i'th word (delimited by blanks)
   cn=substr(w, lastpos('.', w)+1) -- get unqualified class name (to use as ooRexx class name)
   .bsf~bsf.import(w, cn)  -- create an ooRexx proxy class to represent the Java class

say checkout(targetDir, reposURL)  -- invoke the routine that does the checkout

::requires BSF.CLS  -- load the camouflaging support

::routine checkout public  -- check out the given directory to the given location
    use arg path, url
    path=adjust(path)   -- make sure only forward slashes
    url =adjust(url)    -- make sure only forward slashes


    workspace=.SVNWorkspaceManager~createWorkspace("file", directory)


      -- get a constant value
    head=.bsf~bsf.getStaticValue("org.tmatesoft.svn.core.ISVNWorkspace", "HEAD")

    say "checking out" pp(location~toString) "to" pp(directory) "..."

      -- use invokeStrict, allowing us to define the signature (hence no guessing necessary
on the Java side)
    -- revision=workspace~bsf.invokeStrict("checkout", "obj", location, "long", head, "bo",

      -- since a bug-fix in {com.ibm|org.apache}.bsf.util.EngineUtils.java on 2005-06-07 possible:
    revision=workspace~bsf.invoke("checkout", location, head, .false)

    return "Checked out revision:" pp(revision)".";

::routine adjust public       -- make sure only forward slashes used
  return changestr("\", arg(1), "/")

::routine pp public           -- enclose argument in square brackets
  parse arg val
  return "["val"]"

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message