libbsf-java-2.4.0/0000755000175000017500000000000010736513460012666 5ustar mkochmkochlibbsf-java-2.4.0/CHANGES.txt0000644000175000017500000000453110511475731014501 0ustar mkochmkochchanges for Apache BSF 2.4.0 (from RELEASE-NOTE.txt) *) can be used as an extension package to Java by placing it into "jre/lib/ext" [using the thread's context classloader, ie. the result of 'Thread.currentThread().getContextClassLoader()'] *) removed experimental 'DebugLog' class, superceded by commons-logging and log4j *) removed 'org.apache.bsf.engines.activescript.*', as it is not supported anymore (stems from the original IBM codebase, but would need native Windows code to bridge OLE/ActiveX) *) removed 'org.apache.bsf.engines.jpython', as it is superceded by the newer 'org.apache.bsf.engines.jython' *) 'org.apache.bsf.BSFMain.java': new method "public String getVersion()", returns string in the form of a dewey decimal number 'abc' (three levels, each between 0 and 9) 'abc.yyyymmdd', 'yyyy' four digit year, 'mm' two digit month, 'dd' two digit day; e.g. '240.20060925' stands for: BSF version 2.4.0 as of 2006-09-25 *) new class 'org.apache.bsf.utils.BSFEventProcessorReturningEventInfos' *) 'org.apache.bsf.utils.EngineUtils.java': added the method 'addEventListenerReturningEventInfos(...)' changes for Apache BSF 2.3.0 *) Revert BSF debug support (due to several usability issues) and refactor source. *) add javadocs and realclean targets to build.xml scrub remaining email addresses from source for spam prevention add AUTHORS, BUILDING, INSTALL, README, and TODO files *) Cleaned out META* junk *) Removed bsf/src/org/apache/bsf/engines/activescript/samples/* because of copyright issues *) Changes for org.apache.* namespace, license changes changes to BSF 2.2 *) Fix taglibs, and allow debugging through taglibs *) Entry/Exit debugging added *) Overall logging solution, involving a loglevel property *) BSF taglib added to drop package *) Debug Protocol versioning and handshake *) Miscellaneous bugfixes, additions, and cleanups. *) updated XSLT support for Xalan 2 *) added Jython engine *) JSDI and debug engine for ECMAScript *) added master build.xml *) added scripts module to the bsf23 module *) added bsf23 module for rollup of bsf, bsf_debug, and jsdb created bsf-build-23 module for other files (support, build.xml) libbsf-java-2.4.0/TODO.txt0000644000175000017500000000271010511475731014173 0ustar mkochmkochFor 2006-09-25 the TODO list would consist at least from the following items: - add new BSF engines for BSF 2.4 - create a new BSF 3.0 which complies to JSR-223 (which is part of Java 1.6), some features being - BSF 3.0 will be available as FOSS for earlier version of Java - BSF 3.0 may get an internal adapter for employing the numerous BSF 2.4 engines transparently - ... Rony G. Flatscher, 2006-09-25 ------------------------------ cut here (from 2003) ----------------------------- The following TODO list stems from 2003 and has not been updated anymore and has partially been obsoleted: TODO list for BSF 2.3.0-1: use a discovery mechanism like JAXP in place of Languages.properties break out messages for both runtime and debugging into properties files work out a better procedure for obtaining language jarfiles Maven/Ibiblio and replacement of CVS with Subversion are possibilities improve doc generation and distribution provide/incorporate patches for Jasper 4.0.x, 4.1.x, and 5.x. TODO list for BSF 2.4.0: work on improving BSF global scope, e.g.: public Boolean variableExists() public Object getVariableValue() public void setVariableValue() ... TODO list for BSF 3.0.0: address debug support for multiple languages (JSR-045?) ------------------------------ cut here (from 2003) ----------------------------- libbsf-java-2.4.0/samples/0000755000175000017500000000000010511475731014331 5ustar mkochmkochlibbsf-java-2.4.0/samples/xsl/0000755000175000017500000000000010736513022015132 5ustar mkochmkochlibbsf-java-2.4.0/samples/xsl/style1.xsl0000644000175000017500000000132010511475731017104 0ustar mkochmkoch libbsf-java-2.4.0/samples/xsl/table-data.xml0000644000175000017500000000035010511475731017655 0ustar mkochmkoch libbsf-java-2.4.0/samples/xsl/TableFiller$1.class0000644000175000017500000000100210511475731020471 0ustar mkochmkochÊþº¾.  ()VCodeLineNumberTableLocalVariableTablethis InnerClassesLTableFiller$1; windowClosing(Ljava/awt/event/WindowEvent;)VeLjava/awt/event/WindowEvent; SourceFileTableFiller.java   TableFiller$1java/awt/event/WindowAdapterjava/lang/Systemexit(I)V /*·±  =¸±    libbsf-java-2.4.0/samples/xsl/readme0000644000175000017500000000246310511475731016324 0ustar mkochmkochThis program will run starting with Java version 1.4 as it contains the XSL support in its distribution. The program demonstrates how one can use XSLT as a scripting language to fill in a Java data structure using some XML data and a stylesheet. To run it, type: java TableFiller style1.xsl table-data.xml or java TableFiller style2.xsl table-data.xml Note on using Java 1.5, Java 1.6 or higher: - if the sample does not work in these environments then, copy the Xalan-jars from "http://xml.apache.org/xalan-j/downloads.html" distribution into the "endorsed" directory of these Java versions (e.g. "JAVA_JRE_HOME /jre/lib/endorsed/"); make sure that the archive "xalan.jar" (from the xalan-tool jar) is available as well; tested with Xalan 2.7 and 2.8 on Java 1.5 and beta-version of Java 1.6 Be impressed and have fun! ;-) ---rgf, 2006-09-07 =============== Original "readme" text as of 2003-06-25: ================= This demo shows how one can use LotusXSL as a scripting language to fill in a Java data structure using some XML data and a stylesheet. To run it, type: java TableFiller style1.xsl table-data.xml or java TableFiller style2.xsl table-data.xml You need to have LotusXSL v0.18.* on your classpath in addition to bsf.jar and bsfengines.jar. libbsf-java-2.4.0/samples/xsl/TableFiller.java0000644000175000017500000000336710511475731020200 0ustar mkochmkoch/** * This is an example of using an XSL script to fill in a Java * table with data obtained from an XML file. */ import java.io.*; import java.awt.*; import java.awt.event.*; import org.apache.bsf.*; import org.apache.bsf.util.IOUtils; public class TableFiller { public static void main (String[] args) throws Exception { if (args.length != 2) { System.err.println ("Usage: java TableFiller xslfilename xmlfilename"); System.exit (0); } String xslfilename = args[0]; String xmlfilename = args[1]; Frame frame = new Frame ("Table Filler"); frame.addWindowListener (new WindowAdapter () { public void windowClosing (WindowEvent e) { System.exit (0); } }); Panel panel = new Panel (new GridLayout (-1, 2)); Font f = new Font ("SansSerif", Font.BOLD, 14); Label l = new Label ("First"); l.setFont (f); panel.add (l); l = new Label ("Last"); l.setFont (f); panel.add (l); frame.add ("Center", panel); BSFManager mgr = new BSFManager (); // make the panel available for playing in XSL mgr.declareBean ("panel", panel, panel.getClass ()); // tell lotusxsl what the input xml file is mgr.registerBean ("xslt:src", new FileReader (xmlfilename)); // load and run the xsl file to fill in the table. Note that we're // running the xsl script for its side effect of filling in the table // and so we don't care what the resulting document is. mgr.exec ("xslt", xslfilename, 0, 0, IOUtils.getStringFromReader (new FileReader (xslfilename))); // display the frame frame.pack (); // frame.show(); // javac 1.5 warns to use f.show(), Apache build scripts abort as a result :( frame.setVisible(true); // available since Java 1.1 } } libbsf-java-2.4.0/samples/xsl/TableFiller.class0000644000175000017500000000434410511475731020360 0ustar mkochmkochÊþº¾.’ *G HIJ KL HMNO PQ G TUV W XYZ [\] P ^ _`a bc G; *d efg !P hi jk l m nop()VCodeLineNumberTableLocalVariableTablethis LTableFiller;main([Ljava/lang/String;)Vargs[Ljava/lang/String; xslfilenameLjava/lang/String; xmlfilenameframeLjava/awt/Frame;panelLjava/awt/Panel;fLjava/awt/Font;lLjava/awt/Label;mgrLorg/apache/bsf/BSFManager; Exceptionsq SourceFileTableFiller.java +,r st/Usage: java TableFiller xslfilename xmlfilenameu vw xyjava/awt/Frame Table Filler +w TableFiller$1 InnerClasses z{java/awt/Paneljava/awt/GridLayout +| +} java/awt/Font SansSerif +~java/awt/LabelFirst € ‚LastCenter ƒorg/apache/bsf/BSFManager „… †‡xslt:srcjava/io/FileReader ˆ‰xsltŠ ‹Œ Ž , ‘ TableFillerjava/lang/Objectjava/lang/Exceptionjava/lang/SystemerrLjava/io/PrintStream;java/io/PrintStreamprintln(Ljava/lang/String;)Vexit(I)VaddWindowListener"(Ljava/awt/event/WindowListener;)V(II)V(Ljava/awt/LayoutManager;)V(Ljava/lang/String;II)VsetFont(Ljava/awt/Font;)Vadd*(Ljava/awt/Component;)Ljava/awt/Component;<(Ljava/lang/String;Ljava/awt/Component;)Ljava/awt/Component;getClass()Ljava/lang/Class; declareBean8(Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Class;)V registerBean'(Ljava/lang/String;Ljava/lang/Object;)Vorg/apache/bsf/util/IOUtilsgetStringFromReader$(Ljava/io/Reader;)Ljava/lang/String;exec;(Ljava/lang/String;Ljava/lang/String;IILjava/lang/Object;)Vpack setVisible(Z)V!)*+,-/*·±. / 01 23-™Ñ*¾Ÿ²¶¸*2L*2M»Y·N-» Y· ¶ » Y» Y··:»Y·:»Y·:¶¶W»Y·:¶¶W-¶W»Y·:¶¶ »!Y,·"¶#$+»!Y+·"¸%¶&-¶'-¶(±.^$/AOZai t!{"ƒ#Œ%•(£+²0Ç4Ë6Ð7/RÑ45»67·87$­9:A;<O‚=>Zw?@•<ABCDEFS  libbsf-java-2.4.0/samples/xsl/style2.xsl0000644000175000017500000000123610511475731017113 0ustar mkochmkoch libbsf-java-2.4.0/samples/bsh/0000755000175000017500000000000010736513022015100 5ustar mkochmkochlibbsf-java-2.4.0/samples/bsh/calculator.js0000644000175000017500000000267110511475731017602 0ustar mkochmkoch/* A silly little calculator implemented in Javascript (Rhino) using Java components for the UI. */ f = new java.awt.Frame ("BSH Calculator (js)"); bsf.addEventListener (f, "window", "windowClosing", "java.lang.System.exit (0);"); f1 = new java.awt.TextField (20); bsf.addEventListener (f1, "action", null, "doMath ()"); f2 = new java.awt.TextField (20); bsf.addEventListener (f2, "text", null, "doMath ()"); p = new java.awt.Panel (); p.setLayout (new java.awt.GridLayout (2, 2)); p.add (new java.awt.Label ("Enter Operand")); p.add (f1); p.add (new java.awt.Label ("Enter Operand")); p.add (f2); f.add ("North", p); f.add ("Center", new java.awt.Label ("Results:")); p = new java.awt.Panel (); p.setLayout (new java.awt.GridLayout (4, 2)); p.add (new java.awt.Label ("Sum")); p.add (sum = new java.awt.TextField (20)) p.add (new java.awt.Label ("Difference")); p.add (diff = new java.awt.TextField (20)); p.add (new java.awt.Label ("Product")); p.add (prod = new java.awt.TextField (20)); p.add (new java.awt.Label ("Quotient")); p.add (quo = new java.awt.TextField (20)); f.add ("South", p); f.pack (); f.show (); f.toFront (); function getField (f) { t = f.getText (); return (t == "") ? 0 : java.lang.Integer.parseInt (t); } function doMath () { n1 = getField (f1); n2 = getField (f2); sum.setText ((n1 + n2) + ""); diff.setText ((n1 - n2) + ""); prod.setText ((n1 * n2) + ""); quo.setText ((n1 / n2) + ""); } libbsf-java-2.4.0/samples/bsh/calculator.rex0000644000175000017500000000620710511475731017763 0ustar mkochmkoch/* A silly little calculator implemented in Object Rexx using Java components for the UI. ("bsf\samples\bsh\calculator.js" served as an example) ooRexx (FOSS): BSF4Rexx (FOSS): or eventually at license: ------------------------ Apache Version 2.0 license ------------------------- Copyright (C) 2001-2006 Rony G. Flatscher Licensed 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. ----------------------------------------------------------------------------- */ if BsfInvokedBy()=1 then say "This Rexx program was invoked by Java!" else if BsfInvokedBy()=2 then say "This Rexx program was invoked by Rexx, JVM loaded by Rexx!" else say "No JVM present, we got troubles ..." .bsf~bsf.import("java.awt.TextField", "awtTextField") .bsf~bsf.import("java.awt.Label" , "awtLabel" ) f = .bsf~new("java.awt.Frame", "BSH Calculator (ooRexx)") f~bsf.addEventListener("window", "windowClosing", "call bsf 'exit'") f1 = .awtTextField~newStrict("int", 20) -- "newStrict" to force the constructor with the "int" argument f1~bsf.addEventListener("action", "", "call doMath /* action event */") f2 = .awtTextField~newStrict("int", 20) f2~bsf.addEventListener("text", "", "call doMath /* text event */") p = .bsf~new( "java.awt.Panel") ~~setLayout(.bsf~new("java.awt.GridLayout", 2, 2)) p ~~add(.awtLabel~new("Enter operand")) ~~add(f1) p ~~add(.awtLabel~new("Enter operand")) ~~add(f2) f ~~add("North", p) ~~add("Center", .awtLabel~new("Results:")) p = .bsf~new("java.awt.Panel") ~~setLayout(.bsf~new("java.awt.GridLayout", 4, 2)) sum= .awtTextField~newStrict("int", 20) p ~~add(.awtLabel~new("Sum")) ~~add(sum) diff= .awtTextField~newStrict("int", 20) p ~~add(.awtLabel~new("Difference")) ~~add(diff) prod= .awtTextField~newStrict("int", 20) p ~~add(.awtLabel~new("Product")) ~~add(prod) quo = .awtTextField~newStrict("int", 20) p ~~add(.awtLabel~new("Quotient")) ~~add(quo) f ~~add("South", p) ~~pack ~~show ~~toFront do forever interpret .bsf~bsf.pollEventText -- retrieve eventText and interpret it end exit getField: procedure use arg f t=f~getText if t="" then return 0 return t doMath: n1 = getField(f1); if n1="-" then n1=-1;else if n1="+" then n1=1 n2 = getField(f2); if n2="-" then n2=-1;else if n2="+" then n2=1 sum ~setText(n1+n2) diff~setText(n1-n2) prod~setText(n1*n2) if n2=0 then quo~setText("DIVISION by 0 !!!") else quo~setText(n1/n2) return ::requires BSF.CLS -- get Object Rexx wrapper support libbsf-java-2.4.0/samples/bsh/download.rex0000644000175000017500000000371110511475731017436 0ustar mkochmkoch/* This is a simple demo of a Rexx (modelled after the JavaScript) script that uses the Java URL class to download some content from some URL. ooRexx (FOSS): BSF4Rexx (FOSS): or eventually at license: ------------------------ Apache Version 2.0 license ------------------------- Copyright (C) 2003-2006 Rony G. Flatscher Licensed 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. ----------------------------------------------------------------------------- */ /* use the Java URL class to read data from a WWW server */ URL_ADDR = "http://www.RexxLA.org/"; say "connecting to:" URL_ADDR url=.bsf~new("java.net.URL", URL_ADDR) -- create a URL instance /* get the content, a a subclass of: , a subclass of: */ content = url~getContent /* get the content object */ say "Bytes available:" content~available /* get # of bytes */ say "Downloading .. " ch="" do until ch=-1 /* read the content */ ch=content~read /* returns an Integer value representing a Byte or -1 */ if ch>=0 then call charout , ch~d2c /* turn Byte integer value into character */ end ::requires BSF.CLS -- Object Rexx wrapper classes libbsf-java-2.4.0/samples/bsh/download.js0000644000175000017500000000073610511475731017260 0ustar mkochmkoch/* This is a simple demo of a JavaScript script that uses the Java URL class to download some content from some URL. */ URL_ADDR = "http://www.cnn.com/"; /* use a Java bean to get at the URL */ java.lang.System.err.println ("Connecting to .. " + URL_ADDR); url = new java.net.URL (URL_ADDR); /* read the content */ java.lang.System.err.println ("Downloading .. "); content = url.getContent (); while ((ch = content.read ()) != -1) { java.lang.System.out.write (ch) } libbsf-java-2.4.0/samples/bsh/calculator.py0000644000175000017500000000226310511475731017613 0ustar mkochmkoch"""\ A silly little calculator implemented in JPython using Java components for the UI. """ import java from java import awt def exit(e): java.lang.System.exit(0) def getField (f): t = f.getText () if t == '': return 0 else: return java.lang.Integer.parseInt (t) def doMath (e): n1 = getField (f1) n2 = getField (f2) sum.setText (repr (n1 + n2)) diff.setText (repr (n1 - n2)) prod.setText (repr (n1 * n2)) quo.setText (repr (n1 / n2)) f = awt.Frame ('BSH Calculator (jpython)', windowClosing=exit) f1 = awt.TextField (20, actionPerformed=doMath) f2 = awt.TextField (20, textValueChanged=doMath) p = awt.Panel () p.setLayout (awt.GridLayout (2, 2)) p.add (awt.Label ('Enter Operand')) p.add (f1) p.add (awt.Label ('Enter Operand')) p.add (f2) f.add ('North', p) f.add ("Center", awt.Label ('Results:')) p = awt.Panel () p.setLayout (awt.GridLayout (4, 2)) p.add (awt.Label ('Sum')) sum = awt.TextField (20) p.add (sum) p.add (awt.Label ('Difference')) diff = awt.TextField (20) p.add (diff) p.add (awt.Label ('Product')) prod = awt.TextField (20) p.add (prod) p.add (awt.Label ('Quotient')) quo = awt.TextField (20) p.add (quo) f.add ('South', p) f.pack () f.show () f.toFront () libbsf-java-2.4.0/samples/bsh/readme0000644000175000017500000000055710511475731016274 0ustar mkochmkoch To run any of the scripts here, type: java org.apache.bsf.Main -in filename -mode exec where filename is any of the script files here. You need to have the BSF jar file and any language-specific jars/zips on your classpath. Note: The mode must be set to "exec" to avoid the language's interpreter/compiler from treating the script as an expression. libbsf-java-2.4.0/samples/bsh/calculator.jacl0000644000175000017500000000311610511475731020072 0ustar mkochmkoch# A silly little calculator implemented in Jacl using # Java components for the UI. package require java set f [java::new java.awt.Frame "BSH Calculator (jacl/tcl)"] bsf addEventListener $f "window" "windowClosing" "exit" set p [java::new java.awt.Panel] set f1 [java::new java.awt.TextField] $f1 setColumns 20 bsf addEventListener $f1 "action" "" "doMath" set f2 [java::new java.awt.TextField] bsf addEventListener $f2 "text" "" "doMath" set p [java::new java.awt.Panel] $p setLayout [java::new java.awt.GridLayout 2 2] $p add [java::new java.awt.Label "Enter Operand"] $p add $f1 $p add [java::new java.awt.Label "Enter Operand"] $p add $f2 $f add "North" $p $f add "Center" [java::new java.awt.Label "Results:"] set p [java::new java.awt.Panel] $p setLayout [java::new java.awt.GridLayout 4 2] $p add [java::new java.awt.Label "Sum"] $p add [set sum [java::new java.awt.TextField]] $sum setColumns 20 $p add [java::new java.awt.Label "Difference"] $p add [set diff [java::new java.awt.TextField]] $p add [java::new java.awt.Label "Product"] $p add [set prod [java::new java.awt.TextField]] $p add [java::new java.awt.Label "Quotient"] $p add [set quo [java::new java.awt.TextField]] $f add "South" $p $f pack $f show $f toFront proc getField {f} { set t [$f getText] if {$t == ""} { return 0 } else { return [java::call java.lang.Integer parseInt $t] } } proc doMath {} { global f1 f2 sum diff prod quo set n1 [getField $f1] set n2 [getField $f2] $sum setText [expr $n1 + $n2] $diff setText [expr $n1 - $n2] $prod setText [expr $n1 * $n2] $quo setText [expr $n1 / $n2] } libbsf-java-2.4.0/samples/scriptedui/0000755000175000017500000000000010736513022016477 5ustar mkochmkochlibbsf-java-2.4.0/samples/scriptedui/ui.nrx0000644000175000017500000000126510511475731017656 0ustar mkochmkoch /* pick up the center panel bean */ p = java.awt.Panel bsf.lookupBean("centerPanel"); /* set the layout manager to border */ p.setLayout(java.awt.BorderLayout()); /* add a few things */ p.add("Center", java.awt.Label("Middle from NetRexx")); p.add("North", java.awt.TextField("north text from NetRexx")); p.add("South", java.awt.TextField("south text from NetRexx")); p.add("East", java.awt.Button("inner east from NetRexx")); p.add("West", java.awt.Button("inner west from NetRexx")); /* configure p a bit */ p.setBackground(java.awt.Color(255, 0, 0)); /* configure the frame that p is in */ f = java.awt.Frame p.getParent(); f.setTitle("Hello from NetRexx (title reset from NetRexx)"); libbsf-java-2.4.0/samples/scriptedui/ui.js0000644000175000017500000000131510511475731017457 0ustar mkochmkoch /* pick up the center panel bean */ p = bsf.lookupBean ("centerPanel"); /* set the layout manager to border */ p.setLayout (new java.awt.BorderLayout ()); /* add a few things */ p.add ("Center", new java.awt.Label ("Middle from JavaScript")); p.add ("North", new java.awt.TextField ("north text from JavaScript")); p.add ("South", new java.awt.TextField ("south text from JavaScript")); p.add ("East", new java.awt.Button ("inner east from JavaScript")); p.add ("West", new java.awt.Button ("inner west from JavaScript")); /* configure p a bit */ p.setBackground (java.awt.Color.red); /* configure the frame that p is in */ f = p.getParent (); f.setTitle ("Hello from JavaScript (title reset from JavaScript)"); libbsf-java-2.4.0/samples/scriptedui/ScriptedUI$1.class0000644000175000017500000000113410511475731021672 0ustar mkochmkochÊþº¾."   this$0 LScriptedUI; Synthetic(LScriptedUI;)VCodeLineNumberTableLocalVariableTablethis InnerClassesLScriptedUI$1; windowClosing(Ljava/awt/event/WindowEvent;)VeLjava/awt/event/WindowEvent; SourceFileScriptedUI.java   ! ScriptedUI$1java/awt/event/WindowAdapter()Vjava/lang/Systemexit(I)V   > *·*+µ±     =¸±   libbsf-java-2.4.0/samples/scriptedui/ScriptedUI.java0000644000175000017500000000342310511475731021364 0ustar mkochmkoch/* This example shows how a Java app can allow a script to customize a UI */ import java.awt.*; import java.awt.event.*; import java.io.*; import org.apache.bsf.*; import org.apache.bsf.util.*; public class ScriptedUI { BSFManager mgr = new BSFManager (); public ScriptedUI (String fileName) { Frame f = new Frame ("Application's Main Frame"); f.addWindowListener (new WindowAdapter () { public void windowClosing (WindowEvent e) { System.exit (0); } }); Panel p = new Panel (); f.add ("Center", p); f.add ("North", new Button ("North Button")); f.add ("South", new Button ("South Button")); mgr.registerBean ("centerPanel", p); mgr.registerBean ("parentFrame", f); // --rgf, 2006-08-08: to allow Jacl to get to frame ... // exec script engine code to do its thing for this try { String language = BSFManager.getLangFromFilename (fileName); FileReader in = new FileReader (fileName); String script = IOUtils.getStringFromReader (in); mgr.exec (language, fileName, -1, -1, script); } catch (BSFException e) { System.err.println ("Ouch: " + e.getMessage ()); e.printStackTrace (); } catch (IOException e) { System.err.println ("Ouch: " + e.getMessage ()); e.printStackTrace (); } // now pack and show the frame f.pack (); // f.show(); // javac 1.5 warns to use f.show(), Apache build scripts abort as a result :( f.setVisible(true); // available since Java 1.1 } public static void main (String[] args) throws Exception { if (args.length != 1) { System.err.println ("Usage: java ScriptedUI filename"); System.err.println (" where filename is the name of the script"); System.exit (1); } new ScriptedUI (args[0]); } } libbsf-java-2.4.0/samples/scriptedui/ui.rex0000644000175000017500000000400010511475731017633 0ustar mkochmkoch/* pick up the center panel bean, Object Rexx program modelled after ui.nrx */ /* ooRexx (FOSS): BSF4Rexx (FOSS): or eventually at ------------------------ Apache Version 2.0 license ------------------------- Copyright (C) 2003-2006 Rony G. Flatscher Licensed 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. ----------------------------------------------------------------------------- */ p = .bsf~bsf.lookupBean("centerPanel") -- reference the entry in BSF registry, put there by -- the Java program "ScriptedUI.class" /* set the layout manager to border */ p~setLayout(.bsf~new("java.awt.BorderLayout")) /* add a few things */ p~add("Center", .bsf~new("java.awt.Label", "Middle from Object Rexx")) p~add("North", .bsf~new("java.awt.TextField", "North text from Object Rexx")) p~add("South", .bsf~new("java.awt.TextField", "South text from Object Rexx")) p~add("East", .bsf~new("java.awt.Button", "Inner east text from Object Rexx")) p~add("West", .bsf~new("java.awt.Button", "Inner west text from Object Rexx")) /* configure p a bit */ p~setBackground(.bsf~bsf.getStaticValue("java.awt.Color", "green")) /* configure the frame that p is in */ f=p~getParent f~setTitle("Hello from Object REXX (title reset from Object Rexx)") ::requires BSF.CLS -- get Object Rexx wrapper support for BSF libbsf-java-2.4.0/samples/scriptedui/ui.py0000644000175000017500000000124610511475731017476 0ustar mkochmkoch"""\ A silly little calculator implemented in JPython using Java components for the UI. Rony G. Flatscher, 2006-08-08 """ import java from java import awt p = bsf.lookupBean('centerPanel') p.setLayout ( awt.BorderLayout () ) p.add ("Center", java.awt.Label ("Middle from Jython")) p.add ("North", java.awt.TextField ("north text from Jython")) p.add ("South", java.awt.TextField ("south text from Jython")) p.add ("East", java.awt.Button ("inner east from Jython")) p.add ("West", java.awt.Button ("inner west from Jython")) p.setBackground (java.awt.Color.orange) f = p.getParent () f.setTitle ("Hello from Jython (title reset from Jython)") libbsf-java-2.4.0/samples/scriptedui/readme0000644000175000017500000000055610511475731017672 0ustar mkochmkoch In this demo we create some components in Java, register them into BSF, then run a script using BSF to affect those components, and finally come back into Java and continue on. To run, type: java ScriptedUI scriptfilename where filename is any of the script files here. You need to have the BSF jar file and any language-specific jars/zips on your classpath. libbsf-java-2.4.0/samples/scriptedui/ui.jacl0000644000175000017500000000204710511475731017757 0ustar mkochmkoch# A silly little calculator implemented in Jacl using # Java components for the UI. # Rony G. Flatscher, 2006-08-08 package require java set p [bsf lookupBean "centerPanel"] $p setLayout [java::new java.awt.BorderLayout] $p add "Center" [java::new java.awt.Label "Middle from Jacl"] $p add "North" [java::new java.awt.TextField "north text from Jacl"] $p add "South" [java::new java.awt.TextField "south text from Jacl"] $p add "East" [java::new java.awt.Button "inner east from Jacl"] $p add "West" [java::new java.awt.Button "inner west from Jacl"] $p setBackground [java::field java.awt.Color pink] set f [$p getParent] # needed, because the getParent() returns a "java.awt.Container" not "java.awt.Frame" # in the Jacl engine! The following does not hint at the Java class (other than # java.lang.Object) such that the Jacl engine *seems* to start reflection at the # class from which the object got created from set f [bsf lookupBean "parentFrame"] $f setTitle "Hello from Jacl (title reset from Jacl)" libbsf-java-2.4.0/samples/scriptedui/ScriptedUI.class0000644000175000017500000000474710511475731021562 0ustar mkochmkochÊþº¾.ž 1PQ P /RST UV Y Z[ P\ ]^_` Uabc de fg U hi jk lmn Po p q r st uv 'q 'u w xyz l{| /U}mgrLorg/apache/bsf/BSFManager;(Ljava/lang/String;)VCodeLineNumberTableLocalVariableTablelanguageLjava/lang/String;inLjava/io/FileReader;scripteLorg/apache/bsf/BSFException;Ljava/io/IOException;this LScriptedUI;fileNamefLjava/awt/Frame;pLjava/awt/Panel;main([Ljava/lang/String;)Vargs[Ljava/lang/String; Exceptions~ SourceFileScriptedUI.java 4org/apache/bsf/BSFManager 23java/awt/FrameApplication's Main Frame 45 ScriptedUI$1 InnerClasses 4€ ‚java/awt/PanelCenter ƒ„Northjava/awt/Button North ButtonSouth South Button centerPanel …† parentFrame ‡ˆjava/io/FileReader‰ Š‹ Œorg/apache/bsf/BSFExceptionŽ java/lang/StringBufferOuch: ‘’ “” •”– —5 ˜java/io/IOException ™ š›Usage: java ScriptedUI filename/ where filename is the name of the script œ ScriptedUIjava/lang/Objectjava/lang/Exception()V(LScriptedUI;)VaddWindowListener"(Ljava/awt/event/WindowListener;)Vadd<(Ljava/lang/String;Ljava/awt/Component;)Ljava/awt/Component; registerBean'(Ljava/lang/String;Ljava/lang/Object;)VgetLangFromFilename&(Ljava/lang/String;)Ljava/lang/String;org/apache/bsf/util/IOUtilsgetStringFromReader$(Ljava/io/Reader;)Ljava/lang/String;exec;(Ljava/lang/String;Ljava/lang/String;IILjava/lang/Object;)Vjava/lang/SystemerrLjava/io/PrintStream;append,(Ljava/lang/String;)Ljava/lang/StringBuffer; getMessage()Ljava/lang/String;toStringjava/io/PrintStreamprintlnprintStackTracepack setVisible(Z)Vexit(I)V!/123456Ðæ*·*»Y·µ»Y·M,»Y*· ¶ » Y· N, -¶W,»Y·¶W,»Y·¶W*´-¶*´,¶+¸:»Y+·:¸:*´+¶§N:²»Y· !¶"¶#¶"¶$¶%¶&§':²»Y· !¶"¶(¶"¶$¶%¶),¶*,¶+±iŽ‘iޏ'7f %-5EU_i o!y"€$Ž+‘%“&°'µ+¸(º)×*Ü.à0å18\ o9:y;<€=:“">?º">@æABæC:ÍDE-¹FG HI6d&*¾Ÿ²,¶%²-¶%¸.»/Y*2·0W±745679%:8 &JKLMNOX libbsf-java-2.4.0/samples/calc/0000755000175000017500000000000010736513022015226 5ustar mkochmkochlibbsf-java-2.4.0/samples/calc/TestCalc.class0000644000175000017500000000401710511475731017766 0ustar mkochmkochÊþº¾.ƒ "<= <> ?@ A BC D EF GH IJK <L M N O PQ RS TN U IVW IXY D "Z[ < "^_(Ljava/lang/String;)VCodeLineNumberTableLocalVariableTableoeLjava/lang/Throwable;eLorg/apache/bsf/BSFException;this LTestCalc;fileNameLjava/lang/String;managerLorg/apache/bsf/BSFManager; Exceptions`main([Ljava/lang/String;)Vargs[Ljava/lang/String;fLjava/awt/Frame; SourceFile TestCalc.java #aorg/apache/bsf/BSFManagerframeb cd ef ghjava/io/FileReader #$i jk lmorg/apache/bsf/BSFExceptionn opjava/lang/StringBuffer exception: qr st utv w$ xy Original Exception:z {a |pMissing file name }~TestCalc € TestCalc$1 InnerClasses ‚java/awt/Framejava/lang/Exception()Vjava/lang/ObjectgetClass()Ljava/lang/Class; declareBean8(Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Class;)VgetLangFromFilename&(Ljava/lang/String;)Ljava/lang/String;org/apache/bsf/util/IOUtilsgetStringFromReader$(Ljava/io/Reader;)Ljava/lang/String;exec;(Ljava/lang/String;Ljava/lang/String;IILjava/lang/Object;)Vjava/lang/SystemoutLjava/io/PrintStream;append,(Ljava/lang/String;)Ljava/lang/StringBuffer; getMessage()Ljava/lang/String;toStringjava/io/PrintStreamprintlngetTargetException()Ljava/lang/Throwable;java/lang/ThrowableprintStackTraceerrexit(I)V setVisible(Z)VaddWindowListener"(Ljava/awt/event/WindowListener;)V!"#$%ÿ}*·»Y·M,**¶¶,,W+¸+»Y+· ¸ ¶ §MN² »Y·¶-¶¶¶¶-¶:¥ ² »Y·¶¶¶¶¶-¶±/2 &.  /23OUx|'4U'()3I*+},-}./ q0123 45%z.*¾Ÿ²¶¸»Y*2·L+¶+»Y· ¶!±& #%"'-*'.678923:;] libbsf-java-2.4.0/samples/calc/TestCalc.java0000644000175000017500000000233110511475731017577 0ustar mkochmkochimport java.io.*; import java.awt.*; import java.awt.event.*; import java.util.*; import org.apache.bsf.*; import org.apache.bsf.util.*; public class TestCalc extends Frame { public TestCalc (String fileName) throws Exception { BSFManager manager = new BSFManager (); manager.declareBean("frame", this, this.getClass()); try { manager.exec(manager.getLangFromFilename(fileName), fileName, 0, 0, IOUtils.getStringFromReader(new FileReader(fileName))); }catch(BSFException e ) { System.out.println("exception: " + e.getMessage()); Throwable oe= e.getTargetException(); if(null != oe) System.out.println("\nOriginal Exception:"+ oe.getMessage()); e.printStackTrace(); } } public static void main (String[] args) throws Exception { if (args.length != 1) { System.err.println("Missing file name"); System.exit(1); } Frame f = new TestCalc(args[0]); // f.show(); // javac 1.5 warns to use f.show(), Apache build scripts abort as a result :( f.setVisible(true); // available since Java 1.1 f.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } } ); } } libbsf-java-2.4.0/samples/calc/TestCalc$1.class0000644000175000017500000000076510511475731020121 0ustar mkochmkochÊþº¾.  ()VCodeLineNumberTableLocalVariableTablethis InnerClasses LTestCalc$1; windowClosing(Ljava/awt/event/WindowEvent;)VeLjava/awt/event/WindowEvent; SourceFile TestCalc.java   TestCalc$1java/awt/event/WindowAdapterjava/lang/Systemexit(I)V /*·±(  9¸±(   libbsf-java-2.4.0/samples/calc/TestCalc.rex0000644000175000017500000000665510511475731017471 0ustar mkochmkoch/* ooRexx (FOSS): BSF4Rexx (FOSS): or eventually at ------------------------ Apache Version 2.0 license ------------------------- Copyright (C) 2001-2006 Rony G. Flatscher Licensed 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. ----------------------------------------------------------------------------- */ /********************************************************* * A simple four function calculator, written in REXX * *********************************************************/ /* *** create a res window */ res = .bsf~new("java.awt.TextField", 0) /* *** create a panel of buttons */ panel = .bsf~new("java.awt.Panel") panel~setLayout(.bsf~new("java.awt.GridLayout", 4, 4)) buttons = "789*456/123-C0.+" do i=1 to buttons~length label=buttons~substr(i, 1) button=.bsf~new("java.awt.Button", label) panel~add(button) if "*/-+"~pos(label)>0 then button~bsf.addEventListener("action", "", "call op '" ||label||"'") else if label="C" then button~bsf.addEventListener("action", "", "call clear") else button~bsf.addEventListener("action", "", "call press" label) end /* *** Place everything in the frame */ frame = .bsf~bsf.lookupBean("frame") frame~~setTitle("Object Rexx Calc") ~~resize(130, 200) frame~~add("North", res) ~~add("Center", panel) ~~validate ~~show frame~bsf.addEventListener("window", "windowClosing", "call bsf 'exit'") /* *** Initialize the state of the calculator */ mem = 0 nextOp = "+" autoClear = 1 /* true */ do forever /* get eventText and execute it as a Rexx program */ interpret .bsf~bsf.pollEventText end exit press: /* handle data entry keys */ parse arg key if autoClear then res~bsf.invokestrict("setText", "str", 0) if res~getText=="0" & key<>"." then res~bsf.invokeStrict("setText", "str", "") -- res~setText("str", "") if key="." then if pos(".", res~getText)>0 then key="" -- res~setText("str", res~getText || key) res~bsf.invokeStrict("setText", "str", res~getText || key) autoClear=0 /* set it to false */ return /* *** handle arithmetic keys */ op: parse arg key num=res~getText if nextOp="+" then mem=mem+num else if nextOp="-" then mem=mem-num else if nextOp="*" then mem=mem*num else if nextOp="/" & num<>0 then mem=mem/num nextOp=key -- res~setText("str", mem) res~bsf.invokeStrict("setText", "str", mem) autoClear=1 /* set to true */ return /* handle the "C" key */ clear: mem=0 nextOp="" -- res~setText("str", 0) res~bsf.invokeStrict("setText", "str", 0) return ::requires BSF.CLS -- add Object Rexx proxy support libbsf-java-2.4.0/samples/calc/readme0000644000175000017500000000140610511475731016414 0ustar mkochmkochTo run this demo type: java TestCalc filename Please note that as of 2006-09-07 the proprietary Windows scripting languages do not run with the standard distribution. Reason: due to licensing issues IBM was not able to donate the necessary supporting OLE/ActiveX C++ code. Maybe someone picks up this task? The Rexx example (transcribed from the original Windows script examples) works, as it is not dependent on the Windows infrastructure: java TestCalc TestCalc.rex ---rgf, 2006-09-07 ================ original text of "readme" as of 2003-10-07 ============= To run this demo type: java TestCalc filename where filename is one of TestCalc.vbs or TestCalc.jss or TestCalc.pls. You need to have bsf.jar on your classpath and ../../lib/win32 on your path. libbsf-java-2.4.0/NOTICE.txt0000644000175000017500000000027310511475731014411 0ustar mkochmkochBeans Scripting Framework (BSF) Copyright 2002-2006 The Apache Software Foundation. This product includes software developed at The Apache Software Foundation (http://www.apache.org/). libbsf-java-2.4.0/RELEASE-NOTE.txt0000644000175000017500000000702010511475731015250 0ustar mkochmkoch<-- Copyright 2006 The Apache Software Foundation. Licensed 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. --> ========================= BSF 2.4, 2006-10-06 ========================= ========================================================= Release notes for BSF 2.4 (http://jakarta.apache.org/bsf) ========================================================= About the "Bean Scripting Framework (BSF)" ========================================== BSF allows Java programmers to easily deploy scripts written in many scripting (like) languages like JavaScript, JLog (PROLOG) Jython, Rexx, and use even XSLT with the same simple, but powerful BSF APIs. It is possible to supply arguments and retrieve result values from the scripts, as well as sharing Java objects among each other (and among all scripts that are deployed with the help of the same BSF manager). BSF itself can be deployed starting with Java version 1.3, but some scripting languages may need newer versions of Java. This release is meant to be fully compatible with any previous version of BSF. Changes to previous release candidate ===================================== - Bug fixes, e.g. - datatype conversion now encompasses the oversighted primitive datatype "char" into account (class 'TypeConvertor.java', 'TypeConvertorRegistry.java') - dynamic event adapter creation now succeeds - fixed a few spelling errors in the code - Enhancements, changes, e.g. - can be used as an extension package to Java by placing it into "jre/lib/ext" [using the thread's context classloader, ie. the result of 'Thread.currentThread().getContextClassLoader()'] - removed experimental 'DebugLog' class, superceded by commons-logging and log4j - removed 'org.apache.bsf.engines.activescript.*', as it is not supported anymore (stems from the original IBM codebase, but would need native Windows code to bridge OLE/ActiveX) - removed 'org.apache.bsf.engines.jpython', as it is superceded by the newer 'org.apache.bsf.engines.jython' - 'org.apache.bsf.BSFMain.java': new method "public String getVersion()", returns string in the form of a dewey decimal number 'abc' (three levels, each between 0 and 9) 'abc.yyyymmdd', 'yyyy' four digit year, 'mm' two digit month, 'dd' two digit day; e.g. '240.20061006' stands for: BSF version 2.4.0 as of 2006-10-06 - new class 'org.apache.bsf.utils.BSFEventProcessorReturningEventInfos' - 'org.apache.bsf.utils.EngineUtils.java': added the method 'addEventListenerReturningEventInfos(...)' People who have contributed to this release one way or the other (order by first name) ================================================================ Don Schwarz Henning P. Schmiedehausen Igor Bukanov Kev Jackson Nandika Jayawardana Nilupa Bandara Rony G. Flatscher Sanjiva Weerawarana Sanka Samaranayke Thomas Klaeger (Kläger) Victor J. Orlikowski libbsf-java-2.4.0/docs/0000755000175000017500000000000010511475731013615 5ustar mkochmkochlibbsf-java-2.4.0/docs/api/0000755000175000017500000000000010736513022014361 5ustar mkochmkochlibbsf-java-2.4.0/docs/api/index-all.html0000644000175000017500000043052610511475731017143 0ustar mkochmkoch Index (Bean Scripting Framework API)
A B C D E F G I J K L M N O P R S T U V W X

A

AdapterClassLoader - class org.apache.bsf.util.event.generator.AdapterClassLoader.
 
AdapterClassLoader() - Constructor for class org.apache.bsf.util.event.generator.AdapterClassLoader
 
actionPerformed(ActionEvent) - Method in class org.apache.bsf.util.event.adapters.java_awt_event_ActionAdapter
 
addBytes(byte[], byte[]) - Static method in class org.apache.bsf.util.event.generator.ByteUtility
 
addBytes(byte[], byte) - Static method in class org.apache.bsf.util.event.generator.ByteUtility
 
addBytes(byte[], int) - Static method in class org.apache.bsf.util.event.generator.ByteUtility
 
addBytes(byte[], long) - Static method in class org.apache.bsf.util.event.generator.ByteUtility
 
addBytes(byte[], String) - Static method in class org.apache.bsf.util.event.generator.ByteUtility
 
addBytes(byte[], short) - Static method in class org.apache.bsf.util.event.generator.ByteUtility
 
addClass(byte[], short) - Static method in class org.apache.bsf.util.event.generator.Bytecode
 
addConstructorArgument(ObjInfo) - Method in class org.apache.bsf.util.CodeBuffer
 
addConstructorException(String) - Method in class org.apache.bsf.util.CodeBuffer
 
addConstructorStatement(String) - Method in class org.apache.bsf.util.CodeBuffer
 
addEventListener(Object, String, String, Object) - Method in class org.apache.bsf.util.BSFFunctions
 
addEventListener(Object, String, String, BSFEngine, BSFManager, String, int, int, Object) - Static method in class org.apache.bsf.util.EngineUtils
Add a script as a listener to some event coming out of an object.
addEventListener(Object, String, EventProcessor) - Static method in class org.apache.bsf.util.ReflectionUtils
Add an event processor as a listener to some event coming out of an object.
addEventListenerReturningEventInfos(Object, String, String, BSFEngine, BSFManager, String, int, int, Object, Object) - Static method in class org.apache.bsf.util.EngineUtils
Add a script as a listener to some event coming out of an object.
addFieldDeclaration(String) - Method in class org.apache.bsf.util.CodeBuffer
 
addFieldRef(byte[], short, short) - Static method in class org.apache.bsf.util.event.generator.Bytecode
 
addImplements(String) - Method in class org.apache.bsf.util.CodeBuffer
 
addImport(String) - Method in class org.apache.bsf.util.CodeBuffer
 
addInitializerStatement(String) - Method in class org.apache.bsf.util.CodeBuffer
 
addInteger(byte[], int) - Static method in class org.apache.bsf.util.event.generator.Bytecode
 
addInterfaceMethodRef(byte[], short, short) - Static method in class org.apache.bsf.util.event.generator.Bytecode
 
addLong(byte[], long) - Static method in class org.apache.bsf.util.event.generator.Bytecode
 
addMethodDeclaration(String) - Method in class org.apache.bsf.util.CodeBuffer
 
addMethodRef(byte[], short, short) - Static method in class org.apache.bsf.util.event.generator.Bytecode
 
addNameAndType(byte[], short, short) - Static method in class org.apache.bsf.util.event.generator.Bytecode
 
addRef(byte, byte[], short) - Static method in class org.apache.bsf.util.event.generator.Bytecode
 
addRef(byte, byte[], short, short) - Static method in class org.apache.bsf.util.event.generator.Bytecode
 
addServiceMethodException(String) - Method in class org.apache.bsf.util.CodeBuffer
 
addServiceMethodStatement(String) - Method in class org.apache.bsf.util.CodeBuffer
 
addString(byte[], short) - Static method in class org.apache.bsf.util.event.generator.Bytecode
 
addUtf8(byte[], String) - Static method in class org.apache.bsf.util.event.generator.Bytecode
 
adjustmentValueChanged(AdjustmentEvent) - Method in class org.apache.bsf.util.event.adapters.java_awt_event_AdjustmentAdapter
 
apply(String, int, int, Object, Vector, Vector) - Method in interface org.apache.bsf.BSFEngine
This is used by an application to invoke an anonymous function.
apply(String, String, int, int, Object, Vector, Vector) - Method in class org.apache.bsf.BSFManager
Apply the given anonymous function of the given language to the given parameters and return the resulting value.
apply(String, int, int, Object, Vector, Vector) - Method in class org.apache.bsf.engines.jython.JythonEngine
Evaluate an anonymous function (differs from eval() in that apply() handles multiple lines).
apply(String, int, int, Object, Vector, Vector) - Method in class org.apache.bsf.util.BSFEngineImpl
Default impl of apply - calls eval ignoring parameters and returns the result.

B

BSFDeclaredBean - class org.apache.bsf.BSFDeclaredBean.
BSFDeclaredBeans are used internally by BSF to encapsulate information being passed between a BSFManager and its various BSFEngines.
BSFEngine - interface org.apache.bsf.BSFEngine.
This is the view of a scripting engine assumed by the Bean Scripting Framework.
BSFEngineImpl - class org.apache.bsf.util.BSFEngineImpl.
This is a base implementation of the BSFEngine interface which engine implementations may choose to extend to get the basic methods of the interface implemented.
BSFEngineImpl() - Constructor for class org.apache.bsf.util.BSFEngineImpl
 
BSFEventProcessor - class org.apache.bsf.util.BSFEventProcessor.
This is used to support binding scripts to be run when an event occurs.
BSFEventProcessorReturningEventInfos - class org.apache.bsf.util.BSFEventProcessorReturningEventInfos.
This is used to support binding scripts to be run when an event occurs, forwarding the arguments supplied to the event listener.
BSFException - exception org.apache.bsf.BSFException.
If something goes wrong while doing some scripting stuff, one of these is thrown.
BSFException(int, String) - Constructor for class org.apache.bsf.BSFException
 
BSFException(int, String, Throwable) - Constructor for class org.apache.bsf.BSFException
 
BSFException(String) - Constructor for class org.apache.bsf.BSFException
 
BSFFunctions - class org.apache.bsf.util.BSFFunctions.
This is a utility that engine implementors may use as the Java object they expose in the scripting language as "bsf".
BSFFunctions(BSFManager, BSFEngine) - Constructor for class org.apache.bsf.util.BSFFunctions
 
BSFManager - class org.apache.bsf.BSFManager.
This class is the entry point to the bean scripting framework.
BSFManager() - Constructor for class org.apache.bsf.BSFManager
 
Bean - class org.apache.bsf.util.Bean.
A Bean is the class used to represent a bean: it holds a type and a value.
Bean(Class, Object) - Constructor for class org.apache.bsf.util.Bean
 
ByteUtility - class org.apache.bsf.util.event.generator.ByteUtility.
Byte handling utilities 5 April 1999 - functions to append standard types to byte arrays functions to produce standard types from byte arrays
ByteUtility() - Constructor for class org.apache.bsf.util.event.generator.ByteUtility
 
Bytecode - class org.apache.bsf.util.event.generator.Bytecode.
Bytecode handling utilities Handle standard byte arrays as defined in Java VM and Class File 5 April 1999 - functions to append Class File byte subarrays into a Class File byte array
Bytecode() - Constructor for class org.apache.bsf.util.event.generator.Bytecode
 
bean - Variable in class org.apache.bsf.BSFDeclaredBean
 
buildNewSymbol(String) - Method in class org.apache.bsf.util.CodeBuffer
 
byteArrayToDouble(byte[], byte[]) - Static method in class org.apache.bsf.util.event.generator.ByteUtility
 
byteArrayToDouble(byte[]) - Static method in class org.apache.bsf.util.event.generator.ByteUtility
 
byteArrayToFloat(byte[]) - Static method in class org.apache.bsf.util.event.generator.ByteUtility
 
byteArrayToInt(byte[]) - Static method in class org.apache.bsf.util.event.generator.ByteUtility
 
byteArrayToLong(byte[]) - Static method in class org.apache.bsf.util.event.generator.ByteUtility
 
byteArrayToLong(byte[], byte[]) - Static method in class org.apache.bsf.util.event.generator.ByteUtility
 
byteArrayToShort(byte[]) - Static method in class org.apache.bsf.util.event.generator.ByteUtility
 
byteToHexString(byte) - Static method in class org.apache.bsf.util.event.generator.ByteUtility
 

C

CFDriver - class org.apache.bsf.util.cf.CFDriver.
This is an example of how a CodeFormatter bean can be used.
CFDriver() - Constructor for class org.apache.bsf.util.cf.CFDriver
Not used.
C_Class - Static variable in class org.apache.bsf.util.event.generator.Bytecode
 
C_Double - Static variable in class org.apache.bsf.util.event.generator.Bytecode
 
C_FieldRef - Static variable in class org.apache.bsf.util.event.generator.Bytecode
 
C_Float - Static variable in class org.apache.bsf.util.event.generator.Bytecode
 
C_Integer - Static variable in class org.apache.bsf.util.event.generator.Bytecode
 
C_InterfaceMethodRef - Static variable in class org.apache.bsf.util.event.generator.Bytecode
 
C_Long - Static variable in class org.apache.bsf.util.event.generator.Bytecode
 
C_MethodRef - Static variable in class org.apache.bsf.util.event.generator.Bytecode
 
C_NameAndType - Static variable in class org.apache.bsf.util.event.generator.Bytecode
 
C_String - Static variable in class org.apache.bsf.util.event.generator.Bytecode
 
C_Utf8 - Static variable in class org.apache.bsf.util.event.generator.Bytecode
 
CodeBuffer - class org.apache.bsf.util.CodeBuffer.
A CodeBuffer object is used as a code repository for generated Java code.
CodeBuffer() - Constructor for class org.apache.bsf.util.CodeBuffer
 
CodeBuffer(CodeBuffer) - Constructor for class org.apache.bsf.util.CodeBuffer
 
CodeFormatter - class org.apache.bsf.util.cf.CodeFormatter.
A CodeFormatter bean is used to format raw Java code.
CodeFormatter() - Constructor for class org.apache.bsf.util.cf.CodeFormatter
 
call(Object, String, Object[]) - Method in interface org.apache.bsf.BSFEngine
This is used by an application to call into the scripting engine to make a function/method call.
call(Object, String, Object[]) - Method in class org.apache.bsf.engines.jacl.JaclEngine
 
call(Object, String, Object[]) - Method in class org.apache.bsf.engines.javascript.JavaScriptEngine
Return an object from an extension.
call(Object, String, Object[]) - Method in class org.apache.bsf.engines.jython.JythonEngine
call the named method of the given object.
call(Object, String, Object[]) - Method in class org.apache.bsf.engines.netrexx.NetRexxEngine
Return an object from an extension.
call(Object, String, Object[]) - Method in class org.apache.bsf.engines.xslt.XSLTEngine
call the named method of the given object.
callBeanMethod(Object, String, Object[]) - Static method in class org.apache.bsf.util.EngineUtils
Finds and invokes a method with the given signature on the given bean.
classLoader - Variable in class org.apache.bsf.BSFManager
 
classLoader - Variable in class org.apache.bsf.util.BSFEngineImpl
 
classNameToVarName(String) - Static method in class org.apache.bsf.util.StringUtils
 
classPath - Variable in class org.apache.bsf.BSFManager
 
classPath - Variable in class org.apache.bsf.util.BSFEngineImpl
 
cleanString(String) - Static method in class org.apache.bsf.util.StringUtils
 
clearSymbolTable() - Method in class org.apache.bsf.util.CodeBuffer
 
compileApply(String, int, int, Object, Vector, Vector, CodeBuffer) - Method in interface org.apache.bsf.BSFEngine
This is used by an application to compile an anonymous function.
compileApply(String, String, int, int, Object, Vector, Vector, CodeBuffer) - Method in class org.apache.bsf.BSFManager
Compile the application of the given anonymous function of the given language to the given parameters into the given CodeBuffer.
compileApply(String, int, int, Object, Vector, Vector, CodeBuffer) - Method in class org.apache.bsf.util.BSFEngineImpl
Default impl of compileApply - calls compileExpr ignoring parameters.
compileExpr(String, int, int, Object, CodeBuffer) - Method in interface org.apache.bsf.BSFEngine
This is used by an application to compile a value-returning expression.
compileExpr(String, String, int, int, Object, CodeBuffer) - Method in class org.apache.bsf.BSFManager
Compile the given expression of the given language into the given CodeBuffer.
compileExpr(String, int, int, Object, CodeBuffer) - Method in class org.apache.bsf.util.BSFEngineImpl
Default impl of compileExpr - generates code that'll create a new manager, evaluate the expression, and return the value.
compileScript(String, int, int, Object, CodeBuffer) - Method in interface org.apache.bsf.BSFEngine
This is used by an application to compile some script.
compileScript(String, String, int, int, Object, CodeBuffer) - Method in class org.apache.bsf.BSFManager
Compile the given script of the given language into the given CodeBuffer.
compileScript(String, int, int, Object, CodeBuffer) - Method in class org.apache.bsf.util.BSFEngineImpl
Default impl of compileScript - generates code that'll create a new manager, and execute the script.
componentAdded(ContainerEvent) - Method in class org.apache.bsf.util.event.adapters.java_awt_event_ContainerAdapter
 
componentHidden(ComponentEvent) - Method in class org.apache.bsf.util.event.adapters.java_awt_event_ComponentAdapter
 
componentMoved(ComponentEvent) - Method in class org.apache.bsf.util.event.adapters.java_awt_event_ComponentAdapter
 
componentRemoved(ContainerEvent) - Method in class org.apache.bsf.util.event.adapters.java_awt_event_ContainerAdapter
 
componentResized(ComponentEvent) - Method in class org.apache.bsf.util.event.adapters.java_awt_event_ComponentAdapter
 
componentShown(ComponentEvent) - Method in class org.apache.bsf.util.event.adapters.java_awt_event_ComponentAdapter
 
convert(Class, Class, Object) - Method in interface org.apache.bsf.util.type.TypeConvertor
 
createBean(String, Object[]) - Static method in class org.apache.bsf.util.EngineUtils
Creates a new bean.
createBean(ClassLoader, String, Class[], Object[]) - Static method in class org.apache.bsf.util.ReflectionUtils
Create a bean using given class loader and using the appropriate constructor for the given args of the given arg types.
createBean(ClassLoader, String, Object[]) - Static method in class org.apache.bsf.util.ReflectionUtils
Create a bean using given class loader and using the appropriate constructor for the given args.

D

DEFAULT_DELIM - Static variable in class org.apache.bsf.util.cf.CodeFormatter
The default set of delimiters.
DEFAULT_MAX - Static variable in class org.apache.bsf.util.cf.CodeFormatter
The default maximum line length.
DEFAULT_STEP - Static variable in class org.apache.bsf.util.cf.CodeFormatter
The default size of the indentation step.
DEFAULT_S_DELIM - Static variable in class org.apache.bsf.util.cf.CodeFormatter
The default set of sticky delimiters.
declareBean(BSFDeclaredBean) - Method in interface org.apache.bsf.BSFEngine
Declare a bean after the engine has been started.
declareBean(String, Object, Class) - Method in class org.apache.bsf.BSFManager
Declare a bean.
declareBean(BSFDeclaredBean) - Method in class org.apache.bsf.engines.jacl.JaclEngine
Declare a bean
declareBean(BSFDeclaredBean) - Method in class org.apache.bsf.engines.javascript.JavaScriptEngine
 
declareBean(BSFDeclaredBean) - Method in class org.apache.bsf.engines.jython.JythonEngine
Declare a bean
declareBean(BSFDeclaredBean) - Method in class org.apache.bsf.engines.netrexx.NetRexxEngine
 
declareBean(BSFDeclaredBean) - Method in class org.apache.bsf.engines.xslt.XSLTEngine
Declare a bean by setting it as a parameter
declareBean(BSFDeclaredBean) - Method in class org.apache.bsf.util.BSFEngineImpl
 
declaredBeans - Variable in class org.apache.bsf.BSFManager
 
declaredBeans - Variable in class org.apache.bsf.util.BSFEngineImpl
 
defineClass(String, byte[]) - Method in class org.apache.bsf.util.event.generator.AdapterClassLoader
 

E

EngineUtils - class org.apache.bsf.util.EngineUtils.
This class contains utilities that language integrators can use when implementing the BSFEngine interface.
EngineUtils() - Constructor for class org.apache.bsf.util.EngineUtils
 
EventAdapter - interface org.apache.bsf.util.event.EventAdapter.
EventAdapter is the interface that all event adapters must implement in order to work with the automatic event adapter generation model.
EventAdapterGenerator - class org.apache.bsf.util.event.generator.EventAdapterGenerator.
EventAdapterGenerator Generate an "Event Adapter" dynamically during program execution
EventAdapterGenerator() - Constructor for class org.apache.bsf.util.event.generator.EventAdapterGenerator
 
EventAdapterImpl - class org.apache.bsf.util.event.EventAdapterImpl.
EventAdapterImpl is a default implementation of the EventAdapter interface that specific event adapters may choose to subclass from instead of implementing the interface themselves.
EventAdapterImpl() - Constructor for class org.apache.bsf.util.event.EventAdapterImpl
 
EventAdapterRegistry - class org.apache.bsf.util.event.EventAdapterRegistry.
The EventAdapterRegistry is the registry of event adapters.
EventAdapterRegistry() - Constructor for class org.apache.bsf.util.event.EventAdapterRegistry
 
EventProcessor - interface org.apache.bsf.util.event.EventProcessor.
EventProcessor is the interface that event adapters use to delegate events they received to be delivered to the appropriate target.
eval(String, int, int, Object) - Method in interface org.apache.bsf.BSFEngine
This is used by an application to evaluate an expression.
eval(String, String, int, int, Object) - Method in class org.apache.bsf.BSFManager
Evaluate the given expression of the given language and return the resulting value.
eval(String, int, int, Object) - Method in class org.apache.bsf.engines.jacl.JaclEngine
This is used by an application to evaluate a string containing some expression.
eval(String, int, int, Object) - Method in class org.apache.bsf.engines.javascript.JavaScriptEngine
This is used by an application to evaluate a string containing some expression.
eval(String, int, int, Object) - Method in class org.apache.bsf.engines.jython.JythonEngine
Evaluate an expression.
eval(String, int, int, Object) - Method in class org.apache.bsf.engines.netrexx.NetRexxEngine
Override impl of execute.
eval(String, int, int, Object) - Method in class org.apache.bsf.engines.xslt.XSLTEngine
Evaluate an expression.
eventProcessor - Variable in class org.apache.bsf.util.event.EventAdapterImpl
 
exec(String, int, int, Object) - Method in interface org.apache.bsf.BSFEngine
This is used by an application to execute some script.
exec(String, String, int, int, Object) - Method in class org.apache.bsf.BSFManager
Execute the given script of the given language.
exec(String, int, int, Object) - Method in class org.apache.bsf.engines.jython.JythonEngine
Execute a script.
exec(String, int, int, Object) - Method in class org.apache.bsf.engines.netrexx.NetRexxEngine
Override impl of execute.
exec(String, int, int, Object) - Method in class org.apache.bsf.util.BSFEngineImpl
Default impl of execute - calls eval and ignores the result.
execEvalShared(String, int, int, Object, boolean) - Method in class org.apache.bsf.engines.netrexx.NetRexxEngine
This is shared code for the exec() and eval() operations.
extn2Lang - Static variable in class org.apache.bsf.BSFManager
 

F

findClass(String) - Method in class org.apache.bsf.util.event.generator.AdapterClassLoader
 
focusGained(FocusEvent) - Method in class org.apache.bsf.util.event.adapters.java_awt_event_FocusAdapter
 
focusLost(FocusEvent) - Method in class org.apache.bsf.util.event.adapters.java_awt_event_FocusAdapter
 
formatCode(Reader, Writer) - Method in class org.apache.bsf.util.cf.CodeFormatter
Formats the code read from source, and writes the formatted code to target.

G

get(String) - Method in class org.apache.bsf.util.event.generator.AdapterClassLoader
 
getChars(int, char) - Static method in class org.apache.bsf.util.StringUtils
Get a string consisting of numberOfChars theChars.
getClassLoader() - Method in class org.apache.bsf.BSFManager
Get classLoader
getClassName() - Method in class org.apache.bsf.util.CodeBuffer
 
getClassName(Class) - Static method in class org.apache.bsf.util.StringUtils
 
getClassPath() - Method in class org.apache.bsf.BSFManager
Get classPath
getCodeGenString() - Method in interface org.apache.bsf.util.type.TypeConvertor
 
getCommaListFromVector(Vector) - Static method in class org.apache.bsf.util.StringUtils
 
getConstructor(Class, Class[]) - Static method in class org.apache.bsf.util.MethodUtils
Class.getConstructor() finds only the entry point (if any) _exactly_ matching the specified argument types.
getConstructorArguments() - Method in class org.apache.bsf.util.CodeBuffer
 
getConstructorBuffer() - Method in class org.apache.bsf.util.CodeBuffer
 
getConstructorExceptions() - Method in class org.apache.bsf.util.CodeBuffer
 
getContentAsReader(URL) - Static method in class org.apache.bsf.util.StringUtils
 
getContentAsString(URL) - Static method in class org.apache.bsf.util.StringUtils
 
getDelimiters() - Method in class org.apache.bsf.util.cf.CodeFormatter
Gets the set of delimiters.
getExtends() - Method in class org.apache.bsf.util.CodeBuffer
 
getField(Object, String) - Static method in class org.apache.bsf.util.ReflectionUtils
 
getFieldBuffer() - Method in class org.apache.bsf.util.CodeBuffer
 
getFinalServiceMethodStatement() - Method in class org.apache.bsf.util.CodeBuffer
 
getImplements() - Method in class org.apache.bsf.util.CodeBuffer
 
getImports() - Method in class org.apache.bsf.util.CodeBuffer
 
getIndentationStep() - Method in class org.apache.bsf.util.cf.CodeFormatter
Gets the size of the indentation step.
getInitializerBuffer() - Method in class org.apache.bsf.util.CodeBuffer
 
getLangFromFilename(String) - Static method in class org.apache.bsf.BSFManager
Determine the language of a script file by looking at the file extension.
getLoadedClass(String) - Method in class org.apache.bsf.util.event.generator.AdapterClassLoader
 
getMaxLineLength() - Method in class org.apache.bsf.util.cf.CodeFormatter
Gets the maximum line length.
getMethod(Class, String, Class[], boolean) - Static method in class org.apache.bsf.util.MethodUtils
 
getMethod(Object, String, Class[]) - Static method in class org.apache.bsf.util.MethodUtils
Class.getMethod() finds only the entry point (if any) _exactly_ matching the specified argument types.
getMethodBuffer() - Method in class org.apache.bsf.util.CodeBuffer
 
getNode() - Method in class org.apache.bsf.engines.xslt.XSLTResultNode
 
getObjectRegistry() - Method in class org.apache.bsf.BSFManager
Return the current object registry of the manager.
getPackageName() - Method in class org.apache.bsf.util.CodeBuffer
 
getProperty(Object, String, Integer) - Static method in class org.apache.bsf.util.ReflectionUtils
Get a property of a bean.
getReason() - Method in class org.apache.bsf.BSFException
 
getSafeString(String) - Static method in class org.apache.bsf.util.StringUtils
 
getServiceMethodBuffer() - Method in class org.apache.bsf.util.CodeBuffer
 
getServiceMethodExceptions() - Method in class org.apache.bsf.util.CodeBuffer
 
getServiceMethodName() - Method in class org.apache.bsf.util.CodeBuffer
 
getServiceMethodReturnType() - Method in class org.apache.bsf.util.CodeBuffer
 
getStickyDelimiters() - Method in class org.apache.bsf.util.cf.CodeFormatter
Gets the set of sticky delimiters.
getStringFromReader(Reader) - Static method in class org.apache.bsf.util.IOUtils
 
getSymbol(String) - Method in class org.apache.bsf.util.CodeBuffer
 
getSymbolTable() - Method in class org.apache.bsf.util.CodeBuffer
 
getTargetException() - Method in class org.apache.bsf.BSFException
 
getTempDir() - Method in class org.apache.bsf.BSFManager
Get tempDir
getTypeSignatureString(Class) - Static method in class org.apache.bsf.util.EngineUtils
Given a class return the type signature string fragment for it.
getURL(URL, String) - Static method in class org.apache.bsf.util.StringUtils
 
getValidIdentifierName(String) - Static method in class org.apache.bsf.util.StringUtils
 
getVersion() - Static method in class org.apache.bsf.BSFManager
Returns the version string of BSF.

I

IOUtils - class org.apache.bsf.util.IOUtils.
This file is a collection of input/output utilities.
IOUtils() - Constructor for class org.apache.bsf.util.IOUtils
 
IndentWriter - class org.apache.bsf.util.IndentWriter.
An IndentWriter object behaves the same as a PrintWriter object, with the additional capability of being able to print strings that are prepended with a specified amount of spaces.
IndentWriter(OutputStream) - Constructor for class org.apache.bsf.util.IndentWriter
Forwards its arguments to the PrintWriter constructor with the same signature.
IndentWriter(OutputStream, boolean) - Constructor for class org.apache.bsf.util.IndentWriter
Forwards its arguments to the PrintWriter constructor with the same signature.
IndentWriter(Writer) - Constructor for class org.apache.bsf.util.IndentWriter
Forwards its arguments to the PrintWriter constructor with the same signature.
IndentWriter(Writer, boolean) - Constructor for class org.apache.bsf.util.IndentWriter
Forwards its arguments to the PrintWriter constructor with the same signature.
iexec(String, int, int, Object) - Method in interface org.apache.bsf.BSFEngine
This is used by an application to execute some script, as though one were interacting with the language in an interactive session.
iexec(String, String, int, int, Object) - Method in class org.apache.bsf.BSFManager
Execute the given script of the given language, attempting to emulate an interactive session w/ the language.
iexec(String, int, int, Object) - Method in class org.apache.bsf.engines.jython.JythonEngine
Execute script code, emulating console interaction.
iexec(String, int, int, Object) - Method in class org.apache.bsf.util.BSFEngineImpl
Default impl of interactive execution - calls eval and ignores the result.
initialize(BSFManager, String, Vector) - Method in interface org.apache.bsf.BSFEngine
This method is used to initialize the engine right after construction.
initialize(BSFManager, String, Vector) - Method in class org.apache.bsf.engines.jacl.JaclEngine
Initialize the engine.
initialize(BSFManager, String, Vector) - Method in class org.apache.bsf.engines.javascript.JavaScriptEngine
Initialize the engine.
initialize(BSFManager, String, Vector) - Method in class org.apache.bsf.engines.jython.JythonEngine
Initialize the engine.
initialize(BSFManager, String, Vector) - Method in class org.apache.bsf.engines.netrexx.NetRexxEngine
 
initialize(BSFManager, String, Vector) - Method in class org.apache.bsf.engines.xslt.XSLTEngine
Initialize the engine.
initialize(BSFManager, String, Vector) - Method in class org.apache.bsf.util.BSFEngineImpl
initialize the engine; called right after construction by the manager.
isExecutable() - Method in class org.apache.bsf.util.ObjInfo
 
isLanguageRegistered(String) - Static method in class org.apache.bsf.BSFManager
Determine whether a language is registered.
isValidIdentifierName(String) - Static method in class org.apache.bsf.util.StringUtils
 
isValidPackageName(String) - Static method in class org.apache.bsf.util.StringUtils
 
isValueReturning() - Method in class org.apache.bsf.util.ObjInfo
 
itemStateChanged(ItemEvent) - Method in class org.apache.bsf.util.event.adapters.java_awt_event_ItemAdapter
 

J

JDKcompile(String, String) - Static method in class org.apache.bsf.util.JavaUtils
 
JaclEngine - class org.apache.bsf.engines.jacl.JaclEngine.
This is the interface to Scriptics's Jacl (Tcl) from the Bean Scripting Framework.
JaclEngine() - Constructor for class org.apache.bsf.engines.jacl.JaclEngine
 
JavaScriptEngine - class org.apache.bsf.engines.javascript.JavaScriptEngine.
This is the interface to Netscape's Rhino (JavaScript) from the Bean Scripting Framework.
JavaScriptEngine() - Constructor for class org.apache.bsf.engines.javascript.JavaScriptEngine
 
JavaUtils - class org.apache.bsf.util.JavaUtils.
 
JavaUtils() - Constructor for class org.apache.bsf.util.JavaUtils
 
JythonEngine - class org.apache.bsf.engines.jython.JythonEngine.
This is the interface to Jython (http://www.jython.org/) from BSF.
JythonEngine() - Constructor for class org.apache.bsf.engines.jython.JythonEngine
 
java_awt_event_ActionAdapter - class org.apache.bsf.util.event.adapters.java_awt_event_ActionAdapter.
 
java_awt_event_ActionAdapter() - Constructor for class org.apache.bsf.util.event.adapters.java_awt_event_ActionAdapter
 
java_awt_event_AdjustmentAdapter - class org.apache.bsf.util.event.adapters.java_awt_event_AdjustmentAdapter.
 
java_awt_event_AdjustmentAdapter() - Constructor for class org.apache.bsf.util.event.adapters.java_awt_event_AdjustmentAdapter
 
java_awt_event_ComponentAdapter - class org.apache.bsf.util.event.adapters.java_awt_event_ComponentAdapter.
 
java_awt_event_ComponentAdapter() - Constructor for class org.apache.bsf.util.event.adapters.java_awt_event_ComponentAdapter
 
java_awt_event_ContainerAdapter - class org.apache.bsf.util.event.adapters.java_awt_event_ContainerAdapter.
 
java_awt_event_ContainerAdapter() - Constructor for class org.apache.bsf.util.event.adapters.java_awt_event_ContainerAdapter
 
java_awt_event_FocusAdapter - class org.apache.bsf.util.event.adapters.java_awt_event_FocusAdapter.
 
java_awt_event_FocusAdapter() - Constructor for class org.apache.bsf.util.event.adapters.java_awt_event_FocusAdapter
 
java_awt_event_ItemAdapter - class org.apache.bsf.util.event.adapters.java_awt_event_ItemAdapter.
 
java_awt_event_ItemAdapter() - Constructor for class org.apache.bsf.util.event.adapters.java_awt_event_ItemAdapter
 
java_awt_event_KeyAdapter - class org.apache.bsf.util.event.adapters.java_awt_event_KeyAdapter.
 
java_awt_event_KeyAdapter() - Constructor for class org.apache.bsf.util.event.adapters.java_awt_event_KeyAdapter
 
java_awt_event_MouseAdapter - class org.apache.bsf.util.event.adapters.java_awt_event_MouseAdapter.
 
java_awt_event_MouseAdapter() - Constructor for class org.apache.bsf.util.event.adapters.java_awt_event_MouseAdapter
 
java_awt_event_MouseMotionAdapter - class org.apache.bsf.util.event.adapters.java_awt_event_MouseMotionAdapter.
 
java_awt_event_MouseMotionAdapter() - Constructor for class org.apache.bsf.util.event.adapters.java_awt_event_MouseMotionAdapter
 
java_awt_event_TextAdapter - class org.apache.bsf.util.event.adapters.java_awt_event_TextAdapter.
 
java_awt_event_TextAdapter() - Constructor for class org.apache.bsf.util.event.adapters.java_awt_event_TextAdapter
 
java_awt_event_WindowAdapter - class org.apache.bsf.util.event.adapters.java_awt_event_WindowAdapter.
 
java_awt_event_WindowAdapter() - Constructor for class org.apache.bsf.util.event.adapters.java_awt_event_WindowAdapter
 
java_beans_PropertyChangeAdapter - class org.apache.bsf.util.event.adapters.java_beans_PropertyChangeAdapter.
 
java_beans_PropertyChangeAdapter() - Constructor for class org.apache.bsf.util.event.adapters.java_beans_PropertyChangeAdapter
 
java_beans_VetoableChangeAdapter - class org.apache.bsf.util.event.adapters.java_beans_VetoableChangeAdapter.
 
java_beans_VetoableChangeAdapter() - Constructor for class org.apache.bsf.util.event.adapters.java_beans_VetoableChangeAdapter
 

K

keyPressed(KeyEvent) - Method in class org.apache.bsf.util.event.adapters.java_awt_event_KeyAdapter
 
keyReleased(KeyEvent) - Method in class org.apache.bsf.util.event.adapters.java_awt_event_KeyAdapter
 
keyTyped(KeyEvent) - Method in class org.apache.bsf.util.event.adapters.java_awt_event_KeyAdapter
 

L

lang - Variable in class org.apache.bsf.util.BSFEngineImpl
 
ldr - Static variable in class org.apache.bsf.util.event.generator.EventAdapterGenerator
 
lineSeparator - Static variable in class org.apache.bsf.util.StringUtils
 
lineSeparatorStr - Static variable in class org.apache.bsf.util.StringUtils
 
loadClass(BSFManager, String) - Static method in class org.apache.bsf.util.EngineUtils
Load a class using the class loader of given manager.
loadClass(String, boolean) - Method in class org.apache.bsf.util.event.generator.AdapterClassLoader
 
loadScriptingEngine(String) - Method in class org.apache.bsf.BSFManager
Load a scripting engine based on the lang string identifying it.
loadedEngines - Variable in class org.apache.bsf.BSFManager
 
lookup(String) - Method in class org.apache.bsf.util.ObjectRegistry
 
lookup(Class) - Static method in class org.apache.bsf.util.event.EventAdapterRegistry
 
lookup(Class, Class) - Method in class org.apache.bsf.util.type.TypeConvertorRegistry
 
lookupBean(String) - Method in class org.apache.bsf.BSFManager
return a handle to a bean registered in the bean registry by the application or a scripting engine.
lookupBean(String) - Method in class org.apache.bsf.util.BSFFunctions
 
lookupByKey(Object) - Method in class org.apache.bsf.util.type.TypeConvertorRegistry
 

M

Main - class org.apache.bsf.Main.
This is the main driver for BSF to be run on the command line to eval/exec/compile scripts directly.
Main() - Constructor for class org.apache.bsf.Main
 
MethodUtils - class org.apache.bsf.util.MethodUtils.
This file is a collection of reflection utilities for dealing with methods and constructors.
MethodUtils() - Constructor for class org.apache.bsf.util.MethodUtils
 
main(String[]) - Static method in class org.apache.bsf.Main
Static driver to be able to run BSF scripts from the command line.
main(String[]) - Static method in class org.apache.bsf.util.cf.CFDriver
A driver for CodeFormatter.
makeEventAdapterClass(Class, boolean) - Static method in class org.apache.bsf.util.event.generator.EventAdapterGenerator
 
merge(CodeBuffer) - Method in class org.apache.bsf.util.CodeBuffer
 
mgr - Variable in class org.apache.bsf.util.BSFEngineImpl
 
mouseClicked(MouseEvent) - Method in class org.apache.bsf.util.event.adapters.java_awt_event_MouseAdapter
 
mouseDragged(MouseEvent) - Method in class org.apache.bsf.util.event.adapters.java_awt_event_MouseMotionAdapter
 
mouseEntered(MouseEvent) - Method in class org.apache.bsf.util.event.adapters.java_awt_event_MouseAdapter
 
mouseExited(MouseEvent) - Method in class org.apache.bsf.util.event.adapters.java_awt_event_MouseAdapter
 
mouseMoved(MouseEvent) - Method in class org.apache.bsf.util.event.adapters.java_awt_event_MouseMotionAdapter
 
mousePressed(MouseEvent) - Method in class org.apache.bsf.util.event.adapters.java_awt_event_MouseAdapter
 
mouseReleased(MouseEvent) - Method in class org.apache.bsf.util.event.adapters.java_awt_event_MouseAdapter
 

N

NetRexxEngine - class org.apache.bsf.engines.netrexx.NetRexxEngine.
This is the interface to NetRexx from the Bean Scripting Framework.
NetRexxEngine() - Constructor for class org.apache.bsf.engines.netrexx.NetRexxEngine
Constructor.
name - Variable in class org.apache.bsf.BSFDeclaredBean
 

O

ObjInfo - class org.apache.bsf.util.ObjInfo.
An ObjInfo object is used by a compiler to track the name and type of a bean.
ObjInfo(Class, String) - Constructor for class org.apache.bsf.util.ObjInfo
 
ObjectRegistry - class org.apache.bsf.util.ObjectRegistry.
The ObjectRegistry is used to do name-to-object reference lookups.
ObjectRegistry() - Constructor for class org.apache.bsf.util.ObjectRegistry
 
ObjectRegistry(ObjectRegistry) - Constructor for class org.apache.bsf.util.ObjectRegistry
 
objClass - Variable in class org.apache.bsf.util.ObjInfo
 
objName - Variable in class org.apache.bsf.util.ObjInfo
 
objectRegistry - Variable in class org.apache.bsf.BSFManager
 
org.apache.bsf - package org.apache.bsf
 
org.apache.bsf.engines.jacl - package org.apache.bsf.engines.jacl
 
org.apache.bsf.engines.javascript - package org.apache.bsf.engines.javascript
 
org.apache.bsf.engines.jython - package org.apache.bsf.engines.jython
 
org.apache.bsf.engines.netrexx - package org.apache.bsf.engines.netrexx
 
org.apache.bsf.engines.xslt - package org.apache.bsf.engines.xslt
 
org.apache.bsf.util - package org.apache.bsf.util
 
org.apache.bsf.util.cf - package org.apache.bsf.util.cf
 
org.apache.bsf.util.event - package org.apache.bsf.util.event
 
org.apache.bsf.util.event.adapters - package org.apache.bsf.util.event.adapters
 
org.apache.bsf.util.event.generator - package org.apache.bsf.util.event.generator
 
org.apache.bsf.util.type - package org.apache.bsf.util.type
 

P

pcs - Variable in class org.apache.bsf.BSFManager
 
popSymbolTable() - Method in class org.apache.bsf.util.CodeBuffer
 
print(PrintWriter, boolean) - Method in class org.apache.bsf.util.CodeBuffer
 
print(int, String) - Method in class org.apache.bsf.util.IndentWriter
Print the text (indented the specified amount) without inserting a linefeed.
printStackTrace() - Method in class org.apache.bsf.BSFException
 
println(int, String) - Method in class org.apache.bsf.util.IndentWriter
Print the text (indented the specified amount) and insert a linefeed.
processEvent(String, Object[]) - Method in class org.apache.bsf.util.BSFEventProcessor
 
processEvent(String, Object[]) - Method in class org.apache.bsf.util.BSFEventProcessorReturningEventInfos
 
processEvent(String, Object[]) - Method in interface org.apache.bsf.util.event.EventProcessor
 
processExceptionableEvent(String, Object[]) - Method in class org.apache.bsf.util.BSFEventProcessor
 
processExceptionableEvent(String, Object[]) - Method in class org.apache.bsf.util.BSFEventProcessorReturningEventInfos
 
processExceptionableEvent(String, Object[]) - Method in interface org.apache.bsf.util.event.EventProcessor
 
propertyChange(PropertyChangeEvent) - Method in class org.apache.bsf.util.BSFEngineImpl
Receive property change events from the manager and update my fields as needed.
propertyChange(PropertyChangeEvent) - Method in class org.apache.bsf.util.event.adapters.java_beans_PropertyChangeAdapter
 
pushSymbolTable() - Method in class org.apache.bsf.util.CodeBuffer
 
put(String, Class) - Method in class org.apache.bsf.util.event.generator.AdapterClassLoader
 
putSymbol(String, ObjInfo) - Method in class org.apache.bsf.util.CodeBuffer
 

R

REASON_EXECUTION_ERROR - Static variable in class org.apache.bsf.BSFException
 
REASON_INVALID_ARGUMENT - Static variable in class org.apache.bsf.BSFException
 
REASON_IO_ERROR - Static variable in class org.apache.bsf.BSFException
 
REASON_OTHER_ERROR - Static variable in class org.apache.bsf.BSFException
 
REASON_UNKNOWN_LANGUAGE - Static variable in class org.apache.bsf.BSFException
 
REASON_UNSUPPORTED_FEATURE - Static variable in class org.apache.bsf.BSFException
 
ReflectionUtils - class org.apache.bsf.util.ReflectionUtils.
This file is a collection of reflection utilities.
ReflectionUtils() - Constructor for class org.apache.bsf.util.ReflectionUtils
 
register(String, Object) - Method in class org.apache.bsf.util.ObjectRegistry
 
register(Class, Class) - Static method in class org.apache.bsf.util.event.EventAdapterRegistry
 
register(Class, Class, TypeConvertor) - Method in class org.apache.bsf.util.type.TypeConvertorRegistry
 
registerBean(String, Object) - Method in class org.apache.bsf.BSFManager
Registering a bean allows a scripting engine or the application to access that bean by name and to manipulate it.
registerBean(String, Object) - Method in class org.apache.bsf.util.BSFFunctions
 
registerByKey(Object, TypeConvertor) - Method in class org.apache.bsf.util.type.TypeConvertorRegistry
 
registerScriptingEngine(String, String, String[]) - Static method in class org.apache.bsf.BSFManager
Register a scripting engine in the static registry of the BSFManager.
registeredEngines - Static variable in class org.apache.bsf.BSFManager
 

S

StringUtils - class org.apache.bsf.util.StringUtils.
Deals with strings (probably need to elaborate some more).
StringUtils() - Constructor for class org.apache.bsf.util.StringUtils
 
setClassLoader(ClassLoader) - Method in class org.apache.bsf.BSFManager
Set the class loader for those that need to use it.
setClassLoader(ClassLoader) - Static method in class org.apache.bsf.util.event.EventAdapterRegistry
Class loader to use to load event adapter classes.
setClassName(String) - Method in class org.apache.bsf.util.CodeBuffer
 
setClassPath(String) - Method in class org.apache.bsf.BSFManager
Set the classpath for those that need to use it.
setDelimiters(String) - Method in class org.apache.bsf.util.cf.CodeFormatter
Sets the set of delimiters; default set is "(+".
setDynamic(boolean) - Static method in class org.apache.bsf.util.event.EventAdapterRegistry
Indicates whether or not to dynamically generate adapters; default is true.
setEventProcessor(EventProcessor) - Method in interface org.apache.bsf.util.event.EventAdapter
 
setEventProcessor(EventProcessor) - Method in class org.apache.bsf.util.event.EventAdapterImpl
 
setExtends(String) - Method in class org.apache.bsf.util.CodeBuffer
 
setField(Object, String, Bean, TypeConvertorRegistry) - Static method in class org.apache.bsf.util.ReflectionUtils
 
setFinalServiceMethodStatement(ObjInfo) - Method in class org.apache.bsf.util.CodeBuffer
 
setIndentationStep(int) - Method in class org.apache.bsf.util.cf.CodeFormatter
Sets the size of the indentation step; default size is 2.
setMaxLineLength(int) - Method in class org.apache.bsf.util.cf.CodeFormatter
Sets the (desired) maximum line length; default length is 74.
setObjectRegistry(ObjectRegistry) - Method in class org.apache.bsf.BSFManager
Set the object registry used by this manager.
setPackageName(String) - Method in class org.apache.bsf.util.CodeBuffer
 
setProperty(Object, String, Integer, Object, Class, TypeConvertorRegistry) - Static method in class org.apache.bsf.util.ReflectionUtils
Set a property of a bean to a given value.
setServiceMethodName(String) - Method in class org.apache.bsf.util.CodeBuffer
 
setServiceMethodReturnType(Class) - Method in class org.apache.bsf.util.CodeBuffer
 
setStickyDelimiters(String) - Method in class org.apache.bsf.util.cf.CodeFormatter
Sets the set of sticky delimiters; default set is ",".
setSymbolTable(Hashtable) - Method in class org.apache.bsf.util.CodeBuffer
 
setTempDir(String) - Method in class org.apache.bsf.BSFManager
Temporary directory to put stuff into (for those who need to).
symbolTableIsStacked() - Method in class org.apache.bsf.util.CodeBuffer
 

T

TypeConvertor - interface org.apache.bsf.util.type.TypeConvertor.
A TypeConvertor is used to convert an object of one type to one of another type.
TypeConvertorRegistry - class org.apache.bsf.util.type.TypeConvertorRegistry.
The TypeConvertorRegistry is the registry of type convertors.
TypeConvertorRegistry() - Constructor for class org.apache.bsf.util.type.TypeConvertorRegistry
 
tempDir - Variable in class org.apache.bsf.BSFManager
 
tempDir - Variable in class org.apache.bsf.util.BSFEngineImpl
 
terminate() - Method in interface org.apache.bsf.BSFEngine
Graceful termination
terminate() - Method in class org.apache.bsf.BSFManager
Gracefully terminate all engines
terminate() - Method in class org.apache.bsf.util.BSFEngineImpl
 
textValueChanged(TextEvent) - Method in class org.apache.bsf.util.event.adapters.java_awt_event_TextAdapter
 
toString() - Method in class org.apache.bsf.util.CodeBuffer
 
toString() - Method in class org.apache.bsf.util.ObjInfo
 
type - Variable in class org.apache.bsf.BSFDeclaredBean
 
type - Variable in class org.apache.bsf.util.Bean
 

U

undeclareBean(BSFDeclaredBean) - Method in interface org.apache.bsf.BSFEngine
Undeclare a previously declared bean.
undeclareBean(String) - Method in class org.apache.bsf.BSFManager
Undeclare a previously declared bean.
undeclareBean(BSFDeclaredBean) - Method in class org.apache.bsf.engines.jacl.JaclEngine
Undeclare a previously declared bean.
undeclareBean(BSFDeclaredBean) - Method in class org.apache.bsf.engines.javascript.JavaScriptEngine
 
undeclareBean(BSFDeclaredBean) - Method in class org.apache.bsf.engines.jython.JythonEngine
Undeclare a previously declared bean.
undeclareBean(BSFDeclaredBean) - Method in class org.apache.bsf.engines.netrexx.NetRexxEngine
 
undeclareBean(BSFDeclaredBean) - Method in class org.apache.bsf.engines.xslt.XSLTEngine
Undeclare a bean by setting he parameter represeting it to null
undeclareBean(BSFDeclaredBean) - Method in class org.apache.bsf.util.BSFEngineImpl
 
unregister(String) - Method in class org.apache.bsf.util.ObjectRegistry
 
unregisterBean(String) - Method in class org.apache.bsf.BSFManager
Unregister a previously registered bean.
unregisterBean(String) - Method in class org.apache.bsf.util.BSFFunctions
 
unwrap(PyObject) - Method in class org.apache.bsf.engines.jython.JythonEngine
 

V

value - Variable in class org.apache.bsf.util.Bean
 
version - Static variable in class org.apache.bsf.BSFManager
 
vetoableChange(PropertyChangeEvent) - Method in class org.apache.bsf.util.event.adapters.java_beans_VetoableChangeAdapter
 

W

windowActivated(WindowEvent) - Method in class org.apache.bsf.util.event.adapters.java_awt_event_WindowAdapter
 
windowClosed(WindowEvent) - Method in class org.apache.bsf.util.event.adapters.java_awt_event_WindowAdapter
 
windowClosing(WindowEvent) - Method in class org.apache.bsf.util.event.adapters.java_awt_event_WindowAdapter
 
windowDeactivated(WindowEvent) - Method in class org.apache.bsf.util.event.adapters.java_awt_event_WindowAdapter
 
windowDeiconified(WindowEvent) - Method in class org.apache.bsf.util.event.adapters.java_awt_event_WindowAdapter
 
windowIconified(WindowEvent) - Method in class org.apache.bsf.util.event.adapters.java_awt_event_WindowAdapter
 
windowOpened(WindowEvent) - Method in class org.apache.bsf.util.event.adapters.java_awt_event_WindowAdapter
 

X

XSLTEngine - class org.apache.bsf.engines.xslt.XSLTEngine.
Xerces XSLT interface to BSF.
XSLTEngine() - Constructor for class org.apache.bsf.engines.xslt.XSLTEngine
 
XSLTResultNode - class org.apache.bsf.engines.xslt.XSLTResultNode.
 
XSLTResultNode(Node) - Constructor for class org.apache.bsf.engines.xslt.XSLTResultNode
 

A B C D E F G I J K L M N O P R S T U V W X

libbsf-java-2.4.0/docs/api/packages.html0000644000175000017500000000152210511475731017032 0ustar mkochmkoch (Bean Scripting Framework API)


The front page has been relocated.Please see:
          Frame version
          Non-frame version.
libbsf-java-2.4.0/docs/api/constant-values.html0000644000175000017500000003402110511475731020402 0ustar mkochmkoch Constant Field Values (Bean Scripting Framework API)

Constant Field Values


Contents
org.apache.*

org.apache.bsf.BSFException
public static final int REASON_EXECUTION_ERROR 100
public static final int REASON_INVALID_ARGUMENT 0
public static final int REASON_IO_ERROR 10
public static final int REASON_OTHER_ERROR 500
public static final int REASON_UNKNOWN_LANGUAGE 20
public static final int REASON_UNSUPPORTED_FEATURE 499

org.apache.bsf.util.cf.CodeFormatter
public static final java.lang.String DEFAULT_DELIM "(+"
public static final int DEFAULT_MAX 74
public static final java.lang.String DEFAULT_S_DELIM ","
public static final int DEFAULT_STEP 2

org.apache.bsf.util.event.generator.Bytecode
public static final byte C_Class 7
public static final byte C_Double 6
public static final byte C_FieldRef 9
public static final byte C_Float 4
public static final byte C_Integer 3
public static final byte C_InterfaceMethodRef 11
public static final byte C_Long 5
public static final byte C_MethodRef 10
public static final byte C_NameAndType 12
public static final byte C_String 8
public static final byte C_Utf8 1



libbsf-java-2.4.0/docs/api/overview-summary.html0000644000175000017500000001631410511475731020622 0ustar mkochmkoch Overview (Bean Scripting Framework API)

Bean Scripting Framework

Packages
org.apache.bsf  
org.apache.bsf.engines.jacl  
org.apache.bsf.engines.javascript  
org.apache.bsf.engines.jython  
org.apache.bsf.engines.netrexx  
org.apache.bsf.engines.xslt  
org.apache.bsf.util  
org.apache.bsf.util.cf  
org.apache.bsf.util.event  
org.apache.bsf.util.event.adapters  
org.apache.bsf.util.event.generator  
org.apache.bsf.util.type  

 



libbsf-java-2.4.0/docs/api/overview-frame.html0000644000175000017500000000515310511475731020216 0ustar mkochmkoch Overview (Bean Scripting Framework API)
All Classes

Packages
org.apache.bsf
org.apache.bsf.engines.jacl
org.apache.bsf.engines.javascript
org.apache.bsf.engines.jython
org.apache.bsf.engines.netrexx
org.apache.bsf.engines.xslt
org.apache.bsf.util
org.apache.bsf.util.cf
org.apache.bsf.util.event
org.apache.bsf.util.event.adapters
org.apache.bsf.util.event.generator
org.apache.bsf.util.type

  libbsf-java-2.4.0/docs/api/stylesheet.css0000644000175000017500000000226210511475731017273 0ustar mkochmkoch/* Javadoc style sheet */ /* Define colors, fonts and other style attributes here to override the defaults */ /* Page background color */ body { background-color: #FFFFFF } /* Headings */ h1 { font-size: 145% } /* Table colors */ .TableHeadingColor { background: #CCCCFF } /* Dark mauve */ .TableSubHeadingColor { background: #EEEEFF } /* Light mauve */ .TableRowColor { background: #FFFFFF } /* White */ /* Font used in left-hand frame lists */ .FrameTitleFont { font-size: 100%; font-family: Helvetica, Arial, sans-serif } .FrameHeadingFont { font-size: 90%; font-family: Helvetica, Arial, sans-serif } .FrameItemFont { font-size: 90%; font-family: Helvetica, Arial, sans-serif } /* Navigation bar fonts and colors */ .NavBarCell1 { background-color:#EEEEFF;} /* Light mauve */ .NavBarCell1Rev { background-color:#00008B;} /* Dark Blue */ .NavBarFont1 { font-family: Arial, Helvetica, sans-serif; color:#000000;} .NavBarFont1Rev { font-family: Arial, Helvetica, sans-serif; color:#FFFFFF;} .NavBarCell2 { font-family: Arial, Helvetica, sans-serif; background-color:#FFFFFF;} .NavBarCell3 { font-family: Arial, Helvetica, sans-serif; background-color:#FFFFFF;} libbsf-java-2.4.0/docs/api/help-doc.html0000644000175000017500000002130510511475731016750 0ustar mkochmkoch API Help (Bean Scripting Framework API)


How This API Document Is Organized

This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.

Overview

The Overview page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.

Package

Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain four categories:

  • Interfaces (italic)
  • Classes
  • Exceptions
  • Errors

Class/Interface

Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:

  • Class inheritance diagram
  • Direct Subclasses
  • All Known Subinterfaces
  • All Known Implementing Classes
  • Class/interface declaration
  • Class/interface description

  • Nested Class Summary
  • Field Summary
  • Constructor Summary
  • Method Summary

  • Field Detail
  • Constructor Detail
  • Method Detail
Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.

Use

Each documented package, class and interface has its own Use page. This page describes what packages, classes, methods, constructors and fields use any part of the given class or package. Given a class or interface A, its Use page includes subclasses of A, fields declared as A, methods that return A, and methods and constructors with parameters of type A. You can access this page by first going to the package, class or interface, then clicking on the "Use" link in the navigation bar.

Tree (Class Hierarchy)

There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.
  • When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.
  • When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.

Deprecated API

The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.

Index

The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.

Prev/Next

These links take you to the next or previous class, interface, package, or related page.

Frames/No Frames

These links show and hide the HTML frames. All pages are available with or without frames.

Serialized Form

Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.

This help file applies to API documentation generated using the standard doclet.



libbsf-java-2.4.0/docs/api/allclasses-noframe.html0000644000175000017500000001614310511475731021034 0ustar mkochmkoch All Classes (Bean Scripting Framework API) All Classes
AdapterClassLoader
BSFDeclaredBean
BSFEngine
BSFEngineImpl
BSFEventProcessor
BSFEventProcessorReturningEventInfos
BSFException
BSFFunctions
BSFManager
Bean
ByteUtility
Bytecode
CFDriver
CodeBuffer
CodeFormatter
EngineUtils
EventAdapter
EventAdapterGenerator
EventAdapterImpl
EventAdapterRegistry
EventProcessor
IOUtils
IndentWriter
JaclEngine
JavaScriptEngine
JavaUtils
JythonEngine
java_awt_event_ActionAdapter
java_awt_event_AdjustmentAdapter
java_awt_event_ComponentAdapter
java_awt_event_ContainerAdapter
java_awt_event_FocusAdapter
java_awt_event_ItemAdapter
java_awt_event_KeyAdapter
java_awt_event_MouseAdapter
java_awt_event_MouseMotionAdapter
java_awt_event_TextAdapter
java_awt_event_WindowAdapter
java_beans_PropertyChangeAdapter
java_beans_VetoableChangeAdapter
Main
MethodUtils
NetRexxEngine
ObjInfo
ObjectRegistry
ReflectionUtils
StringUtils
TypeConvertor
TypeConvertorRegistry
XSLTEngine
XSLTResultNode
libbsf-java-2.4.0/docs/api/package-list0000644000175000017500000000051310511475731016654 0ustar mkochmkochorg.apache.bsf org.apache.bsf.engines.jacl org.apache.bsf.engines.javascript org.apache.bsf.engines.jython org.apache.bsf.engines.netrexx org.apache.bsf.engines.xslt org.apache.bsf.util org.apache.bsf.util.cf org.apache.bsf.util.event org.apache.bsf.util.event.adapters org.apache.bsf.util.event.generator org.apache.bsf.util.type libbsf-java-2.4.0/docs/api/serialized-form.html0000644000175000017500000001324210511475731020352 0ustar mkochmkoch Serialized Form (Bean Scripting Framework API)

Serialized Form

Class org.apache.bsf.BSFException extends java.lang.Exception implements Serializable

Serialized Fields

reason

int reason

targetThrowable

java.lang.Throwable targetThrowable



libbsf-java-2.4.0/docs/api/index.html0000644000175000017500000000157210511475731016370 0ustar mkochmkoch Bean Scripting Framework API <H2> Frame Alert</H2> <P> This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. <BR> Link to<A HREF="overview-summary.html">Non-frame version.</A> libbsf-java-2.4.0/docs/api/org/0000755000175000017500000000000010511475731015155 5ustar mkochmkochlibbsf-java-2.4.0/docs/api/org/apache/0000755000175000017500000000000010511475731016376 5ustar mkochmkochlibbsf-java-2.4.0/docs/api/org/apache/bsf/0000755000175000017500000000000010736513022017143 5ustar mkochmkochlibbsf-java-2.4.0/docs/api/org/apache/bsf/package-tree.html0000644000175000017500000001463010511475731022372 0ustar mkochmkoch org.apache.bsf Class Hierarchy (Bean Scripting Framework API)

Hierarchy For Package org.apache.bsf

Package Hierarchies:
All Packages

Class Hierarchy

  • class java.lang.Object
    • class org.apache.bsf.BSFDeclaredBean
    • class org.apache.bsf.BSFManager
    • class org.apache.bsf.Main
    • class java.lang.Throwable (implements java.io.Serializable)
      • class java.lang.Exception

Interface Hierarchy

  • interface java.util.EventListener
    • interface java.beans.PropertyChangeListener


libbsf-java-2.4.0/docs/api/org/apache/bsf/Main.html0000644000175000017500000002311710511475731020726 0ustar mkochmkoch Main (Bean Scripting Framework API)

org.apache.bsf
Class Main

java.lang.Object
  extended byorg.apache.bsf.Main

public class Main
extends java.lang.Object

This is the main driver for BSF to be run on the command line to eval/exec/compile scripts directly.

Author:
Sanjiva Weerawarana, Matthew J. Duftler, Sam Ruby

Constructor Summary
Main()
           
 
Method Summary
static void main(java.lang.String[] args)
          Static driver to be able to run BSF scripts from the command line.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Main

public Main()
Method Detail

main

public static void main(java.lang.String[] args)
                 throws java.io.IOException
Static driver to be able to run BSF scripts from the command line.

Parameters:
args - command line arguments
Throws:
java.io.IOException - if any I/O error while loading script


libbsf-java-2.4.0/docs/api/org/apache/bsf/BSFException.html0000644000175000017500000004226610511475731022341 0ustar mkochmkoch BSFException (Bean Scripting Framework API)

org.apache.bsf
Class BSFException

java.lang.Object
  extended byjava.lang.Throwable
      extended byjava.lang.Exception
          extended byorg.apache.bsf.BSFException
All Implemented Interfaces:
java.io.Serializable

public class BSFException
extends java.lang.Exception

If something goes wrong while doing some scripting stuff, one of these is thrown. The integer code indicates what's wrong and the message may give more details. The reason one exception with multiple meanings (via the code) [instead of multiple exception types] is used is due to the interest to keep the run-time size small.

Author:
Sanjiva Weerawarana
See Also:
Serialized Form

Field Summary
static int REASON_EXECUTION_ERROR
           
static int REASON_INVALID_ARGUMENT
           
static int REASON_IO_ERROR
           
static int REASON_OTHER_ERROR
           
static int REASON_UNKNOWN_LANGUAGE
           
static int REASON_UNSUPPORTED_FEATURE
           
 
Constructor Summary
BSFException(int reason, java.lang.String msg)
           
BSFException(int reason, java.lang.String msg, java.lang.Throwable t)
           
BSFException(java.lang.String msg)
           
 
Method Summary
 int getReason()
           
 java.lang.Throwable getTargetException()
           
 void printStackTrace()
           
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, setStackTrace, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

REASON_INVALID_ARGUMENT

public static final int REASON_INVALID_ARGUMENT
See Also:
Constant Field Values

REASON_IO_ERROR

public static final int REASON_IO_ERROR
See Also:
Constant Field Values

REASON_UNKNOWN_LANGUAGE

public static final int REASON_UNKNOWN_LANGUAGE
See Also:
Constant Field Values

REASON_EXECUTION_ERROR

public static final int REASON_EXECUTION_ERROR
See Also:
Constant Field Values

REASON_UNSUPPORTED_FEATURE

public static final int REASON_UNSUPPORTED_FEATURE
See Also:
Constant Field Values

REASON_OTHER_ERROR

public static final int REASON_OTHER_ERROR
See Also:
Constant Field Values
Constructor Detail

BSFException

public BSFException(int reason,
                    java.lang.String msg)

BSFException

public BSFException(int reason,
                    java.lang.String msg,
                    java.lang.Throwable t)

BSFException

public BSFException(java.lang.String msg)
Method Detail

getReason

public int getReason()

getTargetException

public java.lang.Throwable getTargetException()

printStackTrace

public void printStackTrace()


libbsf-java-2.4.0/docs/api/org/apache/bsf/util/0000755000175000017500000000000010736513022020120 5ustar mkochmkochlibbsf-java-2.4.0/docs/api/org/apache/bsf/util/package-tree.html0000644000175000017500000002113010511475731023340 0ustar mkochmkoch org.apache.bsf.util Class Hierarchy (Bean Scripting Framework API)

Hierarchy For Package org.apache.bsf.util

Package Hierarchies:
All Packages

Class Hierarchy



libbsf-java-2.4.0/docs/api/org/apache/bsf/util/CodeBuffer.html0000644000175000017500000010710410511475731023022 0ustar mkochmkoch CodeBuffer (Bean Scripting Framework API)

org.apache.bsf.util
Class CodeBuffer

java.lang.Object
  extended byorg.apache.bsf.util.CodeBuffer

public class CodeBuffer
extends java.lang.Object

A CodeBuffer object is used as a code repository for generated Java code. It provides buffers which correspond to the various sections of a Java class.

Author:
Matthew J. Duftler

Constructor Summary
CodeBuffer()
           
CodeBuffer(CodeBuffer parent)
           
 
Method Summary
 void addConstructorArgument(ObjInfo arg)
           
 void addConstructorException(java.lang.String exceptionName)
           
 void addConstructorStatement(java.lang.String statement)
           
 void addFieldDeclaration(java.lang.String statement)
           
 void addImplements(java.lang.String importName)
           
 void addImport(java.lang.String importName)
           
 void addInitializerStatement(java.lang.String statement)
           
 void addMethodDeclaration(java.lang.String statement)
           
 void addServiceMethodException(java.lang.String exceptionName)
           
 void addServiceMethodStatement(java.lang.String statement)
           
 java.lang.String buildNewSymbol(java.lang.String prefix)
           
 void clearSymbolTable()
           
 java.lang.String getClassName()
           
 java.util.Vector getConstructorArguments()
           
 java.lang.StringBuffer getConstructorBuffer()
           
 java.util.Vector getConstructorExceptions()
           
 java.lang.String getExtends()
           
 java.lang.StringBuffer getFieldBuffer()
           
 ObjInfo getFinalServiceMethodStatement()
           
 java.util.Vector getImplements()
           
 java.util.Vector getImports()
           
 java.lang.StringBuffer getInitializerBuffer()
           
 java.lang.StringBuffer getMethodBuffer()
           
 java.lang.String getPackageName()
           
 java.lang.StringBuffer getServiceMethodBuffer()
           
 java.util.Vector getServiceMethodExceptions()
           
 java.lang.String getServiceMethodName()
           
 java.lang.Class getServiceMethodReturnType()
           
 ObjInfo getSymbol(java.lang.String symbol)
           
 java.util.Hashtable getSymbolTable()
           
 void merge(CodeBuffer otherCB)
           
 void popSymbolTable()
           
 void print(java.io.PrintWriter out, boolean formatOutput)
           
 void pushSymbolTable()
           
 void putSymbol(java.lang.String symbol, ObjInfo obj)
           
 void setClassName(java.lang.String className)
           
 void setExtends(java.lang.String extendsName)
           
 void setFinalServiceMethodStatement(ObjInfo finalStatementInfo)
           
 void setPackageName(java.lang.String packageName)
           
 void setServiceMethodName(java.lang.String serviceMethodName)
           
 void setServiceMethodReturnType(java.lang.Class serviceMethodReturnType)
           
 void setSymbolTable(java.util.Hashtable symbolTable)
           
 boolean symbolTableIsStacked()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CodeBuffer

public CodeBuffer()

CodeBuffer

public CodeBuffer(CodeBuffer parent)
Method Detail

addConstructorArgument

public void addConstructorArgument(ObjInfo arg)

addConstructorException

public void addConstructorException(java.lang.String exceptionName)

addConstructorStatement

public void addConstructorStatement(java.lang.String statement)

addFieldDeclaration

public void addFieldDeclaration(java.lang.String statement)

addImplements

public void addImplements(java.lang.String importName)

addImport

public void addImport(java.lang.String importName)

addInitializerStatement

public void addInitializerStatement(java.lang.String statement)

addMethodDeclaration

public void addMethodDeclaration(java.lang.String statement)

addServiceMethodException

public void addServiceMethodException(java.lang.String exceptionName)

addServiceMethodStatement

public void addServiceMethodStatement(java.lang.String statement)

buildNewSymbol

public java.lang.String buildNewSymbol(java.lang.String prefix)

clearSymbolTable

public void clearSymbolTable()

getClassName

public java.lang.String getClassName()

getConstructorArguments

public java.util.Vector getConstructorArguments()

getConstructorBuffer

public java.lang.StringBuffer getConstructorBuffer()

getConstructorExceptions

public java.util.Vector getConstructorExceptions()

getExtends

public java.lang.String getExtends()

getFieldBuffer

public java.lang.StringBuffer getFieldBuffer()

getFinalServiceMethodStatement

public ObjInfo getFinalServiceMethodStatement()

getImplements

public java.util.Vector getImplements()

getImports

public java.util.Vector getImports()

getInitializerBuffer

public java.lang.StringBuffer getInitializerBuffer()

getMethodBuffer

public java.lang.StringBuffer getMethodBuffer()

getPackageName

public java.lang.String getPackageName()

getServiceMethodBuffer

public java.lang.StringBuffer getServiceMethodBuffer()

getServiceMethodExceptions

public java.util.Vector getServiceMethodExceptions()

getServiceMethodName

public java.lang.String getServiceMethodName()

getServiceMethodReturnType

public java.lang.Class getServiceMethodReturnType()

getSymbol

public ObjInfo getSymbol(java.lang.String symbol)

getSymbolTable

public java.util.Hashtable getSymbolTable()

merge

public void merge(CodeBuffer otherCB)

popSymbolTable

public void popSymbolTable()

print

public void print(java.io.PrintWriter out,
                  boolean formatOutput)

pushSymbolTable

public void pushSymbolTable()

putSymbol

public void putSymbol(java.lang.String symbol,
                      ObjInfo obj)

setClassName

public void setClassName(java.lang.String className)

setExtends

public void setExtends(java.lang.String extendsName)

setFinalServiceMethodStatement

public void setFinalServiceMethodStatement(ObjInfo finalStatementInfo)

setPackageName

public void setPackageName(java.lang.String packageName)

setServiceMethodName

public void setServiceMethodName(java.lang.String serviceMethodName)

setServiceMethodReturnType

public void setServiceMethodReturnType(java.lang.Class serviceMethodReturnType)

setSymbolTable

public void setSymbolTable(java.util.Hashtable symbolTable)

symbolTableIsStacked

public boolean symbolTableIsStacked()

toString

public java.lang.String toString()


libbsf-java-2.4.0/docs/api/org/apache/bsf/util/ObjectRegistry.html0000644000175000017500000003003710511475731023755 0ustar mkochmkoch ObjectRegistry (Bean Scripting Framework API)

org.apache.bsf.util
Class ObjectRegistry

java.lang.Object
  extended byorg.apache.bsf.util.ObjectRegistry

public class ObjectRegistry
extends java.lang.Object

The ObjectRegistry is used to do name-to-object reference lookups. If an ObjectRegistry is passed as a constructor argument, then this ObjectRegistry will be a cascading registry: when a lookup is invoked, it will first look in its own table for a name, and if it's not there, it will cascade to the parent ObjectRegistry. All registration is always local. [??]

Author:
Sanjiva Weerawarana, Matthew J. Duftler

Constructor Summary
ObjectRegistry()
           
ObjectRegistry(ObjectRegistry parent)
           
 
Method Summary
 java.lang.Object lookup(java.lang.String name)
           
 void register(java.lang.String name, java.lang.Object obj)
           
 void unregister(java.lang.String name)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ObjectRegistry

public ObjectRegistry()

ObjectRegistry

public ObjectRegistry(ObjectRegistry parent)
Method Detail

lookup

public java.lang.Object lookup(java.lang.String name)
                        throws java.lang.IllegalArgumentException
Throws:
java.lang.IllegalArgumentException

register

public void register(java.lang.String name,
                     java.lang.Object obj)

unregister

public void unregister(java.lang.String name)


libbsf-java-2.4.0/docs/api/org/apache/bsf/util/IndentWriter.html0000644000175000017500000003616610511475731023445 0ustar mkochmkoch IndentWriter (Bean Scripting Framework API)

org.apache.bsf.util
Class IndentWriter

java.lang.Object
  extended byjava.io.Writer
      extended byjava.io.PrintWriter
          extended byorg.apache.bsf.util.IndentWriter

public class IndentWriter
extends java.io.PrintWriter

An IndentWriter object behaves the same as a PrintWriter object, with the additional capability of being able to print strings that are prepended with a specified amount of spaces.

Author:
Matthew J. Duftler

Field Summary
 
Fields inherited from class java.io.PrintWriter
out
 
Fields inherited from class java.io.Writer
lock
 
Constructor Summary
IndentWriter(java.io.OutputStream out)
          Forwards its arguments to the PrintWriter constructor with the same signature.
IndentWriter(java.io.OutputStream out, boolean autoFlush)
          Forwards its arguments to the PrintWriter constructor with the same signature.
IndentWriter(java.io.Writer out)
          Forwards its arguments to the PrintWriter constructor with the same signature.
IndentWriter(java.io.Writer out, boolean autoFlush)
          Forwards its arguments to the PrintWriter constructor with the same signature.
 
Method Summary
 void print(int numberOfSpaces, java.lang.String text)
          Print the text (indented the specified amount) without inserting a linefeed.
 void println(int numberOfSpaces, java.lang.String text)
          Print the text (indented the specified amount) and insert a linefeed.
 
Methods inherited from class java.io.PrintWriter
checkError, close, flush, print, print, print, print, print, print, print, print, print, println, println, println, println, println, println, println, println, println, println, setError, write, write, write, write, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IndentWriter

public IndentWriter(java.io.OutputStream out)
Forwards its arguments to the PrintWriter constructor with the same signature.


IndentWriter

public IndentWriter(java.io.OutputStream out,
                    boolean autoFlush)
Forwards its arguments to the PrintWriter constructor with the same signature.


IndentWriter

public IndentWriter(java.io.Writer out)
Forwards its arguments to the PrintWriter constructor with the same signature.


IndentWriter

public IndentWriter(java.io.Writer out,
                    boolean autoFlush)
Forwards its arguments to the PrintWriter constructor with the same signature.

Method Detail

print

public void print(int numberOfSpaces,
                  java.lang.String text)
Print the text (indented the specified amount) without inserting a linefeed.

Parameters:
numberOfSpaces - the number of spaces to indent the text.
text - the text to print.

println

public void println(int numberOfSpaces,
                    java.lang.String text)
Print the text (indented the specified amount) and insert a linefeed.

Parameters:
numberOfSpaces - the number of spaces to indent the text.
text - the text to print.


libbsf-java-2.4.0/docs/api/org/apache/bsf/util/cf/0000755000175000017500000000000010736513022020510 5ustar mkochmkochlibbsf-java-2.4.0/docs/api/org/apache/bsf/util/cf/package-tree.html0000644000175000017500000001377110511475731023744 0ustar mkochmkoch org.apache.bsf.util.cf Class Hierarchy (Bean Scripting Framework API)

Hierarchy For Package org.apache.bsf.util.cf

Package Hierarchies:
All Packages

Class Hierarchy



libbsf-java-2.4.0/docs/api/org/apache/bsf/util/cf/CodeFormatter.html0000644000175000017500000005313510511475731024150 0ustar mkochmkoch CodeFormatter (Bean Scripting Framework API)

org.apache.bsf.util.cf
Class CodeFormatter

java.lang.Object
  extended byorg.apache.bsf.util.cf.CodeFormatter

public class CodeFormatter
extends java.lang.Object

A CodeFormatter bean is used to format raw Java code. It indents, word-wraps, and replaces tab characters with an amount of space characters equal to the size of the indentationStep property. To create and use a CodeFormatter, you simply instantiate a new CodeFormatter bean, and invoke formatCode(Reader source, Writer target) with appropriate arguments.

Author:
Matthew J. Duftler

Field Summary
static java.lang.String DEFAULT_DELIM
          The default set of delimiters.
static int DEFAULT_MAX
          The default maximum line length.
static java.lang.String DEFAULT_S_DELIM
          The default set of sticky delimiters.
static int DEFAULT_STEP
          The default size of the indentation step.
 
Constructor Summary
CodeFormatter()
           
 
Method Summary
 void formatCode(java.io.Reader source, java.io.Writer target)
          Formats the code read from source, and writes the formatted code to target.
 java.lang.String getDelimiters()
          Gets the set of delimiters.
 int getIndentationStep()
          Gets the size of the indentation step.
 int getMaxLineLength()
          Gets the maximum line length.
 java.lang.String getStickyDelimiters()
          Gets the set of sticky delimiters.
 void setDelimiters(java.lang.String newDelimiters)
          Sets the set of delimiters; default set is "(+".
 void setIndentationStep(int newIndentationStep)
          Sets the size of the indentation step; default size is 2.
 void setMaxLineLength(int newMaxLineLength)
          Sets the (desired) maximum line length; default length is 74.
 void setStickyDelimiters(java.lang.String newStickyDelimiters)
          Sets the set of sticky delimiters; default set is ",".
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_MAX

public static final int DEFAULT_MAX
The default maximum line length.

See Also:
Constant Field Values

DEFAULT_STEP

public static final int DEFAULT_STEP
The default size of the indentation step.

See Also:
Constant Field Values

DEFAULT_DELIM

public static final java.lang.String DEFAULT_DELIM
The default set of delimiters.

See Also:
Constant Field Values

DEFAULT_S_DELIM

public static final java.lang.String DEFAULT_S_DELIM
The default set of sticky delimiters.

See Also:
Constant Field Values
Constructor Detail

CodeFormatter

public CodeFormatter()
Method Detail

formatCode

public void formatCode(java.io.Reader source,
                       java.io.Writer target)
Formats the code read from source, and writes the formatted code to target.

Parameters:
source - where to read the unformatted code from.
target - where to write the formatted code to.

getDelimiters

public java.lang.String getDelimiters()
Gets the set of delimiters.

Returns:
the set of delimiters.
See Also:
setDelimiters(java.lang.String)

getIndentationStep

public int getIndentationStep()
Gets the size of the indentation step.

Returns:
the size of the indentation step.
See Also:
setIndentationStep(int)

getMaxLineLength

public int getMaxLineLength()
Gets the maximum line length.

Returns:
the maximum line length.
See Also:
setMaxLineLength(int)

getStickyDelimiters

public java.lang.String getStickyDelimiters()
Gets the set of sticky delimiters.

Returns:
the set of sticky delimiters.
See Also:
setStickyDelimiters(java.lang.String)

setDelimiters

public void setDelimiters(java.lang.String newDelimiters)
Sets the set of delimiters; default set is "(+".

Each character represents one delimiter. If a line is ready to be word-wrapped and a delimiter is encountered, the delimiter will appear as the first character on the following line. A quotation mark, " or ', opening a string is always a delimiter, whether you specify it or not.

Parameters:
newDelimiters - the new set of delimiters.
See Also:
getDelimiters()

setIndentationStep

public void setIndentationStep(int newIndentationStep)
Sets the size of the indentation step; default size is 2.

This is the number of spaces that lines will be indented (when appropriate).

Parameters:
newIndentationStep - the new size of the indentation step.
See Also:
getIndentationStep()

setMaxLineLength

public void setMaxLineLength(int newMaxLineLength)
Sets the (desired) maximum line length; default length is 74.

If a token is longer than the requested maximum line length, then the line containing that token will obviously be longer than the desired maximum.

Parameters:
newMaxLineLength - the new maximum line length.
See Also:
getMaxLineLength()

setStickyDelimiters

public void setStickyDelimiters(java.lang.String newStickyDelimiters)
Sets the set of sticky delimiters; default set is ",".

Each character represents one sticky delimiter. If a line is ready to be word-wrapped and a sticky delimiter is encountered, the sticky delimiter will appear as the last character on the current line. A quotation mark, " or ', closing a string is always a sticky delimiter, whether you specify it or not.

Parameters:
newStickyDelimiters - the new set of sticky delimiters.
See Also:
getStickyDelimiters()


libbsf-java-2.4.0/docs/api/org/apache/bsf/util/cf/CFDriver.html0000644000175000017500000002462310511475731023056 0ustar mkochmkoch CFDriver (Bean Scripting Framework API)

org.apache.bsf.util.cf
Class CFDriver

java.lang.Object
  extended byorg.apache.bsf.util.cf.CFDriver

public class CFDriver
extends java.lang.Object

This is an example of how a CodeFormatter bean can be used.

The CFDriver is a stand-alone tool that will instantiate a CodeFormatter bean, configure it according to your command-line arguments, and invoke the formatting. Since the default source of input is stdin, and the default target for output is stdout, a CFDriver can also be used as a filter.

Author:
Matthew J. Duftler
See Also:
CodeFormatter

Constructor Summary
CFDriver()
          Not used.
 
Method Summary
static void main(java.lang.String[] argv)
          A driver for CodeFormatter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CFDriver

public CFDriver()
Not used.

Method Detail

main

public static void main(java.lang.String[] argv)
A driver for CodeFormatter.

Usage:

  java org.apache.cf.CFDriver [args]

args:

[-in fileName] default: <STDIN> [-out fileName] default: <STDOUT> [-maxLine length] default: 74 [-step size] default: 2 [-delim group] default: (+ [-sdelim group] default: ,



libbsf-java-2.4.0/docs/api/org/apache/bsf/util/cf/package-use.html0000644000175000017500000001243110511475731023571 0ustar mkochmkoch Uses of Package org.apache.bsf.util.cf (Bean Scripting Framework API)

Uses of Package
org.apache.bsf.util.cf

No usage of org.apache.bsf.util.cf



libbsf-java-2.4.0/docs/api/org/apache/bsf/util/cf/class-use/0000755000175000017500000000000010736513022022407 5ustar mkochmkochlibbsf-java-2.4.0/docs/api/org/apache/bsf/util/cf/class-use/CodeFormatter.html0000644000175000017500000001323210511475731026041 0ustar mkochmkoch Uses of Class org.apache.bsf.util.cf.CodeFormatter (Bean Scripting Framework API)

Uses of Class
org.apache.bsf.util.cf.CodeFormatter

No usage of org.apache.bsf.util.cf.CodeFormatter



libbsf-java-2.4.0/docs/api/org/apache/bsf/util/cf/class-use/CFDriver.html0000644000175000017500000001316210511475731024751 0ustar mkochmkoch Uses of Class org.apache.bsf.util.cf.CFDriver (Bean Scripting Framework API)

Uses of Class
org.apache.bsf.util.cf.CFDriver

No usage of org.apache.bsf.util.cf.CFDriver



libbsf-java-2.4.0/docs/api/org/apache/bsf/util/cf/package-summary.html0000644000175000017500000001451610511475731024500 0ustar mkochmkoch org.apache.bsf.util.cf (Bean Scripting Framework API)

Package org.apache.bsf.util.cf

Class Summary
CFDriver This is an example of how a CodeFormatter bean can be used.
CodeFormatter A CodeFormatter bean is used to format raw Java code.
 



libbsf-java-2.4.0/docs/api/org/apache/bsf/util/cf/package-frame.html0000644000175000017500000000202710511475731024067 0ustar mkochmkoch org.apache.bsf.util.cf (Bean Scripting Framework API) org.apache.bsf.util.cf
Classes 
CFDriver
CodeFormatter
libbsf-java-2.4.0/docs/api/org/apache/bsf/util/JavaUtils.html0000644000175000017500000002315510511475731022723 0ustar mkochmkoch JavaUtils (Bean Scripting Framework API)

org.apache.bsf.util
Class JavaUtils

java.lang.Object
  extended byorg.apache.bsf.util.JavaUtils

public class JavaUtils
extends java.lang.Object


Constructor Summary
JavaUtils()
           
 
Method Summary
static boolean JDKcompile(java.lang.String fileName, java.lang.String classPath)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JavaUtils

public JavaUtils()
Method Detail

JDKcompile

public static boolean JDKcompile(java.lang.String fileName,
                                 java.lang.String classPath)


libbsf-java-2.4.0/docs/api/org/apache/bsf/util/EngineUtils.html0000644000175000017500000005543510511475731023255 0ustar mkochmkoch EngineUtils (Bean Scripting Framework API)

org.apache.bsf.util
Class EngineUtils

java.lang.Object
  extended byorg.apache.bsf.util.EngineUtils

public class EngineUtils
extends java.lang.Object

This class contains utilities that language integrators can use when implementing the BSFEngine interface.

Author:
Sanjiva Weerawarana, Sam Ruby, Rony G. Flatscher (added addEventListenerReturningEventInfos)

Constructor Summary
EngineUtils()
           
 
Method Summary
static void addEventListener(java.lang.Object bean, java.lang.String eventSetName, java.lang.String filter, BSFEngine engine, BSFManager manager, java.lang.String source, int lineNo, int columnNo, java.lang.Object script)
          Add a script as a listener to some event coming out of an object.
static void addEventListenerReturningEventInfos(java.lang.Object bean, java.lang.String eventSetName, java.lang.String filter, BSFEngine engine, BSFManager manager, java.lang.String source, int lineNo, int columnNo, java.lang.Object script, java.lang.Object dataFromScriptingEngine)
          Add a script as a listener to some event coming out of an object.
static java.lang.Object callBeanMethod(java.lang.Object bean, java.lang.String methodName, java.lang.Object[] args)
          Finds and invokes a method with the given signature on the given bean.
static java.lang.Object createBean(java.lang.String className, java.lang.Object[] args)
          Creates a new bean.
static java.lang.String getTypeSignatureString(java.lang.Class cl)
          Given a class return the type signature string fragment for it.
static java.lang.Class loadClass(BSFManager mgr, java.lang.String name)
          Load a class using the class loader of given manager.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EngineUtils

public EngineUtils()
Method Detail

addEventListener

public static void addEventListener(java.lang.Object bean,
                                    java.lang.String eventSetName,
                                    java.lang.String filter,
                                    BSFEngine engine,
                                    BSFManager manager,
                                    java.lang.String source,
                                    int lineNo,
                                    int columnNo,
                                    java.lang.Object script)
                             throws BSFException
Add a script as a listener to some event coming out of an object. The first two args identify the src of the event and the event set and the rest identify the script which should be run when the event fires.

Parameters:
bean - event source
eventSetName - name of event set from event src to bind to
filter - filter for events
engine - BSFEngine which can run this script
manager - BSFManager of the above engine
source - (context info) the source of this expression (e.g., filename)
lineNo - (context info) the line number in source for expr
columnNo - (context info) the column number in source for expr
script - the script to execute when the event occurs
Throws:
BSFException - if anything goes wrong while running the script

addEventListenerReturningEventInfos

public static void addEventListenerReturningEventInfos(java.lang.Object bean,
                                                       java.lang.String eventSetName,
                                                       java.lang.String filter,
                                                       BSFEngine engine,
                                                       BSFManager manager,
                                                       java.lang.String source,
                                                       int lineNo,
                                                       int columnNo,
                                                       java.lang.Object script,
                                                       java.lang.Object dataFromScriptingEngine)
                                                throws BSFException
Add a script as a listener to some event coming out of an object. The first two args identify the src of the event and the event set and the rest identify the script which should be run when the event fires. The processing will use the engine's apply() method.

Parameters:
bean - event source
eventSetName - name of event set from event src to bind to
filter - filter for events
engine - BSFEngine which can run this script
manager - BSFManager of the above engine
source - (context info) the source of this expression (e.g., filename)
lineNo - (context info) the line number in source for expr
columnNo - (context info) the column number in source for expr
script - the script to execute when the event occurs
dataFromScriptingEngine - this contains any object supplied by the scripting engine and gets sent back with the supplied script, if the event occurs. This could be used e.g. for indicating to the scripting engine which scripting engine object/routine/function/procedure should be ultimately informed of the event occurrence.
Throws:
BSFException - if anything goes wrong while running the script

callBeanMethod

public static java.lang.Object callBeanMethod(java.lang.Object bean,
                                              java.lang.String methodName,
                                              java.lang.Object[] args)
                                       throws BSFException
Finds and invokes a method with the given signature on the given bean. The signature of the method that's invoked is first taken as the types of the args, but if that fails, this tries to convert any primitive wrapper type args to their primitive counterparts to see whether a method exists that way. If it does, done.

Parameters:
bean - the object on which to invoke the method
methodName - name of the method
args - arguments to be given to the method
Returns:
the result of invoking the method, if any
Throws:
BSFException - if something goes wrong

createBean

public static java.lang.Object createBean(java.lang.String className,
                                          java.lang.Object[] args)
                                   throws BSFException
Creates a new bean. The signature of the constructor that's invoked is first taken as the types of the args, but if that fails, this tries to convert any primitive wrapper type args to their primitive counterparts to see whether a method exists that way. If it does, done.

Parameters:
className - fully qualified name of class to instantiate
args - array of constructor args (or null if none)
Returns:
the created bean
Throws:
BSFException - if something goes wrong (@see org.apache.cs.util.MethodUtils for the real exceptions that can occur).

getTypeSignatureString

public static java.lang.String getTypeSignatureString(java.lang.Class cl)
Given a class return the type signature string fragment for it. That is, return "I" for int, "J" for long, ... etc..

Parameters:
cl - class object for whom the signature fragment is needed.
Returns:
the string representing the type signature

loadClass

public static java.lang.Class loadClass(BSFManager mgr,
                                        java.lang.String name)
                                 throws BSFException
Load a class using the class loader of given manager. If that fails try using a class loader that loads from the tempdir of the manager.

Parameters:
mgr - BSFManager who's classLoader and tempDir props are consulted
name - name of the class to load
Returns:
the loaded class
Throws:
BSFException - if something goes wrong.


libbsf-java-2.4.0/docs/api/org/apache/bsf/util/ObjInfo.html0000644000175000017500000003024510511475731022345 0ustar mkochmkoch ObjInfo (Bean Scripting Framework API)

org.apache.bsf.util
Class ObjInfo

java.lang.Object
  extended byorg.apache.bsf.util.ObjInfo

public class ObjInfo
extends java.lang.Object

An ObjInfo object is used by a compiler to track the name and type of a bean.

Author:
Matthew J. Duftler

Field Summary
 java.lang.Class objClass
           
 java.lang.String objName
           
 
Constructor Summary
ObjInfo(java.lang.Class objClass, java.lang.String objName)
           
 
Method Summary
 boolean isExecutable()
           
 boolean isValueReturning()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

objName

public java.lang.String objName

objClass

public java.lang.Class objClass
Constructor Detail

ObjInfo

public ObjInfo(java.lang.Class objClass,
               java.lang.String objName)
Method Detail

isExecutable

public boolean isExecutable()

isValueReturning

public boolean isValueReturning()

toString

public java.lang.String toString()


libbsf-java-2.4.0/docs/api/org/apache/bsf/util/Bean.html0000644000175000017500000002413410511475731021664 0ustar mkochmkoch Bean (Bean Scripting Framework API)

org.apache.bsf.util
Class Bean

java.lang.Object
  extended byorg.apache.bsf.util.Bean

public class Bean
extends java.lang.Object

A Bean is the class used to represent a bean: it holds a type and a value. This is needed because otherwise we can't represent the types of null-valued beans (or primitives) correctly. This was originally in the BML player.

Author:
Sanjiva Weerawarana

Field Summary
 java.lang.Class type
           
 java.lang.Object value
           
 
Constructor Summary
Bean(java.lang.Class type, java.lang.Object value)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

type

public java.lang.Class type

value

public java.lang.Object value
Constructor Detail

Bean

public Bean(java.lang.Class type,
            java.lang.Object value)


libbsf-java-2.4.0/docs/api/org/apache/bsf/util/IOUtils.html0000644000175000017500000002340510511475731022347 0ustar mkochmkoch IOUtils (Bean Scripting Framework API)

org.apache.bsf.util
Class IOUtils

java.lang.Object
  extended byorg.apache.bsf.util.IOUtils

public class IOUtils
extends java.lang.Object

This file is a collection of input/output utilities.

Author:
Sanjiva Weerawarana, Matthew J. Duftler

Constructor Summary
IOUtils()
           
 
Method Summary
static java.lang.String getStringFromReader(java.io.Reader reader)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IOUtils

public IOUtils()
Method Detail

getStringFromReader

public static java.lang.String getStringFromReader(java.io.Reader reader)
                                            throws java.io.IOException
Throws:
java.io.IOException


libbsf-java-2.4.0/docs/api/org/apache/bsf/util/BSFEventProcessor.html0000644000175000017500000002561510511475731024340 0ustar mkochmkoch BSFEventProcessor (Bean Scripting Framework API)

org.apache.bsf.util
Class BSFEventProcessor

java.lang.Object
  extended byorg.apache.bsf.util.BSFEventProcessor
All Implemented Interfaces:
EventProcessor

public class BSFEventProcessor
extends java.lang.Object
implements EventProcessor

This is used to support binding scripts to be run when an event occurs.

Author:
Sanjiva Weerawarana

Method Summary
 void processEvent(java.lang.String inFilter, java.lang.Object[] evtInfo)
           
 void processExceptionableEvent(java.lang.String inFilter, java.lang.Object[] evtInfo)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

processEvent

public void processEvent(java.lang.String inFilter,
                         java.lang.Object[] evtInfo)
Specified by:
processEvent in interface EventProcessor

processExceptionableEvent

public void processExceptionableEvent(java.lang.String inFilter,
                                      java.lang.Object[] evtInfo)
                               throws java.lang.Exception
Specified by:
processExceptionableEvent in interface EventProcessor
Throws:
java.lang.Exception


libbsf-java-2.4.0/docs/api/org/apache/bsf/util/package-use.html0000644000175000017500000003307310511475731023206 0ustar mkochmkoch Uses of Package org.apache.bsf.util (Bean Scripting Framework API)

Uses of Package
org.apache.bsf.util

Packages that use org.apache.bsf.util
org.apache.bsf   
org.apache.bsf.engines.jacl   
org.apache.bsf.engines.javascript   
org.apache.bsf.engines.jython   
org.apache.bsf.engines.netrexx   
org.apache.bsf.engines.xslt   
org.apache.bsf.util   
 

Classes in org.apache.bsf.util used by org.apache.bsf
CodeBuffer
          A CodeBuffer object is used as a code repository for generated Java code.
ObjectRegistry
          The ObjectRegistry is used to do name-to-object reference lookups.
 

Classes in org.apache.bsf.util used by org.apache.bsf.engines.jacl
BSFEngineImpl
          This is a base implementation of the BSFEngine interface which engine implementations may choose to extend to get the basic methods of the interface implemented.
 

Classes in org.apache.bsf.util used by org.apache.bsf.engines.javascript
BSFEngineImpl
          This is a base implementation of the BSFEngine interface which engine implementations may choose to extend to get the basic methods of the interface implemented.
 

Classes in org.apache.bsf.util used by org.apache.bsf.engines.jython
BSFEngineImpl
          This is a base implementation of the BSFEngine interface which engine implementations may choose to extend to get the basic methods of the interface implemented.
 

Classes in org.apache.bsf.util used by org.apache.bsf.engines.netrexx
BSFEngineImpl
          This is a base implementation of the BSFEngine interface which engine implementations may choose to extend to get the basic methods of the interface implemented.
 

Classes in org.apache.bsf.util used by org.apache.bsf.engines.xslt
BSFEngineImpl
          This is a base implementation of the BSFEngine interface which engine implementations may choose to extend to get the basic methods of the interface implemented.
 

Classes in org.apache.bsf.util used by org.apache.bsf.util
Bean
          A Bean is the class used to represent a bean: it holds a type and a value.
CodeBuffer
          A CodeBuffer object is used as a code repository for generated Java code.
ObjectRegistry
          The ObjectRegistry is used to do name-to-object reference lookups.
ObjInfo
          An ObjInfo object is used by a compiler to track the name and type of a bean.
 



libbsf-java-2.4.0/docs/api/org/apache/bsf/util/BSFFunctions.html0000644000175000017500000003174010511475731023323 0ustar mkochmkoch BSFFunctions (Bean Scripting Framework API)

org.apache.bsf.util
Class BSFFunctions

java.lang.Object
  extended byorg.apache.bsf.util.BSFFunctions

public class BSFFunctions
extends java.lang.Object

This is a utility that engine implementors may use as the Java object they expose in the scripting language as "bsf". This has essentially a subset of the methods in BSFManager plus some stuff from the utils. Currently used by Javascript (Rhino) & BML.

Author:
Sanjiva Weerawarana

Constructor Summary
BSFFunctions(BSFManager mgr, BSFEngine engine)
           
 
Method Summary
 void addEventListener(java.lang.Object src, java.lang.String eventSetName, java.lang.String filter, java.lang.Object script)
           
 java.lang.Object lookupBean(java.lang.String name)
           
 void registerBean(java.lang.String name, java.lang.Object bean)
           
 void unregisterBean(java.lang.String name)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BSFFunctions

public BSFFunctions(BSFManager mgr,
                    BSFEngine engine)
Method Detail

addEventListener

public void addEventListener(java.lang.Object src,
                             java.lang.String eventSetName,
                             java.lang.String filter,
                             java.lang.Object script)
                      throws BSFException
Throws:
BSFException

lookupBean

public java.lang.Object lookupBean(java.lang.String name)

registerBean

public void registerBean(java.lang.String name,
                         java.lang.Object bean)

unregisterBean

public void unregisterBean(java.lang.String name)


libbsf-java-2.4.0/docs/api/org/apache/bsf/util/class-use/0000755000175000017500000000000010736513022022017 5ustar mkochmkochlibbsf-java-2.4.0/docs/api/org/apache/bsf/util/class-use/CodeBuffer.html0000644000175000017500000004074710511475731024732 0ustar mkochmkoch Uses of Class org.apache.bsf.util.CodeBuffer (Bean Scripting Framework API)

Uses of Class
org.apache.bsf.util.CodeBuffer

Packages that use CodeBuffer
org.apache.bsf   
org.apache.bsf.util   
 

Uses of CodeBuffer in org.apache.bsf
 

Methods in org.apache.bsf with parameters of type CodeBuffer
 void BSFEngine.compileApply(java.lang.String source, int lineNo, int columnNo, java.lang.Object funcBody, java.util.Vector paramNames, java.util.Vector arguments, CodeBuffer cb)
          This is used by an application to compile an anonymous function.
 void BSFEngine.compileExpr(java.lang.String source, int lineNo, int columnNo, java.lang.Object expr, CodeBuffer cb)
          This is used by an application to compile a value-returning expression.
 void BSFEngine.compileScript(java.lang.String source, int lineNo, int columnNo, java.lang.Object script, CodeBuffer cb)
          This is used by an application to compile some script.
 void BSFManager.compileApply(java.lang.String lang, java.lang.String source, int lineNo, int columnNo, java.lang.Object funcBody, java.util.Vector paramNames, java.util.Vector arguments, CodeBuffer cb)
          Compile the application of the given anonymous function of the given language to the given parameters into the given CodeBuffer.
 void BSFManager.compileExpr(java.lang.String lang, java.lang.String source, int lineNo, int columnNo, java.lang.Object expr, CodeBuffer cb)
          Compile the given expression of the given language into the given CodeBuffer.
 void BSFManager.compileScript(java.lang.String lang, java.lang.String source, int lineNo, int columnNo, java.lang.Object script, CodeBuffer cb)
          Compile the given script of the given language into the given CodeBuffer.
 

Uses of CodeBuffer in org.apache.bsf.util
 

Methods in org.apache.bsf.util with parameters of type CodeBuffer
 void BSFEngineImpl.compileApply(java.lang.String source, int lineNo, int columnNo, java.lang.Object funcBody, java.util.Vector paramNames, java.util.Vector arguments, CodeBuffer cb)
          Default impl of compileApply - calls compileExpr ignoring parameters.
 void BSFEngineImpl.compileExpr(java.lang.String source, int lineNo, int columnNo, java.lang.Object expr, CodeBuffer cb)
          Default impl of compileExpr - generates code that'll create a new manager, evaluate the expression, and return the value.
 void BSFEngineImpl.compileScript(java.lang.String source, int lineNo, int columnNo, java.lang.Object script, CodeBuffer cb)
          Default impl of compileScript - generates code that'll create a new manager, and execute the script.
 void CodeBuffer.merge(CodeBuffer otherCB)
           
 

Constructors in org.apache.bsf.util with parameters of type CodeBuffer
CodeBuffer(CodeBuffer parent)
           
 



libbsf-java-2.4.0/docs/api/org/apache/bsf/util/class-use/ObjectRegistry.html0000644000175000017500000002511110511475731025651 0ustar mkochmkoch Uses of Class org.apache.bsf.util.ObjectRegistry (Bean Scripting Framework API)

Uses of Class
org.apache.bsf.util.ObjectRegistry

Packages that use ObjectRegistry
org.apache.bsf   
org.apache.bsf.util   
 

Uses of ObjectRegistry in org.apache.bsf
 

Fields in org.apache.bsf declared as ObjectRegistry
protected  ObjectRegistry BSFManager.objectRegistry
           
 

Methods in org.apache.bsf that return ObjectRegistry
 ObjectRegistry BSFManager.getObjectRegistry()
          Return the current object registry of the manager.
 

Methods in org.apache.bsf with parameters of type ObjectRegistry
 void BSFManager.setObjectRegistry(ObjectRegistry objectRegistry)
          Set the object registry used by this manager.
 

Uses of ObjectRegistry in org.apache.bsf.util
 

Constructors in org.apache.bsf.util with parameters of type ObjectRegistry
ObjectRegistry(ObjectRegistry parent)
           
 



libbsf-java-2.4.0/docs/api/org/apache/bsf/util/class-use/IndentWriter.html0000644000175000017500000001310110511475731025324 0ustar mkochmkoch Uses of Class org.apache.bsf.util.IndentWriter (Bean Scripting Framework API)

Uses of Class
org.apache.bsf.util.IndentWriter

No usage of org.apache.bsf.util.IndentWriter



libbsf-java-2.4.0/docs/api/org/apache/bsf/util/class-use/JavaUtils.html0000644000175000017500000001305110511475731024614 0ustar mkochmkoch Uses of Class org.apache.bsf.util.JavaUtils (Bean Scripting Framework API)

Uses of Class
org.apache.bsf.util.JavaUtils

No usage of org.apache.bsf.util.JavaUtils



libbsf-java-2.4.0/docs/api/org/apache/bsf/util/class-use/EngineUtils.html0000644000175000017500000001307110511475731025142 0ustar mkochmkoch Uses of Class org.apache.bsf.util.EngineUtils (Bean Scripting Framework API)

Uses of Class
org.apache.bsf.util.EngineUtils

No usage of org.apache.bsf.util.EngineUtils



libbsf-java-2.4.0/docs/api/org/apache/bsf/util/class-use/ObjInfo.html0000644000175000017500000002334010511475731024242 0ustar mkochmkoch Uses of Class org.apache.bsf.util.ObjInfo (Bean Scripting Framework API)

Uses of Class
org.apache.bsf.util.ObjInfo

Packages that use ObjInfo
org.apache.bsf.util   
 

Uses of ObjInfo in org.apache.bsf.util
 

Methods in org.apache.bsf.util that return ObjInfo
 ObjInfo CodeBuffer.getFinalServiceMethodStatement()
           
 ObjInfo CodeBuffer.getSymbol(java.lang.String symbol)
           
 

Methods in org.apache.bsf.util with parameters of type ObjInfo
 void CodeBuffer.addConstructorArgument(ObjInfo arg)
           
 void CodeBuffer.putSymbol(java.lang.String symbol, ObjInfo obj)
           
 void CodeBuffer.setFinalServiceMethodStatement(ObjInfo finalStatementInfo)
           
 



libbsf-java-2.4.0/docs/api/org/apache/bsf/util/class-use/Bean.html0000644000175000017500000002521010511475731023557 0ustar mkochmkoch Uses of Class org.apache.bsf.util.Bean (Bean Scripting Framework API)

Uses of Class
org.apache.bsf.util.Bean

Packages that use Bean
org.apache.bsf.util   
 

Uses of Bean in org.apache.bsf.util
 

Methods in org.apache.bsf.util that return Bean
static Bean ReflectionUtils.createBean(java.lang.ClassLoader cld, java.lang.String className, java.lang.Class[] argTypes, java.lang.Object[] args)
          Create a bean using given class loader and using the appropriate constructor for the given args of the given arg types.
static Bean ReflectionUtils.createBean(java.lang.ClassLoader cld, java.lang.String className, java.lang.Object[] args)
          Create a bean using given class loader and using the appropriate constructor for the given args.
static Bean ReflectionUtils.getField(java.lang.Object target, java.lang.String fieldName)
           
static Bean ReflectionUtils.getProperty(java.lang.Object target, java.lang.String propName, java.lang.Integer index)
          Get a property of a bean.
 

Methods in org.apache.bsf.util with parameters of type Bean
static void ReflectionUtils.setField(java.lang.Object target, java.lang.String fieldName, Bean value, TypeConvertorRegistry tcr)
           
 



libbsf-java-2.4.0/docs/api/org/apache/bsf/util/class-use/IOUtils.html0000644000175000017500000001303110511475731024240 0ustar mkochmkoch Uses of Class org.apache.bsf.util.IOUtils (Bean Scripting Framework API)

Uses of Class
org.apache.bsf.util.IOUtils

No usage of org.apache.bsf.util.IOUtils



libbsf-java-2.4.0/docs/api/org/apache/bsf/util/class-use/BSFEventProcessor.html0000644000175000017500000001315110511475731026227 0ustar mkochmkoch Uses of Class org.apache.bsf.util.BSFEventProcessor (Bean Scripting Framework API)

Uses of Class
org.apache.bsf.util.BSFEventProcessor

No usage of org.apache.bsf.util.BSFEventProcessor



libbsf-java-2.4.0/docs/api/org/apache/bsf/util/class-use/BSFFunctions.html0000644000175000017500000001310110511475731025211 0ustar mkochmkoch Uses of Class org.apache.bsf.util.BSFFunctions (Bean Scripting Framework API)

Uses of Class
org.apache.bsf.util.BSFFunctions

No usage of org.apache.bsf.util.BSFFunctions



libbsf-java-2.4.0/docs/api/org/apache/bsf/util/class-use/StringUtils.html0000644000175000017500000001307110511475731025203 0ustar mkochmkoch Uses of Class org.apache.bsf.util.StringUtils (Bean Scripting Framework API)

Uses of Class
org.apache.bsf.util.StringUtils

No usage of org.apache.bsf.util.StringUtils



libbsf-java-2.4.0/docs/api/org/apache/bsf/util/class-use/BSFEventProcessorReturningEventInfos.html0000644000175000017500000001340110511475731032124 0ustar mkochmkoch Uses of Class org.apache.bsf.util.BSFEventProcessorReturningEventInfos (Bean Scripting Framework API)

Uses of Class
org.apache.bsf.util.BSFEventProcessorReturningEventInfos

No usage of org.apache.bsf.util.BSFEventProcessorReturningEventInfos



libbsf-java-2.4.0/docs/api/org/apache/bsf/util/class-use/ReflectionUtils.html0000644000175000017500000001313110511475731026024 0ustar mkochmkoch Uses of Class org.apache.bsf.util.ReflectionUtils (Bean Scripting Framework API)

Uses of Class
org.apache.bsf.util.ReflectionUtils

No usage of org.apache.bsf.util.ReflectionUtils



libbsf-java-2.4.0/docs/api/org/apache/bsf/util/class-use/MethodUtils.html0000644000175000017500000001307110511475731025155 0ustar mkochmkoch Uses of Class org.apache.bsf.util.MethodUtils (Bean Scripting Framework API)

Uses of Class
org.apache.bsf.util.MethodUtils

No usage of org.apache.bsf.util.MethodUtils



libbsf-java-2.4.0/docs/api/org/apache/bsf/util/class-use/BSFEngineImpl.html0000644000175000017500000003243110511475731025277 0ustar mkochmkoch Uses of Class org.apache.bsf.util.BSFEngineImpl (Bean Scripting Framework API)

Uses of Class
org.apache.bsf.util.BSFEngineImpl

Packages that use BSFEngineImpl
org.apache.bsf.engines.jacl   
org.apache.bsf.engines.javascript   
org.apache.bsf.engines.jython   
org.apache.bsf.engines.netrexx   
org.apache.bsf.engines.xslt   
 

Uses of BSFEngineImpl in org.apache.bsf.engines.jacl
 

Subclasses of BSFEngineImpl in org.apache.bsf.engines.jacl
 class JaclEngine
          This is the interface to Scriptics's Jacl (Tcl) from the Bean Scripting Framework.
 

Uses of BSFEngineImpl in org.apache.bsf.engines.javascript
 

Subclasses of BSFEngineImpl in org.apache.bsf.engines.javascript
 class JavaScriptEngine
          This is the interface to Netscape's Rhino (JavaScript) from the Bean Scripting Framework.
 

Uses of BSFEngineImpl in org.apache.bsf.engines.jython
 

Subclasses of BSFEngineImpl in org.apache.bsf.engines.jython
 class JythonEngine
          This is the interface to Jython (http://www.jython.org/) from BSF.
 

Uses of BSFEngineImpl in org.apache.bsf.engines.netrexx
 

Subclasses of BSFEngineImpl in org.apache.bsf.engines.netrexx
 class NetRexxEngine
          This is the interface to NetRexx from the Bean Scripting Framework.
 

Uses of BSFEngineImpl in org.apache.bsf.engines.xslt
 

Subclasses of BSFEngineImpl in org.apache.bsf.engines.xslt
 class XSLTEngine
          Xerces XSLT interface to BSF.
 



libbsf-java-2.4.0/docs/api/org/apache/bsf/util/package-summary.html0000644000175000017500000002406710511475731024112 0ustar mkochmkoch org.apache.bsf.util (Bean Scripting Framework API)

Package org.apache.bsf.util

Class Summary
Bean A Bean is the class used to represent a bean: it holds a type and a value.
BSFEngineImpl This is a base implementation of the BSFEngine interface which engine implementations may choose to extend to get the basic methods of the interface implemented.
BSFEventProcessor This is used to support binding scripts to be run when an event occurs.
BSFEventProcessorReturningEventInfos This is used to support binding scripts to be run when an event occurs, forwarding the arguments supplied to the event listener.
BSFFunctions This is a utility that engine implementors may use as the Java object they expose in the scripting language as "bsf".
CodeBuffer A CodeBuffer object is used as a code repository for generated Java code.
EngineUtils This class contains utilities that language integrators can use when implementing the BSFEngine interface.
IndentWriter An IndentWriter object behaves the same as a PrintWriter object, with the additional capability of being able to print strings that are prepended with a specified amount of spaces.
IOUtils This file is a collection of input/output utilities.
JavaUtils  
MethodUtils This file is a collection of reflection utilities for dealing with methods and constructors.
ObjectRegistry The ObjectRegistry is used to do name-to-object reference lookups.
ObjInfo An ObjInfo object is used by a compiler to track the name and type of a bean.
ReflectionUtils This file is a collection of reflection utilities.
StringUtils Deals with strings (probably need to elaborate some more).
 



libbsf-java-2.4.0/docs/api/org/apache/bsf/util/StringUtils.html0000644000175000017500000004604710511475731023315 0ustar mkochmkoch StringUtils (Bean Scripting Framework API)

org.apache.bsf.util
Class StringUtils

java.lang.Object
  extended byorg.apache.bsf.util.StringUtils

public class StringUtils
extends java.lang.Object

Deals with strings (probably need to elaborate some more).

Author:
Matthew J. Duftler

Field Summary
static java.lang.String lineSeparator
           
static java.lang.String lineSeparatorStr
           
 
Constructor Summary
StringUtils()
           
 
Method Summary
static java.lang.String classNameToVarName(java.lang.String className)
           
static java.lang.String cleanString(java.lang.String str)
           
static java.lang.String getChars(int numberOfChars, char theChar)
          Get a string consisting of numberOfChars theChars.
static java.lang.String getClassName(java.lang.Class targetClass)
           
static java.lang.String getCommaListFromVector(java.util.Vector sourceVector)
           
static java.io.Reader getContentAsReader(java.net.URL url)
           
static java.lang.String getContentAsString(java.net.URL url)
           
static java.lang.String getSafeString(java.lang.String scriptStr)
           
static java.net.URL getURL(java.net.URL contextURL, java.lang.String spec)
           
static java.lang.String getValidIdentifierName(java.lang.String identifierName)
           
static boolean isValidIdentifierName(java.lang.String identifierName)
           
static boolean isValidPackageName(java.lang.String packageName)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

lineSeparator

public static final java.lang.String lineSeparator

lineSeparatorStr

public static final java.lang.String lineSeparatorStr
Constructor Detail

StringUtils

public StringUtils()
Method Detail

classNameToVarName

public static java.lang.String classNameToVarName(java.lang.String className)

cleanString

public static java.lang.String cleanString(java.lang.String str)

getChars

public static java.lang.String getChars(int numberOfChars,
                                        char theChar)
Get a string consisting of numberOfChars theChars.

Returns:
a string consisting of numberOfChars theChars.

getClassName

public static java.lang.String getClassName(java.lang.Class targetClass)

getCommaListFromVector

public static java.lang.String getCommaListFromVector(java.util.Vector sourceVector)

getContentAsReader

public static java.io.Reader getContentAsReader(java.net.URL url)
                                         throws java.lang.SecurityException,
                                                java.lang.IllegalArgumentException,
                                                java.io.IOException
Throws:
java.lang.SecurityException
java.lang.IllegalArgumentException
java.io.IOException

getContentAsString

public static java.lang.String getContentAsString(java.net.URL url)
                                           throws java.lang.SecurityException,
                                                  java.lang.IllegalArgumentException,
                                                  java.io.IOException
Throws:
java.lang.SecurityException
java.lang.IllegalArgumentException
java.io.IOException

getSafeString

public static java.lang.String getSafeString(java.lang.String scriptStr)

getURL

public static java.net.URL getURL(java.net.URL contextURL,
                                  java.lang.String spec)
                           throws java.net.MalformedURLException
Throws:
java.net.MalformedURLException

getValidIdentifierName

public static java.lang.String getValidIdentifierName(java.lang.String identifierName)

isValidIdentifierName

public static boolean isValidIdentifierName(java.lang.String identifierName)

isValidPackageName

public static boolean isValidPackageName(java.lang.String packageName)


libbsf-java-2.4.0/docs/api/org/apache/bsf/util/event/0000755000175000017500000000000010736513022021241 5ustar mkochmkochlibbsf-java-2.4.0/docs/api/org/apache/bsf/util/event/package-tree.html0000644000175000017500000001524710511475731024475 0ustar mkochmkoch org.apache.bsf.util.event Class Hierarchy (Bean Scripting Framework API)

Hierarchy For Package org.apache.bsf.util.event

Package Hierarchies:
All Packages

Class Hierarchy

Interface Hierarchy



libbsf-java-2.4.0/docs/api/org/apache/bsf/util/event/adapters/0000755000175000017500000000000010736513022023044 5ustar mkochmkochlibbsf-java-2.4.0/docs/api/org/apache/bsf/util/event/adapters/package-tree.html0000644000175000017500000002361710511475731026300 0ustar mkochmkoch org.apache.bsf.util.event.adapters Class Hierarchy (Bean Scripting Framework API)

Hierarchy For Package org.apache.bsf.util.event.adapters

Package Hierarchies:
All Packages

Class Hierarchy



././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootlibbsf-java-2.4.0/docs/api/org/apache/bsf/util/event/adapters/java_awt_event_MouseMotionAdapter.htmllibbsf-java-2.4.0/docs/api/org/apache/bsf/util/event/adapters/java_awt_event_MouseMotionAdapter.html0000644000175000017500000003276210511475731032605 0ustar mkochmkoch java_awt_event_MouseMotionAdapter (Bean Scripting Framework API)

org.apache.bsf.util.event.adapters
Class java_awt_event_MouseMotionAdapter

java.lang.Object
  extended byorg.apache.bsf.util.event.EventAdapterImpl
      extended byorg.apache.bsf.util.event.adapters.java_awt_event_MouseMotionAdapter
All Implemented Interfaces:
EventAdapter, java.util.EventListener, java.awt.event.MouseMotionListener

public class java_awt_event_MouseMotionAdapter
extends EventAdapterImpl
implements java.awt.event.MouseMotionListener


Field Summary
 
Fields inherited from class org.apache.bsf.util.event.EventAdapterImpl
eventProcessor
 
Constructor Summary
java_awt_event_MouseMotionAdapter()
           
 
Method Summary
 void mouseDragged(java.awt.event.MouseEvent e)
           
 void mouseMoved(java.awt.event.MouseEvent e)
           
 
Methods inherited from class org.apache.bsf.util.event.EventAdapterImpl
setEventProcessor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

java_awt_event_MouseMotionAdapter

public java_awt_event_MouseMotionAdapter()
Method Detail

mouseDragged

public void mouseDragged(java.awt.event.MouseEvent e)
Specified by:
mouseDragged in interface java.awt.event.MouseMotionListener

mouseMoved

public void mouseMoved(java.awt.event.MouseEvent e)
Specified by:
mouseMoved in interface java.awt.event.MouseMotionListener


libbsf-java-2.4.0/docs/api/org/apache/bsf/util/event/adapters/java_awt_event_WindowAdapter.html0000644000175000017500000004241510511475731031572 0ustar mkochmkoch java_awt_event_WindowAdapter (Bean Scripting Framework API)

org.apache.bsf.util.event.adapters
Class java_awt_event_WindowAdapter

java.lang.Object
  extended byorg.apache.bsf.util.event.EventAdapterImpl
      extended byorg.apache.bsf.util.event.adapters.java_awt_event_WindowAdapter
All Implemented Interfaces:
EventAdapter, java.util.EventListener, java.awt.event.WindowListener

public class java_awt_event_WindowAdapter
extends EventAdapterImpl
implements java.awt.event.WindowListener


Field Summary
 
Fields inherited from class org.apache.bsf.util.event.EventAdapterImpl
eventProcessor
 
Constructor Summary
java_awt_event_WindowAdapter()
           
 
Method Summary
 void windowActivated(java.awt.event.WindowEvent e)
           
 void windowClosed(java.awt.event.WindowEvent e)
           
 void windowClosing(java.awt.event.WindowEvent e)
           
 void windowDeactivated(java.awt.event.WindowEvent e)
           
 void windowDeiconified(java.awt.event.WindowEvent e)
           
 void windowIconified(java.awt.event.WindowEvent e)
           
 void windowOpened(java.awt.event.WindowEvent e)
           
 
Methods inherited from class org.apache.bsf.util.event.EventAdapterImpl
setEventProcessor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

java_awt_event_WindowAdapter

public java_awt_event_WindowAdapter()
Method Detail

windowActivated

public void windowActivated(java.awt.event.WindowEvent e)
Specified by:
windowActivated in interface java.awt.event.WindowListener

windowClosed

public void windowClosed(java.awt.event.WindowEvent e)
Specified by:
windowClosed in interface java.awt.event.WindowListener

windowClosing

public void windowClosing(java.awt.event.WindowEvent e)
Specified by:
windowClosing in interface java.awt.event.WindowListener

windowDeactivated

public void windowDeactivated(java.awt.event.WindowEvent e)
Specified by:
windowDeactivated in interface java.awt.event.WindowListener

windowDeiconified

public void windowDeiconified(java.awt.event.WindowEvent e)
Specified by:
windowDeiconified in interface java.awt.event.WindowListener

windowIconified

public void windowIconified(java.awt.event.WindowEvent e)
Specified by:
windowIconified in interface java.awt.event.WindowListener

windowOpened

public void windowOpened(java.awt.event.WindowEvent e)
Specified by:
windowOpened in interface java.awt.event.WindowListener


libbsf-java-2.4.0/docs/api/org/apache/bsf/util/event/adapters/java_awt_event_ContainerAdapter.html0000644000175000017500000003304010511475731032237 0ustar mkochmkoch java_awt_event_ContainerAdapter (Bean Scripting Framework API)

org.apache.bsf.util.event.adapters
Class java_awt_event_ContainerAdapter

java.lang.Object
  extended byorg.apache.bsf.util.event.EventAdapterImpl
      extended byorg.apache.bsf.util.event.adapters.java_awt_event_ContainerAdapter
All Implemented Interfaces:
java.awt.event.ContainerListener, EventAdapter, java.util.EventListener

public class java_awt_event_ContainerAdapter
extends EventAdapterImpl
implements java.awt.event.ContainerListener


Field Summary
 
Fields inherited from class org.apache.bsf.util.event.EventAdapterImpl
eventProcessor
 
Constructor Summary
java_awt_event_ContainerAdapter()
           
 
Method Summary
 void componentAdded(java.awt.event.ContainerEvent e)
           
 void componentRemoved(java.awt.event.ContainerEvent e)
           
 
Methods inherited from class org.apache.bsf.util.event.EventAdapterImpl
setEventProcessor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

java_awt_event_ContainerAdapter

public java_awt_event_ContainerAdapter()
Method Detail

componentAdded

public void componentAdded(java.awt.event.ContainerEvent e)
Specified by:
componentAdded in interface java.awt.event.ContainerListener

componentRemoved

public void componentRemoved(java.awt.event.ContainerEvent e)
Specified by:
componentRemoved in interface java.awt.event.ContainerListener


libbsf-java-2.4.0/docs/api/org/apache/bsf/util/event/adapters/java_awt_event_MouseAdapter.html0000644000175000017500000003716510511475731031421 0ustar mkochmkoch java_awt_event_MouseAdapter (Bean Scripting Framework API)

org.apache.bsf.util.event.adapters
Class java_awt_event_MouseAdapter

java.lang.Object
  extended byorg.apache.bsf.util.event.EventAdapterImpl
      extended byorg.apache.bsf.util.event.adapters.java_awt_event_MouseAdapter
All Implemented Interfaces:
EventAdapter, java.util.EventListener, java.awt.event.MouseListener

public class java_awt_event_MouseAdapter
extends EventAdapterImpl
implements java.awt.event.MouseListener


Field Summary
 
Fields inherited from class org.apache.bsf.util.event.EventAdapterImpl
eventProcessor
 
Constructor Summary
java_awt_event_MouseAdapter()
           
 
Method Summary
 void mouseClicked(java.awt.event.MouseEvent e)
           
 void mouseEntered(java.awt.event.MouseEvent e)
           
 void mouseExited(java.awt.event.MouseEvent e)
           
 void mousePressed(java.awt.event.MouseEvent e)
           
 void mouseReleased(java.awt.event.MouseEvent e)
           
 
Methods inherited from class org.apache.bsf.util.event.EventAdapterImpl
setEventProcessor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

java_awt_event_MouseAdapter

public java_awt_event_MouseAdapter()
Method Detail

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent e)
Specified by:
mouseClicked in interface java.awt.event.MouseListener

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent e)
Specified by:
mouseEntered in interface java.awt.event.MouseListener

mouseExited

public void mouseExited(java.awt.event.MouseEvent e)
Specified by:
mouseExited in interface java.awt.event.MouseListener

mousePressed

public void mousePressed(java.awt.event.MouseEvent e)
Specified by:
mousePressed in interface java.awt.event.MouseListener

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e)
Specified by:
mouseReleased in interface java.awt.event.MouseListener


libbsf-java-2.4.0/docs/api/org/apache/bsf/util/event/adapters/java_awt_event_AdjustmentAdapter.html0000644000175000017500000003147710511475731032447 0ustar mkochmkoch java_awt_event_AdjustmentAdapter (Bean Scripting Framework API)

org.apache.bsf.util.event.adapters
Class java_awt_event_AdjustmentAdapter

java.lang.Object
  extended byorg.apache.bsf.util.event.EventAdapterImpl
      extended byorg.apache.bsf.util.event.adapters.java_awt_event_AdjustmentAdapter
All Implemented Interfaces:
java.awt.event.AdjustmentListener, EventAdapter, java.util.EventListener

public class java_awt_event_AdjustmentAdapter
extends EventAdapterImpl
implements java.awt.event.AdjustmentListener


Field Summary
 
Fields inherited from class org.apache.bsf.util.event.EventAdapterImpl
eventProcessor
 
Constructor Summary
java_awt_event_AdjustmentAdapter()
           
 
Method Summary
 void adjustmentValueChanged(java.awt.event.AdjustmentEvent e)
           
 
Methods inherited from class org.apache.bsf.util.event.EventAdapterImpl
setEventProcessor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

java_awt_event_AdjustmentAdapter

public java_awt_event_AdjustmentAdapter()
Method Detail

adjustmentValueChanged

public void adjustmentValueChanged(java.awt.event.AdjustmentEvent e)
Specified by:
adjustmentValueChanged in interface java.awt.event.AdjustmentListener


libbsf-java-2.4.0/docs/api/org/apache/bsf/util/event/adapters/java_awt_event_ItemAdapter.html0000644000175000017500000003117510511475731031222 0ustar mkochmkoch java_awt_event_ItemAdapter (Bean Scripting Framework API)

org.apache.bsf.util.event.adapters
Class java_awt_event_ItemAdapter

java.lang.Object
  extended byorg.apache.bsf.util.event.EventAdapterImpl
      extended byorg.apache.bsf.util.event.adapters.java_awt_event_ItemAdapter
All Implemented Interfaces:
EventAdapter, java.util.EventListener, java.awt.event.ItemListener

public class java_awt_event_ItemAdapter
extends EventAdapterImpl
implements java.awt.event.ItemListener


Field Summary
 
Fields inherited from class org.apache.bsf.util.event.EventAdapterImpl
eventProcessor
 
Constructor Summary
java_awt_event_ItemAdapter()
           
 
Method Summary
 void itemStateChanged(java.awt.event.ItemEvent e)
           
 
Methods inherited from class org.apache.bsf.util.event.EventAdapterImpl
setEventProcessor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

java_awt_event_ItemAdapter

public java_awt_event_ItemAdapter()
Method Detail

itemStateChanged

public void itemStateChanged(java.awt.event.ItemEvent e)
Specified by:
itemStateChanged in interface java.awt.event.ItemListener


libbsf-java-2.4.0/docs/api/org/apache/bsf/util/event/adapters/java_awt_event_KeyAdapter.html0000644000175000017500000003400310511475731031045 0ustar mkochmkoch java_awt_event_KeyAdapter (Bean Scripting Framework API)

org.apache.bsf.util.event.adapters
Class java_awt_event_KeyAdapter

java.lang.Object
  extended byorg.apache.bsf.util.event.EventAdapterImpl
      extended byorg.apache.bsf.util.event.adapters.java_awt_event_KeyAdapter
All Implemented Interfaces:
EventAdapter, java.util.EventListener, java.awt.event.KeyListener

public class java_awt_event_KeyAdapter
extends EventAdapterImpl
implements java.awt.event.KeyListener


Field Summary
 
Fields inherited from class org.apache.bsf.util.event.EventAdapterImpl
eventProcessor
 
Constructor Summary
java_awt_event_KeyAdapter()
           
 
Method Summary
 void keyPressed(java.awt.event.KeyEvent e)
           
 void keyReleased(java.awt.event.KeyEvent e)
           
 void keyTyped(java.awt.event.KeyEvent e)
           
 
Methods inherited from class org.apache.bsf.util.event.EventAdapterImpl
setEventProcessor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

java_awt_event_KeyAdapter

public java_awt_event_KeyAdapter()
Method Detail

keyPressed

public void keyPressed(java.awt.event.KeyEvent e)
Specified by:
keyPressed in interface java.awt.event.KeyListener

keyReleased

public void keyReleased(java.awt.event.KeyEvent e)
Specified by:
keyReleased in interface java.awt.event.KeyListener

keyTyped

public void keyTyped(java.awt.event.KeyEvent e)
Specified by:
keyTyped in interface java.awt.event.KeyListener


libbsf-java-2.4.0/docs/api/org/apache/bsf/util/event/adapters/package-use.html0000644000175000017500000001256610511475731026136 0ustar mkochmkoch Uses of Package org.apache.bsf.util.event.adapters (Bean Scripting Framework API)

Uses of Package
org.apache.bsf.util.event.adapters

No usage of org.apache.bsf.util.event.adapters



libbsf-java-2.4.0/docs/api/org/apache/bsf/util/event/adapters/java_awt_event_TextAdapter.html0000644000175000017500000003121710511475731031245 0ustar mkochmkoch java_awt_event_TextAdapter (Bean Scripting Framework API)

org.apache.bsf.util.event.adapters
Class java_awt_event_TextAdapter

java.lang.Object
  extended byorg.apache.bsf.util.event.EventAdapterImpl
      extended byorg.apache.bsf.util.event.adapters.java_awt_event_TextAdapter
All Implemented Interfaces:
EventAdapter, java.util.EventListener, java.awt.event.TextListener

public class java_awt_event_TextAdapter
extends EventAdapterImpl
implements java.awt.event.TextListener


Field Summary
 
Fields inherited from class org.apache.bsf.util.event.EventAdapterImpl
eventProcessor
 
Constructor Summary
java_awt_event_TextAdapter()
           
 
Method Summary
 void textValueChanged(java.awt.event.TextEvent e)
           
 
Methods inherited from class org.apache.bsf.util.event.EventAdapterImpl
setEventProcessor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

java_awt_event_TextAdapter

public java_awt_event_TextAdapter()
Method Detail

textValueChanged

public void textValueChanged(java.awt.event.TextEvent e)
Specified by:
textValueChanged in interface java.awt.event.TextListener


libbsf-java-2.4.0/docs/api/org/apache/bsf/util/event/adapters/class-use/0000755000175000017500000000000010736513022024743 5ustar mkochmkoch././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootlibbsf-java-2.4.0/docs/api/org/apache/bsf/util/event/adapters/class-use/java_awt_event_MouseMotionAdapter.htmllibbsf-java-2.4.0/docs/api/org/apache/bsf/util/event/adapters/class-use/java_awt_event_MouseMotionAd0000644000175000017500000001372310511475731032501 0ustar mkochmkoch Uses of Class org.apache.bsf.util.event.adapters.java_awt_event_MouseMotionAdapter (Bean Scripting Framework API)

Uses of Class
org.apache.bsf.util.event.adapters.java_awt_event_MouseMotionAdapter

No usage of org.apache.bsf.util.event.adapters.java_awt_event_MouseMotionAdapter



././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootlibbsf-java-2.4.0/docs/api/org/apache/bsf/util/event/adapters/class-use/java_awt_event_WindowAdapter.htmllibbsf-java-2.4.0/docs/api/org/apache/bsf/util/event/adapters/class-use/java_awt_event_WindowAdapter0000644000175000017500000001365310511475731032530 0ustar mkochmkoch Uses of Class org.apache.bsf.util.event.adapters.java_awt_event_WindowAdapter (Bean Scripting Framework API)

Uses of Class
org.apache.bsf.util.event.adapters.java_awt_event_WindowAdapter

No usage of org.apache.bsf.util.event.adapters.java_awt_event_WindowAdapter



././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibbsf-java-2.4.0/docs/api/org/apache/bsf/util/event/adapters/class-use/java_awt_event_ContainerAdapter.htmllibbsf-java-2.4.0/docs/api/org/apache/bsf/util/event/adapters/class-use/java_awt_event_ContainerAdap0000644000175000017500000001370310511475731032464 0ustar mkochmkoch Uses of Class org.apache.bsf.util.event.adapters.java_awt_event_ContainerAdapter (Bean Scripting Framework API)

Uses of Class
org.apache.bsf.util.event.adapters.java_awt_event_ContainerAdapter

No usage of org.apache.bsf.util.event.adapters.java_awt_event_ContainerAdapter



././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootlibbsf-java-2.4.0/docs/api/org/apache/bsf/util/event/adapters/class-use/java_awt_event_MouseAdapter.htmllibbsf-java-2.4.0/docs/api/org/apache/bsf/util/event/adapters/class-use/java_awt_event_MouseAdapter.0000644000175000017500000001364310511475731032426 0ustar mkochmkoch Uses of Class org.apache.bsf.util.event.adapters.java_awt_event_MouseAdapter (Bean Scripting Framework API)

Uses of Class
org.apache.bsf.util.event.adapters.java_awt_event_MouseAdapter

No usage of org.apache.bsf.util.event.adapters.java_awt_event_MouseAdapter



././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootlibbsf-java-2.4.0/docs/api/org/apache/bsf/util/event/adapters/class-use/java_awt_event_AdjustmentAdapter.htmllibbsf-java-2.4.0/docs/api/org/apache/bsf/util/event/adapters/class-use/java_awt_event_AdjustmentAda0000644000175000017500000001371310511475731032501 0ustar mkochmkoch Uses of Class org.apache.bsf.util.event.adapters.java_awt_event_AdjustmentAdapter (Bean Scripting Framework API)

Uses of Class
org.apache.bsf.util.event.adapters.java_awt_event_AdjustmentAdapter

No usage of org.apache.bsf.util.event.adapters.java_awt_event_AdjustmentAdapter



././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootlibbsf-java-2.4.0/docs/api/org/apache/bsf/util/event/adapters/class-use/java_awt_event_ItemAdapter.htmllibbsf-java-2.4.0/docs/api/org/apache/bsf/util/event/adapters/class-use/java_awt_event_ItemAdapter.h0000644000175000017500000001363310511475731032403 0ustar mkochmkoch Uses of Class org.apache.bsf.util.event.adapters.java_awt_event_ItemAdapter (Bean Scripting Framework API)

Uses of Class
org.apache.bsf.util.event.adapters.java_awt_event_ItemAdapter

No usage of org.apache.bsf.util.event.adapters.java_awt_event_ItemAdapter



././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootlibbsf-java-2.4.0/docs/api/org/apache/bsf/util/event/adapters/class-use/java_awt_event_KeyAdapter.htmllibbsf-java-2.4.0/docs/api/org/apache/bsf/util/event/adapters/class-use/java_awt_event_KeyAdapter.ht0000644000175000017500000001362310511475731032420 0ustar mkochmkoch Uses of Class org.apache.bsf.util.event.adapters.java_awt_event_KeyAdapter (Bean Scripting Framework API)

Uses of Class
org.apache.bsf.util.event.adapters.java_awt_event_KeyAdapter

No usage of org.apache.bsf.util.event.adapters.java_awt_event_KeyAdapter



././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootlibbsf-java-2.4.0/docs/api/org/apache/bsf/util/event/adapters/class-use/java_awt_event_TextAdapter.htmllibbsf-java-2.4.0/docs/api/org/apache/bsf/util/event/adapters/class-use/java_awt_event_TextAdapter.h0000644000175000017500000001363310511475731032431 0ustar mkochmkoch Uses of Class org.apache.bsf.util.event.adapters.java_awt_event_TextAdapter (Bean Scripting Framework API)

Uses of Class
org.apache.bsf.util.event.adapters.java_awt_event_TextAdapter

No usage of org.apache.bsf.util.event.adapters.java_awt_event_TextAdapter



././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootlibbsf-java-2.4.0/docs/api/org/apache/bsf/util/event/adapters/class-use/java_beans_VetoableChangeAdapter.htmllibbsf-java-2.4.0/docs/api/org/apache/bsf/util/event/adapters/class-use/java_beans_VetoableChangeAda0000644000175000017500000001371310511475731032326 0ustar mkochmkoch Uses of Class org.apache.bsf.util.event.adapters.java_beans_VetoableChangeAdapter (Bean Scripting Framework API)

Uses of Class
org.apache.bsf.util.event.adapters.java_beans_VetoableChangeAdapter

No usage of org.apache.bsf.util.event.adapters.java_beans_VetoableChangeAdapter



././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootlibbsf-java-2.4.0/docs/api/org/apache/bsf/util/event/adapters/class-use/java_awt_event_FocusAdapter.htmllibbsf-java-2.4.0/docs/api/org/apache/bsf/util/event/adapters/class-use/java_awt_event_FocusAdapter.0000644000175000017500000001364310511475731032415 0ustar mkochmkoch Uses of Class org.apache.bsf.util.event.adapters.java_awt_event_FocusAdapter (Bean Scripting Framework API)

Uses of Class
org.apache.bsf.util.event.adapters.java_awt_event_FocusAdapter

No usage of org.apache.bsf.util.event.adapters.java_awt_event_FocusAdapter



././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootlibbsf-java-2.4.0/docs/api/org/apache/bsf/util/event/adapters/class-use/java_awt_event_ActionAdapter.htmllibbsf-java-2.4.0/docs/api/org/apache/bsf/util/event/adapters/class-use/java_awt_event_ActionAdapter0000644000175000017500000001365310511475731032476 0ustar mkochmkoch Uses of Class org.apache.bsf.util.event.adapters.java_awt_event_ActionAdapter (Bean Scripting Framework API)

Uses of Class
org.apache.bsf.util.event.adapters.java_awt_event_ActionAdapter

No usage of org.apache.bsf.util.event.adapters.java_awt_event_ActionAdapter



././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootlibbsf-java-2.4.0/docs/api/org/apache/bsf/util/event/adapters/class-use/java_beans_PropertyChangeAdapter.htmllibbsf-java-2.4.0/docs/api/org/apache/bsf/util/event/adapters/class-use/java_beans_PropertyChangeAda0000644000175000017500000001371310511475731032411 0ustar mkochmkoch Uses of Class org.apache.bsf.util.event.adapters.java_beans_PropertyChangeAdapter (Bean Scripting Framework API)

Uses of Class
org.apache.bsf.util.event.adapters.java_beans_PropertyChangeAdapter

No usage of org.apache.bsf.util.event.adapters.java_beans_PropertyChangeAdapter



././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibbsf-java-2.4.0/docs/api/org/apache/bsf/util/event/adapters/class-use/java_awt_event_ComponentAdapter.htmllibbsf-java-2.4.0/docs/api/org/apache/bsf/util/event/adapters/class-use/java_awt_event_ComponentAdap0000644000175000017500000001370310511475731032504 0ustar mkochmkoch Uses of Class org.apache.bsf.util.event.adapters.java_awt_event_ComponentAdapter (Bean Scripting Framework API)

Uses of Class
org.apache.bsf.util.event.adapters.java_awt_event_ComponentAdapter

No usage of org.apache.bsf.util.event.adapters.java_awt_event_ComponentAdapter



libbsf-java-2.4.0/docs/api/org/apache/bsf/util/event/adapters/java_beans_VetoableChangeAdapter.html0000644000175000017500000003112210511475731032257 0ustar mkochmkoch java_beans_VetoableChangeAdapter (Bean Scripting Framework API)

org.apache.bsf.util.event.adapters
Class java_beans_VetoableChangeAdapter

java.lang.Object
  extended byorg.apache.bsf.util.event.EventAdapterImpl
      extended byorg.apache.bsf.util.event.adapters.java_beans_VetoableChangeAdapter
All Implemented Interfaces:
EventAdapter, java.util.EventListener, java.beans.VetoableChangeListener

public class java_beans_VetoableChangeAdapter
extends EventAdapterImpl
implements java.beans.VetoableChangeListener


Field Summary
 
Fields inherited from class org.apache.bsf.util.event.EventAdapterImpl
eventProcessor
 
Constructor Summary
java_beans_VetoableChangeAdapter()
           
 
Method Summary
 void vetoableChange(java.beans.PropertyChangeEvent e)
           
 
Methods inherited from class org.apache.bsf.util.event.EventAdapterImpl
setEventProcessor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

java_beans_VetoableChangeAdapter

public java_beans_VetoableChangeAdapter()
Method Detail

vetoableChange

public void vetoableChange(java.beans.PropertyChangeEvent e)
                    throws java.beans.PropertyVetoException
Specified by:
vetoableChange in interface java.beans.VetoableChangeListener
Throws:
java.beans.PropertyVetoException


libbsf-java-2.4.0/docs/api/org/apache/bsf/util/event/adapters/package-summary.html0000644000175000017500000002270210511475731027030 0ustar mkochmkoch org.apache.bsf.util.event.adapters (Bean Scripting Framework API)

Package org.apache.bsf.util.event.adapters

Class Summary
java_awt_event_ActionAdapter  
java_awt_event_AdjustmentAdapter  
java_awt_event_ComponentAdapter  
java_awt_event_ContainerAdapter  
java_awt_event_FocusAdapter  
java_awt_event_ItemAdapter  
java_awt_event_KeyAdapter  
java_awt_event_MouseAdapter  
java_awt_event_MouseMotionAdapter  
java_awt_event_TextAdapter  
java_awt_event_WindowAdapter  
java_beans_PropertyChangeAdapter  
java_beans_VetoableChangeAdapter  
 



libbsf-java-2.4.0/docs/api/org/apache/bsf/util/event/adapters/java_awt_event_FocusAdapter.html0000644000175000017500000003255210511475731031403 0ustar mkochmkoch java_awt_event_FocusAdapter (Bean Scripting Framework API)

org.apache.bsf.util.event.adapters
Class java_awt_event_FocusAdapter

java.lang.Object
  extended byorg.apache.bsf.util.event.EventAdapterImpl
      extended byorg.apache.bsf.util.event.adapters.java_awt_event_FocusAdapter
All Implemented Interfaces:
EventAdapter, java.util.EventListener, java.awt.event.FocusListener

public class java_awt_event_FocusAdapter
extends EventAdapterImpl
implements java.awt.event.FocusListener


Field Summary
 
Fields inherited from class org.apache.bsf.util.event.EventAdapterImpl
eventProcessor
 
Constructor Summary
java_awt_event_FocusAdapter()
           
 
Method Summary
 void focusGained(java.awt.event.FocusEvent e)
           
 void focusLost(java.awt.event.FocusEvent e)
           
 
Methods inherited from class org.apache.bsf.util.event.EventAdapterImpl
setEventProcessor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

java_awt_event_FocusAdapter

public java_awt_event_FocusAdapter()
Method Detail

focusGained

public void focusGained(java.awt.event.FocusEvent e)
Specified by:
focusGained in interface java.awt.event.FocusListener

focusLost

public void focusLost(java.awt.event.FocusEvent e)
Specified by:
focusLost in interface java.awt.event.FocusListener


libbsf-java-2.4.0/docs/api/org/apache/bsf/util/event/adapters/java_awt_event_ActionAdapter.html0000644000175000017500000003056710511475731031545 0ustar mkochmkoch java_awt_event_ActionAdapter (Bean Scripting Framework API)

org.apache.bsf.util.event.adapters
Class java_awt_event_ActionAdapter

java.lang.Object
  extended byorg.apache.bsf.util.event.EventAdapterImpl
      extended byorg.apache.bsf.util.event.adapters.java_awt_event_ActionAdapter
All Implemented Interfaces:
java.awt.event.ActionListener, EventAdapter, java.util.EventListener

public class java_awt_event_ActionAdapter
extends EventAdapterImpl
implements java.awt.event.ActionListener


Field Summary
 
Fields inherited from class org.apache.bsf.util.event.EventAdapterImpl
eventProcessor
 
Constructor Summary
java_awt_event_ActionAdapter()
           
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
           
 
Methods inherited from class org.apache.bsf.util.event.EventAdapterImpl
setEventProcessor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

java_awt_event_ActionAdapter

public java_awt_event_ActionAdapter()
Method Detail

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Specified by:
actionPerformed in interface java.awt.event.ActionListener


libbsf-java-2.4.0/docs/api/org/apache/bsf/util/event/adapters/java_beans_PropertyChangeAdapter.html0000644000175000017500000003142110511475731032344 0ustar mkochmkoch java_beans_PropertyChangeAdapter (Bean Scripting Framework API)

org.apache.bsf.util.event.adapters
Class java_beans_PropertyChangeAdapter

java.lang.Object
  extended byorg.apache.bsf.util.event.EventAdapterImpl
      extended byorg.apache.bsf.util.event.adapters.java_beans_PropertyChangeAdapter
All Implemented Interfaces:
EventAdapter, java.util.EventListener, java.beans.PropertyChangeListener

public class java_beans_PropertyChangeAdapter
extends EventAdapterImpl
implements java.beans.PropertyChangeListener


Field Summary
 
Fields inherited from class org.apache.bsf.util.event.EventAdapterImpl
eventProcessor
 
Constructor Summary
java_beans_PropertyChangeAdapter()
           
 
Method Summary
 void propertyChange(java.beans.PropertyChangeEvent e)
           
 
Methods inherited from class org.apache.bsf.util.event.EventAdapterImpl
setEventProcessor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

java_beans_PropertyChangeAdapter

public java_beans_PropertyChangeAdapter()
Method Detail

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent e)
Specified by:
propertyChange in interface java.beans.PropertyChangeListener


libbsf-java-2.4.0/docs/api/org/apache/bsf/util/event/adapters/package-frame.html0000644000175000017500000000554510511475731026433 0ustar mkochmkoch org.apache.bsf.util.event.adapters (Bean Scripting Framework API) org.apache.bsf.util.event.adapters
Classes 
java_awt_event_ActionAdapter
java_awt_event_AdjustmentAdapter
java_awt_event_ComponentAdapter
java_awt_event_ContainerAdapter
java_awt_event_FocusAdapter
java_awt_event_ItemAdapter
java_awt_event_KeyAdapter
java_awt_event_MouseAdapter
java_awt_event_MouseMotionAdapter
java_awt_event_TextAdapter
java_awt_event_WindowAdapter
java_beans_PropertyChangeAdapter
java_beans_VetoableChangeAdapter
libbsf-java-2.4.0/docs/api/org/apache/bsf/util/event/adapters/java_awt_event_ComponentAdapter.html0000644000175000017500000003615610511475731032272 0ustar mkochmkoch java_awt_event_ComponentAdapter (Bean Scripting Framework API)

org.apache.bsf.util.event.adapters
Class java_awt_event_ComponentAdapter

java.lang.Object
  extended byorg.apache.bsf.util.event.EventAdapterImpl
      extended byorg.apache.bsf.util.event.adapters.java_awt_event_ComponentAdapter
All Implemented Interfaces:
java.awt.event.ComponentListener, EventAdapter, java.util.EventListener

public class java_awt_event_ComponentAdapter
extends EventAdapterImpl
implements java.awt.event.ComponentListener


Field Summary
 
Fields inherited from class org.apache.bsf.util.event.EventAdapterImpl
eventProcessor
 
Constructor Summary
java_awt_event_ComponentAdapter()
           
 
Method Summary
 void componentHidden(java.awt.event.ComponentEvent e)
           
 void componentMoved(java.awt.event.ComponentEvent e)
           
 void componentResized(java.awt.event.ComponentEvent e)
           
 void componentShown(java.awt.event.ComponentEvent e)
           
 
Methods inherited from class org.apache.bsf.util.event.EventAdapterImpl
setEventProcessor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

java_awt_event_ComponentAdapter

public java_awt_event_ComponentAdapter()
Method Detail

componentHidden

public void componentHidden(java.awt.event.ComponentEvent e)
Specified by:
componentHidden in interface java.awt.event.ComponentListener

componentMoved

public void componentMoved(java.awt.event.ComponentEvent e)
Specified by:
componentMoved in interface java.awt.event.ComponentListener

componentResized

public void componentResized(java.awt.event.ComponentEvent e)
Specified by:
componentResized in interface java.awt.event.ComponentListener

componentShown

public void componentShown(java.awt.event.ComponentEvent e)
Specified by:
componentShown in interface java.awt.event.ComponentListener


libbsf-java-2.4.0/docs/api/org/apache/bsf/util/event/generator/0000755000175000017500000000000010736513022023227 5ustar mkochmkochlibbsf-java-2.4.0/docs/api/org/apache/bsf/util/event/generator/package-tree.html0000644000175000017500000001532210511475731026455 0ustar mkochmkoch org.apache.bsf.util.event.generator Class Hierarchy (Bean Scripting Framework API)

Hierarchy For Package org.apache.bsf.util.event.generator

Package Hierarchies:
All Packages

Class Hierarchy



libbsf-java-2.4.0/docs/api/org/apache/bsf/util/event/generator/package-use.html0000644000175000017500000001517410511475731026317 0ustar mkochmkoch Uses of Package org.apache.bsf.util.event.generator (Bean Scripting Framework API)

Uses of Package
org.apache.bsf.util.event.generator

Packages that use org.apache.bsf.util.event.generator
org.apache.bsf.util.event.generator   
 

Classes in org.apache.bsf.util.event.generator used by org.apache.bsf.util.event.generator
AdapterClassLoader
           
 



libbsf-java-2.4.0/docs/api/org/apache/bsf/util/event/generator/class-use/0000755000175000017500000000000010736513022025126 5ustar mkochmkochlibbsf-java-2.4.0/docs/api/org/apache/bsf/util/event/generator/class-use/AdapterClassLoader.html0000644000175000017500000001761110511475731031524 0ustar mkochmkoch Uses of Class org.apache.bsf.util.event.generator.AdapterClassLoader (Bean Scripting Framework API)

Uses of Class
org.apache.bsf.util.event.generator.AdapterClassLoader

Packages that use AdapterClassLoader
org.apache.bsf.util.event.generator   
 

Uses of AdapterClassLoader in org.apache.bsf.util.event.generator
 

Fields in org.apache.bsf.util.event.generator declared as AdapterClassLoader
static AdapterClassLoader EventAdapterGenerator.ldr
           
 



libbsf-java-2.4.0/docs/api/org/apache/bsf/util/event/generator/class-use/Bytecode.html0000644000175000017500000001342310511475731027562 0ustar mkochmkoch Uses of Class org.apache.bsf.util.event.generator.Bytecode (Bean Scripting Framework API)

Uses of Class
org.apache.bsf.util.event.generator.Bytecode

No usage of org.apache.bsf.util.event.generator.Bytecode



libbsf-java-2.4.0/docs/api/org/apache/bsf/util/event/generator/class-use/ByteUtility.html0000644000175000017500000001345310511475731030316 0ustar mkochmkoch Uses of Class org.apache.bsf.util.event.generator.ByteUtility (Bean Scripting Framework API)

Uses of Class
org.apache.bsf.util.event.generator.ByteUtility

No usage of org.apache.bsf.util.event.generator.ByteUtility



libbsf-java-2.4.0/docs/api/org/apache/bsf/util/event/generator/class-use/EventAdapterGenerator.html0000644000175000017500000001357310511475731032263 0ustar mkochmkoch Uses of Class org.apache.bsf.util.event.generator.EventAdapterGenerator (Bean Scripting Framework API)

Uses of Class
org.apache.bsf.util.event.generator.EventAdapterGenerator

No usage of org.apache.bsf.util.event.generator.EventAdapterGenerator



libbsf-java-2.4.0/docs/api/org/apache/bsf/util/event/generator/AdapterClassLoader.html0000644000175000017500000003370310511475731027625 0ustar mkochmkoch AdapterClassLoader (Bean Scripting Framework API)

org.apache.bsf.util.event.generator
Class AdapterClassLoader

java.lang.Object
  extended byjava.lang.ClassLoader
      extended byorg.apache.bsf.util.event.generator.AdapterClassLoader

public class AdapterClassLoader
extends java.lang.ClassLoader


Constructor Summary
AdapterClassLoader()
           
 
Method Summary
 java.lang.Class defineClass(java.lang.String name, byte[] b)
           
protected  java.lang.Class findClass(java.lang.String name)
           
protected  java.lang.Class get(java.lang.String name)
           
 java.lang.Class getLoadedClass(java.lang.String name)
           
protected  java.lang.Class loadClass(java.lang.String name, boolean resolve)
           
protected  void put(java.lang.String name, java.lang.Class c)
           
 
Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, definePackage, findLibrary, findLoadedClass, findResource, findResources, findSystemClass, getPackage, getPackages, getParent, getResource, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AdapterClassLoader

public AdapterClassLoader()
Method Detail

defineClass

public java.lang.Class defineClass(java.lang.String name,
                                   byte[] b)

findClass

protected final java.lang.Class findClass(java.lang.String name)

get

protected final java.lang.Class get(java.lang.String name)

getLoadedClass

public java.lang.Class getLoadedClass(java.lang.String name)

loadClass

protected java.lang.Class loadClass(java.lang.String name,
                                    boolean resolve)
                             throws java.lang.ClassNotFoundException
Throws:
java.lang.ClassNotFoundException

put

protected final void put(java.lang.String name,
                         java.lang.Class c)


libbsf-java-2.4.0/docs/api/org/apache/bsf/util/event/generator/package-summary.html0000644000175000017500000001650610511475731027220 0ustar mkochmkoch org.apache.bsf.util.event.generator (Bean Scripting Framework API)

Package org.apache.bsf.util.event.generator

Class Summary
AdapterClassLoader  
Bytecode Bytecode handling utilities Handle standard byte arrays as defined in Java VM and Class File 5 April 1999 - functions to append Class File byte subarrays into a Class File byte array
ByteUtility Byte handling utilities 5 April 1999 - functions to append standard types to byte arrays functions to produce standard types from byte arrays
EventAdapterGenerator EventAdapterGenerator Generate an "Event Adapter" dynamically during program execution
 



libbsf-java-2.4.0/docs/api/org/apache/bsf/util/event/generator/Bytecode.html0000644000175000017500000006122710511475731025670 0ustar mkochmkoch Bytecode (Bean Scripting Framework API)

org.apache.bsf.util.event.generator
Class Bytecode

java.lang.Object
  extended byorg.apache.bsf.util.event.generator.Bytecode

public class Bytecode
extends java.lang.Object

Bytecode handling utilities Handle standard byte arrays as defined in Java VM and Class File 5 April 1999 - functions to append Class File byte subarrays into a Class File byte array

Author:
Richard F. Boehme

Field Summary
static byte C_Class
           
static byte C_Double
           
static byte C_FieldRef
           
static byte C_Float
           
static byte C_Integer
           
static byte C_InterfaceMethodRef
           
static byte C_Long
           
static byte C_MethodRef
           
static byte C_NameAndType
           
static byte C_String
           
static byte C_Utf8
           
 
Constructor Summary
Bytecode()
           
 
Method Summary
static byte[] addClass(byte[] array, short value)
           
static byte[] addFieldRef(byte[] array, short value1, short value2)
           
static byte[] addInteger(byte[] array, int value)
           
static byte[] addInterfaceMethodRef(byte[] array, short value1, short value2)
           
static byte[] addLong(byte[] array, long value)
           
static byte[] addMethodRef(byte[] array, short value1, short value2)
           
static byte[] addNameAndType(byte[] array, short value1, short value2)
           
static byte[] addRef(byte refType, byte[] array, short value)
           
static byte[] addRef(byte refType, byte[] array, short value1, short value2)
           
static byte[] addString(byte[] array, short value)
           
static byte[] addUtf8(byte[] array, java.lang.String value)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

C_Utf8

public static final byte C_Utf8
See Also:
Constant Field Values

C_Integer

public static final byte C_Integer
See Also:
Constant Field Values

C_Float

public static final byte C_Float
See Also:
Constant Field Values

C_Long

public static final byte C_Long
See Also:
Constant Field Values

C_Double

public static final byte C_Double
See Also:
Constant Field Values

C_Class

public static final byte C_Class
See Also:
Constant Field Values

C_String

public static final byte C_String
See Also:
Constant Field Values

C_FieldRef

public static final byte C_FieldRef
See Also:
Constant Field Values

C_MethodRef

public static final byte C_MethodRef
See Also:
Constant Field Values

C_InterfaceMethodRef

public static final byte C_InterfaceMethodRef
See Also:
Constant Field Values

C_NameAndType

public static final byte C_NameAndType
See Also:
Constant Field Values
Constructor Detail

Bytecode

public Bytecode()
Method Detail

addClass

public static byte[] addClass(byte[] array,
                              short value)

addFieldRef

public static byte[] addFieldRef(byte[] array,
                                 short value1,
                                 short value2)

addInteger

public static byte[] addInteger(byte[] array,
                                int value)

addInterfaceMethodRef

public static byte[] addInterfaceMethodRef(byte[] array,
                                           short value1,
                                           short value2)

addLong

public static byte[] addLong(byte[] array,
                             long value)

addMethodRef

public static byte[] addMethodRef(byte[] array,
                                  short value1,
                                  short value2)

addNameAndType

public static byte[] addNameAndType(byte[] array,
                                    short value1,
                                    short value2)

addRef

public static byte[] addRef(byte refType,
                            byte[] array,
                            short value)

addRef

public static byte[] addRef(byte refType,
                            byte[] array,
                            short value1,
                            short value2)

addString

public static byte[] addString(byte[] array,
                               short value)

addUtf8

public static byte[] addUtf8(byte[] array,
                             java.lang.String value)


libbsf-java-2.4.0/docs/api/org/apache/bsf/util/event/generator/ByteUtility.html0000644000175000017500000004402710511475731026420 0ustar mkochmkoch ByteUtility (Bean Scripting Framework API)

org.apache.bsf.util.event.generator
Class ByteUtility

java.lang.Object
  extended byorg.apache.bsf.util.event.generator.ByteUtility

public class ByteUtility
extends java.lang.Object

Byte handling utilities 5 April 1999 - functions to append standard types to byte arrays functions to produce standard types from byte arrays

Author:
Richard F. Boehme

Constructor Summary
ByteUtility()
           
 
Method Summary
static byte[] addBytes(byte[] array, byte value)
           
static byte[] addBytes(byte[] array, byte[] value)
           
static byte[] addBytes(byte[] array, int value)
           
static byte[] addBytes(byte[] array, long value)
           
static byte[] addBytes(byte[] array, short value)
           
static byte[] addBytes(byte[] array, java.lang.String value)
           
static double byteArrayToDouble(byte[] value)
           
static double byteArrayToDouble(byte[] high, byte[] low)
           
static float byteArrayToFloat(byte[] value)
           
static int byteArrayToInt(byte[] value)
           
static long byteArrayToLong(byte[] value)
           
static long byteArrayToLong(byte[] high, byte[] low)
           
static short byteArrayToShort(byte[] value)
           
static java.lang.String byteToHexString(byte value)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ByteUtility

public ByteUtility()
Method Detail

addBytes

public static byte[] addBytes(byte[] array,
                              byte[] value)

addBytes

public static byte[] addBytes(byte[] array,
                              byte value)

addBytes

public static byte[] addBytes(byte[] array,
                              int value)

addBytes

public static byte[] addBytes(byte[] array,
                              long value)

addBytes

public static byte[] addBytes(byte[] array,
                              java.lang.String value)

addBytes

public static byte[] addBytes(byte[] array,
                              short value)

byteArrayToDouble

public static double byteArrayToDouble(byte[] high,
                                       byte[] low)

byteArrayToDouble

public static double byteArrayToDouble(byte[] value)

byteArrayToFloat

public static float byteArrayToFloat(byte[] value)

byteArrayToInt

public static int byteArrayToInt(byte[] value)

byteArrayToLong

public static long byteArrayToLong(byte[] value)

byteArrayToLong

public static long byteArrayToLong(byte[] high,
                                   byte[] low)

byteArrayToShort

public static short byteArrayToShort(byte[] value)

byteToHexString

public static java.lang.String byteToHexString(byte value)


libbsf-java-2.4.0/docs/api/org/apache/bsf/util/event/generator/EventAdapterGenerator.html0000644000175000017500000002660410511475731030363 0ustar mkochmkoch EventAdapterGenerator (Bean Scripting Framework API)

org.apache.bsf.util.event.generator
Class EventAdapterGenerator

java.lang.Object
  extended byorg.apache.bsf.util.event.generator.EventAdapterGenerator

public class EventAdapterGenerator
extends java.lang.Object

EventAdapterGenerator Generate an "Event Adapter" dynamically during program execution


Field Summary
static AdapterClassLoader ldr
           
 
Constructor Summary
EventAdapterGenerator()
           
 
Method Summary
static java.lang.Class makeEventAdapterClass(java.lang.Class listenerType, boolean writeClassFile)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ldr

public static AdapterClassLoader ldr
Constructor Detail

EventAdapterGenerator

public EventAdapterGenerator()
Method Detail

makeEventAdapterClass

public static java.lang.Class makeEventAdapterClass(java.lang.Class listenerType,
                                                    boolean writeClassFile)


libbsf-java-2.4.0/docs/api/org/apache/bsf/util/event/generator/package-frame.html0000644000175000017500000000257310511475731026614 0ustar mkochmkoch org.apache.bsf.util.event.generator (Bean Scripting Framework API) org.apache.bsf.util.event.generator
Classes 
AdapterClassLoader
Bytecode
ByteUtility
EventAdapterGenerator
libbsf-java-2.4.0/docs/api/org/apache/bsf/util/event/EventAdapter.html0000644000175000017500000002224310511475731024521 0ustar mkochmkoch EventAdapter (Bean Scripting Framework API)

org.apache.bsf.util.event
Interface EventAdapter

All Known Implementing Classes:
EventAdapterImpl

public interface EventAdapter

EventAdapter is the interface that all event adapters must implement in order to work with the automatic event adapter generation model. This interface requires that the adapter implement a method that allows setting the event processor delegated to process the event after the adapter has received the event from the event source. The task of any event adapter is to receive the event and then delegate it to the event processor assigned to it, using either eventProcessor.processEvent or eventProcessor.processExceptionableEvent.

Author:
Sanjiva Weerawarana, Matthew J. Duftler
See Also:
EventProcessor

Method Summary
 void setEventProcessor(EventProcessor eventProcessor)
           
 

Method Detail

setEventProcessor

public void setEventProcessor(EventProcessor eventProcessor)


libbsf-java-2.4.0/docs/api/org/apache/bsf/util/event/EventAdapterImpl.html0000644000175000017500000003566510511475731025357 0ustar mkochmkoch EventAdapterImpl (Bean Scripting Framework API)

org.apache.bsf.util.event
Class EventAdapterImpl

java.lang.Object
  extended byorg.apache.bsf.util.event.EventAdapterImpl
All Implemented Interfaces:
EventAdapter
Direct Known Subclasses:
java_awt_event_ActionAdapter, java_awt_event_AdjustmentAdapter, java_awt_event_ComponentAdapter, java_awt_event_ContainerAdapter, java_awt_event_FocusAdapter, java_awt_event_ItemAdapter, java_awt_event_KeyAdapter, java_awt_event_MouseAdapter, java_awt_event_MouseMotionAdapter, java_awt_event_TextAdapter, java_awt_event_WindowAdapter, java_beans_PropertyChangeAdapter, java_beans_VetoableChangeAdapter

public class EventAdapterImpl
extends java.lang.Object
implements EventAdapter

EventAdapterImpl is a default implementation of the EventAdapter interface that specific event adapters may choose to subclass from instead of implementing the interface themselves. Saves 5 lines of code mebbe.

Author:
Sanjiva Weerawarana, Matthew J. Duftler
See Also:
EventAdapter

Field Summary
protected  EventProcessor eventProcessor
           
 
Constructor Summary
EventAdapterImpl()
           
 
Method Summary
 void setEventProcessor(EventProcessor eventProcessor)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

eventProcessor

protected EventProcessor eventProcessor
Constructor Detail

EventAdapterImpl

public EventAdapterImpl()
Method Detail

setEventProcessor

public void setEventProcessor(EventProcessor eventProcessor)
Specified by:
setEventProcessor in interface EventAdapter


libbsf-java-2.4.0/docs/api/org/apache/bsf/util/event/EventProcessor.html0000644000175000017500000002360510511475731025123 0ustar mkochmkoch EventProcessor (Bean Scripting Framework API)

org.apache.bsf.util.event
Interface EventProcessor

All Known Implementing Classes:
BSFEventProcessor, BSFEventProcessorReturningEventInfos

public interface EventProcessor

EventProcessor is the interface that event adapters use to delegate events they received to be delivered to the appropriate target. They can simply deliver the event using processEvent or, if the event can be excepted to, via processExceptionableEvent (in which case the adapter is expected to forward on an exception to the source bean).

Author:
Sanjiva Weerawarana, Matthew J. Duftler
See Also:
EventAdapter

Method Summary
 void processEvent(java.lang.String filter, java.lang.Object[] eventInfo)
           
 void processExceptionableEvent(java.lang.String filter, java.lang.Object[] eventInfo)
           
 

Method Detail

processEvent

public void processEvent(java.lang.String filter,
                         java.lang.Object[] eventInfo)

processExceptionableEvent

public void processExceptionableEvent(java.lang.String filter,
                                      java.lang.Object[] eventInfo)
                               throws java.lang.Exception
Throws:
java.lang.Exception


libbsf-java-2.4.0/docs/api/org/apache/bsf/util/event/package-use.html0000644000175000017500000002267210511475731024332 0ustar mkochmkoch Uses of Package org.apache.bsf.util.event (Bean Scripting Framework API)

Uses of Package
org.apache.bsf.util.event

Packages that use org.apache.bsf.util.event
org.apache.bsf.util   
org.apache.bsf.util.event   
org.apache.bsf.util.event.adapters   
 

Classes in org.apache.bsf.util.event used by org.apache.bsf.util
EventProcessor
          EventProcessor is the interface that event adapters use to delegate events they received to be delivered to the appropriate target.
 

Classes in org.apache.bsf.util.event used by org.apache.bsf.util.event
EventAdapter
          EventAdapter is the interface that all event adapters must implement in order to work with the automatic event adapter generation model.
EventProcessor
          EventProcessor is the interface that event adapters use to delegate events they received to be delivered to the appropriate target.
 

Classes in org.apache.bsf.util.event used by org.apache.bsf.util.event.adapters
EventAdapter
          EventAdapter is the interface that all event adapters must implement in order to work with the automatic event adapter generation model.
EventAdapterImpl
          EventAdapterImpl is a default implementation of the EventAdapter interface that specific event adapters may choose to subclass from instead of implementing the interface themselves.
 



libbsf-java-2.4.0/docs/api/org/apache/bsf/util/event/class-use/0000755000175000017500000000000010736513022023140 5ustar mkochmkochlibbsf-java-2.4.0/docs/api/org/apache/bsf/util/event/class-use/EventAdapter.html0000644000175000017500000003432210511475731026421 0ustar mkochmkoch Uses of Interface org.apache.bsf.util.event.EventAdapter (Bean Scripting Framework API)

Uses of Interface
org.apache.bsf.util.event.EventAdapter

Packages that use EventAdapter
org.apache.bsf.util.event   
org.apache.bsf.util.event.adapters   
 

Uses of EventAdapter in org.apache.bsf.util.event
 

Classes in org.apache.bsf.util.event that implement EventAdapter
 class EventAdapterImpl
          EventAdapterImpl is a default implementation of the EventAdapter interface that specific event adapters may choose to subclass from instead of implementing the interface themselves.
 

Uses of EventAdapter in org.apache.bsf.util.event.adapters
 

Classes in org.apache.bsf.util.event.adapters that implement EventAdapter
 class java_awt_event_ActionAdapter
           
 class java_awt_event_AdjustmentAdapter
           
 class java_awt_event_ComponentAdapter
           
 class java_awt_event_ContainerAdapter
           
 class java_awt_event_FocusAdapter
           
 class java_awt_event_ItemAdapter
           
 class java_awt_event_KeyAdapter
           
 class java_awt_event_MouseAdapter
           
 class java_awt_event_MouseMotionAdapter
           
 class java_awt_event_TextAdapter
           
 class java_awt_event_WindowAdapter
           
 class java_beans_PropertyChangeAdapter
           
 class java_beans_VetoableChangeAdapter
           
 



libbsf-java-2.4.0/docs/api/org/apache/bsf/util/event/class-use/EventAdapterImpl.html0000644000175000017500000003113110511475731027236 0ustar mkochmkoch Uses of Class org.apache.bsf.util.event.EventAdapterImpl (Bean Scripting Framework API)

Uses of Class
org.apache.bsf.util.event.EventAdapterImpl

Packages that use EventAdapterImpl
org.apache.bsf.util.event.adapters   
 

Uses of EventAdapterImpl in org.apache.bsf.util.event.adapters
 

Subclasses of EventAdapterImpl in org.apache.bsf.util.event.adapters
 class java_awt_event_ActionAdapter
           
 class java_awt_event_AdjustmentAdapter
           
 class java_awt_event_ComponentAdapter
           
 class java_awt_event_ContainerAdapter
           
 class java_awt_event_FocusAdapter
           
 class java_awt_event_ItemAdapter
           
 class java_awt_event_KeyAdapter
           
 class java_awt_event_MouseAdapter
           
 class java_awt_event_MouseMotionAdapter
           
 class java_awt_event_TextAdapter
           
 class java_awt_event_WindowAdapter
           
 class java_beans_PropertyChangeAdapter
           
 class java_beans_VetoableChangeAdapter
           
 



libbsf-java-2.4.0/docs/api/org/apache/bsf/util/event/class-use/EventProcessor.html0000644000175000017500000003056710511475731027027 0ustar mkochmkoch Uses of Interface org.apache.bsf.util.event.EventProcessor (Bean Scripting Framework API)

Uses of Interface
org.apache.bsf.util.event.EventProcessor

Packages that use EventProcessor
org.apache.bsf.util   
org.apache.bsf.util.event   
 

Uses of EventProcessor in org.apache.bsf.util
 

Classes in org.apache.bsf.util that implement EventProcessor
 class BSFEventProcessor
          This is used to support binding scripts to be run when an event occurs.
 class BSFEventProcessorReturningEventInfos
          This is used to support binding scripts to be run when an event occurs, forwarding the arguments supplied to the event listener.
 

Methods in org.apache.bsf.util with parameters of type EventProcessor
static void ReflectionUtils.addEventListener(java.lang.Object source, java.lang.String eventSetName, EventProcessor processor)
          Add an event processor as a listener to some event coming out of an object.
 

Uses of EventProcessor in org.apache.bsf.util.event
 

Fields in org.apache.bsf.util.event declared as EventProcessor
protected  EventProcessor EventAdapterImpl.eventProcessor
           
 

Methods in org.apache.bsf.util.event with parameters of type EventProcessor
 void EventAdapter.setEventProcessor(EventProcessor eventProcessor)
           
 void EventAdapterImpl.setEventProcessor(EventProcessor eventProcessor)
           
 



libbsf-java-2.4.0/docs/api/org/apache/bsf/util/event/class-use/EventAdapterRegistry.html0000644000175000017500000001335210511475731030152 0ustar mkochmkoch Uses of Class org.apache.bsf.util.event.EventAdapterRegistry (Bean Scripting Framework API)

Uses of Class
org.apache.bsf.util.event.EventAdapterRegistry

No usage of org.apache.bsf.util.event.EventAdapterRegistry



libbsf-java-2.4.0/docs/api/org/apache/bsf/util/event/package-summary.html0000644000175000017500000001671610511475731025235 0ustar mkochmkoch org.apache.bsf.util.event (Bean Scripting Framework API)

Package org.apache.bsf.util.event

Interface Summary
EventAdapter EventAdapter is the interface that all event adapters must implement in order to work with the automatic event adapter generation model.
EventProcessor EventProcessor is the interface that event adapters use to delegate events they received to be delivered to the appropriate target.
 

Class Summary
EventAdapterImpl EventAdapterImpl is a default implementation of the EventAdapter interface that specific event adapters may choose to subclass from instead of implementing the interface themselves.
EventAdapterRegistry The EventAdapterRegistry is the registry of event adapters.
 



libbsf-java-2.4.0/docs/api/org/apache/bsf/util/event/EventAdapterRegistry.html0000644000175000017500000003242410511475731026254 0ustar mkochmkoch EventAdapterRegistry (Bean Scripting Framework API)

org.apache.bsf.util.event
Class EventAdapterRegistry

java.lang.Object
  extended byorg.apache.bsf.util.event.EventAdapterRegistry

public class EventAdapterRegistry
extends java.lang.Object

The EventAdapterRegistry is the registry of event adapters. If a desired adapter is not found, the adapter will be dynamically generated when lookup is attempted. Set the dynamic property to false to disable this feature.

This implementation first looks for an adapter in its lookup table and if it doesn't find one looks for a standard implementation of that adapter in the org.apache.bsf.util.event.adapters package with a standard naming convention. The naming convention it assumes is the following: for event listener type a.b.c.FooListener, it loads an adapter of type org.apache.bsf.util.event.adapters.a_b_c_FooAdapter. If both the loading and the dynamic generation fail, then a null is returned.

Author:
Sanjiva Weerawarana, Matthew J. Duftler
See Also:
EventAdapter

Constructor Summary
EventAdapterRegistry()
           
 
Method Summary
static java.lang.Class lookup(java.lang.Class listenerType)
           
static void register(java.lang.Class listenerType, java.lang.Class eventAdapterClass)
           
static void setClassLoader(java.lang.ClassLoader cloader)
          Class loader to use to load event adapter classes.
static void setDynamic(boolean dynamic)
          Indicates whether or not to dynamically generate adapters; default is true.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EventAdapterRegistry

public EventAdapterRegistry()
Method Detail

lookup

public static java.lang.Class lookup(java.lang.Class listenerType)

register

public static void register(java.lang.Class listenerType,
                            java.lang.Class eventAdapterClass)

setClassLoader

public static void setClassLoader(java.lang.ClassLoader cloader)
Class loader to use to load event adapter classes.


setDynamic

public static void setDynamic(boolean dynamic)
Indicates whether or not to dynamically generate adapters; default is true.

If the dynamic property is set to true, and the ClassLoader is unable to resolve an adapter, one will be dynamically generated.

Parameters:
dynamic - whether or not to dynamically generate adapters.


libbsf-java-2.4.0/docs/api/org/apache/bsf/util/event/package-frame.html0000644000175000017500000000277210511475731024627 0ustar mkochmkoch org.apache.bsf.util.event (Bean Scripting Framework API) org.apache.bsf.util.event
Interfaces 
EventAdapter
EventProcessor
Classes 
EventAdapterImpl
EventAdapterRegistry
libbsf-java-2.4.0/docs/api/org/apache/bsf/util/BSFEventProcessorReturningEventInfos.html0000644000175000017500000002645410511475731030241 0ustar mkochmkoch BSFEventProcessorReturningEventInfos (Bean Scripting Framework API)

org.apache.bsf.util
Class BSFEventProcessorReturningEventInfos

java.lang.Object
  extended byorg.apache.bsf.util.BSFEventProcessorReturningEventInfos
All Implemented Interfaces:
EventProcessor

public class BSFEventProcessorReturningEventInfos
extends java.lang.Object
implements EventProcessor

This is used to support binding scripts to be run when an event occurs, forwarding the arguments supplied to the event listener. It is an adapted version of org.apache.bsf.util.BSFEventProcessor.

Author:
Rony G. Flatscher, but most of the code copied from org.apache.bsf.util.BSFEventProcessor by Sanjiva Weerawarana

Method Summary
 void processEvent(java.lang.String inFilter, java.lang.Object[] evtInfo)
           
 void processExceptionableEvent(java.lang.String inFilter, java.lang.Object[] evtInfo)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

processEvent

public void processEvent(java.lang.String inFilter,
                         java.lang.Object[] evtInfo)
Specified by:
processEvent in interface EventProcessor

processExceptionableEvent

public void processExceptionableEvent(java.lang.String inFilter,
                                      java.lang.Object[] evtInfo)
                               throws java.lang.Exception
Specified by:
processExceptionableEvent in interface EventProcessor
Throws:
java.lang.Exception


libbsf-java-2.4.0/docs/api/org/apache/bsf/util/ReflectionUtils.html0000644000175000017500000006132310511475731024133 0ustar mkochmkoch ReflectionUtils (Bean Scripting Framework API)

org.apache.bsf.util
Class ReflectionUtils

java.lang.Object
  extended byorg.apache.bsf.util.ReflectionUtils

public class ReflectionUtils
extends java.lang.Object

This file is a collection of reflection utilities. There are utilities for creating beans, getting bean infos, setting/getting properties, and binding events.

Author:
Sanjiva Weerawarana, Joseph Kesselman

Constructor Summary
ReflectionUtils()
           
 
Method Summary
static void addEventListener(java.lang.Object source, java.lang.String eventSetName, EventProcessor processor)
          Add an event processor as a listener to some event coming out of an object.
static Bean createBean(java.lang.ClassLoader cld, java.lang.String className, java.lang.Class[] argTypes, java.lang.Object[] args)
          Create a bean using given class loader and using the appropriate constructor for the given args of the given arg types.
static Bean createBean(java.lang.ClassLoader cld, java.lang.String className, java.lang.Object[] args)
          Create a bean using given class loader and using the appropriate constructor for the given args.
static Bean getField(java.lang.Object target, java.lang.String fieldName)
           
static Bean getProperty(java.lang.Object target, java.lang.String propName, java.lang.Integer index)
          Get a property of a bean.
static void setField(java.lang.Object target, java.lang.String fieldName, Bean value, TypeConvertorRegistry tcr)
           
static void setProperty(java.lang.Object target, java.lang.String propName, java.lang.Integer index, java.lang.Object value, java.lang.Class valueType, TypeConvertorRegistry tcr)
          Set a property of a bean to a given value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReflectionUtils

public ReflectionUtils()
Method Detail

addEventListener

public static void addEventListener(java.lang.Object source,
                                    java.lang.String eventSetName,
                                    EventProcessor processor)
                             throws java.beans.IntrospectionException,
                                    java.lang.IllegalArgumentException,
                                    java.lang.IllegalAccessException,
                                    java.lang.InstantiationException,
                                    java.lang.reflect.InvocationTargetException
Add an event processor as a listener to some event coming out of an object.

Parameters:
source - event source
eventSetName - name of event set from event src to bind to
processor - event processor the event should be delegated to when it occurs; either via processEvent or processExceptionableEvent.
Throws:
java.beans.IntrospectionException - if unable to introspect
java.lang.IllegalArgumentException - if event set is unknown
java.lang.IllegalAccessException - if the event adapter class or initializer is not accessible.
java.lang.InstantiationException - if event adapter instantiation fails
java.lang.reflect.InvocationTargetException - if something goes wrong while running add event listener method

createBean

public static Bean createBean(java.lang.ClassLoader cld,
                              java.lang.String className,
                              java.lang.Class[] argTypes,
                              java.lang.Object[] args)
                       throws java.lang.ClassNotFoundException,
                              java.lang.NoSuchMethodException,
                              java.lang.InstantiationException,
                              java.lang.IllegalAccessException,
                              java.lang.IllegalArgumentException,
                              java.lang.reflect.InvocationTargetException,
                              java.io.IOException
Create a bean using given class loader and using the appropriate constructor for the given args of the given arg types.

Parameters:
cld - the class loader to use. If null, Class.forName is used.
className - name of class to instantiate
argTypes - array of argument types
args - array of arguments
Returns:
the newly created bean
Throws:
java.lang.ClassNotFoundException - if class is not loaded
java.lang.NoSuchMethodException - if constructor can't be found
java.lang.InstantiationException - if class can't be instantiated
java.lang.IllegalAccessException - if class is not accessible
java.lang.IllegalArgumentException - if argument problem
java.lang.reflect.InvocationTargetException - if constructor excepted
java.io.IOException - if I/O error in beans.instantiate

createBean

public static Bean createBean(java.lang.ClassLoader cld,
                              java.lang.String className,
                              java.lang.Object[] args)
                       throws java.lang.ClassNotFoundException,
                              java.lang.NoSuchMethodException,
                              java.lang.InstantiationException,
                              java.lang.IllegalAccessException,
                              java.lang.IllegalArgumentException,
                              java.lang.reflect.InvocationTargetException,
                              java.io.IOException
Create a bean using given class loader and using the appropriate constructor for the given args. Figures out the arg types and calls above.

Parameters:
cld - the class loader to use. If null, Class.forName is used.
className - name of class to instantiate
args - array of arguments
Returns:
the newly created bean
Throws:
java.lang.ClassNotFoundException - if class is not loaded
java.lang.NoSuchMethodException - if constructor can't be found
java.lang.InstantiationException - if class can't be instantiated
java.lang.IllegalAccessException - if class is not accessible
java.lang.IllegalArgumentException - if argument problem
java.lang.reflect.InvocationTargetException - if constructor excepted
java.io.IOException - if I/O error in beans.instantiate

getField

public static Bean getField(java.lang.Object target,
                            java.lang.String fieldName)
                     throws java.lang.IllegalArgumentException,
                            java.lang.IllegalAccessException
Throws:
java.lang.IllegalArgumentException
java.lang.IllegalAccessException

getProperty

public static Bean getProperty(java.lang.Object target,
                               java.lang.String propName,
                               java.lang.Integer index)
                        throws java.beans.IntrospectionException,
                               java.lang.IllegalArgumentException,
                               java.lang.IllegalAccessException,
                               java.lang.reflect.InvocationTargetException
Get a property of a bean.

Parameters:
target - the object whose prop is to be gotten
propName - name of the property to set
index - index to get (if property is indexed)
Throws:
java.beans.IntrospectionException - if unable to introspect
java.lang.IllegalArgumentException - if problems with args: if the property is unknown, or if the property is given an index when its not, or if the property is not writeable, or if the given value cannot be assigned to the it (type mismatch).
java.lang.IllegalAccessException - if read method is not accessible
java.lang.reflect.InvocationTargetException - if read method excepts

setField

public static void setField(java.lang.Object target,
                            java.lang.String fieldName,
                            Bean value,
                            TypeConvertorRegistry tcr)
                     throws java.lang.IllegalArgumentException,
                            java.lang.IllegalAccessException
Throws:
java.lang.IllegalArgumentException
java.lang.IllegalAccessException

setProperty

public static void setProperty(java.lang.Object target,
                               java.lang.String propName,
                               java.lang.Integer index,
                               java.lang.Object value,
                               java.lang.Class valueType,
                               TypeConvertorRegistry tcr)
                        throws java.beans.IntrospectionException,
                               java.lang.IllegalArgumentException,
                               java.lang.IllegalAccessException,
                               java.lang.reflect.InvocationTargetException
Set a property of a bean to a given value.

Parameters:
target - the object whose prop is to be set
propName - name of the property to set
index - index to set (if property is indexed)
value - the property value
valueType - the type of the above (needed when its null)
tcr - type convertor registry to use to convert value type to property type if necessary
Throws:
java.beans.IntrospectionException - if unable to introspect
java.lang.IllegalArgumentException - if problems with args: if the property is unknown, or if the property is given an index when its not, or if the property is not writeable, or if the given value cannot be assigned to the it (type mismatch).
java.lang.IllegalAccessException - if write method is not accessible
java.lang.reflect.InvocationTargetException - if write method excepts


libbsf-java-2.4.0/docs/api/org/apache/bsf/util/MethodUtils.html0000644000175000017500000003402210511475731023255 0ustar mkochmkoch MethodUtils (Bean Scripting Framework API)

org.apache.bsf.util
Class MethodUtils

java.lang.Object
  extended byorg.apache.bsf.util.MethodUtils

public class MethodUtils
extends java.lang.Object

This file is a collection of reflection utilities for dealing with methods and constructors.

Author:
Sanjiva Weerawarana, Joseph Kesselman

Constructor Summary
MethodUtils()
           
 
Method Summary
static java.lang.reflect.Constructor getConstructor(java.lang.Class targetClass, java.lang.Class[] argTypes)
          Class.getConstructor() finds only the entry point (if any) _exactly_ matching the specified argument types.
static java.lang.reflect.Method getMethod(java.lang.Class target, java.lang.String methodName, java.lang.Class[] argTypes, boolean isStaticReference)
           
static java.lang.reflect.Method getMethod(java.lang.Object target, java.lang.String methodName, java.lang.Class[] argTypes)
          Class.getMethod() finds only the entry point (if any) _exactly_ matching the specified argument types.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MethodUtils

public MethodUtils()
Method Detail

getConstructor

public static java.lang.reflect.Constructor getConstructor(java.lang.Class targetClass,
                                                           java.lang.Class[] argTypes)
                                                    throws java.lang.SecurityException,
                                                           java.lang.NoSuchMethodException
Class.getConstructor() finds only the entry point (if any) _exactly_ matching the specified argument types. Our implmentation can decide between several imperfect matches, using the same search algorithm as the Java compiler. Note that all constructors are static by definition, so isStaticReference is true.

Throws:
java.lang.NoSuchMethodException - if constructor not found.
java.lang.SecurityException

getMethod

public static java.lang.reflect.Method getMethod(java.lang.Class target,
                                                 java.lang.String methodName,
                                                 java.lang.Class[] argTypes,
                                                 boolean isStaticReference)
                                          throws java.lang.SecurityException,
                                                 java.lang.NoSuchMethodException
Throws:
java.lang.SecurityException
java.lang.NoSuchMethodException

getMethod

public static java.lang.reflect.Method getMethod(java.lang.Object target,
                                                 java.lang.String methodName,
                                                 java.lang.Class[] argTypes)
                                          throws java.lang.SecurityException,
                                                 java.lang.NoSuchMethodException
Class.getMethod() finds only the entry point (if any) _exactly_ matching the specified argument types. Our implmentation can decide between several imperfect matches, using the same search algorithm as the Java compiler. This version emulates the compiler behavior by allowing lookup to be performed against either a class or an instance -- classname.foo() must be a static method call, instance.foo() can invoke either static or instance methods.

Parameters:
target - object on which call is to be made
methodName - name of method I'm lookin' for
argTypes - array of argument types of method
Returns:
the desired method
Throws:
java.lang.SecurityException - if security violation
java.lang.NoSuchMethodException - if no such method


libbsf-java-2.4.0/docs/api/org/apache/bsf/util/BSFEngineImpl.html0000644000175000017500000011027010511475731023376 0ustar mkochmkoch BSFEngineImpl (Bean Scripting Framework API)

org.apache.bsf.util
Class BSFEngineImpl

java.lang.Object
  extended byorg.apache.bsf.util.BSFEngineImpl
All Implemented Interfaces:
BSFEngine, java.util.EventListener, java.beans.PropertyChangeListener
Direct Known Subclasses:
JaclEngine, JavaScriptEngine, JythonEngine, NetRexxEngine, XSLTEngine

public abstract class BSFEngineImpl
extends java.lang.Object
implements BSFEngine

This is a base implementation of the BSFEngine interface which engine implementations may choose to extend to get the basic methods of the interface implemented.

Author:
Sanjiva Weerawarana, Olivier Gruber (added original debugging support)

Field Summary
protected  java.lang.ClassLoader classLoader
           
protected  java.lang.String classPath
           
protected  java.util.Vector declaredBeans
           
protected  java.lang.String lang
           
protected  BSFManager mgr
           
protected  java.lang.String tempDir
           
 
Constructor Summary
BSFEngineImpl()
           
 
Method Summary
 java.lang.Object apply(java.lang.String source, int lineNo, int columnNo, java.lang.Object funcBody, java.util.Vector paramNames, java.util.Vector arguments)
          Default impl of apply - calls eval ignoring parameters and returns the result.
 void compileApply(java.lang.String source, int lineNo, int columnNo, java.lang.Object funcBody, java.util.Vector paramNames, java.util.Vector arguments, CodeBuffer cb)
          Default impl of compileApply - calls compileExpr ignoring parameters.
 void compileExpr(java.lang.String source, int lineNo, int columnNo, java.lang.Object expr, CodeBuffer cb)
          Default impl of compileExpr - generates code that'll create a new manager, evaluate the expression, and return the value.
 void compileScript(java.lang.String source, int lineNo, int columnNo, java.lang.Object script, CodeBuffer cb)
          Default impl of compileScript - generates code that'll create a new manager, and execute the script.
 void declareBean(BSFDeclaredBean bean)
          Declare a bean after the engine has been started.
 void exec(java.lang.String source, int lineNo, int columnNo, java.lang.Object script)
          Default impl of execute - calls eval and ignores the result.
 void iexec(java.lang.String source, int lineNo, int columnNo, java.lang.Object script)
          Default impl of interactive execution - calls eval and ignores the result.
 void initialize(BSFManager mgr, java.lang.String lang, java.util.Vector declaredBeans)
          initialize the engine; called right after construction by the manager.
 void propertyChange(java.beans.PropertyChangeEvent e)
          Receive property change events from the manager and update my fields as needed.
 void terminate()
          Graceful termination
 void undeclareBean(BSFDeclaredBean bean)
          Undeclare a previously declared bean.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.bsf.BSFEngine
call, eval
 

Field Detail

mgr

protected BSFManager mgr

lang

protected java.lang.String lang

declaredBeans

protected java.util.Vector declaredBeans

classPath

protected java.lang.String classPath

tempDir

protected java.lang.String tempDir

classLoader

protected java.lang.ClassLoader classLoader
Constructor Detail

BSFEngineImpl

public BSFEngineImpl()
Method Detail

apply

public java.lang.Object apply(java.lang.String source,
                              int lineNo,
                              int columnNo,
                              java.lang.Object funcBody,
                              java.util.Vector paramNames,
                              java.util.Vector arguments)
                       throws BSFException
Default impl of apply - calls eval ignoring parameters and returns the result.

Specified by:
apply in interface BSFEngine
Parameters:
source - (context info) the source of this expression (e.g., filename)
lineNo - (context info) the line number in source for expr
columnNo - (context info) the column number in source for expr
funcBody - the multi-line, value returning script to evaluate
paramNames - the names of the parameters above assumes
arguments - values of the above parameters
Throws:
BSFException - if anything goes wrong while doin' it.

compileApply

public void compileApply(java.lang.String source,
                         int lineNo,
                         int columnNo,
                         java.lang.Object funcBody,
                         java.util.Vector paramNames,
                         java.util.Vector arguments,
                         CodeBuffer cb)
                  throws BSFException
Default impl of compileApply - calls compileExpr ignoring parameters.

Specified by:
compileApply in interface BSFEngine
Parameters:
source - (context info) the source of this expression (e.g., filename)
lineNo - (context info) the line number in source for expr
columnNo - (context info) the column number in source for expr
funcBody - the multi-line, value returning script to evaluate
paramNames - the names of the parameters above assumes
arguments - values of the above parameters
cb - the CodeBuffer to compile into
Throws:
BSFException - if anything goes wrong while doin' it.

compileExpr

public void compileExpr(java.lang.String source,
                        int lineNo,
                        int columnNo,
                        java.lang.Object expr,
                        CodeBuffer cb)
                 throws BSFException
Default impl of compileExpr - generates code that'll create a new manager, evaluate the expression, and return the value.

Specified by:
compileExpr in interface BSFEngine
Parameters:
source - (context info) the source of this expression (e.g., filename)
lineNo - (context info) the line number in source for expr
columnNo - (context info) the column number in source for expr
expr - the expression to compile
cb - the CodeBuffer to compile into
Throws:
BSFException - if anything goes wrong while compiling a BSFException is thrown. The reason indicates the problem.

compileScript

public void compileScript(java.lang.String source,
                          int lineNo,
                          int columnNo,
                          java.lang.Object script,
                          CodeBuffer cb)
                   throws BSFException
Default impl of compileScript - generates code that'll create a new manager, and execute the script.

Specified by:
compileScript in interface BSFEngine
Parameters:
source - (context info) the source of this script (e.g., filename)
lineNo - (context info) the line number in source for script
columnNo - (context info) the column number in source for script
script - the script to compile
cb - the CodeBuffer to compile into
Throws:
BSFException - if anything goes wrong while compiling a BSFException is thrown. The reason indicates the problem.

declareBean

public void declareBean(BSFDeclaredBean bean)
                 throws BSFException
Description copied from interface: BSFEngine
Declare a bean after the engine has been started. Declared beans are beans that are named and which the engine must make available to the scripts it runs in the most first class way possible.

Specified by:
declareBean in interface BSFEngine
Parameters:
bean - the bean to declare
Throws:
BSFException - if the engine cannot do this operation

exec

public void exec(java.lang.String source,
                 int lineNo,
                 int columnNo,
                 java.lang.Object script)
          throws BSFException
Default impl of execute - calls eval and ignores the result.

Specified by:
exec in interface BSFEngine
Parameters:
source - (context info) the source of this expression (e.g., filename)
lineNo - (context info) the line number in source for expr
columnNo - (context info) the column number in source for expr
script - the script to execute
Throws:
BSFException - if anything goes wrong while exec'ing a BSFException is thrown. The reason indicates the problem.

iexec

public void iexec(java.lang.String source,
                  int lineNo,
                  int columnNo,
                  java.lang.Object script)
           throws BSFException
Default impl of interactive execution - calls eval and ignores the result.

Specified by:
iexec in interface BSFEngine
Parameters:
source - (context info) the source of this expression (e.g., filename)
lineNo - (context info) the line number in source for expr
columnNo - (context info) the column number in source for expr
script - the script to execute
Throws:
BSFException - if anything goes wrong while exec'ing a BSFException is thrown. The reason indicates the problem.

initialize

public void initialize(BSFManager mgr,
                       java.lang.String lang,
                       java.util.Vector declaredBeans)
                throws BSFException
initialize the engine; called right after construction by the manager. Declared beans are simply kept in a vector and that's it. Subclasses must do whatever they want with it.

Specified by:
initialize in interface BSFEngine
Parameters:
mgr - The BSFManager that's hosting this engine.
lang - Language string which this engine is handling.
declaredBeans - Vector of BSFDeclaredObject containing beans that should be declared into the language runtime at init time as best as possible.
Throws:
BSFException - if anything goes wrong while init'ing a BSFException is thrown. The reason indicates the problem.

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent e)
Receive property change events from the manager and update my fields as needed.

Specified by:
propertyChange in interface java.beans.PropertyChangeListener
Parameters:
e - PropertyChange event with the change data

terminate

public void terminate()
Description copied from interface: BSFEngine
Graceful termination

Specified by:
terminate in interface BSFEngine

undeclareBean

public void undeclareBean(BSFDeclaredBean bean)
                   throws BSFException
Description copied from interface: BSFEngine
Undeclare a previously declared bean.

Specified by:
undeclareBean in interface BSFEngine
Parameters:
bean - the bean to undeclare
Throws:
BSFException - if the engine cannot do this operation


libbsf-java-2.4.0/docs/api/org/apache/bsf/util/type/0000755000175000017500000000000010736513022021101 5ustar mkochmkochlibbsf-java-2.4.0/docs/api/org/apache/bsf/util/type/package-tree.html0000644000175000017500000001372710511475731024336 0ustar mkochmkoch org.apache.bsf.util.type Class Hierarchy (Bean Scripting Framework API)

Hierarchy For Package org.apache.bsf.util.type

Package Hierarchies:
All Packages

Class Hierarchy

Interface Hierarchy



libbsf-java-2.4.0/docs/api/org/apache/bsf/util/type/TypeConvertorRegistry.html0000644000175000017500000003230410511475731026352 0ustar mkochmkoch TypeConvertorRegistry (Bean Scripting Framework API)

org.apache.bsf.util.type
Class TypeConvertorRegistry

java.lang.Object
  extended byorg.apache.bsf.util.type.TypeConvertorRegistry

public class TypeConvertorRegistry
extends java.lang.Object

The TypeConvertorRegistry is the registry of type convertors. It has lookup and register capabilities based on the types to be converted as well as by some object key.

Author:
Sanjiva Weerawarana, Matthew J. Duftler
See Also:
TypeConvertorRegistry

Constructor Summary
TypeConvertorRegistry()
           
 
Method Summary
 TypeConvertor lookup(java.lang.Class from, java.lang.Class to)
           
 TypeConvertor lookupByKey(java.lang.Object key)
           
 void register(java.lang.Class from, java.lang.Class to, TypeConvertor convertor)
           
 void registerByKey(java.lang.Object key, TypeConvertor convertor)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TypeConvertorRegistry

public TypeConvertorRegistry()
Method Detail

lookup

public TypeConvertor lookup(java.lang.Class from,
                            java.lang.Class to)

lookupByKey

public TypeConvertor lookupByKey(java.lang.Object key)

register

public void register(java.lang.Class from,
                     java.lang.Class to,
                     TypeConvertor convertor)

registerByKey

public void registerByKey(java.lang.Object key,
                          TypeConvertor convertor)


libbsf-java-2.4.0/docs/api/org/apache/bsf/util/type/TypeConvertor.html0000644000175000017500000002220110511475731024614 0ustar mkochmkoch TypeConvertor (Bean Scripting Framework API)

org.apache.bsf.util.type
Interface TypeConvertor


public interface TypeConvertor

A TypeConvertor is used to convert an object of one type to one of another type. The convertor is invoked with the class of the from object, the desired class, and the from object itself. The convertor must return a new object of the desired class.

Author:
Sanjiva Weerawarana
See Also:
TypeConvertorRegistry

Method Summary
 java.lang.Object convert(java.lang.Class from, java.lang.Class to, java.lang.Object obj)
           
 java.lang.String getCodeGenString()
           
 

Method Detail

convert

public java.lang.Object convert(java.lang.Class from,
                                java.lang.Class to,
                                java.lang.Object obj)

getCodeGenString

public java.lang.String getCodeGenString()


libbsf-java-2.4.0/docs/api/org/apache/bsf/util/type/package-use.html0000644000175000017500000001662410511475731024172 0ustar mkochmkoch Uses of Package org.apache.bsf.util.type (Bean Scripting Framework API)

Uses of Package
org.apache.bsf.util.type

Packages that use org.apache.bsf.util.type
org.apache.bsf.util   
org.apache.bsf.util.type   
 

Classes in org.apache.bsf.util.type used by org.apache.bsf.util
TypeConvertorRegistry
          The TypeConvertorRegistry is the registry of type convertors.
 

Classes in org.apache.bsf.util.type used by org.apache.bsf.util.type
TypeConvertor
          A TypeConvertor is used to convert an object of one type to one of another type.
 



libbsf-java-2.4.0/docs/api/org/apache/bsf/util/type/class-use/0000755000175000017500000000000010736513022023000 5ustar mkochmkochlibbsf-java-2.4.0/docs/api/org/apache/bsf/util/type/class-use/TypeConvertorRegistry.html0000644000175000017500000002145610511475731030257 0ustar mkochmkoch Uses of Class org.apache.bsf.util.type.TypeConvertorRegistry (Bean Scripting Framework API)

Uses of Class
org.apache.bsf.util.type.TypeConvertorRegistry

Packages that use TypeConvertorRegistry
org.apache.bsf.util   
 

Uses of TypeConvertorRegistry in org.apache.bsf.util
 

Methods in org.apache.bsf.util with parameters of type TypeConvertorRegistry
static void ReflectionUtils.setField(java.lang.Object target, java.lang.String fieldName, Bean value, TypeConvertorRegistry tcr)
           
static void ReflectionUtils.setProperty(java.lang.Object target, java.lang.String propName, java.lang.Integer index, java.lang.Object value, java.lang.Class valueType, TypeConvertorRegistry tcr)
          Set a property of a bean to a given value.
 



libbsf-java-2.4.0/docs/api/org/apache/bsf/util/type/class-use/TypeConvertor.html0000644000175000017500000002361110511475731026521 0ustar mkochmkoch Uses of Interface org.apache.bsf.util.type.TypeConvertor (Bean Scripting Framework API)

Uses of Interface
org.apache.bsf.util.type.TypeConvertor

Packages that use TypeConvertor
org.apache.bsf.util.type   
 

Uses of TypeConvertor in org.apache.bsf.util.type
 

Methods in org.apache.bsf.util.type that return TypeConvertor
 TypeConvertor TypeConvertorRegistry.lookup(java.lang.Class from, java.lang.Class to)
           
 TypeConvertor TypeConvertorRegistry.lookupByKey(java.lang.Object key)
           
 

Methods in org.apache.bsf.util.type with parameters of type TypeConvertor
 void TypeConvertorRegistry.register(java.lang.Class from, java.lang.Class to, TypeConvertor convertor)
           
 void TypeConvertorRegistry.registerByKey(java.lang.Object key, TypeConvertor convertor)
           
 



libbsf-java-2.4.0/docs/api/org/apache/bsf/util/type/package-summary.html0000644000175000017500000001475010511475731025071 0ustar mkochmkoch org.apache.bsf.util.type (Bean Scripting Framework API)

Package org.apache.bsf.util.type

Interface Summary
TypeConvertor A TypeConvertor is used to convert an object of one type to one of another type.
 

Class Summary
TypeConvertorRegistry The TypeConvertorRegistry is the registry of type convertors.
 



libbsf-java-2.4.0/docs/api/org/apache/bsf/util/type/package-frame.html0000644000175000017500000000237710511475731024470 0ustar mkochmkoch org.apache.bsf.util.type (Bean Scripting Framework API) org.apache.bsf.util.type
Interfaces 
TypeConvertor
Classes 
TypeConvertorRegistry
libbsf-java-2.4.0/docs/api/org/apache/bsf/util/package-frame.html0000644000175000017500000000460610511475731023504 0ustar mkochmkoch org.apache.bsf.util (Bean Scripting Framework API) org.apache.bsf.util
Classes 
Bean
BSFEngineImpl
BSFEventProcessor
BSFEventProcessorReturningEventInfos
BSFFunctions
CodeBuffer
EngineUtils
IndentWriter
IOUtils
JavaUtils
MethodUtils
ObjectRegistry
ObjInfo
ReflectionUtils
StringUtils
libbsf-java-2.4.0/docs/api/org/apache/bsf/BSFManager.html0000644000175000017500000014166110511475731021754 0ustar mkochmkoch BSFManager (Bean Scripting Framework API)

org.apache.bsf
Class BSFManager

java.lang.Object
  extended byorg.apache.bsf.BSFManager

public class BSFManager
extends java.lang.Object

This class is the entry point to the bean scripting framework. An application wishing to integrate scripting to a Java app would place an instance of a BSFManager in their code and use its services to register the beans they want to make available for scripting, load scripting engines, and run scripts.

BSFManager serves as the registry of available scripting engines as well. Loading and unloading of scripting engines is supported as well. Each BSFManager loads one engine per language. Several BSFManagers can be created per JVM.

Author:
Sanjiva Weerawarana, Matthew J. Duftler, Sam Ruby, Olivier Gruber (added original debugging support), Don Schwarz (added support for registering languages dynamically)

Field Summary
protected  java.lang.ClassLoader classLoader
           
protected  java.lang.String classPath
           
protected  java.util.Vector declaredBeans
           
protected static java.util.Hashtable extn2Lang
           
protected  java.util.Hashtable loadedEngines
           
protected  ObjectRegistry objectRegistry
           
protected  java.beans.PropertyChangeSupport pcs
           
protected static java.util.Hashtable registeredEngines
           
protected  java.lang.String tempDir
           
protected static java.lang.String version
           
 
Constructor Summary
BSFManager()
           
 
Method Summary
 java.lang.Object apply(java.lang.String lang, java.lang.String source, int lineNo, int columnNo, java.lang.Object funcBody, java.util.Vector paramNames, java.util.Vector arguments)
          Apply the given anonymous function of the given language to the given parameters and return the resulting value.
 void compileApply(java.lang.String lang, java.lang.String source, int lineNo, int columnNo, java.lang.Object funcBody, java.util.Vector paramNames, java.util.Vector arguments, CodeBuffer cb)
          Compile the application of the given anonymous function of the given language to the given parameters into the given CodeBuffer.
 void compileExpr(java.lang.String lang, java.lang.String source, int lineNo, int columnNo, java.lang.Object expr, CodeBuffer cb)
          Compile the given expression of the given language into the given CodeBuffer.
 void compileScript(java.lang.String lang, java.lang.String source, int lineNo, int columnNo, java.lang.Object script, CodeBuffer cb)
          Compile the given script of the given language into the given CodeBuffer.
 void declareBean(java.lang.String beanName, java.lang.Object bean, java.lang.Class type)
          Declare a bean.
 java.lang.Object eval(java.lang.String lang, java.lang.String source, int lineNo, int columnNo, java.lang.Object expr)
          Evaluate the given expression of the given language and return the resulting value.
 void exec(java.lang.String lang, java.lang.String source, int lineNo, int columnNo, java.lang.Object script)
          Execute the given script of the given language.
 java.lang.ClassLoader getClassLoader()
          Get classLoader
 java.lang.String getClassPath()
          Get classPath
static java.lang.String getLangFromFilename(java.lang.String fileName)
          Determine the language of a script file by looking at the file extension.
 ObjectRegistry getObjectRegistry()
          Return the current object registry of the manager.
 java.lang.String getTempDir()
          Get tempDir
static java.lang.String getVersion()
          Returns the version string of BSF.
 void iexec(java.lang.String lang, java.lang.String source, int lineNo, int columnNo, java.lang.Object script)
          Execute the given script of the given language, attempting to emulate an interactive session w/ the language.
static boolean isLanguageRegistered(java.lang.String lang)
          Determine whether a language is registered.
 BSFEngine loadScriptingEngine(java.lang.String lang)
          Load a scripting engine based on the lang string identifying it.
 java.lang.Object lookupBean(java.lang.String beanName)
          return a handle to a bean registered in the bean registry by the application or a scripting engine.
 void registerBean(java.lang.String beanName, java.lang.Object bean)
          Registering a bean allows a scripting engine or the application to access that bean by name and to manipulate it.
static void registerScriptingEngine(java.lang.String lang, java.lang.String engineClassName, java.lang.String[] extensions)
          Register a scripting engine in the static registry of the BSFManager.
 void setClassLoader(java.lang.ClassLoader classLoader)
          Set the class loader for those that need to use it.
 void setClassPath(java.lang.String classPath)
          Set the classpath for those that need to use it.
 void setObjectRegistry(ObjectRegistry objectRegistry)
          Set the object registry used by this manager.
 void setTempDir(java.lang.String tempDir)
          Temporary directory to put stuff into (for those who need to).
 void terminate()
          Gracefully terminate all engines
 void undeclareBean(java.lang.String beanName)
          Undeclare a previously declared bean.
 void unregisterBean(java.lang.String beanName)
          Unregister a previously registered bean.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

version

protected static java.lang.String version

registeredEngines

protected static java.util.Hashtable registeredEngines

extn2Lang

protected static java.util.Hashtable extn2Lang

loadedEngines

protected java.util.Hashtable loadedEngines

objectRegistry

protected ObjectRegistry objectRegistry

pcs

protected java.beans.PropertyChangeSupport pcs

classLoader

protected java.lang.ClassLoader classLoader

tempDir

protected java.lang.String tempDir

classPath

protected java.lang.String classPath

declaredBeans

protected java.util.Vector declaredBeans
Constructor Detail

BSFManager

public BSFManager()
Method Detail

getVersion

public static java.lang.String getVersion()
Returns the version string of BSF.

Returns:
version string in the form "abc.yyyymmdd" where "abc" represents a dewey decimal number (three levels, each between 0 and 9), and "yyyy" a four digit year, "mm" a two digit month, "dd" a two digit day.
Example: "240.20061006" stands for: BSF version 2.4.0 as of 2006-10-06.
Since:
2006-01-17

apply

public java.lang.Object apply(java.lang.String lang,
                              java.lang.String source,
                              int lineNo,
                              int columnNo,
                              java.lang.Object funcBody,
                              java.util.Vector paramNames,
                              java.util.Vector arguments)
                       throws BSFException
Apply the given anonymous function of the given language to the given parameters and return the resulting value.

Parameters:
lang - language identifier
source - (context info) the source of this expression (e.g., filename)
lineNo - (context info) the line number in source for expr
columnNo - (context info) the column number in source for expr
funcBody - the multi-line, value returning script to evaluate
paramNames - the names of the parameters above assumes
arguments - values of the above parameters
Throws:
BSFException - if anything goes wrong while running the script

compileApply

public void compileApply(java.lang.String lang,
                         java.lang.String source,
                         int lineNo,
                         int columnNo,
                         java.lang.Object funcBody,
                         java.util.Vector paramNames,
                         java.util.Vector arguments,
                         CodeBuffer cb)
                  throws BSFException
Compile the application of the given anonymous function of the given language to the given parameters into the given CodeBuffer.

Parameters:
lang - language identifier
source - (context info) the source of this expression (e.g., filename)
lineNo - (context info) the line number in source for expr
columnNo - (context info) the column number in source for expr
funcBody - the multi-line, value returning script to evaluate
paramNames - the names of the parameters above assumes
arguments - values of the above parameters
cb - code buffer to compile into
Throws:
BSFException - if anything goes wrong while running the script

compileExpr

public void compileExpr(java.lang.String lang,
                        java.lang.String source,
                        int lineNo,
                        int columnNo,
                        java.lang.Object expr,
                        CodeBuffer cb)
                 throws BSFException
Compile the given expression of the given language into the given CodeBuffer.

Parameters:
lang - language identifier
source - (context info) the source of this expression (e.g., filename)
lineNo - (context info) the line number in source for expr
columnNo - (context info) the column number in source for expr
expr - the expression to compile
cb - code buffer to compile into
Throws:
BSFException - if any error while compiling the expression

compileScript

public void compileScript(java.lang.String lang,
                          java.lang.String source,
                          int lineNo,
                          int columnNo,
                          java.lang.Object script,
                          CodeBuffer cb)
                   throws BSFException
Compile the given script of the given language into the given CodeBuffer.

Parameters:
lang - language identifier
source - (context info) the source of this script (e.g., filename)
lineNo - (context info) the line number in source for script
columnNo - (context info) the column number in source for script
script - the script to compile
cb - code buffer to compile into
Throws:
BSFException - if any error while compiling the script

declareBean

public void declareBean(java.lang.String beanName,
                        java.lang.Object bean,
                        java.lang.Class type)
                 throws BSFException
Declare a bean. The difference between declaring and registering is that engines are spsed to make declared beans "pre-available" in the scripts as far as possible. That is, if a script author needs a registered bean, he needs to look it up in some way. However if he needs a declared bean, the language has the responsibility to make those beans avaialable "automatically."

When a bean is declared it is automatically registered as well so that any declared bean can be gotton to by looking it up as well.

If any of the languages that are already running in this manager says they don't like this (by throwing an exception) then this method will simply quit with that exception. That is, any engines that come after than in the engine enumeration will not even be told about this new bean.

So, in general its best to declare beans before the manager has been asked to load any engines because then the user can be informed when an engine rejects it. Also, its much more likely that an engine can declare a bean at start time than it can at any time.

Parameters:
beanName - name to declare bean as
bean - the bean that's being declared
type - the type to represent the bean as
Throws:
BSFException - if any of the languages that are already running decides to throw an exception when asked to declare this bean.

eval

public java.lang.Object eval(java.lang.String lang,
                             java.lang.String source,
                             int lineNo,
                             int columnNo,
                             java.lang.Object expr)
                      throws BSFException
Evaluate the given expression of the given language and return the resulting value.

Parameters:
lang - language identifier
source - (context info) the source of this expression (e.g., filename)
lineNo - (context info) the line number in source for expr
columnNo - (context info) the column number in source for expr
expr - the expression to evaluate
Throws:
BSFException - if anything goes wrong while running the script

exec

public void exec(java.lang.String lang,
                 java.lang.String source,
                 int lineNo,
                 int columnNo,
                 java.lang.Object script)
          throws BSFException
Execute the given script of the given language.

Parameters:
lang - language identifier
source - (context info) the source of this expression (e.g., filename)
lineNo - (context info) the line number in source for expr
columnNo - (context info) the column number in source for expr
script - the script to execute
Throws:
BSFException - if anything goes wrong while running the script

iexec

public void iexec(java.lang.String lang,
                  java.lang.String source,
                  int lineNo,
                  int columnNo,
                  java.lang.Object script)
           throws BSFException
Execute the given script of the given language, attempting to emulate an interactive session w/ the language.

Parameters:
lang - language identifier
source - (context info) the source of this expression (e.g., filename)
lineNo - (context info) the line number in source for expr
columnNo - (context info) the column number in source for expr
script - the script to execute
Throws:
BSFException - if anything goes wrong while running the script

getClassLoader

public java.lang.ClassLoader getClassLoader()
Get classLoader


getClassPath

public java.lang.String getClassPath()
Get classPath


getLangFromFilename

public static java.lang.String getLangFromFilename(java.lang.String fileName)
                                            throws BSFException
Determine the language of a script file by looking at the file extension.

Parameters:
fileName - the name of the file
Returns:
the scripting language the file is in if the file extension is known to me (must have been registered via registerScriptingEngine).
Throws:
BSFException - if file's extension is unknown.

getObjectRegistry

public ObjectRegistry getObjectRegistry()
Return the current object registry of the manager.

Returns:
the current registry.

getTempDir

public java.lang.String getTempDir()
Get tempDir


isLanguageRegistered

public static boolean isLanguageRegistered(java.lang.String lang)
Determine whether a language is registered.

Parameters:
lang - string identifying a language
Returns:
true iff it is

loadScriptingEngine

public BSFEngine loadScriptingEngine(java.lang.String lang)
                              throws BSFException
Load a scripting engine based on the lang string identifying it.

Parameters:
lang - string identifying language
Throws:
BSFException - if the language is unknown (i.e., if it has not been registered) with a reason of REASON_UNKNOWN_LANGUAGE. If the language is known but if the interface can't be created for some reason, then the reason is set to REASON_OTHER_ERROR and the actual exception is passed on as well.

lookupBean

public java.lang.Object lookupBean(java.lang.String beanName)
return a handle to a bean registered in the bean registry by the application or a scripting engine. Returns null if bean is not found.

Parameters:
beanName - name of bean to look up
Returns:
the bean if its found or null

registerBean

public void registerBean(java.lang.String beanName,
                         java.lang.Object bean)
Registering a bean allows a scripting engine or the application to access that bean by name and to manipulate it.

Parameters:
beanName - name to register under
bean - the bean to register

registerScriptingEngine

public static void registerScriptingEngine(java.lang.String lang,
                                           java.lang.String engineClassName,
                                           java.lang.String[] extensions)
Register a scripting engine in the static registry of the BSFManager.

Parameters:
lang - string identifying language
engineClassName - fully qualified name of the class interfacing the language to BSF.
extensions - array of file extensions that should be mapped to this language type. may be null.

setClassLoader

public void setClassLoader(java.lang.ClassLoader classLoader)
Set the class loader for those that need to use it. Default is he who loaded me or null (i.e., its Class.forName).

Parameters:
classLoader - the class loader to use.

setClassPath

public void setClassPath(java.lang.String classPath)
Set the classpath for those that need to use it. Default is the value of the java.class.path property.

Parameters:
classPath - the classpath to use

setObjectRegistry

public void setObjectRegistry(ObjectRegistry objectRegistry)
Set the object registry used by this manager. By default a new one is created when the manager is new'ed and this overwrites that one.

Parameters:
objectRegistry - the registry to use

setTempDir

public void setTempDir(java.lang.String tempDir)
Temporary directory to put stuff into (for those who need to). Note that unless this directory is in the classpath or unless the classloader knows to look in here, any classes here will not be found! BSFManager provides a service method to load a class which uses either the classLoader provided by the class loader property or, if that fails, a class loader which knows to load from the tempdir to try to load the class. Default value of tempDir is "." (current working dir).

Parameters:
tempDir - the temporary directory

terminate

public void terminate()
Gracefully terminate all engines


undeclareBean

public void undeclareBean(java.lang.String beanName)
                   throws BSFException
Undeclare a previously declared bean. This removes the bean from the list of declared beans in the manager as well as asks every running engine to undeclared the bean. As with above, if any of the engines except when asked to undeclare, this method does not catch that exception. Quietly returns if the bean is unknown.

Parameters:
beanName - name of bean to undeclare
Throws:
BSFException - if any of the languages that are already running decides to throw an exception when asked to undeclare this bean.

unregisterBean

public void unregisterBean(java.lang.String beanName)
Unregister a previously registered bean. Silent if name is not found.

Parameters:
beanName - name of bean to unregister


libbsf-java-2.4.0/docs/api/org/apache/bsf/package-use.html0000644000175000017500000004503010511475731022225 0ustar mkochmkoch Uses of Package org.apache.bsf (Bean Scripting Framework API)

Uses of Package
org.apache.bsf

Packages that use org.apache.bsf
org.apache.bsf   
org.apache.bsf.engines.jacl   
org.apache.bsf.engines.javascript   
org.apache.bsf.engines.jython   
org.apache.bsf.engines.netrexx   
org.apache.bsf.engines.xslt   
org.apache.bsf.util   
 

Classes in org.apache.bsf used by org.apache.bsf
BSFDeclaredBean
          BSFDeclaredBeans are used internally by BSF to encapsulate information being passed between a BSFManager and its various BSFEngines.
BSFEngine
          This is the view of a scripting engine assumed by the Bean Scripting Framework.
BSFException
          If something goes wrong while doing some scripting stuff, one of these is thrown.
BSFManager
          This class is the entry point to the bean scripting framework.
 

Classes in org.apache.bsf used by org.apache.bsf.engines.jacl
BSFDeclaredBean
          BSFDeclaredBeans are used internally by BSF to encapsulate information being passed between a BSFManager and its various BSFEngines.
BSFEngine
          This is the view of a scripting engine assumed by the Bean Scripting Framework.
BSFException
          If something goes wrong while doing some scripting stuff, one of these is thrown.
BSFManager
          This class is the entry point to the bean scripting framework.
 

Classes in org.apache.bsf used by org.apache.bsf.engines.javascript
BSFDeclaredBean
          BSFDeclaredBeans are used internally by BSF to encapsulate information being passed between a BSFManager and its various BSFEngines.
BSFEngine
          This is the view of a scripting engine assumed by the Bean Scripting Framework.
BSFException
          If something goes wrong while doing some scripting stuff, one of these is thrown.
BSFManager
          This class is the entry point to the bean scripting framework.
 

Classes in org.apache.bsf used by org.apache.bsf.engines.jython
BSFDeclaredBean
          BSFDeclaredBeans are used internally by BSF to encapsulate information being passed between a BSFManager and its various BSFEngines.
BSFEngine
          This is the view of a scripting engine assumed by the Bean Scripting Framework.
BSFException
          If something goes wrong while doing some scripting stuff, one of these is thrown.
BSFManager
          This class is the entry point to the bean scripting framework.
 

Classes in org.apache.bsf used by org.apache.bsf.engines.netrexx
BSFDeclaredBean
          BSFDeclaredBeans are used internally by BSF to encapsulate information being passed between a BSFManager and its various BSFEngines.
BSFEngine
          This is the view of a scripting engine assumed by the Bean Scripting Framework.
BSFException
          If something goes wrong while doing some scripting stuff, one of these is thrown.
BSFManager
          This class is the entry point to the bean scripting framework.
 

Classes in org.apache.bsf used by org.apache.bsf.engines.xslt
BSFDeclaredBean
          BSFDeclaredBeans are used internally by BSF to encapsulate information being passed between a BSFManager and its various BSFEngines.
BSFEngine
          This is the view of a scripting engine assumed by the Bean Scripting Framework.
BSFException
          If something goes wrong while doing some scripting stuff, one of these is thrown.
BSFManager
          This class is the entry point to the bean scripting framework.
 

Classes in org.apache.bsf used by org.apache.bsf.util
BSFDeclaredBean
          BSFDeclaredBeans are used internally by BSF to encapsulate information being passed between a BSFManager and its various BSFEngines.
BSFEngine
          This is the view of a scripting engine assumed by the Bean Scripting Framework.
BSFException
          If something goes wrong while doing some scripting stuff, one of these is thrown.
BSFManager
          This class is the entry point to the bean scripting framework.
 



libbsf-java-2.4.0/docs/api/org/apache/bsf/class-use/0000755000175000017500000000000010736513022021042 5ustar mkochmkochlibbsf-java-2.4.0/docs/api/org/apache/bsf/class-use/Main.html0000644000175000017500000001264010511475731022624 0ustar mkochmkoch Uses of Class org.apache.bsf.Main (Bean Scripting Framework API)

Uses of Class
org.apache.bsf.Main

No usage of org.apache.bsf.Main



libbsf-java-2.4.0/docs/api/org/apache/bsf/class-use/BSFException.html0000644000175000017500000015414310511475731024236 0ustar mkochmkoch Uses of Class org.apache.bsf.BSFException (Bean Scripting Framework API)

Uses of Class
org.apache.bsf.BSFException

Packages that use BSFException
org.apache.bsf   
org.apache.bsf.engines.jacl   
org.apache.bsf.engines.javascript   
org.apache.bsf.engines.jython   
org.apache.bsf.engines.netrexx   
org.apache.bsf.engines.xslt   
org.apache.bsf.util   
 

Uses of BSFException in org.apache.bsf
 

Methods in org.apache.bsf that throw BSFException
 java.lang.Object BSFEngine.apply(java.lang.String source, int lineNo, int columnNo, java.lang.Object funcBody, java.util.Vector paramNames, java.util.Vector arguments)
          This is used by an application to invoke an anonymous function.
 java.lang.Object BSFEngine.call(java.lang.Object object, java.lang.String name, java.lang.Object[] args)
          This is used by an application to call into the scripting engine to make a function/method call.
 void BSFEngine.compileApply(java.lang.String source, int lineNo, int columnNo, java.lang.Object funcBody, java.util.Vector paramNames, java.util.Vector arguments, CodeBuffer cb)
          This is used by an application to compile an anonymous function.
 void BSFEngine.compileExpr(java.lang.String source, int lineNo, int columnNo, java.lang.Object expr, CodeBuffer cb)
          This is used by an application to compile a value-returning expression.
 void BSFEngine.compileScript(java.lang.String source, int lineNo, int columnNo, java.lang.Object script, CodeBuffer cb)
          This is used by an application to compile some script.
 void BSFEngine.declareBean(BSFDeclaredBean bean)
          Declare a bean after the engine has been started.
 java.lang.Object BSFEngine.eval(java.lang.String source, int lineNo, int columnNo, java.lang.Object expr)
          This is used by an application to evaluate an expression.
 void BSFEngine.exec(java.lang.String source, int lineNo, int columnNo, java.lang.Object script)
          This is used by an application to execute some script.
 void BSFEngine.iexec(java.lang.String source, int lineNo, int columnNo, java.lang.Object script)
          This is used by an application to execute some script, as though one were interacting with the language in an interactive session.
 void BSFEngine.initialize(BSFManager mgr, java.lang.String lang, java.util.Vector declaredBeans)
          This method is used to initialize the engine right after construction.
 void BSFEngine.undeclareBean(BSFDeclaredBean bean)
          Undeclare a previously declared bean.
 java.lang.Object BSFManager.apply(java.lang.String lang, java.lang.String source, int lineNo, int columnNo, java.lang.Object funcBody, java.util.Vector paramNames, java.util.Vector arguments)
          Apply the given anonymous function of the given language to the given parameters and return the resulting value.
 void BSFManager.compileApply(java.lang.String lang, java.lang.String source, int lineNo, int columnNo, java.lang.Object funcBody, java.util.Vector paramNames, java.util.Vector arguments, CodeBuffer cb)
          Compile the application of the given anonymous function of the given language to the given parameters into the given CodeBuffer.
 void BSFManager.compileExpr(java.lang.String lang, java.lang.String source, int lineNo, int columnNo, java.lang.Object expr, CodeBuffer cb)
          Compile the given expression of the given language into the given CodeBuffer.
 void BSFManager.compileScript(java.lang.String lang, java.lang.String source, int lineNo, int columnNo, java.lang.Object script, CodeBuffer cb)
          Compile the given script of the given language into the given CodeBuffer.
 void BSFManager.declareBean(java.lang.String beanName, java.lang.Object bean, java.lang.Class type)
          Declare a bean.
 java.lang.Object BSFManager.eval(java.lang.String lang, java.lang.String source, int lineNo, int columnNo, java.lang.Object expr)
          Evaluate the given expression of the given language and return the resulting value.
 void BSFManager.exec(java.lang.String lang, java.lang.String source, int lineNo, int columnNo, java.lang.Object script)
          Execute the given script of the given language.
 void BSFManager.iexec(java.lang.String lang, java.lang.String source, int lineNo, int columnNo, java.lang.Object script)
          Execute the given script of the given language, attempting to emulate an interactive session w/ the language.
static java.lang.String BSFManager.getLangFromFilename(java.lang.String fileName)
          Determine the language of a script file by looking at the file extension.
 BSFEngine BSFManager.loadScriptingEngine(java.lang.String lang)
          Load a scripting engine based on the lang string identifying it.
 void BSFManager.undeclareBean(java.lang.String beanName)
          Undeclare a previously declared bean.
 

Uses of BSFException in org.apache.bsf.engines.jacl
 

Methods in org.apache.bsf.engines.jacl that throw BSFException
 java.lang.Object JaclEngine.call(java.lang.Object obj, java.lang.String method, java.lang.Object[] args)
           
 void JaclEngine.declareBean(BSFDeclaredBean bean)
          Declare a bean
 java.lang.Object JaclEngine.eval(java.lang.String source, int lineNo, int columnNo, java.lang.Object oscript)
          This is used by an application to evaluate a string containing some expression.
 void JaclEngine.initialize(BSFManager mgr, java.lang.String lang, java.util.Vector declaredBeans)
          Initialize the engine.
 void JaclEngine.undeclareBean(BSFDeclaredBean bean)
          Undeclare a previously declared bean.
 

Uses of BSFException in org.apache.bsf.engines.javascript
 

Methods in org.apache.bsf.engines.javascript that throw BSFException
 java.lang.Object JavaScriptEngine.call(java.lang.Object object, java.lang.String method, java.lang.Object[] args)
          Return an object from an extension.
 void JavaScriptEngine.declareBean(BSFDeclaredBean bean)
           
 java.lang.Object JavaScriptEngine.eval(java.lang.String source, int lineNo, int columnNo, java.lang.Object oscript)
          This is used by an application to evaluate a string containing some expression.
 void JavaScriptEngine.initialize(BSFManager mgr, java.lang.String lang, java.util.Vector declaredBeans)
          Initialize the engine.
 void JavaScriptEngine.undeclareBean(BSFDeclaredBean bean)
           
 

Uses of BSFException in org.apache.bsf.engines.jython
 

Methods in org.apache.bsf.engines.jython that throw BSFException
 java.lang.Object JythonEngine.call(java.lang.Object object, java.lang.String method, java.lang.Object[] args)
          call the named method of the given object.
 void JythonEngine.declareBean(BSFDeclaredBean bean)
          Declare a bean
 java.lang.Object JythonEngine.apply(java.lang.String source, int lineNo, int columnNo, java.lang.Object funcBody, java.util.Vector paramNames, java.util.Vector arguments)
          Evaluate an anonymous function (differs from eval() in that apply() handles multiple lines).
 java.lang.Object JythonEngine.eval(java.lang.String source, int lineNo, int columnNo, java.lang.Object script)
          Evaluate an expression.
 void JythonEngine.exec(java.lang.String source, int lineNo, int columnNo, java.lang.Object script)
          Execute a script.
 void JythonEngine.iexec(java.lang.String source, int lineNo, int columnNo, java.lang.Object script)
          Execute script code, emulating console interaction.
 void JythonEngine.initialize(BSFManager mgr, java.lang.String lang, java.util.Vector declaredBeans)
          Initialize the engine.
 void JythonEngine.undeclareBean(BSFDeclaredBean bean)
          Undeclare a previously declared bean.
 

Uses of BSFException in org.apache.bsf.engines.netrexx
 

Methods in org.apache.bsf.engines.netrexx that throw BSFException
 java.lang.Object NetRexxEngine.call(java.lang.Object object, java.lang.String method, java.lang.Object[] args)
          Return an object from an extension.
 void NetRexxEngine.declareBean(BSFDeclaredBean bean)
           
 java.lang.Object NetRexxEngine.eval(java.lang.String source, int lineNo, int columnNo, java.lang.Object script)
          Override impl of execute.
 void NetRexxEngine.exec(java.lang.String source, int lineNo, int columnNo, java.lang.Object script)
          Override impl of execute.
 java.lang.Object NetRexxEngine.execEvalShared(java.lang.String source, int lineNo, int columnNo, java.lang.Object oscript, boolean returnsObject)
          This is shared code for the exec() and eval() operations.
 void NetRexxEngine.initialize(BSFManager mgr, java.lang.String lang, java.util.Vector declaredBeans)
           
 void NetRexxEngine.undeclareBean(BSFDeclaredBean bean)
           
 

Uses of BSFException in org.apache.bsf.engines.xslt
 

Methods in org.apache.bsf.engines.xslt that throw BSFException
 java.lang.Object XSLTEngine.call(java.lang.Object object, java.lang.String method, java.lang.Object[] args)
          call the named method of the given object.
 void XSLTEngine.declareBean(BSFDeclaredBean bean)
          Declare a bean by setting it as a parameter
 java.lang.Object XSLTEngine.eval(java.lang.String source, int lineNo, int columnNo, java.lang.Object oscript)
          Evaluate an expression.
 void XSLTEngine.initialize(BSFManager mgr, java.lang.String lang, java.util.Vector declaredBeans)
          Initialize the engine.
 void XSLTEngine.undeclareBean(BSFDeclaredBean bean)
          Undeclare a bean by setting he parameter represeting it to null
 

Uses of BSFException in org.apache.bsf.util
 

Methods in org.apache.bsf.util that throw BSFException
 java.lang.Object BSFEngineImpl.apply(java.lang.String source, int lineNo, int columnNo, java.lang.Object funcBody, java.util.Vector paramNames, java.util.Vector arguments)
          Default impl of apply - calls eval ignoring parameters and returns the result.
 void BSFEngineImpl.compileApply(java.lang.String source, int lineNo, int columnNo, java.lang.Object funcBody, java.util.Vector paramNames, java.util.Vector arguments, CodeBuffer cb)
          Default impl of compileApply - calls compileExpr ignoring parameters.
 void BSFEngineImpl.compileExpr(java.lang.String source, int lineNo, int columnNo, java.lang.Object expr, CodeBuffer cb)
          Default impl of compileExpr - generates code that'll create a new manager, evaluate the expression, and return the value.
 void BSFEngineImpl.compileScript(java.lang.String source, int lineNo, int columnNo, java.lang.Object script, CodeBuffer cb)
          Default impl of compileScript - generates code that'll create a new manager, and execute the script.
 void BSFEngineImpl.declareBean(BSFDeclaredBean bean)
           
 void BSFEngineImpl.exec(java.lang.String source, int lineNo, int columnNo, java.lang.Object script)
          Default impl of execute - calls eval and ignores the result.
 void BSFEngineImpl.iexec(java.lang.String source, int lineNo, int columnNo, java.lang.Object script)
          Default impl of interactive execution - calls eval and ignores the result.
 void BSFEngineImpl.initialize(BSFManager mgr, java.lang.String lang, java.util.Vector declaredBeans)
          initialize the engine; called right after construction by the manager.
 void BSFEngineImpl.undeclareBean(BSFDeclaredBean bean)
           
 void BSFFunctions.addEventListener(java.lang.Object src, java.lang.String eventSetName, java.lang.String filter, java.lang.Object script)
           
static void EngineUtils.addEventListener(java.lang.Object bean, java.lang.String eventSetName, java.lang.String filter, BSFEngine engine, BSFManager manager, java.lang.String source, int lineNo, int columnNo, java.lang.Object script)
          Add a script as a listener to some event coming out of an object.
static void EngineUtils.addEventListenerReturningEventInfos(java.lang.Object bean, java.lang.String eventSetName, java.lang.String filter, BSFEngine engine, BSFManager manager, java.lang.String source, int lineNo, int columnNo, java.lang.Object script, java.lang.Object dataFromScriptingEngine)
          Add a script as a listener to some event coming out of an object.
static java.lang.Object EngineUtils.callBeanMethod(java.lang.Object bean, java.lang.String methodName, java.lang.Object[] args)
          Finds and invokes a method with the given signature on the given bean.
static java.lang.Object EngineUtils.createBean(java.lang.String className, java.lang.Object[] args)
          Creates a new bean.
static java.lang.Class EngineUtils.loadClass(BSFManager mgr, java.lang.String name)
          Load a class using the class loader of given manager.
 



libbsf-java-2.4.0/docs/api/org/apache/bsf/class-use/BSFManager.html0000644000175000017500000005372310511475731023654 0ustar mkochmkoch Uses of Class org.apache.bsf.BSFManager (Bean Scripting Framework API)

Uses of Class
org.apache.bsf.BSFManager

Packages that use BSFManager
org.apache.bsf   
org.apache.bsf.engines.jacl   
org.apache.bsf.engines.javascript   
org.apache.bsf.engines.jython   
org.apache.bsf.engines.netrexx   
org.apache.bsf.engines.xslt   
org.apache.bsf.util   
 

Uses of BSFManager in org.apache.bsf
 

Methods in org.apache.bsf with parameters of type BSFManager
 void BSFEngine.initialize(BSFManager mgr, java.lang.String lang, java.util.Vector declaredBeans)
          This method is used to initialize the engine right after construction.
 

Uses of BSFManager in org.apache.bsf.engines.jacl
 

Methods in org.apache.bsf.engines.jacl with parameters of type BSFManager
 void JaclEngine.initialize(BSFManager mgr, java.lang.String lang, java.util.Vector declaredBeans)
          Initialize the engine.
 

Uses of BSFManager in org.apache.bsf.engines.javascript
 

Methods in org.apache.bsf.engines.javascript with parameters of type BSFManager
 void JavaScriptEngine.initialize(BSFManager mgr, java.lang.String lang, java.util.Vector declaredBeans)
          Initialize the engine.
 

Uses of BSFManager in org.apache.bsf.engines.jython
 

Methods in org.apache.bsf.engines.jython with parameters of type BSFManager
 void JythonEngine.initialize(BSFManager mgr, java.lang.String lang, java.util.Vector declaredBeans)
          Initialize the engine.
 

Uses of BSFManager in org.apache.bsf.engines.netrexx
 

Methods in org.apache.bsf.engines.netrexx with parameters of type BSFManager
 void NetRexxEngine.initialize(BSFManager mgr, java.lang.String lang, java.util.Vector declaredBeans)
           
 

Uses of BSFManager in org.apache.bsf.engines.xslt
 

Methods in org.apache.bsf.engines.xslt with parameters of type BSFManager
 void XSLTEngine.initialize(BSFManager mgr, java.lang.String lang, java.util.Vector declaredBeans)
          Initialize the engine.
 

Uses of BSFManager in org.apache.bsf.util
 

Fields in org.apache.bsf.util declared as BSFManager
protected  BSFManager BSFEngineImpl.mgr
           
 

Methods in org.apache.bsf.util with parameters of type BSFManager
 void BSFEngineImpl.initialize(BSFManager mgr, java.lang.String lang, java.util.Vector declaredBeans)
          initialize the engine; called right after construction by the manager.
static void EngineUtils.addEventListener(java.lang.Object bean, java.lang.String eventSetName, java.lang.String filter, BSFEngine engine, BSFManager manager, java.lang.String source, int lineNo, int columnNo, java.lang.Object script)
          Add a script as a listener to some event coming out of an object.
static void EngineUtils.addEventListenerReturningEventInfos(java.lang.Object bean, java.lang.String eventSetName, java.lang.String filter, BSFEngine engine, BSFManager manager, java.lang.String source, int lineNo, int columnNo, java.lang.Object script, java.lang.Object dataFromScriptingEngine)
          Add a script as a listener to some event coming out of an object.
static java.lang.Class EngineUtils.loadClass(BSFManager mgr, java.lang.String name)
          Load a class using the class loader of given manager.
 

Constructors in org.apache.bsf.util with parameters of type BSFManager
BSFFunctions(BSFManager mgr, BSFEngine engine)
           
 



libbsf-java-2.4.0/docs/api/org/apache/bsf/class-use/BSFEngine.html0000644000175000017500000004735310511475731023511 0ustar mkochmkoch Uses of Interface org.apache.bsf.BSFEngine (Bean Scripting Framework API)

Uses of Interface
org.apache.bsf.BSFEngine

Packages that use BSFEngine
org.apache.bsf   
org.apache.bsf.engines.jacl   
org.apache.bsf.engines.javascript   
org.apache.bsf.engines.jython   
org.apache.bsf.engines.netrexx   
org.apache.bsf.engines.xslt   
org.apache.bsf.util   
 

Uses of BSFEngine in org.apache.bsf
 

Methods in org.apache.bsf that return BSFEngine
 BSFEngine BSFManager.loadScriptingEngine(java.lang.String lang)
          Load a scripting engine based on the lang string identifying it.
 

Uses of BSFEngine in org.apache.bsf.engines.jacl
 

Classes in org.apache.bsf.engines.jacl that implement BSFEngine
 class JaclEngine
          This is the interface to Scriptics's Jacl (Tcl) from the Bean Scripting Framework.
 

Uses of BSFEngine in org.apache.bsf.engines.javascript
 

Classes in org.apache.bsf.engines.javascript that implement BSFEngine
 class JavaScriptEngine
          This is the interface to Netscape's Rhino (JavaScript) from the Bean Scripting Framework.
 

Uses of BSFEngine in org.apache.bsf.engines.jython
 

Classes in org.apache.bsf.engines.jython that implement BSFEngine
 class JythonEngine
          This is the interface to Jython (http://www.jython.org/) from BSF.
 

Uses of BSFEngine in org.apache.bsf.engines.netrexx
 

Classes in org.apache.bsf.engines.netrexx that implement BSFEngine
 class NetRexxEngine
          This is the interface to NetRexx from the Bean Scripting Framework.
 

Uses of BSFEngine in org.apache.bsf.engines.xslt
 

Classes in org.apache.bsf.engines.xslt that implement BSFEngine
 class XSLTEngine
          Xerces XSLT interface to BSF.
 

Uses of BSFEngine in org.apache.bsf.util
 

Classes in org.apache.bsf.util that implement BSFEngine
 class BSFEngineImpl
          This is a base implementation of the BSFEngine interface which engine implementations may choose to extend to get the basic methods of the interface implemented.
 

Methods in org.apache.bsf.util with parameters of type BSFEngine
static void EngineUtils.addEventListener(java.lang.Object bean, java.lang.String eventSetName, java.lang.String filter, BSFEngine engine, BSFManager manager, java.lang.String source, int lineNo, int columnNo, java.lang.Object script)
          Add a script as a listener to some event coming out of an object.
static void EngineUtils.addEventListenerReturningEventInfos(java.lang.Object bean, java.lang.String eventSetName, java.lang.String filter, BSFEngine engine, BSFManager manager, java.lang.String source, int lineNo, int columnNo, java.lang.Object script, java.lang.Object dataFromScriptingEngine)
          Add a script as a listener to some event coming out of an object.
 

Constructors in org.apache.bsf.util with parameters of type BSFEngine
BSFFunctions(BSFManager mgr, BSFEngine engine)
           
 



libbsf-java-2.4.0/docs/api/org/apache/bsf/class-use/BSFDeclaredBean.html0000644000175000017500000005027310511475731024570 0ustar mkochmkoch Uses of Class org.apache.bsf.BSFDeclaredBean (Bean Scripting Framework API)

Uses of Class
org.apache.bsf.BSFDeclaredBean

Packages that use BSFDeclaredBean
org.apache.bsf   
org.apache.bsf.engines.jacl   
org.apache.bsf.engines.javascript   
org.apache.bsf.engines.jython   
org.apache.bsf.engines.netrexx   
org.apache.bsf.engines.xslt   
org.apache.bsf.util   
 

Uses of BSFDeclaredBean in org.apache.bsf
 

Methods in org.apache.bsf with parameters of type BSFDeclaredBean
 void BSFEngine.declareBean(BSFDeclaredBean bean)
          Declare a bean after the engine has been started.
 void BSFEngine.undeclareBean(BSFDeclaredBean bean)
          Undeclare a previously declared bean.
 

Uses of BSFDeclaredBean in org.apache.bsf.engines.jacl
 

Methods in org.apache.bsf.engines.jacl with parameters of type BSFDeclaredBean
 void JaclEngine.declareBean(BSFDeclaredBean bean)
          Declare a bean
 void JaclEngine.undeclareBean(BSFDeclaredBean bean)
          Undeclare a previously declared bean.
 

Uses of BSFDeclaredBean in org.apache.bsf.engines.javascript
 

Methods in org.apache.bsf.engines.javascript with parameters of type BSFDeclaredBean
 void JavaScriptEngine.declareBean(BSFDeclaredBean bean)
           
 void JavaScriptEngine.undeclareBean(BSFDeclaredBean bean)
           
 

Uses of BSFDeclaredBean in org.apache.bsf.engines.jython
 

Methods in org.apache.bsf.engines.jython with parameters of type BSFDeclaredBean
 void JythonEngine.declareBean(BSFDeclaredBean bean)
          Declare a bean
 void JythonEngine.undeclareBean(BSFDeclaredBean bean)
          Undeclare a previously declared bean.
 

Uses of BSFDeclaredBean in org.apache.bsf.engines.netrexx
 

Methods in org.apache.bsf.engines.netrexx with parameters of type BSFDeclaredBean
 void NetRexxEngine.declareBean(BSFDeclaredBean bean)
           
 void NetRexxEngine.undeclareBean(BSFDeclaredBean bean)
           
 

Uses of BSFDeclaredBean in org.apache.bsf.engines.xslt
 

Methods in org.apache.bsf.engines.xslt with parameters of type BSFDeclaredBean
 void XSLTEngine.declareBean(BSFDeclaredBean bean)
          Declare a bean by setting it as a parameter
 void XSLTEngine.undeclareBean(BSFDeclaredBean bean)
          Undeclare a bean by setting he parameter represeting it to null
 

Uses of BSFDeclaredBean in org.apache.bsf.util
 

Methods in org.apache.bsf.util with parameters of type BSFDeclaredBean
 void BSFEngineImpl.declareBean(BSFDeclaredBean bean)
           
 void BSFEngineImpl.undeclareBean(BSFDeclaredBean bean)
           
 



libbsf-java-2.4.0/docs/api/org/apache/bsf/BSFEngine.html0000644000175000017500000007460610511475731021613 0ustar mkochmkoch BSFEngine (Bean Scripting Framework API)

org.apache.bsf
Interface BSFEngine

All Superinterfaces:
java.util.EventListener, java.beans.PropertyChangeListener
All Known Implementing Classes:
BSFEngineImpl

public interface BSFEngine
extends java.beans.PropertyChangeListener

This is the view of a scripting engine assumed by the Bean Scripting Framework. This interface is used when an application decides to run some script under application control. (This is the reverse of the more common situation, which is that of the scripting language calling into the application.)

When a scripting engine is first fired up, the initialize() method is called right after construction.

A scripting engine must provide two access points for applications to call into them: via function calls and via expression evaluation. It must also support loading scripts.

A scripting engine is a property change listener and will be notified when any of the relevant properties of the manager change. (See BSFManager to see which of its properties are bound.)

Author:
Sanjiva Weerawarana, Matthew J. Duftler

Method Summary
 java.lang.Object apply(java.lang.String source, int lineNo, int columnNo, java.lang.Object funcBody, java.util.Vector paramNames, java.util.Vector arguments)
          This is used by an application to invoke an anonymous function.
 java.lang.Object call(java.lang.Object object, java.lang.String name, java.lang.Object[] args)
          This is used by an application to call into the scripting engine to make a function/method call.
 void compileApply(java.lang.String source, int lineNo, int columnNo, java.lang.Object funcBody, java.util.Vector paramNames, java.util.Vector arguments, CodeBuffer cb)
          This is used by an application to compile an anonymous function.
 void compileExpr(java.lang.String source, int lineNo, int columnNo, java.lang.Object expr, CodeBuffer cb)
          This is used by an application to compile a value-returning expression.
 void compileScript(java.lang.String source, int lineNo, int columnNo, java.lang.Object script, CodeBuffer cb)
          This is used by an application to compile some script.
 void declareBean(BSFDeclaredBean bean)
          Declare a bean after the engine has been started.
 java.lang.Object eval(java.lang.String source, int lineNo, int columnNo, java.lang.Object expr)
          This is used by an application to evaluate an expression.
 void exec(java.lang.String source, int lineNo, int columnNo, java.lang.Object script)
          This is used by an application to execute some script.
 void iexec(java.lang.String source, int lineNo, int columnNo, java.lang.Object script)
          This is used by an application to execute some script, as though one were interacting with the language in an interactive session.
 void initialize(BSFManager mgr, java.lang.String lang, java.util.Vector declaredBeans)
          This method is used to initialize the engine right after construction.
 void terminate()
          Graceful termination
 void undeclareBean(BSFDeclaredBean bean)
          Undeclare a previously declared bean.
 
Methods inherited from interface java.beans.PropertyChangeListener
propertyChange
 

Method Detail

apply

public java.lang.Object apply(java.lang.String source,
                              int lineNo,
                              int columnNo,
                              java.lang.Object funcBody,
                              java.util.Vector paramNames,
                              java.util.Vector arguments)
                       throws BSFException
This is used by an application to invoke an anonymous function. An anonymous function is a multi-line script which when evaluated will produce a value. These are separated from expressions and scripts because the prior are spsed to be good 'ol expressions and scripts are not value returning. We allow anonymous functions to have parameters as well for completeness.

Parameters:
source - (context info) the source of this expression (e.g., filename)
lineNo - (context info) the line number in source for expr
columnNo - (context info) the column number in source for expr
funcBody - the multi-line, value returning script to evaluate
paramNames - the names of the parameters above assumes
arguments - values of the above parameters
Throws:
BSFException - if anything goes wrong while doin' it.

call

public java.lang.Object call(java.lang.Object object,
                             java.lang.String name,
                             java.lang.Object[] args)
                      throws BSFException
This is used by an application to call into the scripting engine to make a function/method call. The "object" argument is the object whose method is to be called, if that applies. For non-OO languages, this is typically ignored and should be given as null. For pretend-OO languages such as VB, this would be the (String) name of the object. The arguments are given in the args array.

Parameters:
object - object on which to make the call
name - name of the method / procedure to call
args - the arguments to be given to the procedure
Throws:
BSFException - if anything goes wrong while eval'ing a BSFException is thrown. The reason indicates the problem.

compileApply

public void compileApply(java.lang.String source,
                         int lineNo,
                         int columnNo,
                         java.lang.Object funcBody,
                         java.util.Vector paramNames,
                         java.util.Vector arguments,
                         CodeBuffer cb)
                  throws BSFException
This is used by an application to compile an anonymous function. See comments in apply for more hdetails.

Parameters:
source - (context info) the source of this expression (e.g., filename)
lineNo - (context info) the line number in source for expr
columnNo - (context info) the column number in source for expr
funcBody - the multi-line, value returning script to evaluate
paramNames - the names of the parameters above assumes
arguments - values of the above parameters
cb - the CodeBuffer to compile into
Throws:
BSFException - if anything goes wrong while doin' it.

compileExpr

public void compileExpr(java.lang.String source,
                        int lineNo,
                        int columnNo,
                        java.lang.Object expr,
                        CodeBuffer cb)
                 throws BSFException
This is used by an application to compile a value-returning expression. The expr may be string or some other type, depending on the language. The generated code is dumped into the CodeBuffer.

Parameters:
source - (context info) the source of this expression (e.g., filename)
lineNo - (context info) the line number in source for expr
columnNo - (context info) the column number in source for expr
expr - the expression to compile
cb - the CodeBuffer to compile into
Throws:
BSFException - if anything goes wrong while compiling a BSFException is thrown. The reason indicates the problem.

compileScript

public void compileScript(java.lang.String source,
                          int lineNo,
                          int columnNo,
                          java.lang.Object script,
                          CodeBuffer cb)
                   throws BSFException
This is used by an application to compile some script. The script may be string or some other type, depending on the language. The generated code is dumped into the CodeBuffer.

Parameters:
source - (context info) the source of this script (e.g., filename)
lineNo - (context info) the line number in source for script
columnNo - (context info) the column number in source for script
script - the script to compile
cb - the CodeBuffer to compile into
Throws:
BSFException - if anything goes wrong while compiling a BSFException is thrown. The reason indicates the problem.

declareBean

public void declareBean(BSFDeclaredBean bean)
                 throws BSFException
Declare a bean after the engine has been started. Declared beans are beans that are named and which the engine must make available to the scripts it runs in the most first class way possible.

Parameters:
bean - the bean to declare
Throws:
BSFException - if the engine cannot do this operation

eval

public java.lang.Object eval(java.lang.String source,
                             int lineNo,
                             int columnNo,
                             java.lang.Object expr)
                      throws BSFException
This is used by an application to evaluate an expression. The expression may be string or some other type, depending on the language. (For example, for BML it'll be an org.w3c.dom.Element object.)

Parameters:
source - (context info) the source of this expression (e.g., filename)
lineNo - (context info) the line number in source for expr
columnNo - (context info) the column number in source for expr
expr - the expression to evaluate
Throws:
BSFException - if anything goes wrong while eval'ing a BSFException is thrown. The reason indicates the problem.

exec

public void exec(java.lang.String source,
                 int lineNo,
                 int columnNo,
                 java.lang.Object script)
          throws BSFException
This is used by an application to execute some script. The expression may be string or some other type, depending on the language. Returns nothing but if something goes wrong it excepts (of course).

Parameters:
source - (context info) the source of this expression (e.g., filename)
lineNo - (context info) the line number in source for expr
columnNo - (context info) the column number in source for expr
script - the script to execute
Throws:
BSFException - if anything goes wrong while exec'ing a BSFException is thrown. The reason indicates the problem.

iexec

public void iexec(java.lang.String source,
                  int lineNo,
                  int columnNo,
                  java.lang.Object script)
           throws BSFException
This is used by an application to execute some script, as though one were interacting with the language in an interactive session. The expression may be string or some other type, depending on the language. Returns nothing but if something goes wrong it excepts (of course).

Parameters:
source - (context info) the source of this expression (e.g., filename)
lineNo - (context info) the line number in source for expr
columnNo - (context info) the column number in source for expr
script - the script to execute
Throws:
BSFException - if anything goes wrong while exec'ing a BSFException is thrown. The reason indicates the problem.

initialize

public void initialize(BSFManager mgr,
                       java.lang.String lang,
                       java.util.Vector declaredBeans)
                throws BSFException
This method is used to initialize the engine right after construction. This method will be called before any calls to eval or call. At this time the engine should capture the current values of interesting properties from the manager. In the future, any changes to those will be mirrored to me by the manager via a property change event.

Parameters:
mgr - The BSFManager that's hosting this engine.
lang - Language string which this engine is handling.
declaredBeans - Vector of BSFDeclaredObject containing beans that should be declared into the language runtime at init time as best as possible.
Throws:
BSFException - if anything goes wrong while init'ing a BSFException is thrown. The reason indicates the problem.

terminate

public void terminate()
Graceful termination


undeclareBean

public void undeclareBean(BSFDeclaredBean bean)
                   throws BSFException
Undeclare a previously declared bean.

Parameters:
bean - the bean to undeclare
Throws:
BSFException - if the engine cannot do this operation


libbsf-java-2.4.0/docs/api/org/apache/bsf/package-summary.html0000644000175000017500000001645010511475731023132 0ustar mkochmkoch org.apache.bsf (Bean Scripting Framework API)

Package org.apache.bsf

Interface Summary
BSFEngine This is the view of a scripting engine assumed by the Bean Scripting Framework.
 

Class Summary
BSFDeclaredBean BSFDeclaredBeans are used internally by BSF to encapsulate information being passed between a BSFManager and its various BSFEngines.
BSFManager This class is the entry point to the bean scripting framework.
Main This is the main driver for BSF to be run on the command line to eval/exec/compile scripts directly.
 

Exception Summary
BSFException If something goes wrong while doing some scripting stuff, one of these is thrown.
 



libbsf-java-2.4.0/docs/api/org/apache/bsf/engines/0000755000175000017500000000000010511475731020600 5ustar mkochmkochlibbsf-java-2.4.0/docs/api/org/apache/bsf/engines/netrexx/0000755000175000017500000000000010736513022022270 5ustar mkochmkochlibbsf-java-2.4.0/docs/api/org/apache/bsf/engines/netrexx/package-tree.html0000644000175000017500000001432310511475731025516 0ustar mkochmkoch org.apache.bsf.engines.netrexx Class Hierarchy (Bean Scripting Framework API)

Hierarchy For Package org.apache.bsf.engines.netrexx

Package Hierarchies:
All Packages

Class Hierarchy



libbsf-java-2.4.0/docs/api/org/apache/bsf/engines/netrexx/NetRexxEngine.html0000644000175000017500000006736010511475731025722 0ustar mkochmkoch NetRexxEngine (Bean Scripting Framework API)

org.apache.bsf.engines.netrexx
Class NetRexxEngine

java.lang.Object
  extended byorg.apache.bsf.util.BSFEngineImpl
      extended byorg.apache.bsf.engines.netrexx.NetRexxEngine
All Implemented Interfaces:
BSFEngine, java.util.EventListener, java.beans.PropertyChangeListener

public class NetRexxEngine
extends BSFEngineImpl

This is the interface to NetRexx from the Bean Scripting Framework.

The NetRexx code must be written script-style, without a "class" or "properties" section preceeding the executable code. The NetRexxEngine will generate a prefix for this code:

 
 class $$CLASSNAME$$;
 method BSFNetRexxEngineEntry(bsf=org.apache.bsf.BSFManager) public static;
 
 
$$CLASSNAME$$ will be replaced by a generated classname of the form BSFNetRexx*, and the bsf parameter can be used to retrieve application objects registered with the Bean Scripting Framework.

If you use the placeholder string $$CLASSNAME$$ elsewhere in your script -- including within text strings -- BSFNetRexxEngine will replace it with the generated name of the class before the NetRexx code is compiled.

If you need to use full NetRexx functionality, we recommend that your NetRexx script define and invoke a "minor class", with or without the "dependent" keyword as suits your needs. You'll have to use $$CLASSNAME$$ in naming the minor class, since the name of the main class is synthesized; for example, to create the minor class "bar" you'd write "class $$CLASSNAME$$.Bar".

Hazards:

Since NetRexx has to be _compiled_ to a Java classfile, invoking it involves a fair amount of computation to load and execute the compiler. We are currently making an attempt to manage that by caching the class after it has been loaded, but the indexing is fairly primitive; we hash against the script string to find the class for it.

Minor-class .class files are now being deleted after the major class loads. This coould potentially cause problems.

Author:
Joe Kesselman, Sanjiva Weerawarana

Field Summary
 
Fields inherited from class org.apache.bsf.util.BSFEngineImpl
classLoader, classPath, declaredBeans, lang, mgr, tempDir
 
Constructor Summary
NetRexxEngine()
          Constructor.
 
Method Summary
 java.lang.Object call(java.lang.Object object, java.lang.String method, java.lang.Object[] args)
          Return an object from an extension.
 void declareBean(BSFDeclaredBean bean)
          Declare a bean after the engine has been started.
 java.lang.Object eval(java.lang.String source, int lineNo, int columnNo, java.lang.Object script)
          Override impl of execute.
 void exec(java.lang.String source, int lineNo, int columnNo, java.lang.Object script)
          Override impl of execute.
 java.lang.Object execEvalShared(java.lang.String source, int lineNo, int columnNo, java.lang.Object oscript, boolean returnsObject)
          This is shared code for the exec() and eval() operations.
 void initialize(BSFManager mgr, java.lang.String lang, java.util.Vector declaredBeans)
          initialize the engine; called right after construction by the manager.
 void undeclareBean(BSFDeclaredBean bean)
          Undeclare a previously declared bean.
 
Methods inherited from class org.apache.bsf.util.BSFEngineImpl
apply, compileApply, compileExpr, compileScript, iexec, propertyChange, terminate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NetRexxEngine

public NetRexxEngine()
Constructor.

Method Detail

call

public java.lang.Object call(java.lang.Object object,
                             java.lang.String method,
                             java.lang.Object[] args)
                      throws BSFException
Return an object from an extension.

Parameters:
object - object from which to call our static method
method - The name of the method to call.
args - an array of arguments to be passed to the extension, which may be either Vectors of Nodes, or Strings.
Throws:
BSFException - if anything goes wrong while eval'ing a BSFException is thrown. The reason indicates the problem.

declareBean

public void declareBean(BSFDeclaredBean bean)
                 throws BSFException
Description copied from interface: BSFEngine
Declare a bean after the engine has been started. Declared beans are beans that are named and which the engine must make available to the scripts it runs in the most first class way possible.

Specified by:
declareBean in interface BSFEngine
Overrides:
declareBean in class BSFEngineImpl
Throws:
BSFException

eval

public java.lang.Object eval(java.lang.String source,
                             int lineNo,
                             int columnNo,
                             java.lang.Object script)
                      throws BSFException
Override impl of execute. In NetRexx, methods which do not wish to return a value should be invoked via exec, which will cause them to be generated without the "returns" clause. Those which wish to return a value should call eval instead. which will add "returns java.lang.Object" to the header. Note: It would be nice to have the "real" return type avaialable, so we could do something more type-safe than Object, and so we could return primitive types without having to enclose them in their object wrappers. BSF does not currently support that concept.

Parameters:
source - (context info) the source of this expression (e.g., filename)
lineNo - (context info) the line number in source for expr
columnNo - (context info) the column number in source for expr
script - the expression to evaluate
Throws:
BSFException - if anything goes wrong while eval'ing a BSFException is thrown. The reason indicates the problem.

exec

public void exec(java.lang.String source,
                 int lineNo,
                 int columnNo,
                 java.lang.Object script)
          throws BSFException
Override impl of execute. In NetRexx, methods which do not wish to return a value should be invoked via exec, which will cause them to be generated without the "returns" clause. Those which wish to return a value should call eval instead. which will add "returns java.lang.Object" to the header.

Specified by:
exec in interface BSFEngine
Overrides:
exec in class BSFEngineImpl
Throws:
BSFException

execEvalShared

public java.lang.Object execEvalShared(java.lang.String source,
                                       int lineNo,
                                       int columnNo,
                                       java.lang.Object oscript,
                                       boolean returnsObject)
                                throws BSFException
This is shared code for the exec() and eval() operations. It will evaluate a string containing a NetRexx method body -- which may be as simple as a single return statement. It should store the "bsf" handle where the script can get to it, for callback purposes.

Note that NetRexx compilation imposes serious overhead -- 11 seconds for the first compile, about 3 thereafter -- but in exchange you get Java-like speeds once the classes have been created (minus the cache lookup cost).

Nobody knows whether javac is threadsafe. I'm going to serialize access to the compilers to protect it.

Throws:
BSFException

initialize

public void initialize(BSFManager mgr,
                       java.lang.String lang,
                       java.util.Vector declaredBeans)
                throws BSFException
Description copied from class: BSFEngineImpl
initialize the engine; called right after construction by the manager. Declared beans are simply kept in a vector and that's it. Subclasses must do whatever they want with it.

Specified by:
initialize in interface BSFEngine
Overrides:
initialize in class BSFEngineImpl
Throws:
BSFException

undeclareBean

public void undeclareBean(BSFDeclaredBean bean)
                   throws BSFException
Description copied from interface: BSFEngine
Undeclare a previously declared bean.

Specified by:
undeclareBean in interface BSFEngine
Overrides:
undeclareBean in class BSFEngineImpl
Throws:
BSFException


libbsf-java-2.4.0/docs/api/org/apache/bsf/engines/netrexx/package-use.html0000644000175000017500000001247110511475731025355 0ustar mkochmkoch Uses of Package org.apache.bsf.engines.netrexx (Bean Scripting Framework API)

Uses of Package
org.apache.bsf.engines.netrexx

No usage of org.apache.bsf.engines.netrexx



libbsf-java-2.4.0/docs/api/org/apache/bsf/engines/netrexx/class-use/0000755000175000017500000000000010736513022024167 5ustar mkochmkochlibbsf-java-2.4.0/docs/api/org/apache/bsf/engines/netrexx/class-use/NetRexxEngine.html0000644000175000017500000001333210511475731027607 0ustar mkochmkoch Uses of Class org.apache.bsf.engines.netrexx.NetRexxEngine (Bean Scripting Framework API)

Uses of Class
org.apache.bsf.engines.netrexx.NetRexxEngine

No usage of org.apache.bsf.engines.netrexx.NetRexxEngine



libbsf-java-2.4.0/docs/api/org/apache/bsf/engines/netrexx/package-summary.html0000644000175000017500000001420610511475731026254 0ustar mkochmkoch org.apache.bsf.engines.netrexx (Bean Scripting Framework API)

Package org.apache.bsf.engines.netrexx

Class Summary
NetRexxEngine This is the interface to NetRexx from the Bean Scripting Framework.
 



libbsf-java-2.4.0/docs/api/org/apache/bsf/engines/netrexx/package-frame.html0000644000175000017500000000173110511475731025650 0ustar mkochmkoch org.apache.bsf.engines.netrexx (Bean Scripting Framework API) org.apache.bsf.engines.netrexx
Classes 
NetRexxEngine
libbsf-java-2.4.0/docs/api/org/apache/bsf/engines/jython/0000755000175000017500000000000010736513022022106 5ustar mkochmkochlibbsf-java-2.4.0/docs/api/org/apache/bsf/engines/jython/package-tree.html0000644000175000017500000001433110511475731025333 0ustar mkochmkoch org.apache.bsf.engines.jython Class Hierarchy (Bean Scripting Framework API)

Hierarchy For Package org.apache.bsf.engines.jython

Package Hierarchies:
All Packages

Class Hierarchy



libbsf-java-2.4.0/docs/api/org/apache/bsf/engines/jython/package-use.html0000644000175000017500000001246510511475731025176 0ustar mkochmkoch Uses of Package org.apache.bsf.engines.jython (Bean Scripting Framework API)

Uses of Package
org.apache.bsf.engines.jython

No usage of org.apache.bsf.engines.jython



libbsf-java-2.4.0/docs/api/org/apache/bsf/engines/jython/class-use/0000755000175000017500000000000010736513022024005 5ustar mkochmkochlibbsf-java-2.4.0/docs/api/org/apache/bsf/engines/jython/class-use/JythonEngine.html0000644000175000017500000001331210511475731027301 0ustar mkochmkoch Uses of Class org.apache.bsf.engines.jython.JythonEngine (Bean Scripting Framework API)

Uses of Class
org.apache.bsf.engines.jython.JythonEngine

No usage of org.apache.bsf.engines.jython.JythonEngine



libbsf-java-2.4.0/docs/api/org/apache/bsf/engines/jython/package-summary.html0000644000175000017500000001421210511475731026067 0ustar mkochmkoch org.apache.bsf.engines.jython (Bean Scripting Framework API)

Package org.apache.bsf.engines.jython

Class Summary
JythonEngine This is the interface to Jython (http://www.jython.org/) from BSF.
 



libbsf-java-2.4.0/docs/api/org/apache/bsf/engines/jython/package-frame.html0000644000175000017500000000172210511475731025466 0ustar mkochmkoch org.apache.bsf.engines.jython (Bean Scripting Framework API) org.apache.bsf.engines.jython
Classes 
JythonEngine
libbsf-java-2.4.0/docs/api/org/apache/bsf/engines/jython/JythonEngine.html0000644000175000017500000006522610511475731025415 0ustar mkochmkoch JythonEngine (Bean Scripting Framework API)

org.apache.bsf.engines.jython
Class JythonEngine

java.lang.Object
  extended byorg.apache.bsf.util.BSFEngineImpl
      extended byorg.apache.bsf.engines.jython.JythonEngine
All Implemented Interfaces:
BSFEngine, java.util.EventListener, java.beans.PropertyChangeListener

public class JythonEngine
extends BSFEngineImpl

This is the interface to Jython (http://www.jython.org/) from BSF. It's derived from the JPython 1.x engine

Author:
Sanjiva Weerawarana, Finn Bock , Chuck Murcko

Field Summary
 
Fields inherited from class org.apache.bsf.util.BSFEngineImpl
classLoader, classPath, declaredBeans, lang, mgr, tempDir
 
Constructor Summary
JythonEngine()
           
 
Method Summary
 java.lang.Object apply(java.lang.String source, int lineNo, int columnNo, java.lang.Object funcBody, java.util.Vector paramNames, java.util.Vector arguments)
          Evaluate an anonymous function (differs from eval() in that apply() handles multiple lines).
 java.lang.Object call(java.lang.Object object, java.lang.String method, java.lang.Object[] args)
          call the named method of the given object.
 void declareBean(BSFDeclaredBean bean)
          Declare a bean
 java.lang.Object eval(java.lang.String source, int lineNo, int columnNo, java.lang.Object script)
          Evaluate an expression.
 void exec(java.lang.String source, int lineNo, int columnNo, java.lang.Object script)
          Execute a script.
 void iexec(java.lang.String source, int lineNo, int columnNo, java.lang.Object script)
          Execute script code, emulating console interaction.
 void initialize(BSFManager mgr, java.lang.String lang, java.util.Vector declaredBeans)
          Initialize the engine.
 void undeclareBean(BSFDeclaredBean bean)
          Undeclare a previously declared bean.
 java.lang.Object unwrap(PyObject result)
           
 
Methods inherited from class org.apache.bsf.util.BSFEngineImpl
compileApply, compileExpr, compileScript, propertyChange, terminate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JythonEngine

public JythonEngine()
Method Detail

call

public java.lang.Object call(java.lang.Object object,
                             java.lang.String method,
                             java.lang.Object[] args)
                      throws BSFException
call the named method of the given object.

Parameters:
object - object on which to make the call
method - name of the method / procedure to call
args - the arguments to be given to the procedure
Throws:
BSFException - if anything goes wrong while eval'ing a BSFException is thrown. The reason indicates the problem.

declareBean

public void declareBean(BSFDeclaredBean bean)
                 throws BSFException
Declare a bean

Specified by:
declareBean in interface BSFEngine
Overrides:
declareBean in class BSFEngineImpl
Throws:
BSFException

apply

public java.lang.Object apply(java.lang.String source,
                              int lineNo,
                              int columnNo,
                              java.lang.Object funcBody,
                              java.util.Vector paramNames,
                              java.util.Vector arguments)
                       throws BSFException
Evaluate an anonymous function (differs from eval() in that apply() handles multiple lines).

Specified by:
apply in interface BSFEngine
Overrides:
apply in class BSFEngineImpl
Throws:
BSFException

eval

public java.lang.Object eval(java.lang.String source,
                             int lineNo,
                             int columnNo,
                             java.lang.Object script)
                      throws BSFException
Evaluate an expression.

Parameters:
source - (context info) the source of this expression (e.g., filename)
lineNo - (context info) the line number in source for expr
columnNo - (context info) the column number in source for expr
script - the expression to evaluate
Throws:
BSFException - if anything goes wrong while eval'ing a BSFException is thrown. The reason indicates the problem.

exec

public void exec(java.lang.String source,
                 int lineNo,
                 int columnNo,
                 java.lang.Object script)
          throws BSFException
Execute a script.

Specified by:
exec in interface BSFEngine
Overrides:
exec in class BSFEngineImpl
Throws:
BSFException

iexec

public void iexec(java.lang.String source,
                  int lineNo,
                  int columnNo,
                  java.lang.Object script)
           throws BSFException
Execute script code, emulating console interaction.

Specified by:
iexec in interface BSFEngine
Overrides:
iexec in class BSFEngineImpl
Throws:
BSFException

initialize

public void initialize(BSFManager mgr,
                       java.lang.String lang,
                       java.util.Vector declaredBeans)
                throws BSFException
Initialize the engine.

Specified by:
initialize in interface BSFEngine
Overrides:
initialize in class BSFEngineImpl
Throws:
BSFException

undeclareBean

public void undeclareBean(BSFDeclaredBean bean)
                   throws BSFException
Undeclare a previously declared bean.

Specified by:
undeclareBean in interface BSFEngine
Overrides:
undeclareBean in class BSFEngineImpl
Throws:
BSFException

unwrap

public java.lang.Object unwrap(PyObject result)


libbsf-java-2.4.0/docs/api/org/apache/bsf/engines/jacl/0000755000175000017500000000000010736513022021504 5ustar mkochmkochlibbsf-java-2.4.0/docs/api/org/apache/bsf/engines/jacl/package-tree.html0000644000175000017500000001425110511475731024732 0ustar mkochmkoch org.apache.bsf.engines.jacl Class Hierarchy (Bean Scripting Framework API)

Hierarchy For Package org.apache.bsf.engines.jacl

Package Hierarchies:
All Packages

Class Hierarchy



libbsf-java-2.4.0/docs/api/org/apache/bsf/engines/jacl/package-use.html0000644000175000017500000001245510511475731024573 0ustar mkochmkoch Uses of Package org.apache.bsf.engines.jacl (Bean Scripting Framework API)

Uses of Package
org.apache.bsf.engines.jacl

No usage of org.apache.bsf.engines.jacl



libbsf-java-2.4.0/docs/api/org/apache/bsf/engines/jacl/class-use/0000755000175000017500000000000010736513022023403 5ustar mkochmkochlibbsf-java-2.4.0/docs/api/org/apache/bsf/engines/jacl/class-use/JaclEngine.html0000644000175000017500000001325210511475731026300 0ustar mkochmkoch Uses of Class org.apache.bsf.engines.jacl.JaclEngine (Bean Scripting Framework API)

Uses of Class
org.apache.bsf.engines.jacl.JaclEngine

No usage of org.apache.bsf.engines.jacl.JaclEngine



libbsf-java-2.4.0/docs/api/org/apache/bsf/engines/jacl/package-summary.html0000644000175000017500000001415310511475731025471 0ustar mkochmkoch org.apache.bsf.engines.jacl (Bean Scripting Framework API)

Package org.apache.bsf.engines.jacl

Class Summary
JaclEngine This is the interface to Scriptics's Jacl (Tcl) from the Bean Scripting Framework.
 



libbsf-java-2.4.0/docs/api/org/apache/bsf/engines/jacl/JaclEngine.html0000644000175000017500000005266610511475731024415 0ustar mkochmkoch JaclEngine (Bean Scripting Framework API)

org.apache.bsf.engines.jacl
Class JaclEngine

java.lang.Object
  extended byorg.apache.bsf.util.BSFEngineImpl
      extended byorg.apache.bsf.engines.jacl.JaclEngine
All Implemented Interfaces:
BSFEngine, java.util.EventListener, java.beans.PropertyChangeListener

public class JaclEngine
extends BSFEngineImpl

This is the interface to Scriptics's Jacl (Tcl) from the Bean Scripting Framework.

Author:
Sanjiva Weerawarana

Field Summary
 
Fields inherited from class org.apache.bsf.util.BSFEngineImpl
classLoader, classPath, declaredBeans, lang, mgr, tempDir
 
Constructor Summary
JaclEngine()
           
 
Method Summary
 java.lang.Object call(java.lang.Object obj, java.lang.String method, java.lang.Object[] args)
          This is used by an application to call into the scripting engine to make a function/method call.
 void declareBean(BSFDeclaredBean bean)
          Declare a bean
 java.lang.Object eval(java.lang.String source, int lineNo, int columnNo, java.lang.Object oscript)
          This is used by an application to evaluate a string containing some expression.
 void initialize(BSFManager mgr, java.lang.String lang, java.util.Vector declaredBeans)
          Initialize the engine.
 void undeclareBean(BSFDeclaredBean bean)
          Undeclare a previously declared bean.
 
Methods inherited from class org.apache.bsf.util.BSFEngineImpl
apply, compileApply, compileExpr, compileScript, exec, iexec, propertyChange, terminate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JaclEngine

public JaclEngine()
Method Detail

call

public java.lang.Object call(java.lang.Object obj,
                             java.lang.String method,
                             java.lang.Object[] args)
                      throws BSFException
Description copied from interface: BSFEngine
This is used by an application to call into the scripting engine to make a function/method call. The "object" argument is the object whose method is to be called, if that applies. For non-OO languages, this is typically ignored and should be given as null. For pretend-OO languages such as VB, this would be the (String) name of the object. The arguments are given in the args array.

Parameters:
method - The name of the method to call.
args - an array of arguments to be passed to the extension, which may be either Vectors of Nodes, or Strings.
obj - object on which to make the call
Throws:
BSFException - if anything goes wrong while eval'ing a BSFException is thrown. The reason indicates the problem.

declareBean

public void declareBean(BSFDeclaredBean bean)
                 throws BSFException
Declare a bean

Specified by:
declareBean in interface BSFEngine
Overrides:
declareBean in class BSFEngineImpl
Throws:
BSFException

eval

public java.lang.Object eval(java.lang.String source,
                             int lineNo,
                             int columnNo,
                             java.lang.Object oscript)
                      throws BSFException
This is used by an application to evaluate a string containing some expression.

Parameters:
source - (context info) the source of this expression (e.g., filename)
lineNo - (context info) the line number in source for expr
columnNo - (context info) the column number in source for expr
oscript - the expression to evaluate
Throws:
BSFException - if anything goes wrong while eval'ing a BSFException is thrown. The reason indicates the problem.

initialize

public void initialize(BSFManager mgr,
                       java.lang.String lang,
                       java.util.Vector declaredBeans)
                throws BSFException
Initialize the engine.

Specified by:
initialize in interface BSFEngine
Overrides:
initialize in class BSFEngineImpl
Throws:
BSFException

undeclareBean

public void undeclareBean(BSFDeclaredBean bean)
                   throws BSFException
Undeclare a previously declared bean.

Specified by:
undeclareBean in interface BSFEngine
Overrides:
undeclareBean in class BSFEngineImpl
Throws:
BSFException


libbsf-java-2.4.0/docs/api/org/apache/bsf/engines/jacl/package-frame.html0000644000175000017500000000170410511475731025064 0ustar mkochmkoch org.apache.bsf.engines.jacl (Bean Scripting Framework API) org.apache.bsf.engines.jacl
Classes 
JaclEngine
libbsf-java-2.4.0/docs/api/org/apache/bsf/engines/xslt/0000755000175000017500000000000010736513022021565 5ustar mkochmkochlibbsf-java-2.4.0/docs/api/org/apache/bsf/engines/xslt/package-tree.html0000644000175000017500000001456010511475731025016 0ustar mkochmkoch org.apache.bsf.engines.xslt Class Hierarchy (Bean Scripting Framework API)

Hierarchy For Package org.apache.bsf.engines.xslt

Package Hierarchies:
All Packages

Class Hierarchy



libbsf-java-2.4.0/docs/api/org/apache/bsf/engines/xslt/XSLTResultNode.html0000644000175000017500000002272210511475731025264 0ustar mkochmkoch XSLTResultNode (Bean Scripting Framework API)

org.apache.bsf.engines.xslt
Class XSLTResultNode

java.lang.Object
  extended byorg.apache.bsf.engines.xslt.XSLTResultNode

public class XSLTResultNode
extends java.lang.Object


Constructor Summary
XSLTResultNode(org.w3c.dom.Node node)
           
 
Method Summary
 org.w3c.dom.Node getNode()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XSLTResultNode

public XSLTResultNode(org.w3c.dom.Node node)
Method Detail

getNode

public org.w3c.dom.Node getNode()


libbsf-java-2.4.0/docs/api/org/apache/bsf/engines/xslt/XSLTEngine.html0000644000175000017500000005254610511475731024414 0ustar mkochmkoch XSLTEngine (Bean Scripting Framework API)

org.apache.bsf.engines.xslt
Class XSLTEngine

java.lang.Object
  extended byorg.apache.bsf.util.BSFEngineImpl
      extended byorg.apache.bsf.engines.xslt.XSLTEngine
All Implemented Interfaces:
BSFEngine, java.util.EventListener, java.beans.PropertyChangeListener

public class XSLTEngine
extends BSFEngineImpl

Xerces XSLT interface to BSF. Requires Xalan and Xerces from Apache. This integration uses the BSF registry to pass in any src document and stylesheet base URI that the user may wish to set.

Author:
Sanjiva Weerawarana, Sam Ruby Re-implemented for the Xalan 2 codebase, Victor J. Orlikowski

Field Summary
 
Fields inherited from class org.apache.bsf.util.BSFEngineImpl
classLoader, classPath, declaredBeans, lang, mgr, tempDir
 
Constructor Summary
XSLTEngine()
           
 
Method Summary
 java.lang.Object call(java.lang.Object object, java.lang.String method, java.lang.Object[] args)
          call the named method of the given object.
 void declareBean(BSFDeclaredBean bean)
          Declare a bean by setting it as a parameter
 java.lang.Object eval(java.lang.String source, int lineNo, int columnNo, java.lang.Object oscript)
          Evaluate an expression.
 void initialize(BSFManager mgr, java.lang.String lang, java.util.Vector declaredBeans)
          Initialize the engine.
 void undeclareBean(BSFDeclaredBean bean)
          Undeclare a bean by setting he parameter represeting it to null
 
Methods inherited from class org.apache.bsf.util.BSFEngineImpl
apply, compileApply, compileExpr, compileScript, exec, iexec, propertyChange, terminate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XSLTEngine

public XSLTEngine()
Method Detail

call

public java.lang.Object call(java.lang.Object object,
                             java.lang.String method,
                             java.lang.Object[] args)
                      throws BSFException
call the named method of the given object.

Parameters:
object - object on which to make the call
method - name of the method / procedure to call
args - the arguments to be given to the procedure
Throws:
BSFException - if anything goes wrong while eval'ing a BSFException is thrown. The reason indicates the problem.

declareBean

public void declareBean(BSFDeclaredBean bean)
                 throws BSFException
Declare a bean by setting it as a parameter

Specified by:
declareBean in interface BSFEngine
Overrides:
declareBean in class BSFEngineImpl
Throws:
BSFException

eval

public java.lang.Object eval(java.lang.String source,
                             int lineNo,
                             int columnNo,
                             java.lang.Object oscript)
                      throws BSFException
Evaluate an expression. In this case, an expression is assumed to be a stylesheet of the template style (see the XSLT spec).

Parameters:
source - (context info) the source of this expression (e.g., filename)
lineNo - (context info) the line number in source for expr
columnNo - (context info) the column number in source for expr
oscript - the expression to evaluate
Throws:
BSFException - if anything goes wrong while eval'ing a BSFException is thrown. The reason indicates the problem.

initialize

public void initialize(BSFManager mgr,
                       java.lang.String lang,
                       java.util.Vector declaredBeans)
                throws BSFException
Initialize the engine.

Specified by:
initialize in interface BSFEngine
Overrides:
initialize in class BSFEngineImpl
Throws:
BSFException

undeclareBean

public void undeclareBean(BSFDeclaredBean bean)
                   throws BSFException
Undeclare a bean by setting he parameter represeting it to null

Specified by:
undeclareBean in interface BSFEngine
Overrides:
undeclareBean in class BSFEngineImpl
Throws:
BSFException


libbsf-java-2.4.0/docs/api/org/apache/bsf/engines/xslt/package-use.html0000644000175000017500000001245510511475731024654 0ustar mkochmkoch Uses of Package org.apache.bsf.engines.xslt (Bean Scripting Framework API)

Uses of Package
org.apache.bsf.engines.xslt

No usage of org.apache.bsf.engines.xslt



libbsf-java-2.4.0/docs/api/org/apache/bsf/engines/xslt/class-use/0000755000175000017500000000000010736513022023464 5ustar mkochmkochlibbsf-java-2.4.0/docs/api/org/apache/bsf/engines/xslt/class-use/XSLTResultNode.html0000644000175000017500000001331210511475731027156 0ustar mkochmkoch Uses of Class org.apache.bsf.engines.xslt.XSLTResultNode (Bean Scripting Framework API)

Uses of Class
org.apache.bsf.engines.xslt.XSLTResultNode

No usage of org.apache.bsf.engines.xslt.XSLTResultNode



libbsf-java-2.4.0/docs/api/org/apache/bsf/engines/xslt/class-use/XSLTEngine.html0000644000175000017500000001325210511475731026302 0ustar mkochmkoch Uses of Class org.apache.bsf.engines.xslt.XSLTEngine (Bean Scripting Framework API)

Uses of Class
org.apache.bsf.engines.xslt.XSLTEngine

No usage of org.apache.bsf.engines.xslt.XSLTEngine



libbsf-java-2.4.0/docs/api/org/apache/bsf/engines/xslt/package-summary.html0000644000175000017500000001443710511475731025557 0ustar mkochmkoch org.apache.bsf.engines.xslt (Bean Scripting Framework API)

Package org.apache.bsf.engines.xslt

Class Summary
XSLTEngine Xerces XSLT interface to BSF.
XSLTResultNode  
 



libbsf-java-2.4.0/docs/api/org/apache/bsf/engines/xslt/package-frame.html0000644000175000017500000000207310511475731025145 0ustar mkochmkoch org.apache.bsf.engines.xslt (Bean Scripting Framework API) org.apache.bsf.engines.xslt
Classes 
XSLTEngine
XSLTResultNode
libbsf-java-2.4.0/docs/api/org/apache/bsf/engines/javascript/0000755000175000017500000000000010736513022022741 5ustar mkochmkochlibbsf-java-2.4.0/docs/api/org/apache/bsf/engines/javascript/package-tree.html0000644000175000017500000001435310511475731026172 0ustar mkochmkoch org.apache.bsf.engines.javascript Class Hierarchy (Bean Scripting Framework API)

Hierarchy For Package org.apache.bsf.engines.javascript

Package Hierarchies:
All Packages

Class Hierarchy



libbsf-java-2.4.0/docs/api/org/apache/bsf/engines/javascript/JavaScriptEngine.html0000644000175000017500000005355510511475731027045 0ustar mkochmkoch JavaScriptEngine (Bean Scripting Framework API)

org.apache.bsf.engines.javascript
Class JavaScriptEngine

java.lang.Object
  extended byorg.apache.bsf.util.BSFEngineImpl
      extended byorg.apache.bsf.engines.javascript.JavaScriptEngine
All Implemented Interfaces:
BSFEngine, java.util.EventListener, java.beans.PropertyChangeListener

public class JavaScriptEngine
extends BSFEngineImpl

This is the interface to Netscape's Rhino (JavaScript) from the Bean Scripting Framework.

The original version of this code was first written by Adam Peller for use in LotusXSL. Sanjiva took his code and adapted it for BSF.

Author:
Adam Peller , Sanjiva Weerawarana, Matthew J. Duftler, Norris Boyd

Field Summary
 
Fields inherited from class org.apache.bsf.util.BSFEngineImpl
classLoader, classPath, declaredBeans, lang, mgr, tempDir
 
Constructor Summary
JavaScriptEngine()
           
 
Method Summary
 java.lang.Object call(java.lang.Object object, java.lang.String method, java.lang.Object[] args)
          Return an object from an extension.
 void declareBean(BSFDeclaredBean bean)
          Declare a bean after the engine has been started.
 java.lang.Object eval(java.lang.String source, int lineNo, int columnNo, java.lang.Object oscript)
          This is used by an application to evaluate a string containing some expression.
 void initialize(BSFManager mgr, java.lang.String lang, java.util.Vector declaredBeans)
          Initialize the engine.
 void undeclareBean(BSFDeclaredBean bean)
          Undeclare a previously declared bean.
 
Methods inherited from class org.apache.bsf.util.BSFEngineImpl
apply, compileApply, compileExpr, compileScript, exec, iexec, propertyChange, terminate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JavaScriptEngine

public JavaScriptEngine()
Method Detail

call

public java.lang.Object call(java.lang.Object object,
                             java.lang.String method,
                             java.lang.Object[] args)
                      throws BSFException
Return an object from an extension.

Parameters:
object - Object on which to make the call (ignored).
method - The name of the method to call.
args - an array of arguments to be passed to the extension, which may be either Vectors of Nodes, or Strings.
Throws:
BSFException - if anything goes wrong while eval'ing a BSFException is thrown. The reason indicates the problem.

declareBean

public void declareBean(BSFDeclaredBean bean)
                 throws BSFException
Description copied from interface: BSFEngine
Declare a bean after the engine has been started. Declared beans are beans that are named and which the engine must make available to the scripts it runs in the most first class way possible.

Specified by:
declareBean in interface BSFEngine
Overrides:
declareBean in class BSFEngineImpl
Throws:
BSFException

eval

public java.lang.Object eval(java.lang.String source,
                             int lineNo,
                             int columnNo,
                             java.lang.Object oscript)
                      throws BSFException
This is used by an application to evaluate a string containing some expression.

Parameters:
source - (context info) the source of this expression (e.g., filename)
lineNo - (context info) the line number in source for expr
columnNo - (context info) the column number in source for expr
oscript - the expression to evaluate
Throws:
BSFException - if anything goes wrong while eval'ing a BSFException is thrown. The reason indicates the problem.

initialize

public void initialize(BSFManager mgr,
                       java.lang.String lang,
                       java.util.Vector declaredBeans)
                throws BSFException
Initialize the engine. Put the manager into the context-manager map hashtable too.

Specified by:
initialize in interface BSFEngine
Overrides:
initialize in class BSFEngineImpl
Throws:
BSFException

undeclareBean

public void undeclareBean(BSFDeclaredBean bean)
                   throws BSFException
Description copied from interface: BSFEngine
Undeclare a previously declared bean.

Specified by:
undeclareBean in interface BSFEngine
Overrides:
undeclareBean in class BSFEngineImpl
Throws:
BSFException


libbsf-java-2.4.0/docs/api/org/apache/bsf/engines/javascript/package-use.html0000644000175000017500000001250510511475731026024 0ustar mkochmkoch Uses of Package org.apache.bsf.engines.javascript (Bean Scripting Framework API)

Uses of Package
org.apache.bsf.engines.javascript

No usage of org.apache.bsf.engines.javascript



libbsf-java-2.4.0/docs/api/org/apache/bsf/engines/javascript/class-use/0000755000175000017500000000000010736513022024640 5ustar mkochmkochlibbsf-java-2.4.0/docs/api/org/apache/bsf/engines/javascript/class-use/JavaScriptEngine.html0000644000175000017500000001341210511475731030730 0ustar mkochmkoch Uses of Class org.apache.bsf.engines.javascript.JavaScriptEngine (Bean Scripting Framework API)

Uses of Class
org.apache.bsf.engines.javascript.JavaScriptEngine

No usage of org.apache.bsf.engines.javascript.JavaScriptEngine



libbsf-java-2.4.0/docs/api/org/apache/bsf/engines/javascript/package-summary.html0000644000175000017500000001426410511475731026731 0ustar mkochmkoch org.apache.bsf.engines.javascript (Bean Scripting Framework API)

Package org.apache.bsf.engines.javascript

Class Summary
JavaScriptEngine This is the interface to Netscape's Rhino (JavaScript) from the Bean Scripting Framework.
 



libbsf-java-2.4.0/docs/api/org/apache/bsf/engines/javascript/package-frame.html0000644000175000017500000000175610511475731026330 0ustar mkochmkoch org.apache.bsf.engines.javascript (Bean Scripting Framework API) org.apache.bsf.engines.javascript
Classes 
JavaScriptEngine
libbsf-java-2.4.0/docs/api/org/apache/bsf/BSFDeclaredBean.html0000644000175000017500000002265510511475731022674 0ustar mkochmkoch BSFDeclaredBean (Bean Scripting Framework API)

org.apache.bsf
Class BSFDeclaredBean

java.lang.Object
  extended byorg.apache.bsf.BSFDeclaredBean

public class BSFDeclaredBean
extends java.lang.Object

BSFDeclaredBeans are used internally by BSF to encapsulate information being passed between a BSFManager and its various BSFEngines. Note that the constructor is not public because this is not a public class.

Author:
Matthew J. Duftler, Sanjiva Weerawarana

Field Summary
 java.lang.Object bean
           
 java.lang.String name
           
 java.lang.Class type
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

name

public java.lang.String name

bean

public java.lang.Object bean

type

public java.lang.Class type


libbsf-java-2.4.0/docs/api/org/apache/bsf/package-frame.html0000644000175000017500000000317010511475731022522 0ustar mkochmkoch org.apache.bsf (Bean Scripting Framework API) org.apache.bsf
Interfaces 
BSFEngine
Classes 
BSFDeclaredBean
BSFManager
Main
Exceptions 
BSFException
libbsf-java-2.4.0/docs/api/resources/0000755000175000017500000000000010736513022016373 5ustar mkochmkochlibbsf-java-2.4.0/docs/api/resources/inherit.gif0000644000175000017500000000007110511475731020527 0ustar mkochmkochGIF89a€ÿÿÿ,„ ¡½®DršjñÔ;߀Q@–¦…N;libbsf-java-2.4.0/docs/api/overview-tree.html0000644000175000017500000004151210511475731020062 0ustar mkochmkoch Class Hierarchy (Bean Scripting Framework API)

Hierarchy For All Packages

Package Hierarchies:
org.apache.bsf, org.apache.bsf.engines.jacl, org.apache.bsf.engines.javascript, org.apache.bsf.engines.jython, org.apache.bsf.engines.netrexx, org.apache.bsf.engines.xslt, org.apache.bsf.util, org.apache.bsf.util.cf, org.apache.bsf.util.event, org.apache.bsf.util.event.adapters, org.apache.bsf.util.event.generator, org.apache.bsf.util.type

Class Hierarchy

Interface Hierarchy

  • interface org.apache.bsf.util.event.EventAdapter
  • interface java.util.EventListener
    • interface org.apache.bsf.BSFEngine
    • interface java.beans.PropertyChangeListener
  • interface org.apache.bsf.util.event.EventProcessor
  • interface org.apache.bsf.util.type.TypeConvertor


libbsf-java-2.4.0/docs/api/deprecated-list.html0000644000175000017500000001145210511475731020330 0ustar mkochmkoch Deprecated List (Bean Scripting Framework API)

Deprecated API



libbsf-java-2.4.0/docs/api/allclasses-frame.html0000644000175000017500000002013710511475731020475 0ustar mkochmkoch All Classes (Bean Scripting Framework API) All Classes
AdapterClassLoader
BSFDeclaredBean
BSFEngine
BSFEngineImpl
BSFEventProcessor
BSFEventProcessorReturningEventInfos
BSFException
BSFFunctions
BSFManager
Bean
ByteUtility
Bytecode
CFDriver
CodeBuffer
CodeFormatter
EngineUtils
EventAdapter
EventAdapterGenerator
EventAdapterImpl
EventAdapterRegistry
EventProcessor
IOUtils
IndentWriter
JaclEngine
JavaScriptEngine
JavaUtils
JythonEngine
java_awt_event_ActionAdapter
java_awt_event_AdjustmentAdapter
java_awt_event_ComponentAdapter
java_awt_event_ContainerAdapter
java_awt_event_FocusAdapter
java_awt_event_ItemAdapter
java_awt_event_KeyAdapter
java_awt_event_MouseAdapter
java_awt_event_MouseMotionAdapter
java_awt_event_TextAdapter
java_awt_event_WindowAdapter
java_beans_PropertyChangeAdapter
java_beans_VetoableChangeAdapter
Main
MethodUtils
NetRexxEngine
ObjInfo
ObjectRegistry
ReflectionUtils
StringUtils
TypeConvertor
TypeConvertorRegistry
XSLTEngine
XSLTResultNode
libbsf-java-2.4.0/INSTALL.txt0000644000175000017500000000163410511475731014540 0ustar mkochmkochInstalling BSF consists of copying bsf.jar and .jars for any languages intended to be supported to a directory in the execution CLASSPATH of your application, or simply adding them to your CLASSPATH. BSF can be used either as a standalone system, as a class library, or as part of an application server. In order to be used as a class library or as a standalone system, one must simply download the bsf.jar file from the BSF web site (http://jakarta.apache.org/bsf/index.html) and include it in their CLASSPATH, along with any required classes or jar files implementing the desired languages. In order to use BSF as part of the Tomcat servlet engine, one must currently download patches from the BSF website that permit Jasper to call BSF. Instructions for this are posted on the website, and may soon be accompanied by pre-built binaries. It is intended that these changes will be merged into Tomcat in the near future. libbsf-java-2.4.0/README.txt0000644000175000017500000000455110511475731014370 0ustar mkochmkochBean Scripting Framework (BSF) is a set of Java classes which provides an easy to use scripting language support within Java applications. It also provides access to Java objects and methods from supported 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. BSF supports several scripting languages currently. Here is the list of the scripting languages that are knwon to BSF to be available ('org/apache/bsf/Languages.properties'): * beanbasic = org.apache.bsf.engines.beanbasic.BeanBasicEngine, bb * beanshell = bsh.util.BeanShellBSFEngine, bsh * bml = org.apache.bml.ext.BMLEngine, bml * groovy = org.codehaus.groovy.bsf.GroovyEngine, groovy|gy * jacl = org.apache.bsf.engines.jacl.JaclEngine, jacl * java = org.apache.bsf.engines.java.JavaEngine, java * javaclass = org.apache.bsf.engines.javaclass.JavaClassEngine, class * javascript = org.apache.bsf.engines.javascript.JavaScriptEngine, js * jpython = org.apache.bsf.engines.jpython.JPythonEngine, py * judoscript = com.judoscript.BSFJudoEngine, judo|jud * jython = org.apache.bsf.engines.jython.JythonEngine, py * lotusscript = org.apache.bsf.engines.lotusscript.LsEngine, lss * netrexx = org.apache.bsf.engines.netrexx.NetRexxEngine, nrx * objectscript = oscript.bsf.ObjectScriptEngine, os * perl = org.apache.bsf.engines.perl.PerlEngine, pl * pnuts = pnuts.ext.PnutsBSFEngine, pnut * prolog = ubc.cs.JLog.Extras.BSF.JLogBSFEngine, plog|prolog * rexx = org.rexxla.bsf.engines.rexx.RexxEngine, rex | rexx | cls | rxj | rxs * ruby = org.jruby.javasupport.bsf.JRubyEngine, rb * xslt = org.apache.bsf.engines.xslt.XSLTEngine, xslt In addition, there may be additional scripting languages made available for being used in the BSF framework that are not listed here. Information on where to obtain some of these scripting languages for use with BSF is available on the Related Projects page at the BSF web site http://jakarta.apache.org/bsf/index.html libbsf-java-2.4.0/build.xml0000644000175000017500000004333710511475734014523 0ustar mkochmkoch Warning: AnakiaTask not present! Please ensure that velocity.jar is in your classpath. Documentation will not be generated. libbsf-java-2.4.0/BUILDING.txt0000644000175000017500000000260310511475734014627 0ustar mkochmkochFrom the ant "build.xml" file: Master Build file for BSF Notes: This is the build file for use with the Jakarta Ant build tool. Optional additions: BeanShell -> http://www.beanshell.org/ (3rd party BSF engine) JRuby -> http://www.jruby.org/ (3rd party BSF engine) Jacl -> http://www.scriptics.com/java/ JavaScript -> http://www.mozilla.org/rhino/ JudoScript -> http://www.judoscript.com/ (3rd party BSF engine) Jython -> http://www.jython.org/ NetRexx -> http://www2.hursley.ibm.com/netrexx/ Xalan -> http://xml.apache.org/xalan-j Build Instructions: To build, run java org.apache.tools.ant.Main on the directory where this file is located with the target you want. Most useful targets: - all -> creates the binary and src distributions, and builds the site - bindist -> creates the complete binary distribution in "./dist/" - build-site -> creates the website in "./docs" - clean -> removes all the generated files and directories - compile -> creates the "bsf.jar" package in "./build/lib" (default target) - dist -> creates both the binary and the src distributions in "./dist/" - javadocs -> creates the javadocs in "./build/javadocs" - samples -> creates/compiles the samples into "./build/samples" - srcdist -> creates the complete src distribution in "./dist/" libbsf-java-2.4.0/src/0000755000175000017500000000000010736513022013447 5ustar mkochmkochlibbsf-java-2.4.0/src/log4j.properties0000644000175000017500000000022310511475734016611 0ustar mkochmkochlog4j.rootLogger=FATAL, CONSOLE log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender log4j.appender.CONSOLE.layout=org.apache.log4j.SimpleLayoutlibbsf-java-2.4.0/src/org/0000755000175000017500000000000010511475734014246 5ustar mkochmkochlibbsf-java-2.4.0/src/org/apache/0000755000175000017500000000000010511475734015467 5ustar mkochmkochlibbsf-java-2.4.0/src/org/apache/bsf/0000755000175000017500000000000010736513022016231 5ustar mkochmkochlibbsf-java-2.4.0/src/org/apache/bsf/test/0000755000175000017500000000000010511475734017220 5ustar mkochmkochlibbsf-java-2.4.0/src/org/apache/bsf/test/engineTests/0000755000175000017500000000000010511475734021510 5ustar mkochmkochlibbsf-java-2.4.0/src/org/apache/bsf/test/utilTests/0000755000175000017500000000000010511475734021220 5ustar mkochmkochlibbsf-java-2.4.0/src/org/apache/bsf/Languages.properties0000644000175000017500000000330110511475734022262 0ustar mkochmkoch# List of script types and their associated scripting engines # # languageDescriptor = engineClass, ext1|ext2|... {, codebaseURL, ...} # # where exti are extensions for the language. Note that we leave # all the engines enabled now and allow them to fail at load time. # This way engines can be added by just adding to the classpath # without having to edit this file. Cheating, really, but it works. # javascript = org.apache.bsf.engines.javascript.JavaScriptEngine, js jacl = org.apache.bsf.engines.jacl.JaclEngine, jacl netrexx = org.apache.bsf.engines.netrexx.NetRexxEngine, nrx java = org.apache.bsf.engines.java.JavaEngine, java javaclass = org.apache.bsf.engines.javaclass.JavaClassEngine, class bml = org.apache.bml.ext.BMLEngine, bml vbscript = org.apache.bsf.engines.activescript.ActiveScriptEngine, vbs jscript = org.apache.bsf.engines.activescript.ActiveScriptEngine, jss perlscript = org.apache.bsf.engines.activescript.ActiveScriptEngine, pls perl = org.apache.bsf.engines.perl.PerlEngine, pl jpython = org.apache.bsf.engines.jpython.JPythonEngine, py jython = org.apache.bsf.engines.jython.JythonEngine, py lotusscript = org.apache.bsf.engines.lotusscript.LsEngine, lss xslt = org.apache.bsf.engines.xslt.XSLTEngine, xslt pnuts = pnuts.ext.PnutsBSFEngine, pnut beanbasic = org.apache.bsf.engines.beanbasic.BeanBasicEngine, bb beanshell = bsh.util.BeanShellBSFEngine, bsh ruby = org.jruby.javasupport.bsf.JRubyEngine, rb judoscript = com.judoscript.BSFJudoEngine, judo|jud groovy = org.codehaus.groovy.bsf.GroovyEngine, groovy|gy objectscript = oscript.bsf.ObjectScriptEngine, os prolog = ubc.cs.JLog.Extras.BSF.JLogBSFEngine, plog|prolog rexx = org.rexxla.bsf.engines.rexx.RexxEngine, rex | rexx | cls | rxj | rxs libbsf-java-2.4.0/src/org/apache/bsf/util/0000755000175000017500000000000010736513022017206 5ustar mkochmkochlibbsf-java-2.4.0/src/org/apache/bsf/util/IOUtils.java0000644000175000017500000000272310511475734021415 0ustar mkochmkoch/* * Copyright 2004,2004 The Apache Software Foundation. * * Licensed 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. */ package org.apache.bsf.util; import java.io.BufferedReader; import java.io.IOException; import java.io.PrintWriter; import java.io.Reader; import java.io.StringWriter; /** * This file is a collection of input/output utilities. * * @author Sanjiva Weerawarana * @author Matthew J. Duftler */ public class IOUtils { // debug flag - generates debug stuff if true static boolean debug = false; ////////////////////////////////////////////////////////////////////////// public static String getStringFromReader (Reader reader) throws IOException { BufferedReader bufIn = new BufferedReader(reader); StringWriter swOut = new StringWriter(); PrintWriter pwOut = new PrintWriter(swOut); String tempLine; while ((tempLine = bufIn.readLine()) != null) { pwOut.println(tempLine); } pwOut.flush(); return swOut.toString(); } } libbsf-java-2.4.0/src/org/apache/bsf/util/JavaUtils.java0000644000175000017500000000330110511475734021760 0ustar mkochmkoch/* * Copyright 2004,2004 The Apache Software Foundation. * * Licensed 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. */ package org.apache.bsf.util; import java.io.IOException; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public class JavaUtils { // Temporarily copied from JavaEngine... private static Log logger; static { logger = LogFactory.getLog((org.apache.bsf.util.JavaUtils.class) .getName()); } public static boolean JDKcompile(String fileName, String classPath) { String option = (logger.isDebugEnabled()) ? "-g" : "-O"; String args[] = { "javac", option, "-classpath", classPath, fileName }; logger.debug("JavaEngine: Compiling " + fileName); logger.debug("JavaEngine: Classpath is " + classPath); try { Process p = java.lang.Runtime.getRuntime().exec(args); p.waitFor(); return (p.exitValue() != 0); } catch (IOException e) { logger.error("ERROR: IO exception during exec(javac).", e); } catch (SecurityException e) { logger.error("ERROR: Unable to create subprocess to exec(javac).", e); } catch (InterruptedException e) { logger.error("ERROR: Wait for exec(javac) was interrupted.", e); } return false; } } libbsf-java-2.4.0/src/org/apache/bsf/util/cf/0000755000175000017500000000000010736513022017576 5ustar mkochmkochlibbsf-java-2.4.0/src/org/apache/bsf/util/cf/CodeFormatter.java0000644000175000017500000002213610511475734023213 0ustar mkochmkoch/* * Copyright 2004,2004 The Apache Software Foundation. * * Licensed 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. */ package org.apache.bsf.util.cf; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.Reader; import java.io.Writer; import org.apache.bsf.util.IndentWriter; import org.apache.bsf.util.StringUtils; /** * A CodeFormatter bean is used to format raw Java code. It * indents, word-wraps, and replaces tab characters with an amount of space * characters equal to the size of the indentationStep property. * To create and use a CodeFormatter, you simply instantiate a * new CodeFormatter bean, and invoke * formatCode(Reader source, Writer target) with appropriate * arguments. * * @version 1.0 * @author Matthew J. Duftler */ public class CodeFormatter { /** * The default maximum line length. */ public static final int DEFAULT_MAX = 74; /** * The default size of the indentation step. */ public static final int DEFAULT_STEP = 2; /** * The default set of delimiters. */ public static final String DEFAULT_DELIM = "(+"; /** * The default set of sticky delimiters. */ public static final String DEFAULT_S_DELIM = ","; // Configurable Parameters private int maxLineLength = DEFAULT_MAX; private int indentationStep = DEFAULT_STEP; private String delimiters = DEFAULT_DELIM; private String stickyDelimiters = DEFAULT_S_DELIM; // Global Variables private int indent; private int hangingIndent; private int origIndent; private boolean inCPP_Comment; private void addTok(StringBuffer targetBuf, StringBuffer tokBuf, IndentWriter out) { int tokLength = tokBuf.length(), targetLength = targetBuf.length(); if (indent + targetLength + tokLength > maxLineLength) { if (targetLength == 0) { out.println(indent, tokBuf.toString()); indent = hangingIndent; targetBuf.setLength(0); return; } else { out.println(indent, targetBuf.toString().trim()); indent = hangingIndent; targetBuf.setLength(0); } } targetBuf.append(tokBuf.toString()); return; } /** * Formats the code read from source, and writes the formatted * code to target. * * @param source where to read the unformatted code from. * @param target where to write the formatted code to. */ public void formatCode(Reader source, Writer target) { String line; BufferedReader in = new BufferedReader(source); IndentWriter out = new IndentWriter(new BufferedWriter(target), true); try { origIndent = 0; inCPP_Comment = false; while ((line = in.readLine()) != null) { line = line.trim(); if (line.length() > 0) { indent = origIndent; hangingIndent = indent + indentationStep; printLine(line, out); } else out.println(); } } catch (IOException e) { e.printStackTrace(); } } /** * Gets the set of delimiters. * * @return the set of delimiters. * @see #setDelimiters */ public String getDelimiters() { return delimiters; } /** * Gets the size of the indentation step. * * @return the size of the indentation step. * @see #setIndentationStep */ public int getIndentationStep() { return indentationStep; } /** * Gets the maximum line length. * * @return the maximum line length. * @see #setMaxLineLength */ public int getMaxLineLength() { return maxLineLength; } /** * Gets the set of sticky delimiters. * * @return the set of sticky delimiters. * @see #setStickyDelimiters */ public String getStickyDelimiters() { return stickyDelimiters; } private void printLine(String line, IndentWriter out) { char[] source = line.toCharArray(); char ch; char quoteChar = ' '; boolean inEscapeSequence = false; boolean inString = false; StringBuffer tokBuf = new StringBuffer(), targetBuf = new StringBuffer(hangingIndent + line.length()); for (int i = 0; i < source.length; i++) { ch = source[i]; if (inEscapeSequence) { tokBuf.append(ch); inEscapeSequence = false; } else { if (inString) { switch (ch) { case '\\' : tokBuf.append('\\'); inEscapeSequence = true; break; case '\'' : case '\"' : tokBuf.append(ch); if (ch == quoteChar) { addTok(targetBuf, tokBuf, out); tokBuf.setLength(0); inString = false; } break; case 9 : // pass thru tab characters... tokBuf.append(ch); break; default : if (ch > 31) tokBuf.append(ch); break; } } else // !inString { if (inCPP_Comment) { tokBuf.append(ch); if (ch == '/' && i > 0 && source[i - 1] == '*') inCPP_Comment = false; } else { switch (ch) { case '/' : tokBuf.append(ch); if (i > 0 && source[i - 1] == '/') { String tokStr = tokBuf.append(source, i + 1, source.length - (i + 1)).toString(); out.println(indent, targetBuf.append(tokStr).toString()); return; } break; case '*' : tokBuf.append(ch); if (i > 0 && source[i - 1] == '/') inCPP_Comment = true; break; case '\'' : case '\"' : addTok(targetBuf, tokBuf, out); tokBuf.setLength(0); tokBuf.append(ch); quoteChar = ch; inString = true; break; case 9 : // replace tab characters... tokBuf.append(StringUtils.getChars(indentationStep, ' ')); break; case '{' : tokBuf.append(ch); origIndent += indentationStep; break; case '}' : tokBuf.append(ch); origIndent -= indentationStep; if (i == 0) indent = origIndent; break; default : if (ch > 31) { if (delimiters.indexOf(ch) != -1) { addTok(targetBuf, tokBuf, out); tokBuf.setLength(0); tokBuf.append(ch); } else if (stickyDelimiters.indexOf(ch) != -1) { tokBuf.append(ch); addTok(targetBuf, tokBuf, out); tokBuf.setLength(0); } else tokBuf.append(ch); } break; } } } } } if (tokBuf.length() > 0) addTok(targetBuf, tokBuf, out); String lastLine = targetBuf.toString().trim(); if (lastLine.length() > 0) out.println(indent, lastLine); } /** * Sets the set of delimiters; default set is "(+". *

* Each character represents one delimiter. If a line is ready to be * word-wrapped and a delimiter is encountered, the delimiter will * appear as the first character on the following line. * A quotation mark, " or ', opening a string * is always a delimiter, whether you specify it or not. * * @param newDelimiters the new set of delimiters. * @see #getDelimiters */ public void setDelimiters(String newDelimiters) { delimiters = newDelimiters; } /** * Sets the size of the indentation step; default size is 2. *

* This is the number of spaces that lines will be indented (when appropriate). * * @param newIndentationStep the new size of the indentation step. * @see #getIndentationStep */ public void setIndentationStep(int newIndentationStep) { indentationStep = (newIndentationStep < 0 ? 0 : newIndentationStep); } /** * Sets the (desired) maximum line length; default length is * 74. *

* If a token is longer than the requested maximum line length, * then the line containing that token will obviously be longer * than the desired maximum. * * @param newMaxLineLength the new maximum line length. * @see #getMaxLineLength */ public void setMaxLineLength(int newMaxLineLength) { maxLineLength = (newMaxLineLength < 0 ? 0 : newMaxLineLength); } /** * Sets the set of sticky delimiters; default set is ",". *

* Each character represents one sticky delimiter. If a line is ready * to be word-wrapped and a sticky delimiter is encountered, the sticky * delimiter will appear as the last character on the current line. * A quotation mark, " or ', closing a string * is always a sticky delimiter, whether you specify it or not. * * @param newStickyDelimiters the new set of sticky delimiters. * @see #getStickyDelimiters */ public void setStickyDelimiters(String newStickyDelimiters) { stickyDelimiters = newStickyDelimiters; } } libbsf-java-2.4.0/src/org/apache/bsf/util/cf/CFDriver.java0000644000175000017500000001110510511475734022113 0ustar mkochmkoch/* * Copyright 2004,2004 The Apache Software Foundation. * * Licensed 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. */ package org.apache.bsf.util.cf; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.Reader; import java.io.Writer; /** * This is an example of how a CodeFormatter bean can be used. *

* The CFDriver is a stand-alone tool that will instantiate a * CodeFormatter bean, configure it according to your * command-line arguments, and invoke the formatting. Since the * default source of input is stdin, and the default * target for output is stdout, a CFDriver * can also be used as a filter. * * @see CodeFormatter * * @version 1.0 * @author Matthew J. Duftler */ public class CFDriver { /** * Not used. */ public CFDriver() { } /** * A driver for CodeFormatter. *

* Usage: *

	*  java org.apache.cf.CFDriver [args]
	*

* args: *

* [-in fileName] default: <STDIN> * [-out fileName] default: <STDOUT> * [-maxLine length] default: 74 * [-step size] default: 2 * [-delim group] default: (+ * [-sdelim group] default: , *

*/ public static void main(String[] argv) { if (argv.length % 2 == 0) { String inFile = null, outFile = null, maxLine = null, indStep = null, delim = null, sDelim = null; Reader in = null; Writer out = null; CodeFormatter cf = new CodeFormatter(); for (int i = 0; i < argv.length; i += 2) { if (argv[i].startsWith("-i")) inFile = argv[i + 1]; else if (argv[i].startsWith("-o")) outFile = argv[i + 1]; else if (argv[i].startsWith("-m")) maxLine = argv[i + 1]; else if (argv[i].startsWith("-st")) indStep = argv[i + 1]; else if (argv[i].startsWith("-d")) delim = argv[i + 1]; else if (argv[i].startsWith("-sd")) sDelim = argv[i + 1]; } if (inFile != null) { try { in = new FileReader(inFile); } catch (FileNotFoundException e) { printError("Cannot open input file: " + inFile); return; } } else { in = new InputStreamReader(System.in); } if (outFile != null) { try { out = new FileWriter(outFile); } catch (IOException e) { printError("Cannot open output file: " + outFile); return; } } else { out = new OutputStreamWriter(System.out); } if (maxLine != null) { try { cf.setMaxLineLength(Integer.parseInt(maxLine)); } catch (NumberFormatException nfe) { printError("Not a valid integer: " + maxLine); return; } } if (indStep != null) { try { cf.setIndentationStep(Integer.parseInt(indStep)); } catch (NumberFormatException nfe) { printError("Not a valid integer: " + indStep); return; } } if (delim != null) cf.setDelimiters(delim); if (sDelim != null) cf.setStickyDelimiters(sDelim); cf.formatCode(in, out); } else printHelp(); } private static void printError(String errMsg) { System.err.println("ERROR: " + errMsg); } private static void printHelp() { System.out.println("Usage:"); System.out.println(); System.out.println(" java " + CFDriver.class.getName() + " [args]"); System.out.println(); System.out.println(" args:"); System.out.println(); System.out.println(" [-in fileName] default: "); System.out.println(" [-out fileName] default: "); System.out.println(" [-maxLine length] default: " + CodeFormatter.DEFAULT_MAX); System.out.println(" [-step size] default: " + CodeFormatter.DEFAULT_STEP); System.out.println(" [-delim group] default: " + CodeFormatter.DEFAULT_DELIM); System.out.println(" [-sdelim group] default: " + CodeFormatter.DEFAULT_S_DELIM); } } libbsf-java-2.4.0/src/org/apache/bsf/util/BSFEventProcessor.java0000644000175000017500000000563010511475734023401 0ustar mkochmkoch/* * Copyright 2004,2004 The Apache Software Foundation. * * Licensed 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. */ package org.apache.bsf.util; import org.apache.bsf.BSFEngine; import org.apache.bsf.BSFException; import org.apache.bsf.BSFManager; import org.apache.bsf.util.event.EventProcessor; /** * This is used to support binding scripts to be run when an event * occurs. * * @author Sanjiva Weerawarana */ public class BSFEventProcessor implements EventProcessor { BSFEngine engine; BSFManager manager; String filter; String source; int lineNo; int columnNo; Object script; /** * Package-protected constructor makes this class unavailable for * public use. */ BSFEventProcessor (BSFEngine engine, BSFManager manager, String filter, String source, int lineNo, int columnNo, Object script) throws BSFException { this.engine = engine; this.manager = manager; this.filter = filter; this.source = source; this.lineNo = lineNo; this.columnNo = columnNo; this.script = script; } ////////////////////////////////////////////////////////////////////////// // // event is delegated to me by the adapters using this. inFilter is // in general the name of the method via which the event was received // at the adapter. For prop/veto change events, inFilter is the name // of the property. In any case, in the event processor, I only forward // those events if for which the filters match (if one is specified). public void processEvent (String inFilter, Object[] evtInfo) { try { processExceptionableEvent (inFilter, evtInfo); } catch (RuntimeException re) { // rethrow this .. I don't want to intercept run-time stuff // that can in fact occur legit throw re; } catch (Exception e) { // should not occur System.err.println ("BSFError: non-exceptionable event delivery " + "threw exception (that's not nice): " + e); e.printStackTrace (); } } ////////////////////////////////////////////////////////////////////////// // // same as above, but used when the method event method may generate // an exception which must go all the way back to the source (as in // the vetoableChange case) public void processExceptionableEvent (String inFilter, Object[] evtInfo) throws Exception { if ((filter != null) && !filter.equals (inFilter)) { // ignore this event return; } // run the script engine.exec (source, lineNo, columnNo, script); } } libbsf-java-2.4.0/src/org/apache/bsf/util/ObjInfo.java0000644000175000017500000000365510511475734021420 0ustar mkochmkoch/* * Copyright 2004,2004 The Apache Software Foundation. * * Licensed 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. */ package org.apache.bsf.util; /** * An ObjInfo object is used by a compiler to track the name and * type of a bean. * * @author Matthew J. Duftler */ public class ObjInfo { static private String QUOTE_CHARS = "\'\"", EXEC_CHARS = "(="; public String objName; public Class objClass; public ObjInfo(Class objClass, String objName) { this.objClass = objClass; this.objName = objName; } public boolean isExecutable() { char[] chars = objName.toCharArray(); char openingChar = ' '; boolean inString = false, inEscapeSequence = false; for (int i = 0; i < chars.length; i++) { if (inEscapeSequence) { inEscapeSequence = false; } else if (QUOTE_CHARS.indexOf(chars[i]) != -1) { if (!inString) { openingChar = chars[i]; inString = true; } else { if (chars[i] == openingChar) { inString = false; } } } else if (EXEC_CHARS.indexOf(chars[i]) != -1) { if (!inString) { return true; } } else if (inString && chars[i] == '\\') { inEscapeSequence = true; } } return false; } public boolean isValueReturning() { return (objClass != void.class && objClass != Void.class); } public String toString() { return StringUtils.getClassName(objClass) + " " + objName; } } libbsf-java-2.4.0/src/org/apache/bsf/util/BSFEngineImpl.java0000644000175000017500000001617410511475734022454 0ustar mkochmkoch/* * Copyright 2004,2004 The Apache Software Foundation. * * Licensed 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. */ package org.apache.bsf.util; import java.beans.PropertyChangeEvent; import java.util.Vector; import org.apache.bsf.BSFDeclaredBean; import org.apache.bsf.BSFEngine; import org.apache.bsf.BSFException; import org.apache.bsf.BSFManager; /** * This is a base implementation of the BSFEngine interface which * engine implementations may choose to extend to get the basic * methods of the interface implemented. *

* * @author Sanjiva Weerawarana * @author Olivier Gruber (added original debugging support) */ public abstract class BSFEngineImpl implements BSFEngine { protected BSFManager mgr; // my manager protected String lang; // my language string protected Vector declaredBeans; // BSFDeclaredBeans protected String classPath; protected String tempDir; protected ClassLoader classLoader; /** * Default impl of apply - calls eval ignoring parameters and returns * the result. */ public Object apply(String source, int lineNo, int columnNo, Object funcBody, Vector paramNames, Vector arguments) throws BSFException { return eval(source, lineNo, columnNo, funcBody); } /** * Default impl of compileApply - calls compileExpr ignoring parameters. */ public void compileApply(String source, int lineNo, int columnNo, Object funcBody, Vector paramNames, Vector arguments, CodeBuffer cb) throws BSFException { compileExpr(source, lineNo, columnNo, funcBody, cb); } /** * Default impl of compileExpr - generates code that'll create a new * manager, evaluate the expression, and return the value. */ public void compileExpr(String source, int lineNo, int columnNo, Object expr, CodeBuffer cb) throws BSFException { ObjInfo bsfInfo = cb.getSymbol("bsf"); if (bsfInfo == null) { bsfInfo = new ObjInfo(BSFManager.class, "bsf"); cb.addFieldDeclaration("org.apache.bsf.BSFManager bsf = " + "new org.apache.bsf.BSFManager();"); cb.putSymbol("bsf", bsfInfo); } String evalString = bsfInfo.objName + ".eval(\"" + lang + "\", "; evalString += "request.getRequestURI(), " + lineNo + ", " + columnNo; evalString += "," + StringUtils.lineSeparator; evalString += StringUtils.getSafeString(expr.toString()) + ")"; ObjInfo oldRet = cb.getFinalServiceMethodStatement(); if (oldRet != null && oldRet.isExecutable()) { cb.addServiceMethodStatement(oldRet.objName + ";"); } cb.setFinalServiceMethodStatement(new ObjInfo(Object.class, evalString)); cb.addServiceMethodException("org.apache.bsf.BSFException"); } /** * Default impl of compileScript - generates code that'll create a new * manager, and execute the script. */ public void compileScript(String source, int lineNo, int columnNo, Object script, CodeBuffer cb) throws BSFException { ObjInfo bsfInfo = cb.getSymbol("bsf"); if (bsfInfo == null) { bsfInfo = new ObjInfo(BSFManager.class, "bsf"); cb.addFieldDeclaration("org.apache.bsf.BSFManager bsf = " + "new org.apache.bsf.BSFManager();"); cb.putSymbol("bsf", bsfInfo); } String execString = bsfInfo.objName + ".exec(\"" + lang + "\", "; execString += "request.getRequestURI(), " + lineNo + ", " + columnNo; execString += "," + StringUtils.lineSeparator; execString += StringUtils.getSafeString(script.toString()) + ")"; ObjInfo oldRet = cb.getFinalServiceMethodStatement(); if (oldRet != null && oldRet.isExecutable()) { cb.addServiceMethodStatement(oldRet.objName + ";"); } cb.setFinalServiceMethodStatement(new ObjInfo(void.class, execString)); cb.addServiceMethodException("org.apache.bsf.BSFException"); } public void declareBean(BSFDeclaredBean bean) throws BSFException { throw new BSFException(BSFException.REASON_UNSUPPORTED_FEATURE, "language " + lang + " does not support declareBean(...)."); } /** * Default impl of execute - calls eval and ignores the result. */ public void exec(String source, int lineNo, int columnNo, Object script) throws BSFException { eval(source, lineNo, columnNo, script); } /** * Default impl of interactive execution - calls eval and ignores the result. */ public void iexec(String source, int lineNo, int columnNo, Object script) throws BSFException { eval(source, lineNo, columnNo, script); } /** * initialize the engine; called right after construction by * the manager. Declared beans are simply kept in a vector and * that's it. Subclasses must do whatever they want with it. */ public void initialize(BSFManager mgr, String lang, Vector declaredBeans) throws BSFException { this.mgr = mgr; this.lang = lang; this.declaredBeans = declaredBeans; // initialize my properties from those of the manager. It'll send // propagate change events to me this.classPath = mgr.getClassPath(); this.tempDir = mgr.getTempDir(); this.classLoader = mgr.getClassLoader(); } /** * Receive property change events from the manager and update my fields * as needed. * * @param e PropertyChange event with the change data */ public void propertyChange(PropertyChangeEvent e) { String name = e.getPropertyName(); Object value = e.getNewValue(); if (name.equals("classPath")) { classPath = (String) value; } else if (name.equals("tempDir")) { tempDir = (String) value; } else if (name.equals("classLoader")) { classLoader = (ClassLoader) value; } } public void terminate() { mgr = null; declaredBeans = null; classLoader = null; } public void undeclareBean(BSFDeclaredBean bean) throws BSFException { throw new BSFException(BSFException.REASON_UNSUPPORTED_FEATURE, "language " + lang + " does not support undeclareBean(...)."); } } libbsf-java-2.4.0/src/org/apache/bsf/util/CodeBuffer.java0000644000175000017500000002530010511475734022065 0ustar mkochmkoch/* * Copyright 2004,2004 The Apache Software Foundation. * * Licensed 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. */ package org.apache.bsf.util; import java.io.PrintWriter; import java.io.StringReader; import java.io.StringWriter; import java.util.Hashtable; import java.util.Stack; import java.util.Vector; import org.apache.bsf.util.cf.CodeFormatter; /** * A CodeBuffer object is used as a code repository for generated Java code. * It provides buffers which correspond to the various sections of a Java class. * * @author Matthew J. Duftler */ public class CodeBuffer { private StringWriter fieldDeclSW = new StringWriter(), methodDeclSW = new StringWriter(), initializerSW = new StringWriter(), constructorSW = new StringWriter(), serviceMethodSW = new StringWriter(); private PrintWriter fieldDeclPW = new PrintWriter(fieldDeclSW), methodDeclPW = new PrintWriter(methodDeclSW), initializerPW = new PrintWriter(initializerSW), constructorPW = new PrintWriter(constructorSW), serviceMethodPW = new PrintWriter(serviceMethodSW); private Stack symbolTableStack = new Stack(); private Hashtable symbolTable = new Hashtable(), usedSymbolIndices = new Hashtable(); private ObjInfo finalStatementInfo; private CodeBuffer parent; { symbolTableStack.push(symbolTable); } // New stuff... private Vector imports = new Vector(), constructorArguments = new Vector(), constructorExceptions = new Vector(), serviceMethodExceptions = new Vector(), implementsVector = new Vector(); private String packageName = null, className = "Test", serviceMethodName = "exec", extendsName = null; private Class serviceMethodReturnType = void.class; public CodeBuffer() { } public CodeBuffer(CodeBuffer parent) { this.parent = parent; } public void addConstructorArgument(ObjInfo arg) { constructorArguments.addElement(arg); } public void addConstructorException(String exceptionName) { if (!constructorExceptions.contains(exceptionName)) { constructorExceptions.addElement(exceptionName); } } public void addConstructorStatement(String statement) { constructorPW.println(statement); } public void addFieldDeclaration(String statement) { fieldDeclPW.println(statement); } public void addImplements(String importName) { if (!implementsVector.contains(importName)) { implementsVector.addElement(importName); } } public void addImport(String importName) { if (!imports.contains(importName)) { imports.addElement(importName); } } public void addInitializerStatement(String statement) { initializerPW.println(statement); } public void addMethodDeclaration(String statement) { methodDeclPW.println(statement); } public void addServiceMethodException(String exceptionName) { if (!serviceMethodExceptions.contains(exceptionName)) { serviceMethodExceptions.addElement(exceptionName); } } public void addServiceMethodStatement(String statement) { serviceMethodPW.println(statement); } // Used internally by merge(...). private void appendIfNecessary(PrintWriter pw, StringBuffer buf) { if (buf.length() > 0) { pw.print(buf.toString()); } } public String buildNewSymbol(String prefix) { Integer nextNum = getSymbolIndex(prefix); if (nextNum == null) { nextNum = new Integer(0); } int iNextNum = nextNum.intValue(); String symbol = prefix + "_" + iNextNum; while (getSymbol(symbol) != null) { iNextNum++; symbol = prefix + "_" + iNextNum; } putSymbolIndex(prefix, new Integer(iNextNum + 1)); return symbol; } public void clearSymbolTable() { symbolTable = new Hashtable(); symbolTableStack = new Stack(); symbolTableStack.push(symbolTable); usedSymbolIndices = new Hashtable(); } public String getClassName() { return className; } public Vector getConstructorArguments() { return constructorArguments; } public StringBuffer getConstructorBuffer() { constructorPW.flush(); return constructorSW.getBuffer(); } public Vector getConstructorExceptions() { return constructorExceptions; } public String getExtends() { return extendsName; } public StringBuffer getFieldBuffer() { fieldDeclPW.flush(); return fieldDeclSW.getBuffer(); } public ObjInfo getFinalServiceMethodStatement() { return finalStatementInfo; } public Vector getImplements() { return implementsVector; } public Vector getImports() { return imports; } public StringBuffer getInitializerBuffer() { initializerPW.flush(); return initializerSW.getBuffer(); } public StringBuffer getMethodBuffer() { methodDeclPW.flush(); return methodDeclSW.getBuffer(); } public String getPackageName() { return packageName; } public StringBuffer getServiceMethodBuffer() { serviceMethodPW.flush(); return serviceMethodSW.getBuffer(); } public Vector getServiceMethodExceptions() { return serviceMethodExceptions; } public String getServiceMethodName() { return serviceMethodName; } public Class getServiceMethodReturnType() { if (finalStatementInfo != null) { return finalStatementInfo.objClass; } else if (serviceMethodReturnType != null) { return serviceMethodReturnType; } else { return void.class; } } public ObjInfo getSymbol(String symbol) { ObjInfo ret = (ObjInfo)symbolTable.get(symbol); if (ret == null && parent != null) ret = parent.getSymbol(symbol); return ret; } Integer getSymbolIndex(String prefix) { if (parent != null) { return parent.getSymbolIndex(prefix); } else { return (Integer)usedSymbolIndices.get(prefix); } } public Hashtable getSymbolTable() { return symbolTable; } public void merge(CodeBuffer otherCB) { Vector otherImports = otherCB.getImports(); for (int i = 0; i < otherImports.size(); i++) { addImport((String)otherImports.elementAt(i)); } appendIfNecessary(fieldDeclPW, otherCB.getFieldBuffer()); appendIfNecessary(methodDeclPW, otherCB.getMethodBuffer()); appendIfNecessary(initializerPW, otherCB.getInitializerBuffer()); appendIfNecessary(constructorPW, otherCB.getConstructorBuffer()); appendIfNecessary(serviceMethodPW, otherCB.getServiceMethodBuffer()); ObjInfo oldRet = getFinalServiceMethodStatement(); if (oldRet != null && oldRet.isExecutable()) { addServiceMethodStatement(oldRet.objName + ";"); } setFinalServiceMethodStatement(otherCB.getFinalServiceMethodStatement()); } public void popSymbolTable() { symbolTableStack.pop(); symbolTable = (Hashtable)symbolTableStack.peek(); } public void print(PrintWriter out, boolean formatOutput) { if (formatOutput) { new CodeFormatter().formatCode(new StringReader(toString()), out); } else { out.print(toString()); } out.flush(); } public void pushSymbolTable() { symbolTable = (Hashtable)symbolTableStack.push(new ScriptSymbolTable(symbolTable)); } public void putSymbol(String symbol, ObjInfo obj) { symbolTable.put(symbol, obj); } void putSymbolIndex(String prefix, Integer index) { if (parent != null) { parent.putSymbolIndex(prefix, index); } else { usedSymbolIndices.put(prefix, index); } } public void setClassName(String className) { this.className = className; } public void setExtends(String extendsName) { this.extendsName = extendsName; } public void setFinalServiceMethodStatement(ObjInfo finalStatementInfo) { this.finalStatementInfo = finalStatementInfo; } public void setPackageName(String packageName) { this.packageName = packageName; } public void setServiceMethodName(String serviceMethodName) { this.serviceMethodName = serviceMethodName; } public void setServiceMethodReturnType(Class serviceMethodReturnType) { this.serviceMethodReturnType = serviceMethodReturnType; } public void setSymbolTable(Hashtable symbolTable) { this.symbolTable = symbolTable; } public boolean symbolTableIsStacked() { return (symbolTable instanceof ScriptSymbolTable); } public String toString() { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); ObjInfo ret = finalStatementInfo; if (packageName != null && !packageName.equals("")) { pw.println("package " + packageName + ";"); pw.println(); } if (imports.size() > 0) { for (int i = 0; i < imports.size(); i++) { pw.println("import " + imports.elementAt(i) + ";"); } pw.println(); } pw.println("public class " + className + (extendsName != null && !extendsName.equals("") ? " extends " + extendsName : "") + (implementsVector.size() > 0 ? " implements " + StringUtils.getCommaListFromVector(implementsVector) : "") ); pw.println("{"); pw.print(getFieldBuffer().toString()); StringBuffer buf = getInitializerBuffer(); if (buf.length() > 0) { pw.println(); pw.println("{"); pw.print(buf.toString()); pw.println("}"); } buf = getConstructorBuffer(); if (buf.length() > 0) { pw.println(); pw.println("public " + className + "(" + (constructorArguments.size() > 0 ? StringUtils.getCommaListFromVector(constructorArguments) : "" ) + ")" + (constructorExceptions.size() > 0 ? " throws " + StringUtils.getCommaListFromVector(constructorExceptions) : "" ) ); pw.println("{"); pw.print(buf.toString()); pw.println("}"); } buf = getServiceMethodBuffer(); if (buf.length() > 0 || ret != null) { pw.println(); pw.println("public " + StringUtils.getClassName(getServiceMethodReturnType()) + " " + serviceMethodName + "()" + (serviceMethodExceptions.size() > 0 ? " throws " + StringUtils.getCommaListFromVector(serviceMethodExceptions) : "" ) ); pw.println("{"); pw.print(buf.toString()); if (ret != null) { if (ret.isValueReturning()) { pw.println(); pw.println("return " + ret.objName + ";"); } else if (ret.isExecutable()) { pw.println(ret.objName + ";"); } } pw.println("}"); } pw.print(getMethodBuffer().toString()); pw.println("}"); pw.flush(); return sw.toString(); } } libbsf-java-2.4.0/src/org/apache/bsf/util/EngineUtils.java0000644000175000017500000003726410511475734022323 0ustar mkochmkoch/* * Copyright 2004,2004 The Apache Software Foundation. * * Licensed 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. */ package org.apache.bsf.util; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.lang.reflect.Modifier; import org.apache.bsf.BSFEngine; import org.apache.bsf.BSFException; import org.apache.bsf.BSFManager; /** * This class contains utilities that language integrators can use * when implementing the BSFEngine interface. * * @author Sanjiva Weerawarana * @author Sam Ruby * @author Rony G. Flatscher (added addEventListenerReturningEventInfos) */ public class EngineUtils { // the BSF class loader that knows how to load from the a specific // temp directory static BSFClassLoader bsfCL; // ---rgf, 2003-02-13, determine whether changing accessibility of Methods is possible static boolean bMethodHasSetAccessible=false; static { Class mc=Method.class; // get the "Method" class object Class arg[]={boolean.class}; // define an array with the primitive "boolean" pseudo class object try { mc.getMethod("setAccessible", arg ); // is this method available? bMethodHasSetAccessible=true; // no exception, hence method exists } catch (Exception e) { bMethodHasSetAccessible=false;// exception occurred, hence method does not exist } } /** * Add a script as a listener to some event coming out of an object. The * first two args identify the src of the event and the event set * and the rest identify the script which should be run when the event * fires. * * @param bean event source * @param eventSetName name of event set from event src to bind to * @param filter filter for events * @param engine BSFEngine which can run this script * @param manager BSFManager of the above engine * @param source (context info) the source of this expression * (e.g., filename) * @param lineNo (context info) the line number in source for expr * @param columnNo (context info) the column number in source for expr * @param script the script to execute when the event occurs * * @exception BSFException if anything goes wrong while running the script */ public static void addEventListener (Object bean, String eventSetName, String filter, BSFEngine engine, BSFManager manager, String source, int lineNo, int columnNo, Object script) throws BSFException { BSFEventProcessor ep = new BSFEventProcessor (engine, manager, filter, source, lineNo, columnNo, script); try { ReflectionUtils.addEventListener (bean, eventSetName, ep); } catch (Exception e) { e.printStackTrace (); throw new BSFException (BSFException.REASON_OTHER_ERROR, "ouch while adding event listener: " + e, e); } } /** * Add a script as a listener to some event coming out of an object. The * first two args identify the src of the event and the event set * and the rest identify the script which should be run when the event * fires. The processing will use the engine's apply() method. * * @param bean event source * @param eventSetName name of event set from event src to bind to * @param filter filter for events * @param engine BSFEngine which can run this script * @param manager BSFManager of the above engine * @param source (context info) the source of this expression (e.g., filename) * @param lineNo (context info) the line number in source for expr * @param columnNo (context info) the column number in source for expr * @param script the script to execute when the event occurs * @param dataFromScriptingEngine * this contains any object supplied by the scripting engine and gets sent * back with the supplied script, if the event occurs. * This could be used e.g. for indicating to the scripting engine which * scripting engine object/routine/function/procedure * should be ultimately informed of the event occurrence. * * @exception BSFException if anything goes wrong while running the script */ public static void addEventListenerReturningEventInfos ( Object bean, String eventSetName, String filter, BSFEngine engine, BSFManager manager, String source, int lineNo, int columnNo, Object script, Object dataFromScriptingEngine ) throws BSFException { BSFEventProcessorReturningEventInfos ep = new BSFEventProcessorReturningEventInfos (engine, manager, filter, source, lineNo, columnNo, script, dataFromScriptingEngine ); try { ReflectionUtils.addEventListener (bean, eventSetName, ep); } catch (Exception e) { e.printStackTrace (); throw new BSFException (BSFException.REASON_OTHER_ERROR, "ouch while adding event listener: " + e, e); } } /** * Finds and invokes a method with the given signature on the given * bean. The signature of the method that's invoked is first taken * as the types of the args, but if that fails, this tries to convert * any primitive wrapper type args to their primitive counterparts * to see whether a method exists that way. If it does, done. * * @param bean the object on which to invoke the method * @param methodName name of the method * @param args arguments to be given to the method * * @return the result of invoking the method, if any * * @exception BSFException if something goes wrong */ public static Object callBeanMethod (Object bean, String methodName, Object[] args) throws BSFException { Class[] argTypes = null; // determine arg types. note that a null argtype // matches any object type if (args != null) { argTypes = new Class[args.length]; for (int i = 0; i < args.length; i++) { argTypes[i] = (args[i] == null) ? null : args[i].getClass (); } } // we want to allow a static call to occur on an object, similar // to what Java allows. So isStaticOnly is set to false. boolean isStaticOnly = false; Class beanClass = (bean instanceof Class) ? (Class)bean : bean.getClass (); // now try to call method with the right signature try { Method m; try { m = MethodUtils.getMethod (beanClass, methodName, argTypes, isStaticOnly); } catch (NoSuchMethodException e) { // ok, so that didn't work - now try converting any primitive // wrapper types to their primitive counterparts try { // if args is null the NullPointerException will get caught // below and the right thing'll happen .. ugly but works for (int i = 0; i < args.length; i++) { if (args[i] instanceof Number) { if (args[i] instanceof Byte) argTypes[i] = byte.class; else if (args[i] instanceof Integer) argTypes[i] = int.class; else if (args[i] instanceof Long) argTypes[i] = long.class; else if (args[i] instanceof Float) argTypes[i] = float.class; else if (args[i] instanceof Double ) argTypes[i] = double.class; else if (args[i] instanceof Short ) argTypes[i] = short.class; } else if (args[i] instanceof Boolean) argTypes[i] = boolean.class; else if (args[i] instanceof Character) argTypes[i] = char.class; } m = MethodUtils.getMethod (beanClass, methodName, argTypes, isStaticOnly); } catch (Exception e2) { // throw the original throw e; } } // call it, and return the result try { return m.invoke (bean, args); } catch (Exception e) // 2003-02-23, --rgf, maybe an IllegalAccessException? { if (e instanceof IllegalAccessException && bMethodHasSetAccessible && Modifier.isPublic(m.getModifiers()) ) // if a public method allow access to it { m.setAccessible(true); // allow unconditional access to method return m.invoke (bean, args); } // re-throw the exception throw e; } } catch (Exception e) { // something went wrong while invoking method Throwable t = (e instanceof InvocationTargetException) ? ((InvocationTargetException)e).getTargetException () : null; throw new BSFException (BSFException.REASON_OTHER_ERROR, "method invocation failed: " + e + ((t==null) ? "" : (" target exception: " + t)), t); } } /** * Creates a new bean. The signature of the constructor that's invoked * is first taken as the types of the args, but if that fails, this tries * to convert any primitive wrapper type args to their primitive * counterparts to see whether a method exists that way. If it does, done. * * @param className fully qualified name of class to instantiate * @param args array of constructor args (or null if none) * * @return the created bean * * @exception BSFException if something goes wrong (@see * org.apache.cs.util.MethodUtils for the real * exceptions that can occur). */ public static Object createBean (String className, Object args[]) throws BSFException { Bean obj; Class[] argTypes = null; if (args != null) { argTypes = new Class[args.length]; for (int i = 0; i < args.length; i++) { argTypes[i] = (args[i] != null) ? args[i].getClass () : null; } } try { try { obj = ReflectionUtils.createBean (null, className, argTypes, args); return obj.value; } catch (NoSuchMethodException me) { // ok, so that didn't work - now try converting any primitive // wrapper types to their primitive counterparts try { // if args is null the NullPointerException will get caught // below and the right thing'll happen .. ugly but works for (int i = 0; i < args.length; i++) { if (args[i] instanceof Number) argTypes[i] = byte.class; else if (args[i] instanceof Boolean) argTypes[i] = boolean.class; else if (args[i] instanceof Character) argTypes[i] = char.class; } obj = ReflectionUtils.createBean (null, className, argTypes, args); return obj.value; } catch (Exception e) { // throw the previous exception throw me; } } } catch (Exception e) { throw new BSFException (BSFException.REASON_OTHER_ERROR, e.getMessage (), e); } } /** * Given a class return the type signature string fragment for it. * That is, return "I" for int, "J" for long, ... etc.. * * @param cl class object for whom the signature fragment is needed. * * @return the string representing the type signature */ public static String getTypeSignatureString (Class cl) { if (cl.isPrimitive ()) { if (cl == boolean.class) return "Z"; else if (cl == byte.class) return "B"; else if (cl == char.class) return "C"; else if (cl == short.class) return "S"; else if (cl == int.class) return "I"; else if (cl == long.class) return "J"; else if (cl == float.class) return "F"; else if (cl == double.class) return "D"; else return "V"; } else { StringBuffer sb = new StringBuffer ("L"); sb.append (cl.getName ()); sb.append (";"); return sb.toString().replace ('.', '/'); } } /** * Load a class using the class loader of given manager. If that fails * try using a class loader that loads from the tempdir of the manager. * * @param mgr BSFManager who's classLoader and tempDir props are * consulted * @param name name of the class to load * * @return the loaded class * * @exception BSFException if something goes wrong. */ public static Class loadClass (BSFManager mgr, String name) throws BSFException { ClassLoader classLoader = mgr.getClassLoader (); try { return (classLoader == null) ? // Class.forName (name) Thread.currentThread().getContextClassLoader().loadClass (name) : classLoader.loadClass (name); } catch (ClassNotFoundException e) { // try to load it from the temp dir using my own class loader try { if (bsfCL == null) bsfCL = new BSFClassLoader (); bsfCL.setTempDir (mgr.getTempDir ()); return bsfCL.loadClass (name); } catch (ClassNotFoundException e2) { throw new BSFException (BSFException.REASON_OTHER_ERROR, "unable to load class '" + name + "':" + e, e); } } } } libbsf-java-2.4.0/src/org/apache/bsf/util/ReflectionUtils.java0000644000175000017500000003666610511475734023215 0ustar mkochmkoch/* * Copyright 2004,2004 The Apache Software Foundation. * * Licensed 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. */ package org.apache.bsf.util; import java.beans.BeanInfo; import java.beans.Beans; import java.beans.EventSetDescriptor; import java.beans.FeatureDescriptor; import java.beans.IndexedPropertyDescriptor; import java.beans.IntrospectionException; import java.beans.Introspector; import java.beans.PropertyDescriptor; import java.io.IOException; import java.lang.reflect.Constructor; import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import org.apache.bsf.util.event.EventAdapter; import org.apache.bsf.util.event.EventAdapterRegistry; import org.apache.bsf.util.event.EventProcessor; import org.apache.bsf.util.type.TypeConvertor; import org.apache.bsf.util.type.TypeConvertorRegistry; /** * This file is a collection of reflection utilities. There are utilities * for creating beans, getting bean infos, setting/getting properties, * and binding events. * * @author Sanjiva Weerawarana * @author Joseph Kesselman */ public class ReflectionUtils { ////////////////////////////////////////////////////////////////////////// /** * Add an event processor as a listener to some event coming out of an * object. * * @param source event source * @param eventSetName name of event set from event src to bind to * @param processor event processor the event should be delegated to * when it occurs; either via processEvent or * processExceptionableEvent. * * @exception IntrospectionException if unable to introspect * @exception IllegalArgumentException if event set is unknown * @exception IllegalAccessException if the event adapter class or * initializer is not accessible. * @exception InstantiationException if event adapter instantiation fails * @exception InvocationTargetException if something goes wrong while * running add event listener method */ public static void addEventListener (Object source, String eventSetName, EventProcessor processor) throws IntrospectionException, IllegalArgumentException, IllegalAccessException, InstantiationException, InvocationTargetException { // find the event set descriptor for this event BeanInfo bi = Introspector.getBeanInfo (source.getClass ()); EventSetDescriptor esd = (EventSetDescriptor) findFeatureByName ("event", eventSetName, bi.getEventSetDescriptors ()); if (esd == null) // no events found, maybe a proxy from OpenOffice.org? { throw new IllegalArgumentException ("event set '" + eventSetName + "' unknown for source type '" + source.getClass () + "'"); } // get the class object for the event Class listenerType=esd.getListenerType(); // get ListenerType class object from EventSetDescriptor // find an event adapter class of the right type Class adapterClass = EventAdapterRegistry.lookup (listenerType); if (adapterClass == null) { throw new IllegalArgumentException ("event adapter for listener type " + "'" + listenerType + "' (eventset " + "'" + eventSetName + "') unknown"); } // create the event adapter and give it the event processor EventAdapter adapter = (EventAdapter) adapterClass.newInstance (); adapter.setEventProcessor (processor); // bind the adapter to the source bean Method addListenerMethod; Object[] args; if (eventSetName.equals ("propertyChange") || eventSetName.equals ("vetoableChange")) { // In Java 1.2, beans may have direct listener adding methods // for property and vetoable change events which take the // property name as a filter to be applied at the event source. // The filter property of the event processor should be used // in this case to support the source-side filtering. // // ** TBD **: the following two lines need to change appropriately addListenerMethod = esd.getAddListenerMethod (); args = new Object[] {adapter}; } else { addListenerMethod = esd.getAddListenerMethod (); args = new Object[] {adapter}; } addListenerMethod.invoke (source, args); } ////////////////////////////////////////////////////////////////////////// /** * Create a bean using given class loader and using the appropriate * constructor for the given args of the given arg types. * @param cld the class loader to use. If null, Class.forName is used. * @param className name of class to instantiate * @param argTypes array of argument types * @param args array of arguments * * @return the newly created bean * * @exception ClassNotFoundException if class is not loaded * @exception NoSuchMethodException if constructor can't be found * @exception InstantiationException if class can't be instantiated * @exception IllegalAccessException if class is not accessible * @exception IllegalArgumentException if argument problem * @exception InvocationTargetException if constructor excepted * @exception IOException if I/O error in beans.instantiate */ public static Bean createBean (ClassLoader cld, String className, Class[] argTypes, Object[] args) throws ClassNotFoundException, NoSuchMethodException, InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, IOException { if (argTypes != null) { // find the right constructor and use that to create bean Class cl = (cld != null) ? cld.loadClass (className) : Thread.currentThread().getContextClassLoader().loadClass (className); // rgf, 2006-01-05 // : Class.forName (className); Constructor c = MethodUtils.getConstructor (cl, argTypes); return new Bean (cl, c.newInstance (args)); } else { // create the bean with no args constructor Object obj = Beans.instantiate (cld, className); return new Bean (obj.getClass (), obj); } } ////////////////////////////////////////////////////////////////////////// /** * Create a bean using given class loader and using the appropriate * constructor for the given args. Figures out the arg types and * calls above. * @param cld the class loader to use. If null, Class.forName is used. * @param className name of class to instantiate * @param args array of arguments * * @return the newly created bean * * @exception ClassNotFoundException if class is not loaded * @exception NoSuchMethodException if constructor can't be found * @exception InstantiationException if class can't be instantiated * @exception IllegalAccessException if class is not accessible * @exception IllegalArgumentException if argument problem * @exception InvocationTargetException if constructor excepted * @exception IOException if I/O error in beans.instantiate */ public static Bean createBean (ClassLoader cld, String className, Object[] args) throws ClassNotFoundException, NoSuchMethodException, InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, IOException { Class[] argTypes = null; if (args != null) { argTypes = new Class[args.length]; for (int i = 0; i < args.length; i++) { argTypes[i] = (args[i] != null) ? args[i].getClass () : null; } } return createBean (cld, className, argTypes, args); } ////////////////////////////////////////////////////////////////////////// /** * locate the item in the fds array whose name is as given. returns * null if not found. */ private static FeatureDescriptor findFeatureByName (String featureType, String name, FeatureDescriptor[] fds) { for (int i = 0; i < fds.length; i++) { if (name.equals (fds[i].getName())) { return fds[i]; } } return null; } public static Bean getField (Object target, String fieldName) throws IllegalArgumentException, IllegalAccessException { // This is to handle how we do static fields. Class targetClass = (target instanceof Class) ? (Class) target : target.getClass (); try { Field f = targetClass.getField (fieldName); Class fieldType = f.getType (); // Get the value and return it. Object value = f.get (target); return new Bean (fieldType, value); } catch (NoSuchFieldException e) { throw new IllegalArgumentException ("field '" + fieldName + "' is " + "unknown for '" + target + "'"); } } ////////////////////////////////////////////////////////////////////////// /** * Get a property of a bean. * * @param target the object whose prop is to be gotten * @param propName name of the property to set * @param index index to get (if property is indexed) * * @exception IntrospectionException if unable to introspect * @exception IllegalArgumentException if problems with args: if the * property is unknown, or if the property is given an index * when its not, or if the property is not writeable, or if * the given value cannot be assigned to the it (type mismatch). * @exception IllegalAccessException if read method is not accessible * @exception InvocationTargetException if read method excepts */ public static Bean getProperty (Object target, String propName, Integer index) throws IntrospectionException, IllegalArgumentException, IllegalAccessException, InvocationTargetException { // find the property descriptor BeanInfo bi = Introspector.getBeanInfo (target.getClass ()); PropertyDescriptor pd = (PropertyDescriptor) findFeatureByName ("property", propName, bi.getPropertyDescriptors ()); if (pd == null) { throw new IllegalArgumentException ("property '" + propName + "' is " + "unknown for '" + target + "'"); } // get read method and type of property Method rm; Class propType; if (index != null) { // if index != null, then property is indexed - pd better be so too if (!(pd instanceof IndexedPropertyDescriptor)) { throw new IllegalArgumentException ("attempt to get non-indexed " + "property '" + propName + "' as being indexed"); } IndexedPropertyDescriptor ipd = (IndexedPropertyDescriptor) pd; rm = ipd.getIndexedReadMethod (); propType = ipd.getIndexedPropertyType (); } else { rm = pd.getReadMethod (); propType = pd.getPropertyType (); } if (rm == null) { throw new IllegalArgumentException ("property '" + propName + "' is not readable"); } // now get the value Object propVal = null; if (index != null) { propVal = rm.invoke (target, new Object[] {index}); } else { propVal = rm.invoke (target, null); } return new Bean (propType, propVal); } public static void setField (Object target, String fieldName, Bean value, TypeConvertorRegistry tcr) throws IllegalArgumentException, IllegalAccessException { // This is to handle how we do static fields. Class targetClass = (target instanceof Class) ? (Class) target : target.getClass (); try { Field f = targetClass.getField (fieldName); Class fieldType = f.getType (); // type convert the value if necessary Object fieldVal = null; boolean okeydokey = true; if (fieldType.isAssignableFrom (value.type)) { fieldVal = value.value; } else if (tcr != null) { TypeConvertor cvtor = tcr.lookup (value.type, fieldType); if (cvtor != null) { fieldVal = cvtor.convert (value.type, fieldType, value.value); } else { okeydokey = false; } } else { okeydokey = false; } if (!okeydokey) { throw new IllegalArgumentException ("unable to assign '" + value.value + "' to field '" + fieldName + "'"); } // now set the value f.set (target, fieldVal); } catch (NoSuchFieldException e) { throw new IllegalArgumentException ("field '" + fieldName + "' is " + "unknown for '" + target + "'"); } } ////////////////////////////////////////////////////////////////////////// /** * Set a property of a bean to a given value. * * @param target the object whose prop is to be set * @param propName name of the property to set * @param index index to set (if property is indexed) * @param value the property value * @param valueType the type of the above (needed when its null) * @param tcr type convertor registry to use to convert value type to * property type if necessary * * @exception IntrospectionException if unable to introspect * @exception IllegalArgumentException if problems with args: if the * property is unknown, or if the property is given an index * when its not, or if the property is not writeable, or if * the given value cannot be assigned to the it (type mismatch). * @exception IllegalAccessException if write method is not accessible * @exception InvocationTargetException if write method excepts */ public static void setProperty (Object target, String propName, Integer index, Object value, Class valueType, TypeConvertorRegistry tcr) throws IntrospectionException, IllegalArgumentException, IllegalAccessException, InvocationTargetException { // find the property descriptor BeanInfo bi = Introspector.getBeanInfo (target.getClass ()); PropertyDescriptor pd = (PropertyDescriptor) findFeatureByName ("property", propName, bi.getPropertyDescriptors ()); if (pd == null) { throw new IllegalArgumentException ("property '" + propName + "' is " + "unknown for '" + target + "'"); } // get write method and type of property Method wm; Class propType; if (index != null) { // if index != null, then property is indexed - pd better be so too if (!(pd instanceof IndexedPropertyDescriptor)) { throw new IllegalArgumentException ("attempt to set non-indexed " + "property '" + propName + "' as being indexed"); } IndexedPropertyDescriptor ipd = (IndexedPropertyDescriptor) pd; wm = ipd.getIndexedWriteMethod (); propType = ipd.getIndexedPropertyType (); } else { wm = pd.getWriteMethod (); propType = pd.getPropertyType (); } if (wm == null) { throw new IllegalArgumentException ("property '" + propName + "' is not writeable"); } // type convert the value if necessary Object propVal = null; boolean okeydokey = true; if (propType.isAssignableFrom (valueType)) { propVal = value; } else if (tcr != null) { TypeConvertor cvtor = tcr.lookup (valueType, propType); if (cvtor != null) { propVal = cvtor.convert (valueType, propType, value); } else { okeydokey = false; } } else { okeydokey = false; } if (!okeydokey) { throw new IllegalArgumentException ("unable to assign '" + value + "' to property '" + propName + "'"); } // now set the value if (index != null) { wm.invoke (target, new Object[] {index, propVal}); } else { wm.invoke (target, new Object[] {propVal}); } } } libbsf-java-2.4.0/src/org/apache/bsf/util/BSFEventProcessorReturningEventInfos.java0000644000175000017500000001375510511475734027307 0ustar mkochmkoch/* * This software consists of voluntary contributions made by many individuals * on behalf of the Apache Software Foundation and was originally created by * Sanjiva Weerawarana and others at International Business Machines * Corporation. For more information on the Apache Software Foundation, * please see . */ package org.apache.bsf.util; import java.util.Vector; import org.apache.bsf.BSFEngine; import org.apache.bsf.BSFException; import org.apache.bsf.BSFManager; import org.apache.bsf.util.event.EventProcessor; /* * Copyright (C) 2001-2006 Rony G. Flatscher * * Licensed 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. * */ /** * * This is used to support binding scripts to be run when an event occurs, * forwarding the arguments supplied to the event listener. It is an adapted * version of org.apache.bsf.util.BSFEventProcessor. * * @author Rony G. Flatscher, but most of the code copied from * org.apache.bsf.util.BSFEventProcessor by Sanjiva Weerawarana */ public class BSFEventProcessorReturningEventInfos implements EventProcessor { BSFEngine engine; BSFManager manager; String filter; String source; int lineNo; int columnNo; Object script; Object dataFromScriptingEngine; // ---rgf, 2006-02-24: data coming from the // script engine, could be // e.g. an object reference to forward event with received arguments to /** * Package-protected constructor makes this class unavailable for public * use. * * @param dataFromScriptingEngine * this contains any object supplied by the scripting engine and * gets sent back with the supplied script. This could be used * e.g. for indicating which scripting engine object should be * ultimately informed of the event occurrence. */ BSFEventProcessorReturningEventInfos(BSFEngine engine, BSFManager manager, String filter, String source, int lineNo, int columnNo, Object script, Object dataFromScriptingEngine) throws BSFException { this.engine = engine; this.manager = manager; this.filter = filter; this.source = source; this.lineNo = lineNo; this.columnNo = columnNo; this.script = script; this.dataFromScriptingEngine = dataFromScriptingEngine; } // //////////////////////////////////////////////////////////////////////// // // event is delegated to me by the adapters using this. inFilter is // in general the name of the method via which the event was received // at the adapter. For prop/veto change events, inFilter is the name // of the property. In any case, in the event processor, I only forward // those events if for which the filters match (if one is specified). public void processEvent(String inFilter, Object[] evtInfo) { try { processExceptionableEvent(inFilter, evtInfo); } catch (RuntimeException re) { // rethrow this .. I don't want to intercept run-time stuff // that can in fact occur legit throw re; } catch (Exception e) { // should not occur System.err.println("BSFError: non-exceptionable event delivery " + "threw exception (that's not nice): " + e); e.printStackTrace(); } } // //////////////////////////////////////////////////////////////////////// // // same as above, but used when the method event method may generate // an exception which must go all the way back to the source (as in // the vetoableChange case) public void processExceptionableEvent(String inFilter, Object[] evtInfo) throws Exception { // System.err.println(this+": inFilter=["+inFilter+"], // filter=["+filter+"]"); if ((filter != null) && !filter.equals(inFilter)) { // ignore this event return; } // run the script // engine.exec (source, lineNo, columnNo, script); // create the parameter vectors for engine.apply() Vector paramNames = new Vector(), paramValues = new Vector(); // parameter # 1 // supply the parameters as an array object as sent to the event object // listener // (usually the first entry is the sent event object) paramNames.add("eventParameters"); paramValues.add(evtInfo); // parameter # 2 // supply the data object received from the scripting engine to be sent // with the event paramNames.add("dataFromScriptingEngine"); paramValues.add(this.dataFromScriptingEngine); // can be null as well // parameter # 3 // event filter in place paramNames.add("inFilter"); paramValues.add(inFilter); // event name that has occurred // parameter # 4 // event filter in place paramNames.add("eventFilter"); paramValues.add(this.filter); // can be null as well // parameter # 5 // BSF manager instance (e.g. allows access to its registry) paramNames.add("BSFManager"); paramValues.add(this.manager); engine.apply(source, lineNo, columnNo, this.script, paramNames, paramValues); } } libbsf-java-2.4.0/src/org/apache/bsf/util/StringUtils.java0000644000175000017500000002357710511475734022366 0ustar mkochmkoch/* * Copyright 2004,2004 The Apache Software Foundation. * * Licensed 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. */ package org.apache.bsf.util; import java.beans.Introspector; import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.Reader; import java.io.StringReader; import java.net.MalformedURLException; import java.net.URL; import java.util.StringTokenizer; import java.util.Vector; /** * Deals with strings (probably need to elaborate some more). * * @author Matthew J. Duftler */ public class StringUtils { public static final String lineSeparator = System.getProperty("line.separator", "\n"); public static final String lineSeparatorStr = cleanString(lineSeparator); public static String classNameToVarName(String className) { // Might represent an array. int arrayDim = 0; while (className.endsWith("[]")) { className = className.substring(0, className.length() - 2); arrayDim++; } int iLastPeriod = className.lastIndexOf('.'); String varName = Introspector.decapitalize( iLastPeriod != -1 ? className.substring(iLastPeriod + 1) : className); if (arrayDim > 0) { varName += "_" + arrayDim + "D"; } return getValidIdentifierName(varName); } // Ensure that escape sequences are passed through properly. public static String cleanString(String str) { if (str == null) return null; else { char[] charArray = str.toCharArray(); StringBuffer sBuf = new StringBuffer(); for (int i = 0; i < charArray.length; i++) switch (charArray[i]) { case '\"' : sBuf.append("\\\""); break; case '\\' : sBuf.append("\\\\"); break; case '\n' : sBuf.append("\\n"); break; case '\r' : sBuf.append("\\r"); break; default : sBuf.append(charArray[i]); break; } return sBuf.toString(); } } /** * Get a string consisting of numberOfChars theChars. * * @return a string consisting of numberOfChars theChars. */ public static String getChars(int numberOfChars, char theChar) { if (numberOfChars <= 0) return ""; StringBuffer sRet = new StringBuffer(numberOfChars); for (int i = 0; i < numberOfChars; i++) sRet.append(theChar); return sRet.toString(); } /* This method will return the correct name for a class object representing a primitive, a single instance of a class, as well as n-dimensional arrays of primitives or instances. This logic is needed to handle the string returned from Class.getName(). If the class object represents a single instance (or a primitive), Class.getName() returns the fully-qualified name of the class and no further work is needed. However, if the class object represents an array (of n dimensions), Class.getName() returns a Descriptor (the Descriptor grammar is defined in section 4.3 of the Java VM Spec). This method will parse the Descriptor if necessary. */ public static String getClassName(Class targetClass) { String className = targetClass.getName(); return targetClass.isArray() ? parseDescriptor(className) : className; } public static String getCommaListFromVector(Vector sourceVector) { StringBuffer strBuf = new StringBuffer(); for (int i = 0; i < sourceVector.size(); i++) { strBuf.append((i > 0 ? ", " : "") + sourceVector.elementAt(i)); } return strBuf.toString(); } /* Returns a Reader for reading from the specified resource, if the resource points to a stream. */ public static Reader getContentAsReader(URL url) throws SecurityException, IllegalArgumentException, IOException { if (url == null) { throw new IllegalArgumentException("URL cannot be null."); } try { Object content = url.getContent(); if (content == null) { throw new IllegalArgumentException("No content."); } if (content instanceof InputStream) { Reader in = new InputStreamReader((InputStream)content); if (in.ready()) { return in; } else { throw new FileNotFoundException(); } } else { throw new IllegalArgumentException((content instanceof String) ? (String)content : "This URL points to a: " + StringUtils.getClassName(content.getClass())); } } catch (SecurityException e) { throw new SecurityException("Your JVM's SecurityManager has disallowed this."); } catch (FileNotFoundException e) { throw new FileNotFoundException("This file was not found: " + url); } } /* Shorthand for: IOUtils.getStringFromReader(getContentAsReader(url)). */ public static String getContentAsString(URL url) throws SecurityException, IllegalArgumentException, IOException { return IOUtils.getStringFromReader(getContentAsReader(url)); } // Handles multi-line strings. public static String getSafeString(String scriptStr) { BufferedReader in = new BufferedReader(new StringReader(scriptStr)); StringBuffer strBuf = new StringBuffer(); String tempLine, previousLine = null; try { while ((tempLine = in.readLine()) != null) { if (previousLine != null) { strBuf.append("\"" + previousLine + lineSeparatorStr + "\" +" + lineSeparator); } previousLine = cleanString(tempLine); } } catch (IOException e) { } strBuf.append("\"" + (previousLine != null ? previousLine : "") + "\"" + lineSeparator); return strBuf.toString(); } /* */ public static URL getURL(URL contextURL, String spec) throws MalformedURLException { return getURL(contextURL, spec, 1); } /* The recursiveDepth argument is used to insure that the algorithm gives up after hunting 2 levels up in the contextURL's path. */ private static URL getURL(URL contextURL, String spec, int recursiveDepth) throws MalformedURLException { URL url = null; try { url = new URL(contextURL, spec); try { url.openStream(); } catch (IOException ioe1) { throw new MalformedURLException("This file was not found: " + url); } } catch (MalformedURLException e1) { url = new URL("file", "", spec); try { url.openStream(); } catch (IOException ioe2) { if (contextURL != null) { String contextFileName = contextURL.getFile(); String parentName = new File(contextFileName).getParent(); if (parentName != null && recursiveDepth < 3) { return getURL(new URL("file", "", parentName + '/'), spec, recursiveDepth + 1); } } throw new MalformedURLException("This file was not found: " + url); } } return url; } public static String getValidIdentifierName(String identifierName) { if (identifierName == null || identifierName.length() == 0) return null; StringBuffer strBuf = new StringBuffer(); char[] chars = identifierName.toCharArray(); strBuf.append(Character.isJavaIdentifierStart(chars[0]) ? chars[0] : '_' ); for (int i = 1; i < chars.length; i++) { strBuf.append(Character.isJavaIdentifierPart(chars[i]) ? chars[i] : '_' ); } return strBuf.toString(); } public static boolean isValidIdentifierName(String identifierName) { if (identifierName == null || identifierName.length() == 0) return false; char[] chars = identifierName.toCharArray(); if (!Character.isJavaIdentifierStart(chars[0])) return false; for (int i = 1; i < chars.length; i++) if (!Character.isJavaIdentifierPart(chars[i])) return false; return true; } public static boolean isValidPackageName(String packageName) { if (packageName == null) return false; else if (packageName.length() == 0) // Empty is ok. return true; StringTokenizer strTok = new StringTokenizer(packageName, ".", true); // Should have an odd number of tokens (including '.' delimiters). if (strTok.countTokens() % 2 != 1) return false; // Must start with a valid identifier name. if (!isValidIdentifierName(strTok.nextToken())) return false; // ... followed by 0 or more of ".ValidIdentifier". while (strTok.hasMoreTokens()) { // Must be a '.'. if (!strTok.nextToken().equals(".")) return false; // Must be a valid identifier name. if (strTok.hasMoreTokens()) { if (!isValidIdentifierName(strTok.nextToken())) return false; } else return false; } return true; } /* See the comment above for getClassName(targetClass)... */ private static String parseDescriptor(String className) { char[] classNameChars = className.toCharArray(); int arrayDim = 0; int i = 0; while (classNameChars[i] == '[') { arrayDim++; i++; } StringBuffer classNameBuf = new StringBuffer(); switch (classNameChars[i++]) { case 'B' : classNameBuf.append("byte"); break; case 'C' : classNameBuf.append("char"); break; case 'D' : classNameBuf.append("double"); break; case 'F' : classNameBuf.append("float"); break; case 'I' : classNameBuf.append("int"); break; case 'J' : classNameBuf.append("long"); break; case 'S' : classNameBuf.append("short"); break; case 'Z' : classNameBuf.append("boolean"); break; case 'L' : classNameBuf.append(classNameChars, i, classNameChars.length - i - 1); break; } for (i = 0; i < arrayDim; i++) classNameBuf.append("[]"); return classNameBuf.toString(); } } libbsf-java-2.4.0/src/org/apache/bsf/util/JNIUtils.h0000644000175000017500000000456610511475734021043 0ustar mkochmkoch/* * Copyright 2003,2004 The Apache Software Foundation. * * Licensed 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. */ #include #if defined(__cplusplus) extern "C" { #endif /* throw a BSFException with the given message */ extern void bsf_exception (JNIEnv *jenv, int code, char *msg); /* cvt a pointer to a Long object whose value is the pointer value */ extern jobject bsf_pointer2longobj (JNIEnv *jenv, void *ptr); /* cvt a Long object whose value is the pointer value to the pointer */ extern void *bsf_longobj2pointer (JNIEnv *jenv, jobject lobj); /* convert an object to a string obj */ jstring bsf_obj2jstring (JNIEnv *jenv, jobject obj); /* cvt an object to a c-string .. wastes memory, but useful for debug */ const char *bsf_obj2cstring (JNIEnv *jenv, jobject obj); /* create an instance of the named class with the given args */ extern jobject bsf_createbean (JNIEnv *jenv, char *methodname, jobjectArray args); /* call the named method with the given args on the given bean */ extern jobject bsf_callmethod (JNIEnv *jenv, jobject target, char *methodname, jobjectArray args); /* return the named bean from the given mgr's bean registry */ extern jobject bsf_lookupbean (JNIEnv *jenv, jobject mgr, char *beanname); /* return the type signature string component for the given type: I for ints, J for long, ... */ extern char *bsf_getTypeSignatureString (JNIEnv *jenv, jclass objclass); /* make objects from primitives */ extern jobject bsf_makeBoolean (JNIEnv *jenv, int val); extern jobject bsf_makeByte (JNIEnv *jenv, int val); extern jobject bsf_makeShort (JNIEnv *jenv, int val); extern jobject bsf_makeInteger (JNIEnv *jenv, int val); extern jobject bsf_makeLong (JNIEnv *jenv, long val); extern jobject bsf_makeFloat (JNIEnv *jenv, float val); extern jobject bsf_makeDouble (JNIEnv *jenv, double val); #if defined(__cplusplus) } #endif libbsf-java-2.4.0/src/org/apache/bsf/util/event/0000755000175000017500000000000010736513022020327 5ustar mkochmkochlibbsf-java-2.4.0/src/org/apache/bsf/util/event/adapters/0000755000175000017500000000000010736513022022132 5ustar mkochmkochlibbsf-java-2.4.0/src/org/apache/bsf/util/event/adapters/java_awt_event_ItemAdapter.java0000644000175000017500000000177210511475734030270 0ustar mkochmkoch/* * Copyright 2004,2004 The Apache Software Foundation. * * Licensed 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. */ package org.apache.bsf.util.event.adapters; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import org.apache.bsf.util.event.EventAdapterImpl; public class java_awt_event_ItemAdapter extends EventAdapterImpl implements ItemListener { public void itemStateChanged (ItemEvent e) { eventProcessor.processEvent ("itemStateChanged", new Object[]{e}); } } libbsf-java-2.4.0/src/org/apache/bsf/util/event/adapters/java_awt_event_MouseMotionAdapter.java0000644000175000017500000000216410511475734031644 0ustar mkochmkoch/* * Copyright 2004,2004 The Apache Software Foundation. * * Licensed 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. */ package org.apache.bsf.util.event.adapters; import java.awt.event.MouseEvent; import java.awt.event.MouseMotionListener; import org.apache.bsf.util.event.EventAdapterImpl; public class java_awt_event_MouseMotionAdapter extends EventAdapterImpl implements MouseMotionListener { public void mouseDragged(MouseEvent e) { eventProcessor.processEvent ("mouseDragged", new Object[]{e}); } public void mouseMoved(MouseEvent e) { eventProcessor.processEvent ("mouseMoved", new Object[]{e}); } } libbsf-java-2.4.0/src/org/apache/bsf/util/event/adapters/java_awt_event_ActionAdapter.java0000644000175000017500000000200110511475734030571 0ustar mkochmkoch/* * Copyright 2004,2004 The Apache Software Foundation. * * Licensed 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. */ package org.apache.bsf.util.event.adapters; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import org.apache.bsf.util.event.EventAdapterImpl; public class java_awt_event_ActionAdapter extends EventAdapterImpl implements ActionListener { public void actionPerformed (ActionEvent e) { eventProcessor.processEvent ("actionPerformed", new Object[]{e}); } } libbsf-java-2.4.0/src/org/apache/bsf/util/event/adapters/java_awt_event_WindowAdapter.java0000644000175000017500000000334110511475734030633 0ustar mkochmkoch/* * Copyright 2004,2004 The Apache Software Foundation. * * Licensed 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. */ package org.apache.bsf.util.event.adapters; import java.awt.event.WindowEvent; import java.awt.event.WindowListener; import org.apache.bsf.util.event.EventAdapterImpl; public class java_awt_event_WindowAdapter extends EventAdapterImpl implements WindowListener { public void windowActivated (WindowEvent e) { eventProcessor.processEvent ("windowActivated", new Object[]{e}); } public void windowClosed (WindowEvent e) { eventProcessor.processEvent ("windowClosed", new Object[]{e}); } public void windowClosing (WindowEvent e) { eventProcessor.processEvent ("windowClosing", new Object[]{e}); } public void windowDeactivated (WindowEvent e) { eventProcessor.processEvent ("windowDeactivated", new Object[]{e}); } public void windowDeiconified (WindowEvent e) { eventProcessor.processEvent ("windowDeiconified", new Object[]{e}); } public void windowIconified (WindowEvent e) { eventProcessor.processEvent ("windowIconified", new Object[]{e}); } public void windowOpened (WindowEvent e) { eventProcessor.processEvent ("windowOpened", new Object[]{e}); } } libbsf-java-2.4.0/src/org/apache/bsf/util/event/adapters/java_awt_event_AdjustmentAdapter.java0000644000175000017500000000204410511475734031501 0ustar mkochmkoch/* * Copyright 2004,2004 The Apache Software Foundation. * * Licensed 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. */ package org.apache.bsf.util.event.adapters; import java.awt.event.AdjustmentEvent; import java.awt.event.AdjustmentListener; import org.apache.bsf.util.event.EventAdapterImpl; public class java_awt_event_AdjustmentAdapter extends EventAdapterImpl implements AdjustmentListener { public void adjustmentValueChanged (AdjustmentEvent e) { eventProcessor.processEvent ("adjustmentValueChanged", new Object[]{e}); } } libbsf-java-2.4.0/src/org/apache/bsf/util/event/adapters/java_awt_event_ComponentAdapter.java0000644000175000017500000000257410511475734031335 0ustar mkochmkoch/* * Copyright 2004,2004 The Apache Software Foundation. * * Licensed 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. */ package org.apache.bsf.util.event.adapters; import java.awt.event.ComponentEvent; import java.awt.event.ComponentListener; import org.apache.bsf.util.event.EventAdapterImpl; public class java_awt_event_ComponentAdapter extends EventAdapterImpl implements ComponentListener { public void componentHidden (ComponentEvent e) { eventProcessor.processEvent ("componentHidden", new Object[]{e}); } public void componentMoved (ComponentEvent e) { eventProcessor.processEvent ("componentMoved", new Object[]{e}); } public void componentResized (ComponentEvent e) { eventProcessor.processEvent ("componentResized", new Object[]{e}); } public void componentShown (ComponentEvent e) { eventProcessor.processEvent ("componentShown", new Object[]{e}); } } libbsf-java-2.4.0/src/org/apache/bsf/util/event/adapters/java_awt_event_KeyAdapter.java0000644000175000017500000000227210511475734030116 0ustar mkochmkoch/* * Copyright 2004,2004 The Apache Software Foundation. * * Licensed 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. */ package org.apache.bsf.util.event.adapters; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import org.apache.bsf.util.event.EventAdapterImpl; public class java_awt_event_KeyAdapter extends EventAdapterImpl implements KeyListener { public void keyPressed (KeyEvent e) { eventProcessor.processEvent ("keyPressed", new Object[]{e}); } public void keyReleased (KeyEvent e) { eventProcessor.processEvent ("keyReleased", new Object[]{e}); } public void keyTyped (KeyEvent e) { eventProcessor.processEvent ("keyTyped", new Object[]{e}); } } libbsf-java-2.4.0/src/org/apache/bsf/util/event/adapters/java_awt_event_ContainerAdapter.java0000644000175000017500000000221210511475734031302 0ustar mkochmkoch/* * Copyright 2004,2004 The Apache Software Foundation. * * Licensed 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. */ package org.apache.bsf.util.event.adapters; import java.awt.event.ContainerEvent; import java.awt.event.ContainerListener; import org.apache.bsf.util.event.EventAdapterImpl; public class java_awt_event_ContainerAdapter extends EventAdapterImpl implements ContainerListener { public void componentAdded (ContainerEvent e) { eventProcessor.processEvent ("componentAdded", new Object[]{e}); } public void componentRemoved (ContainerEvent e) { eventProcessor.processEvent ("componentRemoved", new Object[]{e}); } } libbsf-java-2.4.0/src/org/apache/bsf/util/event/adapters/java_beans_VetoableChangeAdapter.java0000644000175000017500000000232010511475734031323 0ustar mkochmkoch/* * Copyright 2004,2004 The Apache Software Foundation. * * Licensed 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. */ package org.apache.bsf.util.event.adapters; import java.beans.PropertyChangeEvent; import java.beans.PropertyVetoException; import java.beans.VetoableChangeListener; import org.apache.bsf.util.event.EventAdapterImpl; public class java_beans_VetoableChangeAdapter extends EventAdapterImpl implements VetoableChangeListener { public void vetoableChange (PropertyChangeEvent e) throws PropertyVetoException { try { eventProcessor.processExceptionableEvent (e.getPropertyName(), new Object[]{e}); } catch (PropertyVetoException ex) { throw ex; } catch (Exception ex) { } } } libbsf-java-2.4.0/src/org/apache/bsf/util/event/adapters/java_awt_event_FocusAdapter.java0000644000175000017500000000213510511475734030443 0ustar mkochmkoch/* * Copyright 2004,2004 The Apache Software Foundation. * * Licensed 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. */ package org.apache.bsf.util.event.adapters; import java.awt.event.FocusEvent; import java.awt.event.FocusListener; import org.apache.bsf.util.event.EventAdapterImpl; public class java_awt_event_FocusAdapter extends EventAdapterImpl implements FocusListener { public void focusGained (FocusEvent e) { eventProcessor.processEvent ("focusGained", new Object[]{e}); } public void focusLost (FocusEvent e) { eventProcessor.processEvent ("focusLost", new Object[]{e}); } } libbsf-java-2.4.0/src/org/apache/bsf/util/event/adapters/java_beans_PropertyChangeAdapter.java0000644000175000017500000000203610511475734031412 0ustar mkochmkoch/* * Copyright 2004,2004 The Apache Software Foundation. * * Licensed 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. */ package org.apache.bsf.util.event.adapters; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import org.apache.bsf.util.event.EventAdapterImpl; public class java_beans_PropertyChangeAdapter extends EventAdapterImpl implements PropertyChangeListener { public void propertyChange(PropertyChangeEvent e) { eventProcessor.processEvent (e.getPropertyName(), new Object[]{e}); } } libbsf-java-2.4.0/src/org/apache/bsf/util/event/adapters/java_awt_event_TextAdapter.java0000644000175000017500000000177310511475734030317 0ustar mkochmkoch/* * Copyright 2004,2004 The Apache Software Foundation. * * Licensed 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. */ package org.apache.bsf.util.event.adapters; import java.awt.event.TextEvent; import java.awt.event.TextListener; import org.apache.bsf.util.event.EventAdapterImpl; public class java_awt_event_TextAdapter extends EventAdapterImpl implements TextListener { public void textValueChanged (TextEvent e) { eventProcessor.processEvent ("textValueChanged", new Object[]{e}); } } libbsf-java-2.4.0/src/org/apache/bsf/util/event/adapters/java_awt_event_MouseAdapter.java0000644000175000017500000000266510511475734030464 0ustar mkochmkoch/* * Copyright 2004,2004 The Apache Software Foundation. * * Licensed 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. */ package org.apache.bsf.util.event.adapters; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import org.apache.bsf.util.event.EventAdapterImpl; public class java_awt_event_MouseAdapter extends EventAdapterImpl implements MouseListener { public void mouseClicked (MouseEvent e) { eventProcessor.processEvent ("mouseClicked", new Object[]{e}); } public void mouseEntered (MouseEvent e) { eventProcessor.processEvent ("mouseEntered", new Object[]{e}); } public void mouseExited (MouseEvent e) { eventProcessor.processEvent ("mouseExited", new Object[]{e}); } public void mousePressed (MouseEvent e) { eventProcessor.processEvent ("mousePressed", new Object[]{e}); } public void mouseReleased (MouseEvent e) { eventProcessor.processEvent ("mouseReleased", new Object[]{e}); } } libbsf-java-2.4.0/src/org/apache/bsf/util/event/EventAdapter.java0000644000175000017500000000262710511475734023573 0ustar mkochmkoch/* * Copyright 2004,2004 The Apache Software Foundation. * * Licensed 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. */ package org.apache.bsf.util.event; /** * EventAdapter is the interface that all event adapters must * implement in order to work with the automatic event adapter generation * model. This interface requires that the adapter implement a method * that allows setting the event processor delegated to process the event * after the adapter has received the event from the event source. The * task of any event adapter is to receive the event and then delegate it * to the event processor assigned to it, using either * eventProcessor.processEvent or eventProcessor.processExceptionableEvent. * * @author Sanjiva Weerawarana * @author Matthew J. Duftler * @see EventProcessor */ public interface EventAdapter { public void setEventProcessor (EventProcessor eventProcessor); } libbsf-java-2.4.0/src/org/apache/bsf/util/event/EventAdapterRegistry.java0000644000175000017500000000725510511475734025326 0ustar mkochmkoch/* * Copyright 2004,2004 The Apache Software Foundation. * * Licensed 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. */ package org.apache.bsf.util.event; import java.util.Hashtable; import org.apache.bsf.util.event.generator.EventAdapterGenerator; /** * The EventAdapterRegistry is the registry of event adapters. * If a desired adapter is not found, the adapter will be dynamically * generated when lookup is attempted. Set the dynamic property * to false to disable this feature. *

* This implementation first looks for an adapter in its lookup table * and if it doesn't find one looks for a standard implementation of * that adapter in the org.apache.bsf.util.event.adapters package with a * standard naming convention. The naming convention it assumes is the * following: for event listener type a.b.c.FooListener, * it loads an adapter of type * org.apache.bsf.util.event.adapters.a_b_c_FooAdapter. * If both the loading and the dynamic generation fail, then a * null is returned. *

* * @author Sanjiva Weerawarana * @author Matthew J. Duftler * @see EventAdapter */ public class EventAdapterRegistry { private static Hashtable reg = new Hashtable (); private static ClassLoader cl = null; private static String adapterPackage = "org.apache.bsf.util.event.adapters"; private static String adapterSuffix = "Adapter"; private static boolean dynamic = true; public static Class lookup (Class listenerType) { String key = listenerType.getName().replace ('.', '_'); Class adapterClass = (Class) reg.get (key); if (adapterClass == null) { String en = key.substring (0, key.lastIndexOf ("Listener")); String cn = adapterPackage + "." + en + adapterSuffix; try { // Try to resolve one. // adapterClass = (cl != null) ? cl.loadClass (cn) : Class.forName (cn); adapterClass = (cl != null) ? cl.loadClass (cn) : Thread.currentThread().getContextClassLoader().loadClass (cn); // rgf, 2006-01-05 } catch (ClassNotFoundException e) { if (dynamic) { // Unable to resolve one, try to generate one. adapterClass = // if second argument is set to 'true', then the class file will be stored in the filesystem EventAdapterGenerator.makeEventAdapterClass (listenerType, false); } } if (adapterClass != null) { reg.put (key, adapterClass); } } return adapterClass; } public static void register (Class listenerType, Class eventAdapterClass) { String key = listenerType.getName().replace('.', '_'); reg.put (key, eventAdapterClass); } /** * Class loader to use to load event adapter classes. */ public static void setClassLoader (ClassLoader cloader) { cl = cloader; } /** * Indicates whether or not to dynamically generate adapters; default is * true. *

* If the dynamic property is set to true, and the * ClassLoader is unable to resolve an adapter, one will be * dynamically generated. * * @param dynamic whether or not to dynamically generate adapters. */ public static void setDynamic (boolean dynamic) { EventAdapterRegistry.dynamic = dynamic; } } libbsf-java-2.4.0/src/org/apache/bsf/util/event/generator/0000755000175000017500000000000010736513022022315 5ustar mkochmkochlibbsf-java-2.4.0/src/org/apache/bsf/util/event/generator/AdapterClassLoader.java0000644000175000017500000000431010511475734026663 0ustar mkochmkoch/* * Copyright 2004,2004 The Apache Software Foundation. * * Licensed 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. */ package org.apache.bsf.util.event.generator; import java.util.Hashtable; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public class AdapterClassLoader extends ClassLoader { private static Hashtable classCache = new Hashtable(); private Class c; private Log logger = LogFactory.getLog(this.getClass().getName()); public AdapterClassLoader() { super(); } public synchronized Class defineClass(String name, byte[] b) { if ((c = getLoadedClass(name)) == null) { c = defineClass(name.replace('/','.'), b, 0, b.length); // rgf, 2006-02-03 put(name, c); } else { logger.error("AdapterClassLoader: " + c + " previously loaded. Can not redefine class."); } return c; } final protected Class findClass(String name) { return get(name); } final protected Class get(String name) { return (Class)classCache.get(name); } public synchronized Class getLoadedClass(String name) { Class c = findLoadedClass(name); if (c == null) { try { c = findSystemClass(name); } catch (ClassNotFoundException e) { } } if (c == null) { c = findClass(name); } return c; } protected synchronized Class loadClass(String name, boolean resolve) throws ClassNotFoundException { Class c = getLoadedClass(name); if (c != null && resolve) { resolveClass(c); } return c; } // Not in JDK 1.1, only in JDK 1.2. // public AdapterClassLoader(ClassLoader loader) // { // super(loader); // } final protected void put(String name, Class c) { classCache.put(name, c); } } libbsf-java-2.4.0/src/org/apache/bsf/util/event/generator/ByteUtility.java0000644000175000017500000001624010511475734025462 0ustar mkochmkoch/* * Copyright 2004,2004 The Apache Software Foundation. * * Licensed 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. */ package org.apache.bsf.util.event.generator; /** * Byte handling utilities * * 5 April 1999 - functions to append standard types to byte arrays * functions to produce standard types from byte arrays * * @author Richard F. Boehme * */ public class ByteUtility { public static byte[] addBytes(byte[] array,byte[] value) { if( null != array ) { byte newarray[] = new byte[array.length + value.length]; System.arraycopy(array,0,newarray,0,array.length); System.arraycopy(value,0,newarray,array.length,value.length); array = newarray; } else { array = value; } return array; } public static byte[] addBytes(byte[] array, byte value) { if( null != array ) { byte newarray[] = new byte[array.length + 1]; System.arraycopy(array,0,newarray,0,array.length); newarray[newarray.length-1] = value; array = newarray; } else { array = new byte[1]; array[0] = value; } return array; } public static byte[] addBytes(byte[] array, int value) { if( null != array ) { byte newarray[] = new byte[array.length + 3]; System.arraycopy(array,0,newarray,0,array.length); newarray[newarray.length-3] = (byte) (( value >> 16 ) & 0xFF); newarray[newarray.length-2] = (byte) (( value >> 8 ) & 0xFF); newarray[newarray.length-1] = (byte) ( value & 0xFF); array = newarray; } else { array = new byte[3]; array[0] = (byte) (( value >> 16 ) & 0xFF); array[1] = (byte) (( value >> 8 ) & 0xFF); array[2] = (byte) ( value & 0xFF); } return array; } public static byte[] addBytes(byte[] array, long value) { if( null != array ) { byte newarray[] = new byte[array.length + 4]; System.arraycopy(array,0,newarray,0,array.length); newarray[newarray.length-4] = (byte) (( value >> 24 ) & 0xFF); newarray[newarray.length-3] = (byte) (( value >> 16 ) & 0xFF); newarray[newarray.length-2] = (byte) (( value >> 8 ) & 0xFF); newarray[newarray.length-1] = (byte) ( value & 0xFF); array = newarray; } else { array = new byte[4]; array[0] = (byte) (( value >> 24 ) & 0xFF); array[1] = (byte) (( value >> 16 ) & 0xFF); array[2] = (byte) (( value >> 8 ) & 0xFF); array[3] = (byte) (value & 0xFF); } return array; } public static byte[] addBytes(byte[] array,String value) { if( null != value ) { if( null != array) { byte newarray[] = new byte[array.length + value.length()]; System.arraycopy(array,0,newarray,0,array.length); System.arraycopy(value.getBytes(),0,newarray,array.length,value.length()); array = newarray; } else { array = value.getBytes(); } } return array; } public static byte[] addBytes(byte[] array, short value) { if( null != array) { byte newarray[] = new byte[array.length + 2]; System.arraycopy(array,0,newarray,0,array.length); newarray[newarray.length-2] = (byte) (( value >> 8 ) & 0xFF); newarray[newarray.length-1] = (byte) ( value & 0xFF); array = newarray; } else { array = new byte[2]; array[0] = (byte) (( value >> 8 ) & 0xFF); array[1] = (byte) ( value & 0xFF); } return array; } public static double byteArrayToDouble(byte high[], byte low[]) { double temp = 0; // high bytes temp += (((long)high[0]) & 0xFF) << 56; temp += (((long)high[1]) & 0xFF) << 48; temp += (((long)high[2]) & 0xFF) << 40; temp += (((long)high[3]) & 0xFF) << 32; // low bytes temp += (((long)low[0]) & 0xFF) << 24; temp += (((long)low[1]) & 0xFF) << 16; temp += (((long)low[2]) & 0xFF) << 8; temp += (((long)low[3]) & 0xFF); return temp; } public static double byteArrayToDouble(byte value[]) { byte high[] = new byte[4]; byte low[] = new byte[4]; high[0] = value[0]; high[1] = value[1]; high[2] = value[2]; high[3] = value[3]; low[0] = value[4]; low[1] = value[5]; low[2] = value[6]; low[3] = value[7]; return byteArrayToDouble(high,low); } public static float byteArrayToFloat(byte value[]) { float temp = 0; temp += (((int)value[0]) & 0xFF) << 24; temp += (((int)value[1]) & 0xFF) << 16; temp += (((int)value[2]) & 0xFF) << 8; temp += (((int)value[3]) & 0xFF); return temp; } public static int byteArrayToInt(byte value[]) { int temp = 0; temp += (((int)value[0]) & 0xFF) << 24; temp += (((int)value[1]) & 0xFF) << 16; temp += (((int)value[2]) & 0xFF) << 8; temp += (((int)value[3]) & 0xFF); return temp; } public static long byteArrayToLong(byte value[]) { byte high[] = new byte[4]; byte low[] = new byte[4]; high[0] = value[0]; high[1] = value[1]; high[2] = value[2]; high[3] = value[3]; low[0] = value[4]; low[1] = value[5]; low[2] = value[6]; low[3] = value[7]; return byteArrayToLong(high,low); } public static long byteArrayToLong(byte high[], byte low[]) { long temp = 0; // high bytes temp += (((long)high[0]) & 0xFF) << 56; temp += (((long)high[1]) & 0xFF) << 48; temp += (((long)high[2]) & 0xFF) << 40; temp += (((long)high[3]) & 0xFF) << 32; // low bytes temp += (((long)low[0]) & 0xFF) << 24; temp += (((long)low[1]) & 0xFF) << 16; temp += (((long)low[2]) & 0xFF) << 8; temp += (((long)low[3]) & 0xFF); return temp; } // make the following loops with check on array length ***************** public static short byteArrayToShort(byte value[]) { short temp = 0; temp += (((int)value[0]) & 0xFF) << 8; temp += (((int)value[1]) & 0xFF); return temp; } public static String byteToHexString(byte value) { String temp = null; switch( (value & 0xF0) >> 4 ) { case 0: temp = "0"; break; case 1: temp = "1"; break; case 2: temp = "2"; break; case 3: temp = "3"; break; case 4: temp = "4"; break; case 5: temp = "5"; break; case 6: temp = "6"; break; case 7: temp = "7"; break; case 8: temp = "8"; break; case 9: temp = "9"; break; case 10: temp = "A"; break; case 11: temp = "B"; break; case 12: temp = "C"; break; case 13: temp = "D"; break; case 14: temp = "E"; break; case 15: temp = "F"; break; } switch( (value & 0x0F) ) { case 0: temp += "0"; break; case 1: temp += "1"; break; case 2: temp += "2"; break; case 3: temp += "3"; break; case 4: temp += "4"; break; case 5: temp += "5"; break; case 6: temp += "6"; break; case 7: temp += "7"; break; case 8: temp += "8"; break; case 9: temp += "9"; break; case 10: temp += "A"; break; case 11: temp += "B"; break; case 12: temp += "C"; break; case 13: temp += "D"; break; case 14: temp += "E"; break; case 15: temp += "F"; break; } return temp; } } libbsf-java-2.4.0/src/org/apache/bsf/util/event/generator/EventAdapterGenerator.java0000644000175000017500000005477210511475734027440 0ustar mkochmkoch/* * Copyright 2004,2004 The Apache Software Foundation. * * Licensed 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. */ package org.apache.bsf.util.event.generator; import java.io.FileOutputStream; import java.io.IOException; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** EventAdapterGenerator * * Generate an "Event Adapter" dynamically during program execution * **/ public class EventAdapterGenerator { public static AdapterClassLoader ldr = new AdapterClassLoader(); static Class EVENTLISTENER = null; static String CLASSPACKAGE = "org/apache/bsf/util/event/adapters/"; static String WRITEDIRECTORY = null; // starting 8 bytes of all Java Class files static byte CLASSHEADER[]; // constant pool items found in all event adapters static short BASECPCOUNT; // number of cp items + 1 ( cp item # 0 reserved for JVM ) static byte BASECP[]; // // some bytes in the middle of the class file (see below) static byte FIXEDCLASSBYTES[]; // the initialization method, noargs constructor static byte INITMETHOD[]; private static Log logger; /* The static initializer */ static { logger = LogFactory.getLog( (org.apache.bsf.util.event.generator.EventAdapterGenerator.class).getName()); String USERCLASSPACKAGE = System.getProperty("DynamicEventClassPackage", ""); if (!USERCLASSPACKAGE.equals("")) { CLASSPACKAGE = USERCLASSPACKAGE; } if(CLASSPACKAGE.length() > 0 ) { CLASSPACKAGE = CLASSPACKAGE.replace('\\','/'); if(!CLASSPACKAGE.endsWith("/")) { CLASSPACKAGE = CLASSPACKAGE+"/"; } } WRITEDIRECTORY = System.getProperty("DynamicEventClassWriteDirectory",CLASSPACKAGE); if(WRITEDIRECTORY.length() > 0 ) { WRITEDIRECTORY = WRITEDIRECTORY.replace('\\','/'); if(!WRITEDIRECTORY.endsWith("/")) { WRITEDIRECTORY = WRITEDIRECTORY+"/"; } } try // { EVENTLISTENER = Class.forName("java.util.EventListener"); } { EVENTLISTENER = Thread.currentThread().getContextClassLoader().loadClass ("java.util.EventListener"); } // rgf, 2006-01-05 catch(ClassNotFoundException ex) { System.err.println(ex.getMessage()); ex.printStackTrace(); } // start of the Java Class File CLASSHEADER = ByteUtility.addBytes(CLASSHEADER,(byte)0xCA); // magic CLASSHEADER = ByteUtility.addBytes(CLASSHEADER,(byte)0xFE); // magic CLASSHEADER = ByteUtility.addBytes(CLASSHEADER,(byte)0xBA); // magic CLASSHEADER = ByteUtility.addBytes(CLASSHEADER,(byte)0xBE); // magic CLASSHEADER = ByteUtility.addBytes(CLASSHEADER,(short)3); // minor version CLASSHEADER = ByteUtility.addBytes(CLASSHEADER,(short)45); // major version // Start the constant pool for base items in all event adapter classes BASECPCOUNT = 17; // number of cp items + 1 ( cp item # 0 reserved for JVM ) // cp item 01 BASECP = Bytecode.addUtf8(BASECP,"()V"); // cp item 02 BASECP = Bytecode.addUtf8(BASECP,""); // cp item 03 BASECP = Bytecode.addUtf8(BASECP,"Code"); // cp item 04 BASECP = Bytecode.addUtf8(BASECP,"eventProcessor"); // cp item 05 BASECP = Bytecode.addUtf8(BASECP,"java/lang/Object"); // cp item 06 BASECP = Bytecode.addUtf8(BASECP,"org/apache/bsf/util/event/EventAdapterImpl"); // cp item 07 BASECP = Bytecode.addUtf8(BASECP,"org/apache/bsf/util/event/EventProcessor"); // cp item 08 BASECP = Bytecode.addUtf8(BASECP,"(Ljava/lang/String;[Ljava/lang/Object;)V"); // cp item 09 BASECP = Bytecode.addUtf8(BASECP,"Lorg/apache/bsf/util/event/EventProcessor;"); // cp item 10 BASECP = Bytecode.addClass(BASECP,(short)5); // Class "java/lang/Object" // cp item 11 BASECP = Bytecode.addClass(BASECP,(short)6); // Class "org/apache/bsf/util/event/EventAdapterImpl" // cp item 12 BASECP = Bytecode.addClass(BASECP,(short)7); // Class "org/apache/bsf/util/event/EventProcessor" // cp item 13 BASECP = Bytecode.addNameAndType(BASECP,(short)2,(short)1); // "" "()V" // cp item 14 BASECP = Bytecode.addNameAndType(BASECP,(short)4,(short)9); // "eventProcessor" "Lorg/apache/bsf/util/event/EventProcessor;" // cp item 15 BASECP = Bytecode.addFieldRef(BASECP,(short)11,(short)14); // cp item 16 BASECP = Bytecode.addMethodRef(BASECP,(short)11,(short)13); // fixed bytes in middle of class file FIXEDCLASSBYTES = ByteUtility.addBytes(FIXEDCLASSBYTES,(short)0x21); // access_flags (fixed) FIXEDCLASSBYTES = ByteUtility.addBytes(FIXEDCLASSBYTES,(short)20); // this_class (fixed) FIXEDCLASSBYTES = ByteUtility.addBytes(FIXEDCLASSBYTES,(short)11); // super_class (fixed) FIXEDCLASSBYTES = ByteUtility.addBytes(FIXEDCLASSBYTES,(short)1); // interface_count (fixed) FIXEDCLASSBYTES = ByteUtility.addBytes(FIXEDCLASSBYTES,(short)19); // interfaces (fixed) FIXEDCLASSBYTES = ByteUtility.addBytes(FIXEDCLASSBYTES,(short)0); // field_count (fixed) // initialization method, constructor INITMETHOD = ByteUtility.addBytes(INITMETHOD,(short)1); // access_flags INITMETHOD = ByteUtility.addBytes(INITMETHOD,(short)2); // name_index "" INITMETHOD = ByteUtility.addBytes(INITMETHOD,(short)1); // descriptor_index "()V" INITMETHOD = ByteUtility.addBytes(INITMETHOD,(short)1); // attribute_count INITMETHOD = ByteUtility.addBytes(INITMETHOD,(short)3); // attribute_name_index "Code" INITMETHOD = ByteUtility.addBytes(INITMETHOD,(long)17); // attribute_length INITMETHOD = ByteUtility.addBytes(INITMETHOD,(short)1); // max_stack INITMETHOD = ByteUtility.addBytes(INITMETHOD,(short)1); // max_locals INITMETHOD = ByteUtility.addBytes(INITMETHOD,(long)5); // code_length //code INITMETHOD = ByteUtility.addBytes(INITMETHOD,(byte)0x2A); // aload_0 INITMETHOD = ByteUtility.addBytes(INITMETHOD,(byte)0xB7); // invokespecial INITMETHOD = ByteUtility.addBytes(INITMETHOD,(short)16); // method_ref index INITMETHOD = ByteUtility.addBytes(INITMETHOD,(byte)0xB1); // return // exception table INITMETHOD = ByteUtility.addBytes(INITMETHOD,(short)0); // exception_table_length INITMETHOD = ByteUtility.addBytes(INITMETHOD,(short)0); // attributes_count } /* methods that take an EventListener Class Type to create an EventAdapterClass */ public static Class makeEventAdapterClass(Class listenerType,boolean writeClassFile) { logger.info("EventAdapterGenerator"); if( EVENTLISTENER.isAssignableFrom(listenerType) ) { boolean exceptionable = false; boolean nonExceptionable = false; byte constantPool[] = null; short cpBaseIndex; short cpCount = 0; short cpExceptionBaseIndex; short exceptionableCount; short nonExceptionableCount; /* Derive Names */ String listenerTypeName = listenerType.getName(); logger.info("ListenerTypeName: "+listenerTypeName); String adapterClassName = CLASSPACKAGE+ (listenerTypeName.endsWith("Listener") ? listenerTypeName.substring(0, listenerTypeName.length() - 8) : listenerTypeName).replace('.', '_') + "Adapter"; String finalAdapterClassName = adapterClassName; Class cached = null; int suffixIndex = 0; do { if (null != (cached = ldr.getLoadedClass(finalAdapterClassName))) { logger.info("cached: "+cached); try { if (!listenerType.isAssignableFrom(cached)) finalAdapterClassName = adapterClassName + "_" + suffixIndex++; else return cached; } catch(VerifyError ex) { System.err.println(ex.getMessage()); ex.printStackTrace(); return cached; } } } while (cached != null); String eventListenerName = listenerTypeName.replace('.', '/'); /* method stuff */ java.lang.reflect.Method lms[] = listenerType.getMethods(); /* ****************************************************************************************** */ // Listener interface // Class name cpCount += 4; // cp item 17 constantPool = Bytecode.addUtf8(constantPool,eventListenerName); // cp item 18 constantPool = Bytecode.addUtf8(constantPool,finalAdapterClassName); // cp item 19 constantPool = Bytecode.addClass(constantPool,(short)17); // cp item 20 constantPool = Bytecode.addClass(constantPool,(short)18); // do we have nonExceptionalble event, exceptionable or both for (int i = 0 ; i < lms.length ; ++i) { Class exceptionTypes[] = lms[i].getExceptionTypes(); if( 0 < exceptionTypes.length) { exceptionable = true; } else { nonExceptionable = true; } }/* End for*/ /* ****************************************************************************************** */ // optional inclusion of nonexceptional events affects exceptional events indices nonExceptionableCount = 0; if(nonExceptionable) { nonExceptionableCount = 3; cpCount += nonExceptionableCount; // cp item 21 constantPool = Bytecode.addUtf8(constantPool,"processEvent"); // cp item 22 constantPool = Bytecode.addNameAndType(constantPool,(short)21,(short)8); // cp item 23 constantPool = Bytecode.addInterfaceMethodRef(constantPool,(short)12,(short)22); } /* ****************************************************************************************** */ // optional inclusion of exceptional events affects CP Items which follow for specific methods exceptionableCount = 0; if(exceptionable) { int classIndex = BASECPCOUNT + cpCount + 1; int nameIndex = BASECPCOUNT + cpCount + 0; int natIndex = BASECPCOUNT + cpCount + 3; exceptionableCount = 5; cpCount += exceptionableCount; // cp item 24 or 21 constantPool = Bytecode.addUtf8(constantPool,"processExceptionableEvent"); // cp item 25 or 22 constantPool = Bytecode.addUtf8(constantPool,"java/lang/Exception"); // cp item 26 or 23 constantPool = Bytecode.addClass(constantPool,(short)classIndex); // cp item 27 or 24 constantPool = Bytecode.addNameAndType(constantPool,(short)nameIndex,(short)8); // cp item 28 or 25 constantPool = Bytecode.addInterfaceMethodRef(constantPool,(short)12,(short)natIndex); } // base index for method cp references cpBaseIndex = (short)(BASECPCOUNT + cpCount); logger.debug("cpBaseIndex: " + cpBaseIndex); for (int i = 0 ; i < lms.length ; ++i) { String eventMethodName = lms[i].getName(); String eventName = lms[i].getParameterTypes()[0].getName().replace('.','/'); cpCount += 3; // cp items for event methods constantPool = Bytecode.addUtf8(constantPool,eventMethodName); constantPool = Bytecode.addUtf8(constantPool,("(L" + eventName + ";)V")); constantPool = Bytecode.addString(constantPool,(short)(BASECPCOUNT+cpCount-3)); }/* End for*/ boolean propertyChangeFlag[] = new boolean[lms.length]; int cpIndexPCE = 0; for (int i = 0 ; i < lms.length ; ++i) { String eventName = lms[i].getParameterTypes()[0].getName().replace('.','/'); // cp items for PropertyChangeEvent special handling if(eventName.equalsIgnoreCase("java/beans/PropertyChangeEvent")) { propertyChangeFlag[i] = true; if( 0 == cpIndexPCE ) { constantPool = Bytecode.addUtf8(constantPool,eventName); constantPool = Bytecode.addUtf8(constantPool,"getPropertyName"); constantPool = Bytecode.addUtf8(constantPool,"()Ljava/lang/String;"); constantPool = Bytecode.addClass(constantPool,(short)(BASECPCOUNT + cpCount)); constantPool = Bytecode.addNameAndType(constantPool, (short)(BASECPCOUNT + cpCount + 1), (short)(BASECPCOUNT + cpCount + 2)); constantPool = Bytecode.addMethodRef(constantPool, (short)(BASECPCOUNT + cpCount + 3), (short)(BASECPCOUNT + cpCount + 4)); cpCount += 6; cpIndexPCE = BASECPCOUNT + cpCount - 1; } } else { propertyChangeFlag[i] = false; } }/* End for*/ cpExceptionBaseIndex = (short)(BASECPCOUNT + cpCount); logger.debug("cpExceptionBaseIndex: " + cpExceptionBaseIndex); int excpIndex[][] = new int[lms.length][]; for (int i = 0 ; i < lms.length ; ++i) { Class exceptionTypes[] = lms[i].getExceptionTypes(); excpIndex[i] = new int[exceptionTypes.length]; for ( int j = 0 ; j < exceptionTypes.length ; j++) { constantPool = Bytecode.addUtf8(constantPool,exceptionTypes[j].getName().replace('.', '/')); constantPool = Bytecode.addClass(constantPool,(short)(BASECPCOUNT+cpCount)); excpIndex[i][j] = BASECPCOUNT + cpCount + 1; cpCount += 2; } }/* End for*/ /* end constant pool */ /* ************************************************************************************************ */ // put the Class byte array together /* start */ byte newClass[] = CLASSHEADER; // magic, version (fixed) short count = (short)(BASECPCOUNT + cpCount); newClass = ByteUtility.addBytes(newClass,count); // constant_pool_count (variable) newClass = ByteUtility.addBytes(newClass,BASECP); // constant_pool (fixed) newClass = ByteUtility.addBytes(newClass,constantPool); // constant_pool (variable) newClass = ByteUtility.addBytes(newClass,FIXEDCLASSBYTES); // see FIXEDCLASSBYTES (fixed) newClass = ByteUtility.addBytes(newClass,(short)(lms.length+1)); // method_count (variable) newClass = ByteUtility.addBytes(newClass,INITMETHOD); // constructor (fixed) // methods /* ****************************************************************************************** */ /* loop over listener methods from listenerType */ for (int i = 0 ; i < lms.length ; ++i) { newClass = ByteUtility.addBytes(newClass,(short)1); // access_flags (fixed) newClass = ByteUtility.addBytes(newClass,(short)(cpBaseIndex+3*i+0)); // name_index (variable) newClass = ByteUtility.addBytes(newClass,(short)(cpBaseIndex+3*i+1)); // descriptor_index (variable) newClass = ByteUtility.addBytes(newClass,(short)1); // attribute_count (fixed) newClass = ByteUtility.addBytes(newClass,(short)3); // attribute_name_index code(fixed) // Code Attribute Length int length = 32; if( 0 < excpIndex[i].length ) { length += 5 + 8 * ( 1 + excpIndex[i].length ); } if(propertyChangeFlag[i]) { length += 2; } newClass = ByteUtility.addBytes(newClass,(long)length); // attribute_length (variable) // start code attribute newClass = ByteUtility.addBytes(newClass,(short)6); // max_stack (fixed) newClass = ByteUtility.addBytes(newClass,(short)3); // max_locals (fixed) // Code Length length = 20; if(exceptionable && 0 < excpIndex[i].length) { length += 5; } if(propertyChangeFlag[i]) { length += 2; } newClass = ByteUtility.addBytes(newClass,(long)length); // code_length (variable) // start code newClass = ByteUtility.addBytes(newClass,(byte)0x2A); // aload_0 (fixed) newClass = ByteUtility.addBytes(newClass,(byte)0xB4); // getfield (fixed) newClass = ByteUtility.addBytes(newClass,(short)15); // index (fixed) if(propertyChangeFlag[i]) { // the propertyName is passed as the first parameter newClass = ByteUtility.addBytes(newClass,(byte)0x2B); // aload_1 (fixed) newClass = ByteUtility.addBytes(newClass,(byte)0xB6); // invokevirtual (fixed) newClass = ByteUtility.addBytes(newClass,(short)cpIndexPCE); // methodref (variable) } else { // the eventMethodName is passed as the first parameter // Target for method invocation. newClass = ByteUtility.addBytes(newClass,(byte)0x12); // ldc (fixed) newClass = ByteUtility.addBytes(newClass,(byte)(cpBaseIndex+3*i+2)); // index (byte) (variable) } newClass = ByteUtility.addBytes(newClass,(byte)0x04); // iconst_1 (fixed) newClass = ByteUtility.addBytes(newClass,(byte)0xBD); // anewarray (fixed) newClass = ByteUtility.addBytes(newClass,(short)10); // Class java/lang/Object (fixed) newClass = ByteUtility.addBytes(newClass,(byte)0x59); // dup (fixed) newClass = ByteUtility.addBytes(newClass,(byte)0x03); // iconst_0 (fixed) newClass = ByteUtility.addBytes(newClass,(byte)0x2B); // aload_1 (fixed) newClass = ByteUtility.addBytes(newClass,(byte)0x53); // aastore (fixed) newClass = ByteUtility.addBytes(newClass,(byte)0xB9); // invokeinterface (fixed) // index to processEvent or processExceptionableEvent method length = 23; // actually an index into cp if(exceptionable && nonExceptionable) { // interface method index if( 0 < lms[i].getExceptionTypes().length ) { length += 5; } } else if(exceptionable) { length += 2; } newClass = ByteUtility.addBytes(newClass,(short)length); // index (process??????...) (variable) newClass = ByteUtility.addBytes(newClass,(byte)0x03); // iconst_0 (fixed) newClass = ByteUtility.addBytes(newClass,(byte)0x00); // noop (fixed) newClass = ByteUtility.addBytes(newClass,(byte)0xB1); // return (fixed) if(exceptionable && 0 < excpIndex[i].length) { // exception code newClass = ByteUtility.addBytes(newClass,(byte)0x4D); // astore_2 (fixed) newClass = ByteUtility.addBytes(newClass,(byte)0x2C); // aload_2 (fixed) newClass = ByteUtility.addBytes(newClass,(byte)0xBF); // athrow (fixed) newClass = ByteUtility.addBytes(newClass,(byte)0x57); // pop (fixed) newClass = ByteUtility.addBytes(newClass,(byte)0xB1); // return (fixed) // end code // exception table length = excpIndex[i].length; newClass = ByteUtility.addBytes(newClass,(short)(1+length)); // exception_table_length (variable) for( int j = 0 ; j < length ; j++ ) { // catch exception types and rethrow newClass = ByteUtility.addBytes(newClass,(short)0); // start_pc (fixed) if(propertyChangeFlag[i]) { newClass = ByteUtility.addBytes(newClass,(short)21); // end_pc (fixed) newClass = ByteUtility.addBytes(newClass,(short)22); // handler_pc (fixed) } else { newClass = ByteUtility.addBytes(newClass,(short)19); // end_pc (fixed) newClass = ByteUtility.addBytes(newClass,(short)20); // handler_pc (fixed) } newClass = ByteUtility.addBytes(newClass,(short)excpIndex[i][j]); // catch_type (variable) } // catch "exception" and trap it newClass = ByteUtility.addBytes(newClass,(short)0); // start_pc (fixed) if(propertyChangeFlag[i]) { newClass = ByteUtility.addBytes(newClass,(short)21); // end_pc (fixed) newClass = ByteUtility.addBytes(newClass,(short)25); // handler_pc (fixed) } else { newClass = ByteUtility.addBytes(newClass,(short)19); // end_pc (fixed) newClass = ByteUtility.addBytes(newClass,(short)23); // handler_pc (fixed) } if(nonExceptionable) { newClass = ByteUtility.addBytes(newClass,(short)26); } // catch_type (fixed) else // or { newClass = ByteUtility.addBytes(newClass,(short)23); } // catch_type (fixed) } else { newClass = ByteUtility.addBytes(newClass,(short)0); } // exception_table_length (fixed) // attributes on the code attribute (none) newClass = ByteUtility.addBytes(newClass,(short)0); // attribute_count (fixed) // end code attribute }/* End for*/ // Class Attributes (none for this) newClass = ByteUtility.addBytes(newClass,(short)0); // attribute_count (fixed) /* done */ logger.debug("adapterName: " + finalAdapterClassName); logger.debug("cpCount: " + count + " = " + BASECPCOUNT + " + " + cpCount); logger.debug("methodCount: " + (lms.length+1)); // output to disk class file /* ****************************************************************************************** */ // now create the class and load it // return the Class. if (writeClassFile) { try { // removed "WRITEDIRECTORY+", as this path is already part of 'finalAdapterClassName' FileOutputStream fos = new FileOutputStream(finalAdapterClassName+".class"); fos.write(newClass); fos.close(); } catch(IOException ex) { System.err.println(ex.getMessage()); ex.printStackTrace(); } try { Class ret = ldr.loadClass(finalAdapterClassName); logger.debug("EventAdapterGenerator: " + ret.getName() + " dynamically generated"); return ret; } catch (ClassNotFoundException ex) { System.err.println(ex.getMessage()); ex.printStackTrace(); } } try { Class ret = ldr.defineClass(finalAdapterClassName,newClass); logger.debug("EventAdapterGenerator: " + ret.getName() + " dynamically generated"); return ret; } catch(Exception ex) { System.err.println(ex.getMessage()); ex.printStackTrace(); } } return null; } } libbsf-java-2.4.0/src/org/apache/bsf/util/event/generator/Bytecode.java0000644000175000017500000000741710511475734024737 0ustar mkochmkoch/* * Copyright 2004,2004 The Apache Software Foundation. * * Licensed 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. */ package org.apache.bsf.util.event.generator; /** * Bytecode handling utilities * * Handle standard byte arrays as defined in Java VM and Class File * * 5 April 1999 - functions to append Class File byte subarrays * into a Class File byte array * * @author Richard F. Boehme * */ public class Bytecode { // Constant Pool Item Codes public static final byte C_Utf8 = 0x01; // 1 public static final byte C_Integer = 0x03; // 3 public static final byte C_Float = 0x04; // 4 public static final byte C_Long = 0x05; // 5 public static final byte C_Double = 0x06; // 6 public static final byte C_Class = 0x07; // 7 public static final byte C_String = 0x08; // 8 public static final byte C_FieldRef = 0x09; // 9 public static final byte C_MethodRef = 0x0A; // 10 public static final byte C_InterfaceMethodRef = 0x0B; // 11 public static final byte C_NameAndType = 0x0C; // 12 //public static byte[] addDouble(byte[] array,double value) //{ // array = ByteUtility.addBytes(array,C_Double); // array = ByteUtility.addBytes(array,value); // return array; //} public static byte[] addClass(byte[] array,short value) { return addRef(C_Class,array,value); } public static byte[] addFieldRef(byte[] array,short value1,short value2) { return addRef(C_FieldRef,array,value1,value2); } public static byte[] addInteger(byte[] array,int value) { array = ByteUtility.addBytes(array,C_Integer); array = ByteUtility.addBytes(array,value); return array; } public static byte[] addInterfaceMethodRef(byte[] array,short value1,short value2) { return addRef(C_InterfaceMethodRef,array,value1,value2); } //public static byte[] addFloat(byte[] array,float value) //{ // array = ByteUtility.addBytes(array,C_Float); // array = ByteUtility.addBytes(array,value); // return array; //} public static byte[] addLong(byte[] array,long value) { array = ByteUtility.addBytes(array,C_Long); array = ByteUtility.addBytes(array,value); return array; } public static byte[] addMethodRef(byte[] array,short value1,short value2) { return addRef(C_MethodRef,array,value1,value2); } public static byte[] addNameAndType(byte[] array,short value1,short value2) { return addRef(C_NameAndType,array,value1,value2); } public static byte[] addRef(byte refType,byte[] array,short value) { array = ByteUtility.addBytes(array,refType); array = ByteUtility.addBytes(array,value); return array; } // Generic Bytecode Methods public static byte[] addRef(byte refType,byte[] array,short value1,short value2) { array = ByteUtility.addBytes(array,refType); array = ByteUtility.addBytes(array,value1); array = ByteUtility.addBytes(array,value2); return array; } public static byte[] addString(byte[] array,short value) { return addRef(C_String,array,value); } // Constant Pool Item Methods public static byte[] addUtf8(byte[] array,String value) { array = ByteUtility.addBytes(array,C_Utf8); array = ByteUtility.addBytes(array,(short)value.length()); array = ByteUtility.addBytes(array,value); return array; } } libbsf-java-2.4.0/src/org/apache/bsf/util/event/EventAdapterImpl.java0000644000175000017500000000226710511475734024415 0ustar mkochmkoch/* * Copyright 2004,2004 The Apache Software Foundation. * * Licensed 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. */ package org.apache.bsf.util.event; /** * EventAdapterImpl is a default implementation of the EventAdapter * interface that specific event adapters may choose to subclass from * instead of implementing the interface themselves. Saves 5 lines of code * mebbe. * * @author Sanjiva Weerawarana * @author Matthew J. Duftler * @see EventAdapter */ public class EventAdapterImpl implements EventAdapter { protected EventProcessor eventProcessor; public void setEventProcessor (EventProcessor eventProcessor) { this.eventProcessor = eventProcessor; } } libbsf-java-2.4.0/src/org/apache/bsf/util/event/EventProcessor.java0000644000175000017500000000245710511475734024173 0ustar mkochmkoch/* * Copyright 2004,2004 The Apache Software Foundation. * * Licensed 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. */ package org.apache.bsf.util.event; /** * EventProcessor is the interface that event adapters use to * delegate events they received to be delivered to the appropriate target. * They can simply deliver the event using processEvent or, if the event * can be excepted to, via processExceptionableEvent (in which case the * adapter is expected to forward on an exception to the source bean). * * @author Sanjiva Weerawarana * @author Matthew J. Duftler * @see EventAdapter */ public interface EventProcessor { public void processEvent (String filter, Object[] eventInfo); public void processExceptionableEvent (String filter, Object[] eventInfo) throws Exception; } libbsf-java-2.4.0/src/org/apache/bsf/util/ObjectRegistry.java0000644000175000017500000000364210511475734023025 0ustar mkochmkoch/* * Copyright 2004,2004 The Apache Software Foundation. * * Licensed 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. */ package org.apache.bsf.util; import java.util.Hashtable; /** * The ObjectRegistry is used to do name-to-object reference lookups. * If an ObjectRegistry is passed as a constructor argument, then this * ObjectRegistry will be a cascading registry: when a lookup is * invoked, it will first look in its own table for a name, and if it's not * there, it will cascade to the parent ObjectRegistry. * All registration is always local. [??] * * @author Sanjiva Weerawarana * @author Matthew J. Duftler */ public class ObjectRegistry { Hashtable reg = new Hashtable (); ObjectRegistry parent = null; public ObjectRegistry () { } public ObjectRegistry (ObjectRegistry parent) { this.parent = parent; } // lookup an object: cascade up if needed public Object lookup (String name) throws IllegalArgumentException { Object obj = reg.get (name); if (obj == null && parent != null) { obj = parent.lookup (name); } if (obj == null) { throw new IllegalArgumentException ("object '" + name + "' not in registry"); } return obj; } // register an object public void register (String name, Object obj) { reg.put (name, obj); } // unregister an object (silent if unknown name) public void unregister (String name) { reg.remove (name); } } libbsf-java-2.4.0/src/org/apache/bsf/util/BSFFunctions.java0000644000175000017500000000330110511475734022361 0ustar mkochmkoch/* * Copyright 2004,2004 The Apache Software Foundation. * * Licensed 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. */ package org.apache.bsf.util; import org.apache.bsf.BSFEngine; import org.apache.bsf.BSFException; import org.apache.bsf.BSFManager; /** * This is a utility that engine implementors may use as the Java * object they expose in the scripting language as "bsf". This has * essentially a subset of the methods in BSFManager plus some * stuff from the utils. Currently used by Javascript (Rhino) & BML. * * @author Sanjiva Weerawarana */ public class BSFFunctions { BSFManager mgr; BSFEngine engine; public BSFFunctions (BSFManager mgr, BSFEngine engine) { this.mgr = mgr; this.engine = engine; } public void addEventListener (Object src, String eventSetName, String filter, Object script) throws BSFException { EngineUtils.addEventListener (src, eventSetName, filter, engine, mgr, "", 0, 0, script); } public Object lookupBean (String name) { return mgr.lookupBean (name); } public void registerBean (String name, Object bean) { mgr.registerBean (name, bean); } public void unregisterBean (String name) { mgr.unregisterBean (name); } } libbsf-java-2.4.0/src/org/apache/bsf/util/type/0000755000175000017500000000000010736513022020167 5ustar mkochmkochlibbsf-java-2.4.0/src/org/apache/bsf/util/type/TypeConvertor.java0000644000175000017500000000216610511475734023672 0ustar mkochmkoch/* * Copyright 2004,2004 The Apache Software Foundation. * * Licensed 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. */ package org.apache.bsf.util.type; /** * A TypeConvertor is used to convert an object of one type to * one of another type. The convertor is invoked with the class of the * from object, the desired class, and the from object itself. The * convertor must return a new object of the desired class. * * @author Sanjiva Weerawarana * @see TypeConvertorRegistry */ public interface TypeConvertor { public Object convert (Class from, Class to, Object obj); public String getCodeGenString (); } libbsf-java-2.4.0/src/org/apache/bsf/util/type/TypeConvertorRegistry.java0000644000175000017500000001570710511475734025430 0ustar mkochmkoch/* * Copyright 2004,2004 The Apache Software Foundation. * * Licensed 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. */ package org.apache.bsf.util.type; import java.awt.Color; import java.awt.Font; import java.util.Hashtable; /** * The TypeConvertorRegistry is the registry of type convertors. * It has lookup and register capabilities based on the types to be * converted as well as by some object key. * * @author Sanjiva Weerawarana * @author Matthew J. Duftler * @see TypeConvertorRegistry */ public class TypeConvertorRegistry { Hashtable reg = new Hashtable (); Hashtable keyedReg = new Hashtable (); // register some standard convertors at construction time public TypeConvertorRegistry () { // no-op convertors: cvt from primitive wrappers to the object wrapper TypeConvertor tc = new TypeConvertor () { public Object convert (Class from, Class to, Object obj) { return obj; } public String getCodeGenString() { return "(Class from, Class to, Object obj) {\n" + "return obj;\n" + "}"; } }; register (Boolean.class, boolean.class, tc); register (boolean.class, Boolean.class, tc); register (Byte.class, byte.class, tc); register (byte.class, Byte.class, tc); register (Character.class, char.class, tc); register (char.class, Character.class, tc); register (Short.class, short.class, tc); register (short.class, Short.class, tc); register (Integer.class, int.class, tc); register (int.class, Integer.class, tc); register (Long.class, long.class, tc); register (long.class, Long.class, tc); register (Float.class, float.class, tc); register (float.class, Float.class, tc); register (Double.class, double.class, tc); register (double.class, Double.class, tc); // object to string: the registry special cases this one as the backup // if the target is string and there is no special convertor available // otherwise tc = new TypeConvertor () { public Object convert (Class from, Class to, Object obj) { return (obj == null) ? "(null)" : obj.toString (); } public String getCodeGenString() { return "(Class from, Class to, Object obj) {\n" + "return (obj == null) ? \"(null)\" : obj.toString ();\n" + "}"; } }; register (Object.class, String.class, tc); // convert strings to various primitives (both their object versions // and wrappers for primitive versions) tc = new TypeConvertor () { public Object convert (Class from, Class to, Object obj) { String str = (String) obj; if (to == Boolean.class || to == boolean.class) { return Boolean.valueOf (str); } else if (to == Byte.class || to == byte.class) { return Byte.valueOf (str); } else if (to == Character.class || to == char.class) { return new Character (str.charAt (0)); } else if (to == Short.class || to == short.class) { return Short.valueOf (str); } else if (to == Integer.class || to == int.class) { return Integer.valueOf (str); } else if (to == Long.class || to == long.class) { return Long.valueOf (str); } else if (to == Float.class || to == float.class) { return Float.valueOf (str); } else if (to == Double.class || to == double.class) { return Double.valueOf (str); } else { return null; } } public String getCodeGenString() { return "(Class from, Class to, Object obj) {\n" + "String str = (String) obj;\n" + "if (to == Boolean.class || to == boolean.class) {\n" + "return Boolean.valueOf (str);\n" + "} else if (to == Byte.class || to == byte.class) {\n" + "return Byte.valueOf (str);\n" + "} else if (to == Character.class || to == char.class) {\n" + "return new Character (str.charAt (0));\n" + "} else if (to == Short.class || to == short.class) {\n" + "return Short.valueOf (str);\n" + "} else if (to == Integer.class || to == int.class) {\n" + "return Integer.valueOf (str);\n" + "} else if (to == Long.class || to == long.class) {\n" + "return Long.valueOf (str);\n" + "} else if (to == Float.class || to == float.class) {\n" + "return Float.valueOf (str);\n" + "} else if (to == Double.class || to == double.class) {\n" + "return Double.valueOf (str);\n" + "} else {\n" + "return null;\n" + "}\n" + "}"; } }; register (String.class, boolean.class, tc); register (String.class, Boolean.class, tc); register (String.class, byte.class, tc); register (String.class, Byte.class, tc); register (String.class, char.class, tc); register (String.class, Character.class, tc); register (String.class, short.class, tc); register (String.class, Short.class, tc); register (String.class, int.class, tc); register (String.class, Integer.class, tc); register (String.class, long.class, tc); register (String.class, Long.class, tc); register (String.class, float.class, tc); register (String.class, Float.class, tc); register (String.class, double.class, tc); register (String.class, Double.class, tc); // strings to fonts tc = new TypeConvertor () { public Object convert (Class from, Class to, Object obj) { return Font.decode ((String) obj); } public String getCodeGenString() { return "(Class from, Class to, Object obj) {\n" + "return Font.decode ((String) obj);\n" + "}"; } }; register (String.class, Font.class, tc); // strings to colors tc = new TypeConvertor () { public Object convert (Class from, Class to, Object obj) { return Color.decode ((String) obj); } public String getCodeGenString() { return "(Class from, Class to, Object obj) {\n" + "return Color.decode ((String) obj);\n" + "}"; } }; register (String.class, Color.class, tc); } // lookup a convertor public TypeConvertor lookup (Class from, Class to) { String key = from.getName () + " -> " + to.getName (); TypeConvertor tc = (TypeConvertor) reg.get (key); if (tc == null) { if (from != void.class && from != Void.class && to == String.class) { // find the object -> string convertor return lookup (Object.class, String.class); } } return tc; } // lookup a convertor by key public TypeConvertor lookupByKey (Object key) { return (TypeConvertor) keyedReg.get (key); } // register a convertor public void register (Class from, Class to, TypeConvertor convertor) { String key = from.getName () + " -> " + to.getName (); reg.put (key, convertor); } // register a convertor by key public void registerByKey (Object key, TypeConvertor convertor) { keyedReg.put (key, convertor); } } libbsf-java-2.4.0/src/org/apache/bsf/util/MethodUtils.java0000644000175000017500000004263510511475734022334 0ustar mkochmkoch/* * Copyright 2004,2004 The Apache Software Foundation. * * Licensed 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. */ package org.apache.bsf.util; import java.lang.reflect.Constructor; import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.util.Enumeration; import java.util.Vector; /** * This file is a collection of reflection utilities for dealing with * methods and constructors. * * @author Sanjiva Weerawarana * @author Joseph Kesselman */ public class MethodUtils { /** Internal Class for getEntryPoint(). Implements 15.11.2.2 MORE SPECIFIC rules. Retains a list of methods (already known to match the arguments). As each method is added, we check against past entries to determine which if any is "more specific" -- defined as having _all_ its arguments (not just a preponderance) be method-convertable into those of another. If such a relationship is found, the more-specific method is retained and the less-specific method is discarded. At the end, if this has yielded a single winner it is considered the Most Specific Method and hence the one that should be invoked. Otherwise, a NoSuchMethodException is thrown. PERFORMANCE VERSUS ARCHITECTURE: Arguably, this should "have-a" Vector. But the code is 6% smaller, and possibly faster, if we code it as "is-a" Vector. Since it's an inner class, nobody's likely to abuse the privilage. Note: "Static" in the case of an inner class means "Does not reference instance data in the outer class", and is required since our caller is a static method. */ private static class MoreSpecific extends Vector { /** Submit an entry-point to the list. May be discarded if a past entry is more specific, or may cause others to be discarded it if is more specific. newEntry: Method or Constructor under consideration. */ void addItem (Object newEntry) { if(size()==0) addElement(newEntry); else { Class[] newargs=entryGetParameterTypes(newEntry); boolean keep=true; for (Enumeration e = elements(); keep & e.hasMoreElements() ; ) { Object oldEntry=e.nextElement(); // CAVEAT: Implicit references to enclosing class! Class[] oldargs=entryGetParameterTypes(oldEntry); if(areMethodConvertable(oldargs,newargs)) removeElement(oldEntry); // New more specific; discard old else if(areMethodConvertable(newargs,oldargs)) keep=false; // Old more specific; discard new // Else they're tied. Keep both and hope someone beats both. } if(keep) addElement(newEntry); } } /** Obtain the single Most Specific entry-point. If there is no clear winner, or if the list is empty, throw NoSuchMethodException. Arguments describe the call we were hoping to resolve. They are used to throw a nice verbose exception if something goes wrong. */ Object getMostSpecific(Class targetClass,String methodName, Class[] argTypes,boolean isStaticReference) throws NoSuchMethodException { if(size()==1) return firstElement(); if(size()>1) { StringBuffer buf=new StringBuffer(); Enumeration e=elements(); buf.append(e.nextElement()); while(e.hasMoreElements()) buf.append(" and ").append(e.nextElement()); throw new NoSuchMethodException (callToString(targetClass, methodName, argTypes, isStaticReference)+ " is ambiguous. It matches "+ buf.toString()); } return null; } } /** Convenience method: Test an entire parameter-list/argument-list pair for isMethodConvertable(), qv. */ static private boolean areMethodConvertable(Class[] parms,Class[] args) { if(parms.length!=args.length) return false; for(int i=0;i0) { if(false) { // ????? Sanjiva has an ArrayToString method. Using it would // save a few bytes, at cost of giving up some reusability. } else { buf.append(StringUtils.getClassName(argTypes[0])); for (int i = 1; i < argTypes.length; i++) { buf.append(",").append(StringUtils.getClassName(argTypes[i])); } } } else buf.append("[none]"); buf.append(")"); return buf.toString(); } /** Utility function: obtain common data from either Method or Constructor. (In lieu of an EntryPoint interface.) */ static int entryGetModifiers(Object entry) { return (entry instanceof Method) ? ((Method)entry).getModifiers() : ((Constructor)entry).getModifiers(); } // The common lookup code would be much easier if Method and // Constructor shared an "EntryPoint" Interface. Unfortunately, even // though their APIs are almost identical, they don't. These calls // are a workaround... at the cost of additional runtime overhead // and some extra bytecodes. // // (A JDK bug report has been submitted requesting that they add the // Interface; it would be easy, harmless, and useful.) /** Utility function: obtain common data from either Method or Constructor. (In lieu of an EntryPoint interface.) */ static String entryGetName(Object entry) { return (entry instanceof Method) ? ((Method)entry).getName() : ((Constructor)entry).getName(); } /** Utility function: obtain common data from either Method or Constructor. (In lieu of an EntryPoint interface.) */ static Class[] entryGetParameterTypes(Object entry) { return (entry instanceof Method) ? ((Method)entry).getParameterTypes() : ((Constructor)entry).getParameterTypes(); } /** Utility function: obtain common data from either Method or Constructor. (In lieu of an EntryPoint interface.) */ static String entryToString(Object entry) { return (entry instanceof Method) ? ((Method)entry).toString() : ((Constructor)entry).toString(); } ////////////////////////////////////////////////////////////////////////// /** Class.getConstructor() finds only the entry point (if any) _exactly_ matching the specified argument types. Our implmentation can decide between several imperfect matches, using the same search algorithm as the Java compiler. Note that all constructors are static by definition, so isStaticReference is true. @exception NoSuchMethodException if constructor not found. */ static public Constructor getConstructor(Class targetClass, Class[] argTypes) throws SecurityException, NoSuchMethodException { return (Constructor) getEntryPoint(targetClass,null,argTypes,true); } ////////////////////////////////////////////////////////////////////////// /** * Search for entry point, per Java Language Spec 1.0 * as amended, verified by comparison against compiler behavior. * * @param targetClass Class object for the class to be queried. * @param methodName Name of method to invoke, or null for constructor. * Only Public methods will be accepted. * @param argTypes Classes of intended arguments. Note that primitives * must be specified via their TYPE equivalents, * rather than as their wrapper classes -- Integer.TYPE * rather than Integer. "null" may be passed in as an * indication that you intend to invoke the method with * a literal null argument and therefore can accept * any object type in this position. * @param isStaticReference If true, and if the target is a Class object, * only static methods will be accepted as valid matches. * * @return a Method or Constructor of the appropriate signature * * @exception SecurityException if security violation * @exception NoSuchMethodException if no such method */ static private Object getEntryPoint(Class targetClass, String methodName, Class[] argTypes, boolean isStaticReference) throws SecurityException, NoSuchMethodException { // 15.11.1: OBTAIN STARTING CLASS FOR SEARCH Object m=null; // 15.11.2 DETERMINE ARGUMENT SIGNATURE // (Passed in as argTypes array.) // Shortcut: If an exact match exists, return it. try { if(methodName!=null) { m=targetClass.getMethod (methodName, argTypes); if(isStaticReference && !Modifier.isStatic(entryGetModifiers(m)) ) { throw new NoSuchMethodException (callToString (targetClass, methodName, argTypes, isStaticReference)+ " resolved to instance " + m); } return m; } else return targetClass.getConstructor (argTypes); } catch (NoSuchMethodException e) { // no-args has no alternatives! if(argTypes==null || argTypes.length==0) { throw new NoSuchMethodException (callToString (targetClass, methodName, argTypes, isStaticReference)+ " not found."); } // Else fall through. } // Well, _that_ didn't work. Time to search for the Most Specific // matching function. NOTE that conflicts are possible! // 15.11.2.1 ACCESSIBLE: We apparently need to gather from two // sources to be sure we have both instance and static methods. Object[] methods; if(methodName!=null) { methods=targetClass.getMethods(); } else { methods=targetClass.getConstructors(); } if(0==methods.length) { throw new NoSuchMethodException("No methods!"); } MoreSpecific best=new MoreSpecific(); for(int i=0;i=primTypes.length) return false; // Off the end for(argscore=0;argscore=primTypes.length) return false; // Off the end // OK if ordered AND NOT char-to-smaller-than-int return (argscore2) ); } } libbsf-java-2.4.0/src/org/apache/bsf/util/JNIUtils.c0000644000175000017500000001753210511475734021033 0ustar mkochmkoch/* * Copyright 2003,2004 The Apache Software Foundation. * * Licensed 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. */ #include #include #include "JNIUtils.h" /***** * * NOTE: Whereever I think an exception may occur, I need to check * whether it did and recover appropriately .. otherwise the behavior * of JNI is undefined! * *****/ /* throw a BSFException with the given code and message. */ void bsf_exception (JNIEnv *jenv, int code, char *msg) { jclass bsfexceptclass = (*jenv)->FindClass (jenv, "org/apache/bsf/BSFException"); (*jenv)->ThrowNew (jenv, bsfexceptclass, msg); } /* cvt a pointer to a Long object whose value is the pointer value */ jobject bsf_pointer2longobj (JNIEnv *jenv, void *ptr) { return bsf_makeLong (jenv, (long) ptr); } /* cvt a Long object whose value is the pointer value to the pointer */ void *bsf_longobj2pointer (JNIEnv *jenv, jobject lobj) { jclass longclass = (*jenv)->FindClass (jenv, "java/lang/Long"); jmethodID mi = (*jenv)->GetMethodID (jenv, longclass, "longValue", "()J"); void *ptr = (void *) (*jenv)->CallLongMethod (jenv, lobj, mi); return ptr; } /* convert an object to a string obj */ jstring bsf_obj2jstring (JNIEnv *jenv, jobject obj) { jclass objclass = (*jenv)->GetObjectClass (jenv, obj); jmethodID tostr = (*jenv)->GetMethodID (jenv, objclass, "toString", "()Ljava/lang/String;"); jstring strobj = (jstring) (*jenv)->CallObjectMethod (jenv, obj, tostr); return strobj; } /* cvt an object to a c-string .. wastes memory, but useful for debug */ const char *bsf_obj2cstring (JNIEnv *jenv, jobject obj) { return (*jenv)->GetStringUTFChars (jenv, bsf_obj2jstring (jenv, obj), 0); } /* call the named method with the given args on the given bean */ jobject bsf_createbean (JNIEnv *jenv, char *classname, jobjectArray args) { jclass cl; jmethodID mid; jobject result; /* find the BSFUtils.createBean method ID if needed */ cl = (*jenv)->FindClass (jenv, "org/apache/bsf/util/EngineUtils"); mid = (*jenv)->GetStaticMethodID (jenv, cl, "createBean", "(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/Object;"); if ((*jenv)->ExceptionOccurred (jenv)) { (*jenv)->ExceptionDescribe (jenv); (*jenv)->ExceptionClear (jenv); return 0; } result = (*jenv)->CallStaticObjectMethod (jenv, cl, mid, (*jenv)->NewStringUTF (jenv, classname), args); if ((*jenv)->ExceptionOccurred (jenv)) { (*jenv)->ExceptionDescribe (jenv); (*jenv)->ExceptionClear (jenv); /* I should really throw a BSF exception here and the caller should check whether an exception was thrown and in that case return. later. */ return 0; } else { return result; } } /* call the named method with the given args on the given bean */ jobject bsf_callmethod (JNIEnv *jenv, jobject target, char *methodname, jobjectArray args) { jclass cl; jmethodID mid; jobject result; /* find the BSFUtils.callBeanMethod method ID if needed */ cl = (*jenv)->FindClass (jenv, "org/apache/bsf/util/EngineUtils"); mid = (*jenv)->GetStaticMethodID (jenv, cl, "callBeanMethod", "(Ljava/lang/Object;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/Object;"); if ((*jenv)->ExceptionOccurred (jenv)) { (*jenv)->ExceptionDescribe (jenv); (*jenv)->ExceptionClear (jenv); return 0; } result = (*jenv)->CallStaticObjectMethod (jenv, cl, mid, target, (*jenv)->NewStringUTF (jenv, methodname), args); if ((*jenv)->ExceptionOccurred (jenv)) { (*jenv)->ExceptionDescribe (jenv); (*jenv)->ExceptionClear (jenv); /* I should really throw a BSF exception here and the caller should check whether an exception was thrown and in that case return. later. */ return 0; } else { return result; } } /* return the named bean from the given mgr's bean registry */ jobject bsf_lookupbean (JNIEnv *jenv, jobject mgr, char *beanname) { jmethodID lookupMethod; jobject result; jclass bsfmgrclass = (*jenv)->GetObjectClass (jenv, mgr); lookupMethod = (*jenv)->GetMethodID (jenv, bsfmgrclass, "lookupBean", "(Ljava/lang/String;)Ljava/lang/Object;"); if ((*jenv)->ExceptionOccurred (jenv)) { (*jenv)->ExceptionDescribe (jenv); (*jenv)->ExceptionClear (jenv); return 0; } result = (*jenv)->CallObjectMethod (jenv, mgr, lookupMethod, (*jenv)->NewStringUTF (jenv, beanname)); if ((*jenv)->ExceptionOccurred (jenv)) { (*jenv)->ExceptionDescribe (jenv); (*jenv)->ExceptionClear (jenv); /* I should really throw a BSF exception here and the caller should check whether an exception was thrown and in that case return. later. */ return 0; } else { return result; } } /* return the type signature string component for the given type: I for ints, J for long, ... */ char *bsf_getTypeSignatureString (JNIEnv *jenv, jclass objclass) { jclass cl = 0; jmethodID mid = 0; jstring str; cl = (*jenv)->FindClass (jenv, "org/apache/bsf/util/EngineUtils"); mid = (*jenv)->GetStaticMethodID (jenv, cl, "getTypeSignatureString", "(Ljava/lang/Class;)Ljava/lang/String;"); if ((*jenv)->ExceptionOccurred (jenv)) { (*jenv)->ExceptionDescribe (jenv); (*jenv)->ExceptionClear (jenv); return 0; } str = (jstring) (*jenv)->CallStaticObjectMethod (jenv, cl, mid, objclass); return (char *) bsf_obj2cstring (jenv, str); } /* make objects from primitives */ jobject bsf_makeBoolean (JNIEnv *jenv, int val) { jclass classobj = (*jenv)->FindClass (jenv, "java/lang/Boolean"); jmethodID constructor = (*jenv)->GetMethodID (jenv, classobj, "", "(Z)V"); return (*jenv)->NewObject (jenv, classobj, constructor, (jboolean) val); } jobject bsf_makeByte (JNIEnv *jenv, int val) { jclass classobj = (*jenv)->FindClass (jenv, "java/lang/Byte"); jmethodID constructor = (*jenv)->GetMethodID (jenv, classobj, "", "(B)V"); return (*jenv)->NewObject (jenv, classobj, constructor, (jbyte) val); } jobject bsf_makeShort (JNIEnv *jenv, int val) { jclass classobj = (*jenv)->FindClass (jenv, "java/lang/Short"); jmethodID constructor = (*jenv)->GetMethodID (jenv, classobj, "", "(S)V"); return (*jenv)->NewObject (jenv, classobj, constructor, (jshort) val); } jobject bsf_makeInteger (JNIEnv *jenv, int val) { jclass classobj = (*jenv)->FindClass (jenv, "java/lang/Integer"); jmethodID constructor = (*jenv)->GetMethodID (jenv, classobj, "", "(I)V"); return (*jenv)->NewObject (jenv, classobj, constructor, (jint) val); } jobject bsf_makeLong (JNIEnv *jenv, long val) { jclass classobj = (*jenv)->FindClass (jenv, "java/lang/Long"); jmethodID constructor = (*jenv)->GetMethodID (jenv, classobj, "", "(J)V"); return (*jenv)->NewObject (jenv, classobj, constructor, (jlong) val); } jobject bsf_makeFloat (JNIEnv *jenv, float val) { jclass classobj = (*jenv)->FindClass (jenv, "java/lang/Float"); jmethodID constructor = (*jenv)->GetMethodID (jenv, classobj, "", "(F)V"); return (*jenv)->NewObject (jenv, classobj, constructor, (jfloat) val); } jobject bsf_makeDouble (JNIEnv *jenv, double val) { jclass classobj = (*jenv)->FindClass (jenv, "java/lang/Double"); jmethodID constructor = (*jenv)->GetMethodID (jenv, classobj, "", "(D)V"); return (*jenv)->NewObject (jenv, classobj, constructor, (jdouble) val); } libbsf-java-2.4.0/src/org/apache/bsf/util/Bean.java0000644000175000017500000000221010511475734020721 0ustar mkochmkoch/* * Copyright 2004,2004 The Apache Software Foundation. * * Licensed 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. */ package org.apache.bsf.util; /** * A Bean is the class used to represent a bean: it holds a * type and a value. This is needed because otherwise we can't represent * the types of null-valued beans (or primitives) correctly. This was * originally in the BML player. * * @author Sanjiva Weerawarana */ public class Bean { // type of this bean public Class type; // its current value (mebbe null) public Object value; public Bean (Class type, Object value) { this.type = type; this.value = value; } } libbsf-java-2.4.0/src/org/apache/bsf/util/BSFClassLoader.java0000644000175000017500000000405410511475734022613 0ustar mkochmkoch/* * Copyright 2004,2004 The Apache Software Foundation. * * Licensed 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. */ package org.apache.bsf.util; import java.io.File; import java.io.FileInputStream; import java.util.Hashtable; /** * This class loader knows to load a class from the tempDir dir * of the environment of the given manager. * * @author Sanjiva Weerawarana */ class BSFClassLoader extends ClassLoader { Hashtable cache = new Hashtable (); String tempDir = "."; // note the non-public constructor - this is only avail within // this package. BSFClassLoader () { } public synchronized Class loadClass (String name, boolean resolve) throws ClassNotFoundException { Class c = (Class) cache.get (name); if (c == null) { // is it a system class try { c = findSystemClass (name); cache.put (name, c); return c; } catch (ClassNotFoundException e) { // nope } try { byte[] data = loadClassData (name); c = defineClass (name, data, 0, data.length); cache.put (name, c); } catch (Exception e) { e.printStackTrace (); throw new ClassNotFoundException ("unable to resolve class '" + name + "'"); } } if (resolve) resolveClass (c); return c; } private byte[] loadClassData (String name) throws Exception { String fileName = tempDir + File.separatorChar + name + ".class"; FileInputStream fi = new FileInputStream (fileName); byte[] data = new byte[fi.available ()]; fi.read (data); fi.close(); return data; } public void setTempDir (String tempDir) { this.tempDir = tempDir; } } libbsf-java-2.4.0/src/org/apache/bsf/util/ScriptSymbolTable.java0000644000175000017500000000224510511475734023466 0ustar mkochmkoch/* * Copyright 2004,2004 The Apache Software Foundation. * * Licensed 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. */ package org.apache.bsf.util; import java.util.Hashtable; /** * An ScriptSymbolTable object is used by a CodeBuffer * object to implement nested scopes. * * @author Matthew J. Duftler */ class ScriptSymbolTable extends Hashtable { private Hashtable parentTable; ScriptSymbolTable(Hashtable parentTable) { this.parentTable = parentTable; } public synchronized Object get(Object key) { Object ret = super.get(key); if (ret == null && parentTable != null) ret = parentTable.get(key); return ret; } } libbsf-java-2.4.0/src/org/apache/bsf/util/IndentWriter.java0000644000175000017500000000461710511475734022507 0ustar mkochmkoch/* * Copyright 2004,2004 The Apache Software Foundation. * * Licensed 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. */ package org.apache.bsf.util; import java.io.OutputStream; import java.io.PrintWriter; import java.io.Writer; /** * An IndentWriter object behaves the same as a * PrintWriter object, with the additional capability * of being able to print strings that are prepended with a specified * amount of spaces. * * @author Matthew J. Duftler */ public class IndentWriter extends PrintWriter { /** * Forwards its arguments to the PrintWriter constructor * with the same signature. */ public IndentWriter(OutputStream out) { super(out); } /** * Forwards its arguments to the PrintWriter constructor * with the same signature. */ public IndentWriter(OutputStream out, boolean autoFlush) { super(out, autoFlush); } /** * Forwards its arguments to the PrintWriter constructor * with the same signature. */ public IndentWriter(Writer out) { super(out); } /** * Forwards its arguments to the PrintWriter constructor * with the same signature. */ public IndentWriter(Writer out, boolean autoFlush) { super(out, autoFlush); } /** * Print the text (indented the specified amount) without inserting a linefeed. * * @param numberOfSpaces the number of spaces to indent the text. * @param text the text to print. */ public void print(int numberOfSpaces, String text) { super.print(StringUtils.getChars(numberOfSpaces, ' ') + text); } /** * Print the text (indented the specified amount) and insert a linefeed. * * @param numberOfSpaces the number of spaces to indent the text. * @param text the text to print. */ public void println(int numberOfSpaces, String text) { super.println(StringUtils.getChars(numberOfSpaces, ' ') + text); } } libbsf-java-2.4.0/src/org/apache/bsf/BSFException.java0000644000175000017500000000413510511475734021400 0ustar mkochmkoch/* * Copyright 2004,2004 The Apache Software Foundation. * * Licensed 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. */ package org.apache.bsf; /** * If something goes wrong while doing some scripting stuff, one of these * is thrown. The integer code indicates what's wrong and the message * may give more details. The reason one exception with multiple meanings * (via the code) [instead of multiple exception types] is used is due to * the interest to keep the run-time size small. * * @author Sanjiva Weerawarana */ public class BSFException extends Exception { public static final int REASON_INVALID_ARGUMENT = 0; public static final int REASON_IO_ERROR = 10; public static final int REASON_UNKNOWN_LANGUAGE = 20; public static final int REASON_EXECUTION_ERROR = 100; public static final int REASON_UNSUPPORTED_FEATURE = 499; public static final int REASON_OTHER_ERROR = 500; int reason; Throwable targetThrowable; public BSFException (int reason, String msg) { super (msg); this.reason = reason; } public BSFException (int reason, String msg, Throwable t) { this (reason, msg); targetThrowable = t; } public BSFException (String msg) { this (REASON_OTHER_ERROR, msg); } public int getReason () { return reason; } public Throwable getTargetException () { return targetThrowable; } public void printStackTrace () { if (targetThrowable != null) { String msg = getMessage (); if (msg != null && !msg.equals (targetThrowable.getMessage ())) { System.err.print (msg + ": "); } targetThrowable.printStackTrace (); } else { super.printStackTrace (); } } } libbsf-java-2.4.0/src/org/apache/bsf/BSFEngine.java0000644000175000017500000002366110511475734020654 0ustar mkochmkoch/* * Copyright 2004,2004 The Apache Software Foundation. * * Licensed 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. */ package org.apache.bsf; import java.beans.PropertyChangeListener; import java.util.Vector; import org.apache.bsf.util.CodeBuffer; /** * This is the view of a scripting engine assumed by the Bean Scripting * Framework. This interface is used when an application decides to * run some script under application control. (This is the reverse of * the more common situation, which is that of the scripting language * calling into the application.) *

* When a scripting engine is first fired up, the initialize() * method is called right after construction. *

* A scripting engine must provide two access points for applications * to call into them: via function calls and via expression evaluation. * It must also support loading scripts. *

* A scripting engine is a property change listener and will be notified * when any of the relevant properties of the manager change. (See * BSFManager to see which of its properties are bound.) * * @author Sanjiva Weerawarana * @author Matthew J. Duftler */ public interface BSFEngine extends PropertyChangeListener { /** * This is used by an application to invoke an anonymous function. An * anonymous function is a multi-line script which when evaluated will * produce a value. These are separated from expressions and scripts * because the prior are spsed to be good 'ol expressions and scripts * are not value returning. We allow anonymous functions to have parameters * as well for completeness. * * @param source (context info) the source of this expression * (e.g., filename) * @param lineNo (context info) the line number in source for expr * @param columnNo (context info) the column number in source for expr * @param funcBody the multi-line, value returning script to evaluate * @param paramNames the names of the parameters above assumes * @param arguments values of the above parameters * * @exception BSFException if anything goes wrong while doin' it. */ public Object apply( String source, int lineNo, int columnNo, Object funcBody, Vector paramNames, Vector arguments) throws BSFException; /** * This is used by an application to call into the scripting engine * to make a function/method call. The "object" argument is the object * whose method is to be called, if that applies. For non-OO languages, * this is typically ignored and should be given as null. For pretend-OO * languages such as VB, this would be the (String) name of the object. * The arguments are given in the args array. * * @param object object on which to make the call * @param name name of the method / procedure to call * @param args the arguments to be given to the procedure * * @exception BSFException if anything goes wrong while eval'ing a * BSFException is thrown. The reason indicates the problem. */ public Object call(Object object, String name, Object[] args) throws BSFException; /** * This is used by an application to compile an anonymous function. See * comments in apply for more hdetails. * * @param source (context info) the source of this expression * (e.g., filename) * @param lineNo (context info) the line number in source for expr * @param columnNo (context info) the column number in source for expr * @param funcBody the multi-line, value returning script to evaluate * @param paramNames the names of the parameters above assumes * @param arguments values of the above parameters * @param cb the CodeBuffer to compile into * * @exception BSFException if anything goes wrong while doin' it. */ public void compileApply( String source, int lineNo, int columnNo, Object funcBody, Vector paramNames, Vector arguments, CodeBuffer cb) throws BSFException; /** * This is used by an application to compile a value-returning expression. * The expr may be string or some other type, depending on the language. * The generated code is dumped into the CodeBuffer. * * @param source (context info) the source of this expression * (e.g., filename) * @param lineNo (context info) the line number in source for expr * @param columnNo (context info) the column number in source for expr * @param expr the expression to compile * @param cb the CodeBuffer to compile into * * @exception BSFException if anything goes wrong while compiling a * BSFException is thrown. The reason indicates the problem. */ public void compileExpr( String source, int lineNo, int columnNo, Object expr, CodeBuffer cb) throws BSFException; /** * This is used by an application to compile some script. The * script may be string or some other type, depending on the * language. The generated code is dumped into the CodeBuffer. * * @param source (context info) the source of this script * (e.g., filename) * @param lineNo (context info) the line number in source for script * @param columnNo (context info) the column number in source for script * @param script the script to compile * @param cb the CodeBuffer to compile into * * @exception BSFException if anything goes wrong while compiling a * BSFException is thrown. The reason indicates the problem. */ public void compileScript( String source, int lineNo, int columnNo, Object script, CodeBuffer cb) throws BSFException; /** * Declare a bean after the engine has been started. Declared beans * are beans that are named and which the engine must make available * to the scripts it runs in the most first class way possible. * * @param bean the bean to declare * * @exception BSFException if the engine cannot do this operation */ public void declareBean(BSFDeclaredBean bean) throws BSFException; /** * This is used by an application to evaluate an expression. The * expression may be string or some other type, depending on the * language. (For example, for BML it'll be an org.w3c.dom.Element * object.) * * @param source (context info) the source of this expression * (e.g., filename) * @param lineNo (context info) the line number in source for expr * @param columnNo (context info) the column number in source for expr * @param expr the expression to evaluate * * @exception BSFException if anything goes wrong while eval'ing a * BSFException is thrown. The reason indicates the problem. */ public Object eval(String source, int lineNo, int columnNo, Object expr) throws BSFException; /** * This is used by an application to execute some script. The * expression may be string or some other type, depending on the * language. Returns nothing but if something goes wrong it excepts * (of course). * * @param source (context info) the source of this expression * (e.g., filename) * @param lineNo (context info) the line number in source for expr * @param columnNo (context info) the column number in source for expr * @param script the script to execute * * @exception BSFException if anything goes wrong while exec'ing a * BSFException is thrown. The reason indicates the problem. */ public void exec(String source, int lineNo, int columnNo, Object script) throws BSFException; /** * This is used by an application to execute some script, as though * one were interacting with the language in an interactive session. * The expression may be string or some other type, depending on the * language. Returns nothing but if something goes wrong it excepts (of * course). * * @param source (context info) the source of this expression * (e.g., filename) * @param lineNo (context info) the line number in source for expr * @param columnNo (context info) the column number in source for expr * @param script the script to execute * * @exception BSFException if anything goes wrong while exec'ing a * BSFException is thrown. The reason indicates the problem. */ public void iexec(String source, int lineNo, int columnNo, Object script) throws BSFException; /** * This method is used to initialize the engine right after construction. * This method will be called before any calls to eval or call. At this * time the engine should capture the current values of interesting * properties from the manager. In the future, any changes to those * will be mirrored to me by the manager via a property change event. * * @param mgr The BSFManager that's hosting this engine. * @param lang Language string which this engine is handling. * @param declaredBeans Vector of BSFDeclaredObject containing beans * that should be declared into the language runtime at init * time as best as possible. * * @exception BSFException if anything goes wrong while init'ing a * BSFException is thrown. The reason indicates the problem. */ public void initialize(BSFManager mgr, String lang, Vector declaredBeans) throws BSFException; /** * Graceful termination */ public void terminate(); /** * Undeclare a previously declared bean. * * @param bean the bean to undeclare * * @exception BSFException if the engine cannot do this operation */ public void undeclareBean(BSFDeclaredBean bean) throws BSFException; } libbsf-java-2.4.0/src/org/apache/bsf/BSFDeclaredBean.java0000644000175000017500000000220710511475734021731 0ustar mkochmkoch/* * Copyright 2004,2004 The Apache Software Foundation. * * Licensed 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. */ package org.apache.bsf; /** * BSFDeclaredBeans are used internally by BSF to encapsulate information being * passed between a BSFManager and its various BSFEngines. Note that the * constructor is not public because this is not a public class. * * @author Matthew J. Duftler * @author Sanjiva Weerawarana */ public class BSFDeclaredBean { public String name; public Object bean; public Class type; BSFDeclaredBean(String name, Object bean, Class type) { this.name = name; this.bean = bean; this.type = type; } } libbsf-java-2.4.0/src/org/apache/bsf/engines/0000755000175000017500000000000010511475734017671 5ustar mkochmkochlibbsf-java-2.4.0/src/org/apache/bsf/engines/javaclass/0000755000175000017500000000000010736513022021630 5ustar mkochmkochlibbsf-java-2.4.0/src/org/apache/bsf/engines/javaclass/JavaClassEngine.java0000644000175000017500000000504710511475734025506 0ustar mkochmkoch/* * Copyright 2004,2004 The Apache Software Foundation. * * Licensed 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. */ package org.apache.bsf.engines.javaclass; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import org.apache.bsf.BSFException; import org.apache.bsf.util.BSFEngineImpl; import org.apache.bsf.util.MethodUtils; /** * This is the interface to scripts consisting of Java objects from the * Bean Scripting Framework. * * @author Sanjiva Weerawarana */ public class JavaClassEngine extends BSFEngineImpl { /** * call the named method of the given object. If object is an instance * of Class, then the call is a static call on that object. If not, its * an instance method call or a static call (as per Java) on the given * object. */ public Object call (Object object, String method, Object[] args) throws BSFException { // determine arg types Class[] argTypes = null; if (args != null) { argTypes = new Class[args.length]; for (int i = 0; i < args.length; i++) { argTypes[i] = (args[i] != null) ? args[i].getClass () : null; } } // now find method with the right signature, call it and return result try { Method m = MethodUtils.getMethod (object, method, argTypes); return m.invoke (object, args); } catch (Exception e) { // something went wrong while invoking method Throwable t = (e instanceof InvocationTargetException) ? ((InvocationTargetException)e).getTargetException () : null; throw new BSFException (BSFException.REASON_OTHER_ERROR, "method invocation failed: " + e + ((t==null)?"":(" target exception: "+t)), t); } } /** * This is used by an application to evaluate an object containing * some expression - clearly not possible for compiled code .. */ public Object eval (String source, int lineNo, int columnNo, Object oscript) throws BSFException { throw new BSFException (BSFException.REASON_UNSUPPORTED_FEATURE, "Java bytecode engine can't evaluate expressions"); } } libbsf-java-2.4.0/src/org/apache/bsf/engines/netrexx/0000755000175000017500000000000010736513022021356 5ustar mkochmkochlibbsf-java-2.4.0/src/org/apache/bsf/engines/netrexx/NetRexxEngine.java0000644000175000017500000004354410511475734024766 0ustar mkochmkoch/* * Copyright 2004,2004 The Apache Software Foundation. * * Licensed 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. */ package org.apache.bsf.engines.netrexx; import java.io.File; import java.io.FileOutputStream; import java.io.FilenameFilter; import java.io.PrintWriter; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.Hashtable; import java.util.Vector; import org.apache.bsf.BSFDeclaredBean; import org.apache.bsf.BSFException; import org.apache.bsf.BSFManager; import org.apache.bsf.util.BSFEngineImpl; import org.apache.bsf.util.BSFFunctions; import org.apache.bsf.util.EngineUtils; import org.apache.bsf.util.MethodUtils; import org.apache.bsf.util.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * This is the interface to NetRexx from the * Bean Scripting Framework. *

* The NetRexx code must be written script-style, without a "class" or * "properties" section preceeding the executable code. The NetRexxEngine will * generate a prefix for this code: *

 * 
 * class $$CLASSNAME$$;
 * method BSFNetRexxEngineEntry(bsf=org.apache.bsf.BSFManager) public static;
 * 
 * 
* $$CLASSNAME$$ will be replaced by a generated classname of the form * BSFNetRexx*, and the bsf parameter can be used to retrieve application * objects registered with the Bean Scripting Framework. *

* If you use the placeholder string $$CLASSNAME$$ elsewhere * in your script -- including within text strings -- BSFNetRexxEngine will * replace it with the generated name of the class before the NetRexx code * is compiled. *

* If you need to use full NetRexx functionality, we recommend that your * NetRexx script define and invoke a "minor class", with or without the * "dependent" keyword as suits your needs. You'll have to use $$CLASSNAME$$ * in naming the minor class, since the name of the main class is synthesized; * for example, to create the minor class "bar" you'd write * "class $$CLASSNAME$$.Bar". *

*

Hazards:

*

* Since NetRexx has to be _compiled_ to a Java classfile, invoking it involves * a fair amount of computation to load and execute the compiler. We are * currently making an attempt to manage that by caching the class * after it has been loaded, but the indexing is fairly primitive; we * hash against the script string to find the class for it. *

* Minor-class .class files are now being deleted after the major class loads. * This coould potentially cause problems. * * @author Joe Kesselman * @author Sanjiva Weerawarana */ public class NetRexxEngine extends BSFEngineImpl { BSFFunctions mgrfuncs; static Hashtable codeToClass=new Hashtable(); static String serializeCompilation=""; static String placeholder="$$CLASSNAME$$"; String minorPrefix; private Log logger = LogFactory.getLog(this.getClass().getName()); /** * Create a scratchfile, open it for writing, return its name. * Relies on the filesystem to provide us with uniqueness testing. * NOTE THAT uniqueFileOffset continues to count; we don't want to * risk reusing a classname we have previously loaded in this session * even if the classfile has been deleted. * * I've made the offset static, due to concerns about reuse/reentrancy * of the NetRexx engine. */ private static int uniqueFileOffset=0; private class GeneratedFile { File file=null; FileOutputStream fos=null; String className=null; GeneratedFile(File file,FileOutputStream fos,String className) { this.file=file; this.fos=fos; this.className=className; } } // rexxclass used to be an instance variable, on the theory that // each NetRexxEngine was an instance of a specific script. // BSF is currently reusing Engines, so caching the class // no longer makes sense. // Class rexxclass; /** * Constructor. */ public NetRexxEngine () { /* The following line is intended to cause the constructor to throw a NoClassDefFoundError if the NetRexxC.zip dependency is not resolved. If this line was not here, the problem would not surface until the actual processing of a script. We want to know all is well at the time the engine is instantiated, not when we attempt to process a script. */ new netrexx.lang.BadArgumentException(); } /** * Return an object from an extension. * @param object object from which to call our static method * @param method The name of the method to call. * @param args an array of arguments to be * passed to the extension, which may be either * Vectors of Nodes, or Strings. */ public Object call (Object object, String method, Object[] args) throws BSFException { throw new BSFException(BSFException.REASON_UNSUPPORTED_FEATURE, "NetRexx doesn't currently support call()", null); } /** * Invoke a static method. * @param rexxclass Class to invoke the method against * @param method The name of the method to call. * @param args an array of arguments to be * passed to the extension, which may be either * Vectors of Nodes, or Strings. */ Object callStatic(Class rexxclass, String method, Object[] args) throws BSFException { //***** ISSUE: Currently supports only static methods Object retval = null; try { if (rexxclass != null) { //***** This should call the lookup used in BML, for typesafety Class[] argtypes=new Class[args.length]; for(int i=0;i * Note that NetRexx compilation imposes serious overhead -- 11 seconds for * the first compile, about 3 thereafter -- but in exchange you get * Java-like speeds once the classes have been created (minus the cache * lookup cost). *

* Nobody knows whether javac is threadsafe. * I'm going to serialize access to the compilers to protect it. */ public Object execEvalShared (String source, int lineNo, int columnNo, Object oscript,boolean returnsObject) throws BSFException { Object retval=null; String classname=null; GeneratedFile gf=null; // Moved into the exec process; see comment above. Class rexxclass=null; String basescript=oscript.toString(); String script=basescript; // May be altered by $$CLASSNAME$$ expansion try { // Do we already have a class exactly matching this code? rexxclass=(Class)codeToClass.get(basescript); if(rexxclass!=null) { logger.debug("NetRexxEngine: Found pre-compiled class" + " for script '" + basescript + "'"); classname=rexxclass.getName(); } else { gf=openUniqueFile(tempDir,"BSFNetRexx",".nrx"); if(gf==null) throw new BSFException("couldn't create NetRexx scratchfile"); // Obtain classname classname=gf.className; // Decide whether to declare a return type String returnsDecl=""; if(returnsObject) returnsDecl="returns java.lang.Object"; // Write the kluge header to the file. // ***** By doing so we give up the ability to use Property blocks. gf.fos.write(("class "+classname+";\n") .getBytes()); gf.fos.write( ("method BSFNetRexxEngineEntry(bsf=org.apache.bsf.util.BSFFunctions) "+ " public static "+returnsDecl+";\n") .getBytes()); // Edit the script to replace placeholder with the generated // classname. Note that this occurs _after_ the cache was // checked! int startpoint,endpoint; if((startpoint=script.indexOf(placeholder))>=0) { StringBuffer changed=new StringBuffer(); for(; startpoint>=0; startpoint=script.indexOf(placeholder,startpoint)) { changed.setLength(0); // Reset for 2nd pass or later if(startpoint>0) changed.append(script.substring(0,startpoint)); changed.append(classname); endpoint=startpoint+placeholder.length(); if(endpoint0;) { file=new File(minor_classfiles[--i]); file.delete(); } } } return retval; } public void initialize(BSFManager mgr, String lang,Vector declaredBeans) throws BSFException { super.initialize(mgr, lang, declaredBeans); mgrfuncs = new BSFFunctions (mgr, this); } private GeneratedFile openUniqueFile(String directory,String prefix,String suffix) { File file=null,obj=null; FileOutputStream fos=null; int max=1000; // Don't try forever GeneratedFile gf=null; int i; String className = null; for(i=max,++uniqueFileOffset; fos==null && i>0; --i,++uniqueFileOffset) { // Probably a timing hazard here... *************** try { className = prefix+uniqueFileOffset; file=new File(directory+File.separatorChar+className+suffix); obj=new File(directory+File.separatorChar+className+".class"); if(file!=null && !file.exists() & obj!=null & !obj.exists()) fos=new FileOutputStream(file); } catch(Exception e) { // File could not be opened for write, or Security Exception // was thrown. If someone else created the file before we could // open it, that's probably a threading conflict and we don't // bother reporting it. if(!file.exists()) { logger.error("openUniqueFile: unexpected "+e); } } } if(fos==null) logger.error("openUniqueFile: Failed "+max+"attempts."); else gf=new GeneratedFile(file,fos,className); return gf; } public void undeclareBean (BSFDeclaredBean bean) throws BSFException {} } libbsf-java-2.4.0/src/org/apache/bsf/engines/jython/0000755000175000017500000000000010736513022021174 5ustar mkochmkochlibbsf-java-2.4.0/src/org/apache/bsf/engines/jython/JythonEngine.java0000644000175000017500000001627110511475734024457 0ustar mkochmkoch/* * Copyright 2004,2004 The Apache Software Foundation. * * Licensed 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. */ package org.apache.bsf.engines.jython; import java.io.ByteArrayInputStream; import java.util.Vector; import org.apache.bsf.BSFDeclaredBean; import org.apache.bsf.BSFException; import org.apache.bsf.BSFManager; import org.apache.bsf.util.BSFEngineImpl; import org.apache.bsf.util.BSFFunctions; import org.python.core.Py; import org.python.core.PyException; import org.python.core.PyJavaInstance; import org.python.core.PyObject; import org.python.util.InteractiveInterpreter; /** * This is the interface to Jython (http://www.jython.org/) from BSF. * It's derived from the JPython 1.x engine * * @author Sanjiva Weerawarana * @author Finn Bock * @author Chuck Murcko */ public class JythonEngine extends BSFEngineImpl { BSFPythonInterpreter interp; /** * call the named method of the given object. */ public Object call (Object object, String method, Object[] args) throws BSFException { try { PyObject[] pyargs = Py.EmptyObjects; if (args != null) { pyargs = new PyObject[args.length]; for (int i = 0; i < pyargs.length; i++) pyargs[i] = Py.java2py(args[i]); } if (object != null) { PyObject o = Py.java2py(object); return unwrap(o.invoke(method, pyargs)); } PyObject m = interp.get(method); if (m == null) m = interp.eval(method); if (m != null) { return unwrap(m.__call__(pyargs)); } return null; } catch (PyException e) { throw new BSFException (BSFException.REASON_EXECUTION_ERROR, "exception from Jython:\n" + e, e); } } /** * Declare a bean */ public void declareBean (BSFDeclaredBean bean) throws BSFException { interp.set (bean.name, bean.bean); } /** * Evaluate an anonymous function (differs from eval() in that apply() * handles multiple lines). */ public Object apply (String source, int lineNo, int columnNo, Object funcBody, Vector paramNames, Vector arguments) throws BSFException { try { /* We wrapper the original script in a function definition, and * evaluate the function. A hack, no question, but it allows * apply() to pretend to work on Jython. */ StringBuffer script = new StringBuffer(byteify(funcBody.toString())); int index = 0; script.insert(0, "def bsf_temp_fn():\n"); while (index < script.length()) { if (script.charAt(index) == '\n') { script.insert(index+1, '\t'); } index++; } interp.exec (script.toString ()); Object result = interp.eval ("bsf_temp_fn()"); if (result != null && result instanceof PyJavaInstance) result = ((PyJavaInstance)result).__tojava__(Object.class); return result; } catch (PyException e) { throw new BSFException (BSFException.REASON_EXECUTION_ERROR, "exception from Jython:\n" + e, e); } } /** * Evaluate an expression. */ public Object eval (String source, int lineNo, int columnNo, Object script) throws BSFException { try { Object result = interp.eval (byteify(script.toString ())); if (result != null && result instanceof PyJavaInstance) result = ((PyJavaInstance)result).__tojava__(Object.class); return result; } catch (PyException e) { throw new BSFException (BSFException.REASON_EXECUTION_ERROR, "exception from Jython:\n" + e, e); } } /** * Execute a script. */ public void exec (String source, int lineNo, int columnNo, Object script) throws BSFException { try { interp.exec (byteify(script.toString ())); } catch (PyException e) { throw new BSFException (BSFException.REASON_EXECUTION_ERROR, "exception from Jython:\n" + e, e); } } /** * Execute script code, emulating console interaction. */ public void iexec (String source, int lineNo, int columnNo, Object script) throws BSFException { String scriptStr = byteify(script.toString()); int newline = scriptStr.indexOf("\n"); if (newline > -1) scriptStr = scriptStr.substring(0, newline); try { if (interp.buffer.length() > 0) interp.buffer.append("\n"); interp.buffer.append(scriptStr); if (!(interp.runsource(interp.buffer.toString()))) interp.resetbuffer(); } catch (PyException e) { interp.resetbuffer(); throw new BSFException(BSFException.REASON_EXECUTION_ERROR, "exception from Jython:\n" + e, e); } } /** * Initialize the engine. */ public void initialize (BSFManager mgr, String lang, Vector declaredBeans) throws BSFException { super.initialize (mgr, lang, declaredBeans); // create an interpreter interp = new BSFPythonInterpreter (); // ensure that output and error streams are re-directed correctly interp.setOut(System.out); interp.setErr(System.err); // register the mgr with object name "bsf" interp.set ("bsf", new BSFFunctions (mgr, this)); // Declare all declared beans to the interpreter int size = declaredBeans.size (); for (int i = 0; i < size; i++) { declareBean ((BSFDeclaredBean) declaredBeans.elementAt (i)); } } /** * Undeclare a previously declared bean. */ public void undeclareBean (BSFDeclaredBean bean) throws BSFException { interp.set (bean.name, null); } public Object unwrap(PyObject result) { if (result != null) { Object ret = result.__tojava__(Object.class); if (ret != Py.NoConversion) return ret; } return result; } private String byteify (String orig) { // Ugh. Jython likes to be fed bytes, rather than the input string. ByteArrayInputStream bais = new ByteArrayInputStream(orig.getBytes()); StringBuffer s = new StringBuffer(); int c; while ((c = bais.read()) >= 0) { s.append((char)c); } return s.toString(); } private class BSFPythonInterpreter extends InteractiveInterpreter { public BSFPythonInterpreter() { super(); } // Override runcode so as not to print the stack dump public void runcode(PyObject code) { try { this.exec(code); } catch (PyException exc) { throw exc; } } } } libbsf-java-2.4.0/src/org/apache/bsf/engines/java/0000755000175000017500000000000010736513022020602 5ustar mkochmkochlibbsf-java-2.4.0/src/org/apache/bsf/engines/java/JavaEngine.java0000644000175000017500000003334010511475734023467 0ustar mkochmkoch/* * Copyright 2004,2004 The Apache Software Foundation. * * Licensed 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. */ package org.apache.bsf.engines.java; import java.io.File; import java.io.FileOutputStream; import java.io.FilenameFilter; import java.lang.reflect.Method; import java.util.Hashtable; import java.util.Vector; import org.apache.bsf.BSFException; import org.apache.bsf.BSFManager; import org.apache.bsf.util.BSFEngineImpl; import org.apache.bsf.util.CodeBuffer; import org.apache.bsf.util.EngineUtils; import org.apache.bsf.util.JavaUtils; import org.apache.bsf.util.MethodUtils; import org.apache.bsf.util.ObjInfo; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * This is the interface to Java from the * Bean Scripting Framework. *

* The Java code must be written script-style -- that is, just the body of * the function, without class or method headers or footers. * The JavaEngine will generate those via a "boilerplate" wrapper: *

 * 
 * import java.lang.*;
 * import java.util.*;
 * public class $$CLASSNAME$$ {
 *   static public Object BSFJavaEngineEntry(org.apache.bsf.BSFManager bsf) {
 *     // Your code will be placed here
 *   }
 * }
 * 
 * 
* $$CLASSNAME$$ will be replaced by a generated classname of the form * BSFJava*, and the bsf parameter can be used to retrieve application * objects registered with the Bean Scripting Framework. *

* If you use the placeholder string $$CLASSNAME$$ elsewhere * in your script -- including within text strings -- BSFJavaEngine will * replace it with the generated name of the class before the Java code * is compiled. *

*

Hazards:

*

* NOTE that it is your responsibility to convert the code into an acceptable * Java string. If you're invoking the JavaEngine directly (as in the * JSPLikeInJava example) that means \"quoting\" characters that would * otherwise cause trouble. *

* ALSO NOTE that it is your responsibility to return an object, or null in * lieu thereof! *

* Since the code has to be compiled to a Java classfile, invoking it involves * a fair amount of computation to load and execute the compiler. We are * currently making an attempt to manage that by caching the class * after it has been loaded, but the indexing is fairly primitive. It has * been suggested that the Bean Scripting Framework may want to support * preload-and-name-script and execute-preloaded-script-by-name options to * provide better control over when and how much overhead occurs. *

* @author Joe Kesselman */ public class JavaEngine extends BSFEngineImpl { Class javaclass = null; static Hashtable codeToClass = new Hashtable(); static String serializeCompilation = ""; static String placeholder = "$$CLASSNAME$$"; String minorPrefix; private Log logger = LogFactory.getLog(this.getClass().getName()); /** * Create a scratchfile, open it for writing, return its name. * Relies on the filesystem to provide us with uniqueness testing. * NOTE THAT uniqueFileOffset continues to count; we don't want to * risk reusing a classname we have previously loaded in this session * even if the classfile has been deleted. */ private int uniqueFileOffset = -1; private class GeneratedFile { File file = null; FileOutputStream fos = null; String className = null; GeneratedFile(File file, FileOutputStream fos, String className) { this.file = file; this.fos = fos; this.className = className; } } /** * Constructor. */ public JavaEngine () { // Do compilation-possible check here?????????????? } public Object call (Object object, String method, Object[] args) throws BSFException { throw new BSFException (BSFException.REASON_UNSUPPORTED_FEATURE, "call() is not currently supported by JavaEngine"); } public void compileScript (String source, int lineNo, int columnNo, Object script, CodeBuffer cb) throws BSFException { ObjInfo oldRet = cb.getFinalServiceMethodStatement (); if (oldRet != null && oldRet.isExecutable ()) { cb.addServiceMethodStatement (oldRet.objName + ";"); } cb.addServiceMethodStatement (script.toString ()); cb.setFinalServiceMethodStatement (null); } /** * This is used by an application to evaluate a string containing * some expression. It should store the "bsf" handle where the * script can get to it, for callback purposes. *

* Note that Java compilation imposes serious overhead, * but in exchange you get full Java performance * once the classes have been created (minus the cache lookup cost). *

* Nobody knows whether javac is threadsafe. * I'm going to serialize access to protect it. *

* There is no published API for invoking javac as a class. There's a trick * that seems to work for Java 1.1.x, but it stopped working in Java 1.2. * We will attempt to use it, then if necessary fall back on invoking * javac via the command line. */ public Object eval (String source, int lineNo, int columnNo, Object oscript) throws BSFException { Object retval = null; String classname = null; GeneratedFile gf = null; String basescript = oscript.toString(); String script = basescript; // May be altered by $$CLASSNAME$$ expansion try { // Do we already have a class exactly matching this code? javaclass = (Class)codeToClass.get(basescript); if(javaclass != null) { classname=javaclass.getName(); } else { gf = openUniqueFile(tempDir, "BSFJava",".java"); if( gf == null) { throw new BSFException("couldn't create JavaEngine scratchfile"); } // Obtain classname classname = gf.className; // Write the kluge header to the file. gf.fos.write(("import java.lang.*;"+ "import java.util.*;"+ "public class "+classname+" {\n" + " static public Object BSFJavaEngineEntry(org.apache.bsf.BSFManager bsf) {\n") .getBytes()); // Edit the script to replace placeholder with the generated // classname. Note that this occurs _after_ the cache was checked! int startpoint = script.indexOf(placeholder); int endpoint; if(startpoint >= 0) { StringBuffer changed = new StringBuffer(); for(; startpoint >=0; startpoint = script.indexOf(placeholder,startpoint)) { changed.setLength(0); // Reset for 2nd pass or later if(startpoint > 0) { changed.append(script.substring(0,startpoint)); } changed.append(classname); endpoint = startpoint+placeholder.length(); if(endpoint < script.length()) { changed.append(script.substring(endpoint)); } script = changed.toString(); } } // MJD - debug // BSFDeclaredBean tempBean; // String className; // // for (int i = 0; i < declaredBeans.size (); i++) { // tempBean = (BSFDeclaredBean) declaredBeans.elementAt (i); // className = StringUtils.getClassName (tempBean.bean.getClass ()); // // gf.fos.write ((className + " " + // tempBean.name + " = (" + className + // ")bsf.lookupBean(\"" + // tempBean.name + "\");").getBytes ()); // } // MJD - debug // Copy the input to the file. // Assumes all available -- probably mistake, but same as other engines. gf.fos.write(script.getBytes()); // Close the method and class gf.fos.write(("\n }\n}\n").getBytes()); gf.fos.close(); // Compile through Java to .class file // May not be threadsafe. Serialize access on static object: synchronized(serializeCompilation) { JavaUtils.JDKcompile(gf.file.getPath(), classPath); } // Load class. javaclass = EngineUtils.loadClass(mgr, classname); // Stash class for reuse codeToClass.put(basescript, javaclass); } Object[] callArgs = {mgr}; retval = internalCall(this,"BSFJavaEngineEntry",callArgs); } catch(Exception e) { e.printStackTrace (); throw new BSFException (BSFException.REASON_IO_ERROR, e.getMessage ()); } finally { // Cleanup: delete the .java and .class files // if(gf!=null && gf.file!=null && gf.file.exists()) // gf.file.delete(); // .java file if(classname!=null) { // Generated class File file = new File(tempDir+File.separatorChar+classname+".class"); // if(file.exists()) // file.delete(); // Search for and clean up minor classes, classname$xxx.class file = new File(tempDir); // ***** Is this required? minorPrefix = classname+"$"; // Indirect arg to filter String[] minorClassfiles = file.list(new FilenameFilter() { // Starts with classname$ and ends with .class public boolean accept(File dir,String name) { return (0 == name.indexOf(minorPrefix)) && (name.lastIndexOf(".class") == name.length()-6); } }); for(int i = 0; i < minorClassfiles.length; ++i) { file = new File(minorClassfiles[i]); // file.delete(); } } } return retval; } public void initialize (BSFManager mgr, String lang, Vector declaredBeans) throws BSFException { super.initialize (mgr, lang, declaredBeans); } /** * Return an object from an extension. * @param object Object on which to make the internal_call (ignored). * @param method The name of the method to internal_call. * @param args an array of arguments to be * passed to the extension, which may be either * Vectors of Nodes, or Strings. */ Object internalCall (Object object, String method, Object[] args) throws BSFException { //***** ISSUE: Only static methods are currently supported Object retval = null; try { if(javaclass != null) { //***** This should call the lookup used in BML, for typesafety Class[] argtypes = new Class[args.length]; for(int i=0; i0;--i,++uniqueFileOffset) { // Probably a timing hazard here... *************** try { className = prefix+uniqueFileOffset; file = new File(directory+File.separatorChar+className+suffix); if(file != null && !file.exists()) { fos = new FileOutputStream(file); } } catch(Exception e) { // File could not be opened for write, or Security Exception // was thrown. If someone else created the file before we could // open it, that's probably a threading conflict and we don't // bother reporting it. if(!file.exists()) { logger.error("openUniqueFile: unexpected ", e); } } } if(fos==null) { logger.error("openUniqueFile: Failed "+max+"attempts."); } else { gf = new GeneratedFile(file,fos,className); } return gf; } }libbsf-java-2.4.0/src/org/apache/bsf/engines/jacl/0000755000175000017500000000000010736513022020572 5ustar mkochmkochlibbsf-java-2.4.0/src/org/apache/bsf/engines/jacl/JaclEngine.java0000644000175000017500000000771710511475734023460 0ustar mkochmkoch/* * Copyright 2004,2004 The Apache Software Foundation. * * Licensed 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. */ package org.apache.bsf.engines.jacl; import java.util.Vector; import org.apache.bsf.BSFDeclaredBean; import org.apache.bsf.BSFException; import org.apache.bsf.BSFManager; import org.apache.bsf.util.BSFEngineImpl; import tcl.lang.Interp; import tcl.lang.ReflectObject; import tcl.lang.TclDouble; import tcl.lang.TclException; import tcl.lang.TclInteger; import tcl.lang.TclObject; import tcl.lang.TclString; /** * This is the interface to Scriptics's Jacl (Tcl) from the * Bean Scripting Framework. *

* * @author Sanjiva Weerawarana */ public class JaclEngine extends BSFEngineImpl { /* the Jacl interpretor object */ private Interp interp; /** * * @param method The name of the method to call. * @param args an array of arguments to be * passed to the extension, which may be either * Vectors of Nodes, or Strings. */ public Object call (Object obj, String method, Object[] args) throws BSFException { StringBuffer tclScript = new StringBuffer (method); if (args != null) { for( int i = 0 ; i < args.length ; i++ ) { tclScript.append (" "); tclScript.append (args[i].toString ()); } } return eval ("", 0, 0, tclScript.toString ()); } /** * Declare a bean */ public void declareBean (BSFDeclaredBean bean) throws BSFException { String expr = "set " + bean.name + " [bsf lookupBean \"" + bean.name + "\"]"; eval ("", 0, 0, expr); } /** * This is used by an application to evaluate a string containing * some expression. */ public Object eval (String source, int lineNo, int columnNo, Object oscript) throws BSFException { String script = oscript.toString (); try { interp.eval (script); TclObject result = interp.getResult(); Object internalRep = result.getInternalRep(); // if the object has a corresponding Java type, unwrap it if (internalRep instanceof ReflectObject) return ReflectObject.get(interp,result); if (internalRep instanceof TclString) return result.toString(); if (internalRep instanceof TclDouble) return new Double(TclDouble.get(interp,result)); if (internalRep instanceof TclInteger) return new Integer(TclInteger.get(interp,result)); return result; } catch (TclException e) { throw new BSFException (BSFException.REASON_EXECUTION_ERROR, "error while eval'ing Jacl expression: " + interp.getResult (), e); } } /** * Initialize the engine. */ public void initialize (BSFManager mgr, String lang, Vector declaredBeans) throws BSFException { super.initialize (mgr, lang, declaredBeans); // create interpreter interp = new Interp(); // register the extension that user's can use to get at objects // registered by the app interp.createCommand ("bsf", new BSFCommand (mgr, this)); // Make java functions be available to Jacl try { interp.eval("jaclloadjava"); } catch (TclException e) { throw new BSFException (BSFException.REASON_OTHER_ERROR, "error while loading java package: " + interp.getResult (), e); } int size = declaredBeans.size (); for (int i = 0; i < size; i++) { declareBean ((BSFDeclaredBean) declaredBeans.elementAt (i)); } } /** * Undeclare a previously declared bean. */ public void undeclareBean (BSFDeclaredBean bean) throws BSFException { eval ("", 0, 0, "set " + bean.name + " \"\""); } } libbsf-java-2.4.0/src/org/apache/bsf/engines/jacl/BSFCommand.java0000644000175000017500000000641610511475734023365 0ustar mkochmkoch/* * Copyright 2004,2004 The Apache Software Foundation. * * Licensed 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. */ package org.apache.bsf.engines.jacl; import org.apache.bsf.BSFEngine; import org.apache.bsf.BSFException; import org.apache.bsf.BSFManager; import org.apache.bsf.util.EngineUtils; import tcl.lang.Command; import tcl.lang.Interp; import tcl.lang.ReflectObject; import tcl.lang.TCL; import tcl.lang.TclException; import tcl.lang.TclObject; // class used to add "bsf" command to the Jacl runtime class BSFCommand implements Command { BSFManager mgr; BSFEngine jengine; BSFCommand (BSFManager mgr, BSFEngine jengine) { this.mgr = mgr; this.jengine = jengine; } public void cmdProc (Interp interp, TclObject argv[]) throws TclException { if (argv.length < 2) { interp.setResult ("invalid # of args; usage: bsf " + "lookupBean|registerBean|unregisterBean|addEventListener args"); throw new TclException (TCL.ERROR); } String op = argv[1].toString (); if (op.equals ("lookupBean")) { if (argv.length != 3) { interp.setResult ("invalid # of args; usage: bsf " + "lookupBean name-of-bean"); throw new TclException (TCL.ERROR); } String beanName = argv[2].toString (); Object bean = mgr.lookupBean (beanName); if (bean == null) { interp.setResult ("unknown object: " + beanName); throw new TclException (TCL.ERROR); } interp.setResult (ReflectObject.newInstance (interp, bean.getClass (), bean)); } else if (op.equals ("registerBean")) { if (argv.length != 4) { interp.setResult ("invalid # of args; usage: bsf " + "registerBean name-of-bean bean"); throw new TclException (TCL.ERROR); } mgr.registerBean (argv[2].toString (), ReflectObject.get (interp, argv[3])); interp.setResult (""); } else if (op.equals ("unregisterBean")) { if (argv.length != 3) { interp.setResult ("invalid # of args; usage: bsf " + "unregisterBean name-of-bean"); throw new TclException (TCL.ERROR); } mgr.unregisterBean (argv[2].toString ()); interp.setResult (""); } else if (op.equals ("addEventListener")) { if (argv.length != 6) { interp.setResult ("invalid # of args; usage: bsf " + "addEventListener object event-set-name filter " + "script-to-run"); throw new TclException (TCL.ERROR); } try { // usage: bsf addEventListener object event-set filter script String filter = argv[4].toString (); filter = filter.equals ("") ? null : filter; EngineUtils.addEventListener (ReflectObject.get (interp, argv[2]), argv[3].toString (), filter, jengine, mgr, "", 0, 0, argv[5].toString ()); } catch (BSFException e) { e.printStackTrace (); interp.setResult ("got BSF exception: " + e.getMessage ()); throw new TclException (TCL.ERROR); } } } } libbsf-java-2.4.0/src/org/apache/bsf/engines/xslt/0000755000175000017500000000000010736513022020653 5ustar mkochmkochlibbsf-java-2.4.0/src/org/apache/bsf/engines/xslt/XSLTResultNode.java0000644000175000017500000000151310511475734024325 0ustar mkochmkoch/* * Copyright 2004,2004 The Apache Software Foundation. * * Licensed 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. */ package org.apache.bsf.engines.xslt; import org.w3c.dom.Node; public class XSLTResultNode { Node node; public XSLTResultNode(Node node) { this.node = node; } public Node getNode() { return node; } } libbsf-java-2.4.0/src/org/apache/bsf/engines/xslt/XSLTEngine.java0000644000175000017500000001611310511475734023450 0ustar mkochmkoch/* * Copyright 2004,2004 The Apache Software Foundation. * * Licensed 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. */ package org.apache.bsf.engines.xslt; import java.io.File; import java.io.Reader; import java.io.StringReader; import java.net.URL; import java.util.Vector; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMResult; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamSource; import org.apache.bsf.BSFDeclaredBean; import org.apache.bsf.BSFException; import org.apache.bsf.BSFManager; import org.apache.bsf.util.BSFEngineImpl; import org.apache.bsf.util.BSFFunctions; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.xpath.objects.XObject; import org.w3c.dom.Node; /** * Xerces XSLT interface to BSF. Requires Xalan and Xerces from Apache. * * This integration uses the BSF registry to pass in any src document * and stylesheet base URI that the user may wish to set. * * @author Sanjiva Weerawarana * @author Sam Ruby * * Re-implemented for the Xalan 2 codebase * * @author Victor J. Orlikowski */ public class XSLTEngine extends BSFEngineImpl { TransformerFactory tFactory; Transformer transformer; Log logger = LogFactory.getLog(this.getClass().getName()); /** * call the named method of the given object. */ public Object call (Object object, String method, Object[] args) throws BSFException { throw new BSFException (BSFException.REASON_UNSUPPORTED_FEATURE, "BSF:XSLTEngine can't call methods"); } /** * Declare a bean by setting it as a parameter */ public void declareBean (BSFDeclaredBean bean) throws BSFException { transformer.setParameter (bean.name, new XObject (bean.bean)); } /** * Evaluate an expression. In this case, an expression is assumed * to be a stylesheet of the template style (see the XSLT spec). */ public Object eval (String source, int lineNo, int columnNo, Object oscript) throws BSFException { // get the style base URI (the place from where Xerces XSLT will // look for imported/included files and referenced docs): if a // bean named "xslt:styleBaseURI" is registered, then cvt it // to a string and use that. Otherwise use ".", which means the // base is the directory where the process is running from Object sbObj = mgr.lookupBean ("xslt:styleBaseURI"); String styleBaseURI = (sbObj == null) ? "." : sbObj.toString (); // Locate the stylesheet. StreamSource styleSource; styleSource = new StreamSource(new StringReader(oscript.toString ())); styleSource.setSystemId(styleBaseURI); try { transformer = tFactory.newTransformer(styleSource); } catch (Exception e) { logger.error("Exception from Xerces XSLT:", e); throw new BSFException (BSFException.REASON_EXECUTION_ERROR, "Exception from Xerces XSLT: " + e, e); } // get the src to work on: if a bean named "xslt:src" is registered // and its a Node, then use it as the source. If its not a Node, then // if its a URL parse it, if not treat it as a file and make a URL and // parse it and go. If no xslt:src is found, use an empty document // (stylesheet is treated as a literal result element stylesheet) Object srcObj = mgr.lookupBean ("xslt:src"); Object xis = null; if (srcObj != null) { if (srcObj instanceof Node) { xis = new DOMSource((Node)srcObj); } else { try { String mesg = "as anything"; if (srcObj instanceof Reader) { xis = new StreamSource ((Reader) srcObj); mesg = "as a Reader"; } else if (srcObj instanceof File) { xis = new StreamSource ((File) srcObj); mesg = "as a file"; } else { String srcObjstr=srcObj.toString(); xis = new StreamSource (new StringReader(srcObjstr)); if (srcObj instanceof URL) { mesg = "as a URL"; } else { ((StreamSource) xis).setPublicId (srcObjstr); mesg = "as an XML string"; } } if (xis == null) { throw new Exception ("Unable to get input from '" + srcObj + "' " + mesg); } } catch (Exception e) { throw new BSFException (BSFException.REASON_EXECUTION_ERROR, "BSF:XSLTEngine: unable to get " + "input from '" + srcObj + "' as XML", e); } } } else { // create an empty document - real src must come into the // stylesheet using "doc(...)" [see XSLT spec] or the stylesheet // must be of literal result element type xis = new StreamSource(); } // set all declared beans as parameters. for (int i = 0; i < declaredBeans.size (); i++) { BSFDeclaredBean b = (BSFDeclaredBean) declaredBeans.elementAt (i); transformer.setParameter (b.name, new XObject (b.bean)); } // declare a "bsf" parameter which is the BSF handle so that // the script can do BSF stuff if it wants to transformer.setParameter ("bsf", new XObject (new BSFFunctions (mgr, this))); // do it try { DOMResult result = new DOMResult(); transformer.transform ((StreamSource) xis, result); return new XSLTResultNode (result.getNode()); } catch (Exception e) { throw new BSFException (BSFException.REASON_EXECUTION_ERROR, "exception while eval'ing XSLT script" + e, e); } } /** * Initialize the engine. */ public void initialize (BSFManager mgr, String lang, Vector declaredBeans) throws BSFException { super.initialize (mgr, lang, declaredBeans); tFactory = TransformerFactory.newInstance(); } /** * Undeclare a bean by setting he parameter represeting it to null */ public void undeclareBean (BSFDeclaredBean bean) throws BSFException { // Cannot clear only one parameter in Xalan 2, so we set it to null if ((transformer.getParameter (bean.name)) != null) { transformer.setParameter (bean.name, null); } } } libbsf-java-2.4.0/src/org/apache/bsf/engines/javascript/0000755000175000017500000000000010736513022022027 5ustar mkochmkochlibbsf-java-2.4.0/src/org/apache/bsf/engines/javascript/JavaScriptEngine.java0000644000175000017500000001717110511475734026105 0ustar mkochmkoch/* * Copyright 2004,2004 The Apache Software Foundation. * * Licensed 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. */ package org.apache.bsf.engines.javascript; import java.util.Iterator; import java.util.Vector; import org.apache.bsf.BSFDeclaredBean; import org.apache.bsf.BSFException; import org.apache.bsf.BSFManager; import org.apache.bsf.util.BSFEngineImpl; import org.apache.bsf.util.BSFFunctions; import org.mozilla.javascript.Context; import org.mozilla.javascript.EvaluatorException; import org.mozilla.javascript.Function; import org.mozilla.javascript.ImporterTopLevel; import org.mozilla.javascript.JavaScriptException; import org.mozilla.javascript.NativeJavaObject; import org.mozilla.javascript.Scriptable; import org.mozilla.javascript.WrappedException; import org.mozilla.javascript.Wrapper; /** * This is the interface to Netscape's Rhino (JavaScript) from the * Bean Scripting Framework. *

* The original version of this code was first written by Adam Peller * for use in LotusXSL. Sanjiva took his code and adapted it for BSF. * * @author Adam Peller * @author Sanjiva Weerawarana * @author Matthew J. Duftler * @author Norris Boyd */ public class JavaScriptEngine extends BSFEngineImpl { /** * The global script object, where all embedded functions are defined, * as well as the standard ECMA "core" objects. */ private Scriptable global; /** * Return an object from an extension. * @param object Object on which to make the call (ignored). * @param method The name of the method to call. * @param args an array of arguments to be * passed to the extension, which may be either * Vectors of Nodes, or Strings. */ public Object call(Object object, String method, Object[] args) throws BSFException { Object retval = null; Context cx; try { cx = Context.enter(); // REMIND: convert arg list Vectors here? Object fun = global.get(method, global); // NOTE: Source and line arguments are nonsense in a call(). // Any way to make these arguments *sensible? if (fun == Scriptable.NOT_FOUND) throw new EvaluatorException("function " + method + " not found.", "none", 0); cx.setOptimizationLevel(-1); cx.setGeneratingDebug(false); cx.setGeneratingSource(false); cx.setOptimizationLevel(0); cx.setDebugger(null, null); retval = ((Function) fun).call(cx, global, global, args); // ScriptRuntime.call(cx, fun, global, args, global); if (retval instanceof Wrapper) retval = ((Wrapper) retval).unwrap(); } catch (Throwable t) { handleError(t); } finally { Context.exit(); } return retval; } public void declareBean(BSFDeclaredBean bean) throws BSFException { if ((bean.bean instanceof Number) || (bean.bean instanceof String) || (bean.bean instanceof Boolean)) { global.put(bean.name, global, bean.bean); } else { // Must wrap non-scriptable objects before presenting to Rhino Scriptable wrapped = Context.toObject(bean.bean, global); global.put(bean.name, global, wrapped); } } /** * This is used by an application to evaluate a string containing * some expression. */ public Object eval(String source, int lineNo, int columnNo, Object oscript) throws BSFException { String scriptText = oscript.toString(); Object retval = null; Context cx; try { cx = Context.enter(); cx.setOptimizationLevel(-1); cx.setGeneratingDebug(false); cx.setGeneratingSource(false); cx.setOptimizationLevel(0); cx.setDebugger(null, null); retval = cx.evaluateString(global, scriptText, source, lineNo, null); if (retval instanceof NativeJavaObject) retval = ((NativeJavaObject) retval).unwrap(); } catch (Throwable t) { // includes JavaScriptException, rethrows Errors handleError(t); } finally { Context.exit(); } return retval; } private void handleError(Throwable t) throws BSFException { if (t instanceof WrappedException) t = ((WrappedException) t).getWrappedException(); String message = null; Throwable target = t; if (t instanceof JavaScriptException) { message = t.getLocalizedMessage(); // Is it an exception wrapped in a JavaScriptException? Object value = ((JavaScriptException) t).getValue(); if (value instanceof Throwable) { // likely a wrapped exception from a LiveConnect call. // Display its stack trace as a diagnostic target = (Throwable) value; } } else if (t instanceof EvaluatorException || t instanceof SecurityException) { message = t.getLocalizedMessage(); } else if (t instanceof RuntimeException) { message = "Internal Error: " + t.toString(); } else if (t instanceof StackOverflowError) { message = "Stack Overflow"; } if (message == null) message = t.toString(); if (t instanceof Error && !(t instanceof StackOverflowError)) { // Re-throw Errors because we're supposed to let the JVM see it // Don't re-throw StackOverflows, because we know we've // corrected the situation by aborting the loop and // a long stacktrace would end up on the user's console throw (Error) t; } else { throw new BSFException(BSFException.REASON_OTHER_ERROR, "JavaScript Error: " + message, target); } } /** * Initialize the engine. * Put the manager into the context-manager * map hashtable too. */ public void initialize(BSFManager mgr, String lang, Vector declaredBeans) throws BSFException { super.initialize(mgr, lang, declaredBeans); // Initialize context and global scope object try { Context cx = Context.enter(); global = new ImporterTopLevel(cx); Scriptable bsf = Context.toObject(new BSFFunctions(mgr, this), global); global.put("bsf", global, bsf); for(Iterator it = declaredBeans.iterator(); it.hasNext();) { declareBean((BSFDeclaredBean) it.next()); } } catch (Throwable t) { } finally { Context.exit(); } } public void undeclareBean(BSFDeclaredBean bean) throws BSFException { global.delete(bean.name); } } libbsf-java-2.4.0/src/org/apache/bsf/Main.java0000644000175000017500000001353710511475734020001 0ustar mkochmkoch/* * Copyright 2004,2004 The Apache Software Foundation. * * Licensed 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. */ package org.apache.bsf; import java.awt.Frame; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.io.Reader; import java.util.Hashtable; import org.apache.bsf.util.CodeBuffer; import org.apache.bsf.util.IOUtils; /** * This is the main driver for BSF to be run on the command line * to eval/exec/compile scripts directly. * * @author Sanjiva Weerawarana * @author Matthew J. Duftler * @author Sam Ruby */ public class Main { private static String ARG_IN = "-in"; private static String ARG_LANG = "-lang"; private static String ARG_MODE = "-mode"; private static String ARG_OUT = "-out"; private static String ARG_VAL_EVAL = "eval"; private static String ARG_VAL_EXEC = "exec"; private static String ARG_VAL_COMPILE = "compile"; private static String DEFAULT_IN_FILE_NAME = ""; private static String DEFAULT_MODE = ARG_VAL_EVAL; private static String DEFAULT_CLASS_NAME = "Test"; /** * Static driver to be able to run BSF scripts from the command line. * * @param args command line arguments * * @exception IOException if any I/O error while loading script */ public static void main(String[] args) throws IOException { try { if ((args.length == 0) || (args.length % 2 != 0)) { printHelp(); System.exit(1); } Hashtable argsTable = new Hashtable(); argsTable.put(ARG_OUT, DEFAULT_CLASS_NAME); argsTable.put(ARG_MODE, DEFAULT_MODE); for (int i = 0; i < args.length; i += 2) { argsTable.put(args[i], args[i + 1]); } String inFileName = (String) argsTable.get(ARG_IN); String language = (String) argsTable.get(ARG_LANG); if (language == null) { if (inFileName != null) { language = BSFManager.getLangFromFilename(inFileName); } else { throw new BSFException( BSFException.REASON_OTHER_ERROR, "unable to determine language"); } } Reader in; if (inFileName != null) { in = new FileReader(inFileName); } else { in = new InputStreamReader(System.in); inFileName = DEFAULT_IN_FILE_NAME; } BSFManager mgr = new BSFManager(); String mode = (String) argsTable.get(ARG_MODE); if (mode.equals(ARG_VAL_COMPILE)) { String outClassName = (String) argsTable.get(ARG_OUT); FileWriter out = new FileWriter(outClassName + ".java"); PrintWriter pw = new PrintWriter(out); CodeBuffer cb = new CodeBuffer(); cb.setClassName(outClassName); mgr.compileScript( language, inFileName, 0, 0, IOUtils.getStringFromReader(in), cb); cb.print(pw, true); out.close(); } else { if (mode.equals(ARG_VAL_EXEC)) { mgr.exec(language, inFileName, 0, 0, IOUtils.getStringFromReader(in)); } else { /* eval */ Object obj = mgr.eval(language, inFileName, 0, 0, IOUtils.getStringFromReader(in)); // Try to display the result. if (obj instanceof java.awt.Component) { Frame f; if (obj instanceof Frame) { f = (Frame) obj; } else { f = new Frame ("BSF Result: " + inFileName); f.add ((java.awt.Component) obj); } // Add a window listener to quit on closing. f.addWindowListener( new WindowAdapter () { public void windowClosing (WindowEvent e) { System.exit (0); } } ); f.pack (); // f.show(); // javac 1.5 warns to use f.show(), Apache build scripts abort as a result :( f.setVisible(true); // available since Java 1.1 } else { System.err.println("Result: " + obj); } System.err.println("Result: " + obj); } } } catch (BSFException e) { e.printStackTrace(); } } private static void printHelp() { System.err.println("Usage:"); System.err.println(); System.err.println(" java " + Main.class.getName() + " [args]"); System.err.println(); System.err.println(" args:"); System.err.println(); System.err.println( " [-in fileName] default: " + DEFAULT_IN_FILE_NAME); System.err.println( " [-lang languageName] default: " + ""); System.err.println( " [-mode (eval|exec|compile)] default: " + DEFAULT_MODE); System.err.println(); System.err.println( " Additional args used only if -mode is " + "set to \"compile\":"); System.err.println(); System.err.println( " [-out className] default: " + DEFAULT_CLASS_NAME); } }libbsf-java-2.4.0/src/org/apache/bsf/BSFManager.java0000644000175000017500000010125010511475734021010 0ustar mkochmkoch/* * Copyright 2004,2004 The Apache Software Foundation. * * Licensed 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. */ package org.apache.bsf; import java.beans.PropertyChangeSupport; import java.io.IOException; import java.io.InputStream; import java.net.URL; import java.security.AccessController; import java.security.PrivilegedActionException; import java.security.PrivilegedExceptionAction; import java.util.Enumeration; import java.util.Hashtable; import java.util.Iterator; import java.util.MissingResourceException; import java.util.NoSuchElementException; import java.util.Properties; import java.util.StringTokenizer; import java.util.Vector; import org.apache.bsf.util.CodeBuffer; import org.apache.bsf.util.ObjectRegistry; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * This class is the entry point to the bean scripting framework. An * application wishing to integrate scripting to a Java app would * place an instance of a BSFManager in their code and use its services * to register the beans they want to make available for scripting, * load scripting engines, and run scripts. *

* BSFManager serves as the registry of available scripting engines * as well. Loading and unloading of scripting engines is * supported as well. Each BSFManager loads one engine per language. * Several BSFManagers can be created per JVM. * * @author Sanjiva Weerawarana * @author Matthew J. Duftler * @author Sam Ruby * @author Olivier Gruber (added original debugging support) * @author Don Schwarz (added support for registering languages dynamically) */ public class BSFManager { // version string is in the form "abc.yyyymmdd" where // "abc" represents a dewey decimal number (three levels, each between 0 and 9), // and "yyyy" a four digit year, "mm" a two digit month, "dd" a two digit day. // // Example: "240.20060925" stands for: BSF version "2.4.0" as of "2006-09-25" protected static String version="240.20061006"; // table of registered scripting engines protected static Hashtable registeredEngines = new Hashtable(); // mapping of file extensions to languages protected static Hashtable extn2Lang = new Hashtable(); // table of scripting engine instances created by this manager. // only one instance of a given language engine is created by a single // manager instance. protected Hashtable loadedEngines = new Hashtable(); // table of registered beans for use by scripting engines. protected ObjectRegistry objectRegistry = new ObjectRegistry(); // prop change support containing loaded engines to inform when any // of my interesting properties change protected PropertyChangeSupport pcs; // the class loader to use if a class loader is needed. Default is // he who loaded me (which may be null in which case its Class.forName). // protected ClassLoader classLoader = getClass().getClassLoader(); protected ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); // rgf, 2006-01-05 // temporary directory to use to dump temporary files into. Note that // if class files are dropped here then unless this dir is in the // classpath or unless the classloader knows to look here, the classes // will not be found. protected String tempDir = "."; // classpath used by those that need a classpath protected String classPath; // stores BSFDeclaredBeans representing objects // introduced by a client of BSFManager protected Vector declaredBeans = new Vector(); private Log logger = LogFactory.getLog(this.getClass().getName()); ////////////////////////////////////////////////////////////////////// // // pre-register engines that BSF supports off the shelf // ////////////////////////////////////////////////////////////////////// static { try { Enumeration e = BSFManager.class.getClassLoader().getResources("org/apache/bsf/Languages.properties"); while (e.hasMoreElements()) { URL url = (URL)e.nextElement(); InputStream is = url.openStream(); Properties p = new Properties(); p.load(is); for (Enumeration keys = p.propertyNames(); keys.hasMoreElements();) { String key = (String) keys.nextElement(); String value = p.getProperty(key); String className = value.substring(0, value.indexOf(",")); // get the extensions for this language String exts = value.substring(value.indexOf(",")+1, value.length()); StringTokenizer st = new StringTokenizer(exts, "|"); String[] extensions = new String[st.countTokens()]; for (int i = 0; st.hasMoreTokens(); i++) { extensions[i] = ((String) st.nextToken()).trim(); } registerScriptingEngine(key, className, extensions); } } } catch (IOException ex) { ex.printStackTrace(); System.err.println("Error reading Languages file " + ex); } catch (NoSuchElementException nsee) { nsee.printStackTrace(); System.err.println("Syntax error in Languages resource bundle"); } catch (MissingResourceException mre) { mre.printStackTrace(); System.err.println("Initialization error: " + mre.toString()); } } public BSFManager() { pcs = new PropertyChangeSupport(this); } /** Returns the version string of BSF. * * @return version string in the form "abc.yyyymmdd" where "abc" represents a dewey decimal number (three levels, each between 0 and 9), and "yyyy" a four digit year, "mm" a two digit month, "dd" a two digit day. *
Example: "240.20061006" stands for: BSF version 2.4.0 as of 2006-10-06. * * * @since 2006-01-17 */ public static String getVersion() { return version; } /** * Apply the given anonymous function of the given language to the given * parameters and return the resulting value. * * @param lang language identifier * @param source (context info) the source of this expression (e.g., filename) * @param lineNo (context info) the line number in source for expr * @param columnNo (context info) the column number in source for expr * @param funcBody the multi-line, value returning script to evaluate * @param paramNames the names of the parameters above assumes * @param arguments values of the above parameters * * @exception BSFException if anything goes wrong while running the script */ public Object apply(String lang, String source, int lineNo, int columnNo, Object funcBody, Vector paramNames, Vector arguments) throws BSFException { logger.debug("BSFManager:apply"); final BSFEngine e = loadScriptingEngine(lang); final String sourcef = source; final int lineNof = lineNo, columnNof = columnNo; final Object funcBodyf = funcBody; final Vector paramNamesf = paramNames; final Vector argumentsf = arguments; Object result = null; try { final Object resultf = AccessController.doPrivileged(new PrivilegedExceptionAction() { public Object run() throws Exception { return e.apply(sourcef, lineNof, columnNof, funcBodyf, paramNamesf, argumentsf); } }); result = resultf; } catch (PrivilegedActionException prive) { logger.error("Exception: ", prive); throw (BSFException) prive.getException(); } return result; } /** * Compile the application of the given anonymous function of the given * language to the given parameters into the given CodeBuffer. * * @param lang language identifier * @param source (context info) the source of this expression (e.g., filename) * @param lineNo (context info) the line number in source for expr * @param columnNo (context info) the column number in source for expr * @param funcBody the multi-line, value returning script to evaluate * @param paramNames the names of the parameters above assumes * @param arguments values of the above parameters * @param cb code buffer to compile into * * @exception BSFException if anything goes wrong while running the script */ public void compileApply(String lang, String source, int lineNo, int columnNo, Object funcBody, Vector paramNames, Vector arguments, CodeBuffer cb) throws BSFException { logger.debug("BSFManager:compileApply"); final BSFEngine e = loadScriptingEngine(lang); final String sourcef = source; final int lineNof = lineNo, columnNof = columnNo; final Object funcBodyf = funcBody; final Vector paramNamesf = paramNames; final Vector argumentsf = arguments; final CodeBuffer cbf = cb; try { AccessController.doPrivileged(new PrivilegedExceptionAction() { public Object run() throws Exception { e.compileApply(sourcef, lineNof, columnNof, funcBodyf, paramNamesf, argumentsf, cbf); return null; } }); } catch (PrivilegedActionException prive) { logger.error("Exception :", prive); throw (BSFException) prive.getException(); } } /** * Compile the given expression of the given language into the given * CodeBuffer. * * @param lang language identifier * @param source (context info) the source of this expression (e.g., filename) * @param lineNo (context info) the line number in source for expr * @param columnNo (context info) the column number in source for expr * @param expr the expression to compile * @param cb code buffer to compile into * * @exception BSFException if any error while compiling the expression */ public void compileExpr(String lang, String source, int lineNo, int columnNo, Object expr, CodeBuffer cb) throws BSFException { logger.debug("BSFManager:compileExpr"); final BSFEngine e = loadScriptingEngine(lang); final String sourcef = source; final int lineNof = lineNo, columnNof = columnNo; final Object exprf = expr; final CodeBuffer cbf = cb; try { AccessController.doPrivileged(new PrivilegedExceptionAction() { public Object run() throws Exception { e.compileExpr(sourcef, lineNof, columnNof, exprf, cbf); return null; } }); } catch (PrivilegedActionException prive) { logger.error("Exception :", prive); throw (BSFException) prive.getException(); } } /** * Compile the given script of the given language into the given * CodeBuffer. * * @param lang language identifier * @param source (context info) the source of this script (e.g., filename) * @param lineNo (context info) the line number in source for script * @param columnNo (context info) the column number in source for script * @param script the script to compile * @param cb code buffer to compile into * * @exception BSFException if any error while compiling the script */ public void compileScript(String lang, String source, int lineNo, int columnNo, Object script, CodeBuffer cb) throws BSFException { logger.debug("BSFManager:compileScript"); final BSFEngine e = loadScriptingEngine(lang); final String sourcef = source; final int lineNof = lineNo, columnNof = columnNo; final Object scriptf = script; final CodeBuffer cbf = cb; try { AccessController.doPrivileged(new PrivilegedExceptionAction() { public Object run() throws Exception { e.compileScript(sourcef, lineNof, columnNof, scriptf, cbf); return null; } }); } catch (PrivilegedActionException prive) { logger.error("Exception :", prive); throw (BSFException) prive.getException(); } } /** * Declare a bean. The difference between declaring and registering * is that engines are spsed to make declared beans "pre-available" * in the scripts as far as possible. That is, if a script author * needs a registered bean, he needs to look it up in some way. However * if he needs a declared bean, the language has the responsibility to * make those beans avaialable "automatically." *

* When a bean is declared it is automatically registered as well * so that any declared bean can be gotton to by looking it up as well. *

* If any of the languages that are already running in this manager * says they don't like this (by throwing an exception) then this * method will simply quit with that exception. That is, any engines * that come after than in the engine enumeration will not even be * told about this new bean. *

* So, in general its best to declare beans before the manager has * been asked to load any engines because then the user can be informed * when an engine rejects it. Also, its much more likely that an engine * can declare a bean at start time than it can at any time. * * @param beanName name to declare bean as * @param bean the bean that's being declared * @param type the type to represent the bean as * * @exception BSFException if any of the languages that are already * running decides to throw an exception when asked to * declare this bean. */ public void declareBean(String beanName, Object bean, Class type) throws BSFException { logger.debug("BSFManager:declareBean"); registerBean(beanName, bean); BSFDeclaredBean tempBean = new BSFDeclaredBean(beanName, bean, type); declaredBeans.addElement(tempBean); Enumeration enginesEnum = loadedEngines.elements(); BSFEngine engine; while (enginesEnum.hasMoreElements()) { engine = (BSFEngine) enginesEnum.nextElement(); engine.declareBean(tempBean); } } /** * Evaluate the given expression of the given language and return the * resulting value. * * @param lang language identifier * @param source (context info) the source of this expression (e.g., filename) * @param lineNo (context info) the line number in source for expr * @param columnNo (context info) the column number in source for expr * @param expr the expression to evaluate * * @exception BSFException if anything goes wrong while running the script */ public Object eval(String lang, String source, int lineNo, int columnNo, Object expr) throws BSFException { logger.debug("BSFManager:eval"); final BSFEngine e = loadScriptingEngine(lang); final String sourcef = source; final int lineNof = lineNo, columnNof = columnNo; final Object exprf = expr; Object result = null; try { final Object resultf = AccessController.doPrivileged(new PrivilegedExceptionAction() { public Object run() throws Exception { return e.eval(sourcef, lineNof, columnNof, exprf); } }); result = resultf; } catch (PrivilegedActionException prive) { logger.error("Exception: ", prive); throw (BSFException) prive.getException(); } return result; } ////////////////////////////////////////////////////////////////////// // // Convenience functions for exec'ing and eval'ing scripts directly // without loading and dealing with engines etc.. // ////////////////////////////////////////////////////////////////////// /** * Execute the given script of the given language. * * @param lang language identifier * @param source (context info) the source of this expression (e.g., filename) * @param lineNo (context info) the line number in source for expr * @param columnNo (context info) the column number in source for expr * @param script the script to execute * * @exception BSFException if anything goes wrong while running the script */ public void exec(String lang, String source, int lineNo, int columnNo, Object script) throws BSFException { logger.debug("BSFManager:exec"); final BSFEngine e = loadScriptingEngine(lang); final String sourcef = source; final int lineNof = lineNo, columnNof = columnNo; final Object scriptf = script; try { AccessController.doPrivileged(new PrivilegedExceptionAction() { public Object run() throws Exception { e.exec(sourcef, lineNof, columnNof, scriptf); return null; } }); } catch (PrivilegedActionException prive) { logger.error("Exception :", prive); throw (BSFException) prive.getException(); } } /** * Execute the given script of the given language, attempting to * emulate an interactive session w/ the language. * * @param lang language identifier * @param source (context info) the source of this expression * (e.g., filename) * @param lineNo (context info) the line number in source for expr * @param columnNo (context info) the column number in source for expr * @param script the script to execute * * @exception BSFException if anything goes wrong while running the script */ public void iexec(String lang, String source, int lineNo, int columnNo, Object script) throws BSFException { logger.debug("BSFManager:iexec"); final BSFEngine e = loadScriptingEngine(lang); final String sourcef = source; final int lineNof = lineNo, columnNof = columnNo; final Object scriptf = script; try { AccessController.doPrivileged(new PrivilegedExceptionAction() { public Object run() throws Exception { e.iexec(sourcef, lineNof, columnNof, scriptf); return null; } }); } catch (PrivilegedActionException prive) { logger.error("Exception :", prive); throw (BSFException) prive.getException(); } } /** * Get classLoader */ public ClassLoader getClassLoader() { logger.debug("BSFManager:getClassLoader"); return classLoader; } /** * Get classPath */ public String getClassPath() { logger.debug("BSFManager:getClassPath"); if (classPath == null) { try { classPath = System.getProperty("java.class.path"); } catch (Throwable t) { logger.debug("Exception :", t); // prolly a security exception .. so no can do } } return classPath; } /** * Determine the language of a script file by looking at the file * extension. * * @param fileName the name of the file * * @return the scripting language the file is in if the file extension * is known to me (must have been registered via * registerScriptingEngine). * * @exception BSFException if file's extension is unknown. */ public static String getLangFromFilename(String fileName) throws BSFException { int dotIndex = fileName.lastIndexOf("."); if (dotIndex != -1) { String extn = fileName.substring(dotIndex + 1); String langval = (String) extn2Lang.get(extn); String lang = null; int index, loops = 0; if (langval != null) { while ((index = langval.indexOf(":", 0)) != -1) { // Great. Multiple language engines registered // for this extension. // Try to find first one that is in our classpath. lang = langval.substring(0, index); langval = langval.substring(index + 1); loops++; // Test to see if in classpath try { String engineName = (String) registeredEngines.get(lang); Class.forName(engineName); } catch (ClassNotFoundException cnfe) { // Bummer. lang = langval; continue; } // Got past that? Good. break; } if (loops == 0) { lang = langval; } } if (lang != null && lang != "") { return lang; } } throw new BSFException(BSFException.REASON_OTHER_ERROR, "file extension missing or unknown: " + "unable to determine language for '" + fileName + "'"); } /** * Return the current object registry of the manager. * * @return the current registry. */ public ObjectRegistry getObjectRegistry() { return objectRegistry; } /** * Get tempDir */ public String getTempDir() { return tempDir; } /** * Determine whether a language is registered. * * @param lang string identifying a language * * @return true iff it is */ public static boolean isLanguageRegistered(String lang) { return (registeredEngines.get(lang) != null); } ////////////////////////////////////////////////////////////////////// // // Bean scripting framework services // ////////////////////////////////////////////////////////////////////// /** * Load a scripting engine based on the lang string identifying it. * * @param lang string identifying language * @exception BSFException if the language is unknown (i.e., if it * has not been registered) with a reason of * REASON_UNKNOWN_LANGUAGE. If the language is known but * if the interface can't be created for some reason, then * the reason is set to REASON_OTHER_ERROR and the actual * exception is passed on as well. */ public BSFEngine loadScriptingEngine(String lang) throws BSFException { logger.debug("BSFManager:loadScriptingEngine"); // if its already loaded return that BSFEngine eng = (BSFEngine) loadedEngines.get(lang); if (eng != null) { return eng; } // is it a registered language? String engineClassName = (String) registeredEngines.get(lang); if (engineClassName == null) { logger.error("unsupported language: " + lang); throw new BSFException(BSFException.REASON_UNKNOWN_LANGUAGE, "unsupported language: " + lang); } // create the engine and initialize it. if anything goes wrong // except. try { Class engineClass = (classLoader == null) ? Class.forName(engineClassName) : classLoader.loadClass(engineClassName); final BSFEngine engf = (BSFEngine) engineClass.newInstance(); final BSFManager thisf = this; final String langf = lang; final Vector dbf = declaredBeans; AccessController.doPrivileged(new PrivilegedExceptionAction() { public Object run() throws Exception { engf.initialize(thisf, langf, dbf); return null; } }); eng = engf; loadedEngines.put(lang, eng); pcs.addPropertyChangeListener(eng); return eng; } catch (PrivilegedActionException prive) { logger.error("Exception :", prive); throw (BSFException) prive.getException(); } catch (Throwable t) { logger.error("Exception :", t); throw new BSFException(BSFException.REASON_OTHER_ERROR, "unable to load language: " + lang, t); } } /** * return a handle to a bean registered in the bean registry by the * application or a scripting engine. Returns null if bean is not found. * * @param beanName name of bean to look up * * @return the bean if its found or null */ public Object lookupBean(String beanName) { logger.debug("BSFManager:lookupBean"); try { return ((BSFDeclaredBean)objectRegistry.lookup(beanName)).bean; } catch (IllegalArgumentException e) { logger.debug("Exception :", e); return null; } } /** * Registering a bean allows a scripting engine or the application to * access that bean by name and to manipulate it. * * @param beanName name to register under * @param bean the bean to register */ public void registerBean(String beanName, Object bean) { logger.debug("BSFManager:registerBean"); BSFDeclaredBean tempBean; if(bean == null) { tempBean = new BSFDeclaredBean(beanName, null, null); } else { tempBean = new BSFDeclaredBean(beanName, bean, bean.getClass()); } objectRegistry.register(beanName, tempBean); } /** * Register a scripting engine in the static registry of the * BSFManager. * * @param lang string identifying language * @param engineClassName fully qualified name of the class interfacing * the language to BSF. * @param extensions array of file extensions that should be mapped to * this language type. may be null. */ public static void registerScriptingEngine(String lang, String engineClassName, String[] extensions) { registeredEngines.put(lang, engineClassName); if (extensions != null) { for (int i = 0; i < extensions.length; i++) { String langstr = (String) extn2Lang.get(extensions[i]); langstr = (langstr == null) ? lang : lang + ":" + langstr; extn2Lang.put(extensions[i], langstr); } } } /** * Set the class loader for those that need to use it. Default is he * who loaded me or null (i.e., its Class.forName). * * @param classLoader the class loader to use. */ public void setClassLoader(ClassLoader classLoader) { logger.debug("BSFManager:setClassLoader"); pcs.firePropertyChange("classLoader", this.classLoader, classLoader); this.classLoader = classLoader; } /** * Set the classpath for those that need to use it. Default is the value * of the java.class.path property. * * @param classPath the classpath to use */ public void setClassPath(String classPath) { logger.debug("BSFManager:setClassPath"); pcs.firePropertyChange("classPath", this.classPath, classPath); this.classPath = classPath; } /** * Set the object registry used by this manager. By default a new * one is created when the manager is new'ed and this overwrites * that one. * * @param objectRegistry the registry to use */ public void setObjectRegistry(ObjectRegistry objectRegistry) { logger.debug("BSFManager:setObjectRegistry"); this.objectRegistry = objectRegistry; } /** * Temporary directory to put stuff into (for those who need to). Note * that unless this directory is in the classpath or unless the * classloader knows to look in here, any classes here will not * be found! BSFManager provides a service method to load a class * which uses either the classLoader provided by the class loader * property or, if that fails, a class loader which knows to load from * the tempdir to try to load the class. Default value of tempDir * is "." (current working dir). * * @param tempDir the temporary directory */ public void setTempDir(String tempDir) { logger.debug("BSFManager:setTempDir"); pcs.firePropertyChange("tempDir", this.tempDir, tempDir); this.tempDir = tempDir; } /** * Gracefully terminate all engines */ public void terminate() { logger.debug("BSFManager:terminate"); Enumeration enginesEnum = loadedEngines.elements(); BSFEngine engine; while (enginesEnum.hasMoreElements()) { engine = (BSFEngine) enginesEnum.nextElement(); engine.terminate(); } loadedEngines = new Hashtable(); } /** * Undeclare a previously declared bean. This removes the bean from * the list of declared beans in the manager as well as asks every * running engine to undeclared the bean. As with above, if any * of the engines except when asked to undeclare, this method does * not catch that exception. Quietly returns if the bean is unknown. * * @param beanName name of bean to undeclare * * @exception BSFException if any of the languages that are already * running decides to throw an exception when asked to * undeclare this bean. */ public void undeclareBean(String beanName) throws BSFException { logger.debug("BSFManager:undeclareBean"); unregisterBean(beanName); BSFDeclaredBean tempBean = null; boolean found = false; for (Iterator i = declaredBeans.iterator(); i.hasNext();) { tempBean = (BSFDeclaredBean) i.next(); if (tempBean.name.equals(beanName)) { found = true; break; } } if (found) { declaredBeans.removeElement(tempBean); Enumeration enginesEnum = loadedEngines.elements(); while (enginesEnum.hasMoreElements()) { BSFEngine engine = (BSFEngine) enginesEnum.nextElement(); engine.undeclareBean(tempBean); } } } /** * Unregister a previously registered bean. Silent if name is not found. * * @param beanName name of bean to unregister */ public void unregisterBean(String beanName) { logger.debug("BSFManager:unregisterBean"); objectRegistry.unregister(beanName); } }libbsf-java-2.4.0/AUTHORS.txt0000644000175000017500000000115310511475731014553 0ustar mkochmkochOriginal Authors: Sanjiva Weerawarana Matthew J. Duftler Sam Ruby Original Bytecode Utilities: Richard F. Boehme Original Rhino Debugger/JSDI Authors: Olivier Gruber Jason Crawford John Ponzo Maintainers (BSF 2.3.0): Victor J. Orlikowski Charles Murcko Maintainers (BSF 2.4.0) by first name: Rony G. Flatscher Sanjiva Weerawarana Sanka Samaranayke libbsf-java-2.4.0/LICENSE.txt0000644000175000017500000002613710511475731014521 0ustar mkochmkoch Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed 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.