Java Doc for NetRexxEngine.java in  » Scripting » bsf-2.4.0 » org » apache » bsf » engines » netrexx » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Scripting » bsf 2.4.0 » org.apache.bsf.engines.netrexx 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.apache.bsf.util.BSFEngineImpl
      org.apache.bsf.engines.netrexx.NetRexxEngine

NetRexxEngine
public class NetRexxEngine extends BSFEngineImpl (Code)
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



Field Summary
static  HashtablecodeToClass
    
 BSFFunctionsmgrfuncs
    
 StringminorPrefix
    
static  Stringplaceholder
    
static  StringserializeCompilation
    

Constructor Summary
public  NetRexxEngine()
     Constructor.

Method Summary
public  Objectcall(Object object, String method, Object[] args)
     Return an object from an extension.
 ObjectcallStatic(Class rexxclass, String method, Object[] args)
     Invoke a static method.
public  voiddeclareBean(BSFDeclaredBean bean)
    
public  Objecteval(String source, int lineNo, int columnNo, Object script)
     Override impl of execute.
public  voidexec(String source, int lineNo, int columnNo, Object script)
     Override impl of execute.
public  ObjectexecEvalShared(String source, int lineNo, int columnNo, Object oscript, boolean returnsObject)
     This is shared code for the exec() and eval() operations.
public  voidinitialize(BSFManager mgr, String lang, Vector declaredBeans)
    
public  voidundeclareBean(BSFDeclaredBean bean)
    

Field Detail
codeToClass
static Hashtable codeToClass(Code)



mgrfuncs
BSFFunctions mgrfuncs(Code)



minorPrefix
String minorPrefix(Code)



placeholder
static String placeholder(Code)



serializeCompilation
static String serializeCompilation(Code)




Constructor Detail
NetRexxEngine
public NetRexxEngine()(Code)
Constructor.




Method Detail
call
public Object call(Object object, String method, Object[] args) throws BSFException(Code)
Return an object from an extension.
Parameters:
  object - object from which to call our static method
Parameters:
  method - The name of the method to call.
Parameters:
  args - an array of arguments to bepassed to the extension, which may be eitherVectors of Nodes, or Strings.



callStatic
Object callStatic(Class rexxclass, String method, Object[] args) throws BSFException(Code)
Invoke a static method.
Parameters:
  rexxclass - Class to invoke the method against
Parameters:
  method - The name of the method to call.
Parameters:
  args - an array of arguments to bepassed to the extension, which may be eitherVectors of Nodes, or Strings.



declareBean
public void declareBean(BSFDeclaredBean bean) throws BSFException(Code)



eval
public Object eval(String source, int lineNo, int columnNo, Object script) throws BSFException(Code)
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.



exec
public void exec(String source, int lineNo, int columnNo, Object script) throws BSFException(Code)
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.



execEvalShared
public Object execEvalShared(String source, int lineNo, int columnNo, Object oscript, boolean returnsObject) throws BSFException(Code)
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.




initialize
public void initialize(BSFManager mgr, String lang, Vector declaredBeans) throws BSFException(Code)



undeclareBean
public void undeclareBean(BSFDeclaredBean bean) throws BSFException(Code)



Fields inherited from org.apache.bsf.util.BSFEngineImpl
protected ClassLoader classLoader(Code)(Java Doc)
protected String classPath(Code)(Java Doc)
protected Vector declaredBeans(Code)(Java Doc)
protected String lang(Code)(Java Doc)
protected BSFManager mgr(Code)(Java Doc)
protected String tempDir(Code)(Java Doc)

Methods inherited from org.apache.bsf.util.BSFEngineImpl
public Object apply(String source, int lineNo, int columnNo, Object funcBody, Vector paramNames, Vector arguments) throws BSFException(Code)(Java Doc)
public void compileApply(String source, int lineNo, int columnNo, Object funcBody, Vector paramNames, Vector arguments, CodeBuffer cb) throws BSFException(Code)(Java Doc)
public void compileExpr(String source, int lineNo, int columnNo, Object expr, CodeBuffer cb) throws BSFException(Code)(Java Doc)
public void compileScript(String source, int lineNo, int columnNo, Object script, CodeBuffer cb) throws BSFException(Code)(Java Doc)
public void declareBean(BSFDeclaredBean bean) throws BSFException(Code)(Java Doc)
public void exec(String source, int lineNo, int columnNo, Object script) throws BSFException(Code)(Java Doc)
public void iexec(String source, int lineNo, int columnNo, Object script) throws BSFException(Code)(Java Doc)
public void initialize(BSFManager mgr, String lang, Vector declaredBeans) throws BSFException(Code)(Java Doc)
public void propertyChange(PropertyChangeEvent e)(Code)(Java Doc)
public void terminate()(Code)(Java Doc)
public void undeclareBean(BSFDeclaredBean bean) throws BSFException(Code)(Java Doc)

Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.