Java Doc for OscriptInterpreter.java in  » Scripting » oscript-2.10.4 » oscript » 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 » oscript 2.10.4 » oscript 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   oscript.OscriptInterpreter

All known Subclasses:   oscript.Main,
OscriptInterpreter
public class OscriptInterpreter (Code)
The toplevel and main interface for the interpreter. There can only be one instance of this object. The scope object can be used to create logically isolated interpreter "instances".

This does need some cleanup, and perhaps should be a front-end for other stuff someone embedding this in an application might want, such as creating a new scope...

Description of properties that are interesting:
property description regular default webstart default
oscript.cache.path where the cache directory is created $CWD/.cache $HOME/.cache
oscript.cwd the current working directory $CWD $HOME/Desktop || $HOME

author:
   Rob Clark (rob@ti.com)


Inner Class :public static class CacheEntry

Field Summary
final public static  StringCACHE_VERSION
     the CACHE_VERSION should change any time a change is made in the interpreter that could cause incompatibility with previously serialized cache entries.
public static  ValueDEFAULT_ARRAY_SORT_COMPARISION_FXN
    
final public static  NodeEvaluatorEMPTY_EXPR_LIST_EVALUATOR
    
public static  longet
    


Method Summary
final public static  void__declareInScope(String name, Value val, Scope scope)
    
final public static  Value__eval(String str)
    
final public static  Value__eval(String str, Scope scope)
    
public static  voidaddParser(Parser parser)
     Add the parser to list of recognized parsers.
public static  voidaddScriptPath(String path)
     Add the specified path to the paths that are searched to import a file.
public static  NodeEvaluatorcreateNodeEvaluator(String name, Node node)
     Create a NodeEvaluator to evaluate a node.
public static  Valueeval(AbstractFile file)
     Evaluate from the specified abstract file.
public static  Valueeval(AbstractFile file, Scope scope)
     Evaluate from the specified abstract file.
public static  Valueeval(String str)
     Evaluate the specified sting.
public static  Valueeval(String str, Scope scope)
     Evaluate the specified sting.
static  voidflushNodeEvaluatorCache()
     Flush the node-evaluator-cache...
public static  ScopegetGlobalScope()
     Get the global scope object.
public static  IteratorgetScriptPath()
     Return an iterator of entries in the script-path.
public static  StringgetVersionString()
     Get a descriptive version string.
public static  ValueimportHelper(String path, Scope scope)
     helper function to implement import statements.
public static  ClassloadClassFromCache(String className)
    
final public static  voidmountJarFile(AbstractFile file)
    
public static  Nodeparse(AbstractFile file)
     Parse the input stream to a syntaxtree.
public static  Nodeparse(String str)
     Parse the string to a syntaxtree.
public static  voidregisterClassLoader(ClassLoader loader)
     Register a class loader that we can delegate the act of resolving classes.
public static  voidremoveParser(Parser parser)
     Remove the parser from list of recognized parsers.
public static  voidremoveScriptPath(String path)
     Remove the specified path to the paths that are searched to import a file.
public static  AbstractFileresolve(String path, boolean create)
     Try to load the specified file from one of the registered filesystems.
public static  voidsetErr(PrintStream err)
     Set the error stream.
public static  voidsetIn(InputStream in)
     Set the input stream.
public static  voidsetOut(PrintStream out)
     Set the output stream.
public static  voiduseCompiler(boolean useCompiler)
     Set whether the compiler should be used or not.

Field Detail
CACHE_VERSION
final public static String CACHE_VERSION(Code)
the CACHE_VERSION should change any time a change is made in the interpreter that could cause incompatibility with previously serialized cache entries. It is made part of the path to serialized cache entry, so entries serialized with different cache versions will not conflict.



DEFAULT_ARRAY_SORT_COMPARISION_FXN
public static Value DEFAULT_ARRAY_SORT_COMPARISION_FXN(Code)



EMPTY_EXPR_LIST_EVALUATOR
final public static NodeEvaluator EMPTY_EXPR_LIST_EVALUATOR(Code)



et
public static long et(Code)





Method Detail
__declareInScope
final public static void __declareInScope(String name, Value val, Scope scope)(Code)



__eval
final public static Value __eval(String str) throws ParseException(Code)



__eval
final public static Value __eval(String str, Scope scope) throws ParseException(Code)



addParser
public static void addParser(Parser parser)(Code)
Add the parser to list of recognized parsers. The registered parsers will determine what sorts of input the interpreter can handle.
Parameters:
  parser - the parser to register
See Also:   OscriptInterpreter.removeParser



addScriptPath
public static void addScriptPath(String path)(Code)
Add the specified path to the paths that are searched to import a file.
Parameters:
  path - a path to search for imports



createNodeEvaluator
public static NodeEvaluator createNodeEvaluator(String name, Node node)(Code)
Create a NodeEvaluator to evaluate a node. An application embedding the interpreter should use this method to convert the parsed syntax tree to something that can be evaluated within a scope, rather than directly using the visitors. This protects the application against changes to the parsed representation of the program.
Parameters:
  desc - description
Parameters:
  node - the node a NodeEvaluator



eval
public static Value eval(AbstractFile file) throws ParseException, IOException(Code)
Evaluate from the specified abstract file. The stream is evaluated until EOF is hit.
Parameters:
  file - the file to evaluate the result of evaluating the input
throws:
  ParseException - if error parsing input
throws:
  IOException - if something goes poorly when reading file



eval
public static Value eval(AbstractFile file, Scope scope) throws ParseException, IOException(Code)
Evaluate from the specified abstract file. The stream is evaluated until EOF is hit.
Parameters:
  file - the file to evaluate
Parameters:
  scope - the scope to evaluate in the result of evaluating the input
throws:
  ParseException - if error parsing input
throws:
  IOException - if something goes poorly when reading file



eval
public static Value eval(String str) throws ParseException(Code)
Evaluate the specified sting.
Parameters:
  str - the string to evaluate the result of evaluating the string
throws:
  ParseException - if error parsing string



eval
public static Value eval(String str, Scope scope) throws ParseException(Code)
Evaluate the specified sting.
Parameters:
  str - the string to evaluate
Parameters:
  scope - the scope to evaluate in the result of evaluating the string
throws:
  ParseException - if error parsing string



flushNodeEvaluatorCache
static void flushNodeEvaluatorCache()(Code)
Flush the node-evaluator-cache...



getGlobalScope
public static Scope getGlobalScope()(Code)
Get the global scope object. The globalScope is static, meaning that all script code in an application shares a single global scope. But, since the interpreter is multi-threaded, you can achieve the same effect of having multiple interpreter instances by creating a new level of scope (ie with globalScope as it's parent, an evaluate within that scope. the globalScope object



getScriptPath
public static Iterator getScriptPath()(Code)
Return an iterator of entries in the script-path. Each entry is a path that is prefixed to a relative path passed to OscriptInterpreter.resolve in the process of trying to resolve a file. an iterator of strings



getVersionString
public static String getVersionString()(Code)
Get a descriptive version string.



importHelper
public static Value importHelper(String path, Scope scope)(Code)
helper function to implement import statements.



loadClassFromCache
public static Class loadClassFromCache(String className) throws ClassNotFoundException(Code)



mountJarFile
final public static void mountJarFile(AbstractFile file) throws Exception(Code)
Mount a .jar file under /jar/file.jar and add to script path
Parameters:
  file - the jar file to mount



parse
public static Node parse(AbstractFile file) throws ParseException, IOException(Code)
Parse the input stream to a syntaxtree.
Parameters:
  file - the file to parse the parsed syntaxtree



parse
public static Node parse(String str) throws ParseException(Code)
Parse the string to a syntaxtree.
Parameters:
  str - the string to parse the parsed syntaxtree



registerClassLoader
public static void registerClassLoader(ClassLoader loader)(Code)
Register a class loader that we can delegate the act of resolving classes. This allows the user of ObjectScript to give us the ability to load classes that we might not otherwise have access to.



removeParser
public static void removeParser(Parser parser)(Code)
Remove the parser from list of recognized parsers. The registered parsers will determine what sorts of input the interpreter can handle.
Parameters:
  parser - the parser to register
See Also:   OscriptInterpreter.addParser



removeScriptPath
public static void removeScriptPath(String path)(Code)
Remove the specified path to the paths that are searched to import a file.
Parameters:
  path - a path to search for imports



resolve
public static AbstractFile resolve(String path, boolean create) throws IOException(Code)
Try to load the specified file from one of the registered filesystems.
Parameters:
  path - the path to the file to resolve
Parameters:
  create - create the file if it does not exist
throws:
  IOException - if something goes wrong when reading file
See Also:   OscriptInterpreter.addScriptPath



setErr
public static void setErr(PrintStream err)(Code)
Set the error stream.
Parameters:
  err - the stream to use for error output



setIn
public static void setIn(InputStream in)(Code)
Set the input stream.
Parameters:
  in - the stream to use for input



setOut
public static void setOut(PrintStream out)(Code)
Set the output stream.
Parameters:
  out - the stream to use for output



useCompiler
public static void useCompiler(boolean useCompiler)(Code)
Set whether the compiler should be used or not.
Parameters:
  useCompiler - iff true, enabled compiler, otherwiseuse only the interpreter



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.