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


java.lang.Object
   sisc.util.Util
      sisc.interpreter.Context

Context
abstract public class Context extends Util (Code)
Context is a utility class which facilitates Java to Scheme calls in SISC. Typically, this involves obtaining an Interpreter for a given initialized sisc.interpreter.AppContext , using the Interpreter for one or more evaluations, then exiting the context, as follows:
 AppContext ctx = ...
 Interpreter r=Context.enter(ctx);
 r.eval(someProcedure, new Value[] { ... some arguments ... });
 Context.exit();
 
Preferrably, one should use the SchemeCaller supported visitor pattern to allow Context to handle the management of the Interpreter Context, as follows:
 Object returnValue=Context.execute(ctx, mySchemeCaller);
 
The provided SchemeCaller instance's execute method is invoked with an Interpreter which is automatically obtained and then returned when the call completes. The return value of the SchemeCaller's execute method is returned from the Context method.
See Also:   SchemeCaller
See Also:   AppContext
See Also:   Interpreter




Method Summary
public static  AppContextcurrentAppContext()
     Returns the AppContext of any current interpreter in an internal call, or the default AppContext if no current interpreter is present.
public static  InterpretercurrentInterpreter()
     Fetches the current Interpreter, if this is an internal call (that is, a call from Java to Scheme in the contex of a Scheme->Java call).
public static  InterpretercurrentInterpreter(AppContext ctx)
     Fetches the nearest enclosing Interpreter that operates on a given AppContext, if this is an internal call (that is, a call from Java to Scheme in the contex of a Scheme->Java call).
public static  Interpreterenter()
     Returns an Interpreter that shares the AppContext and DynamicEnvironment with the current Interpreter.
public static  Interpreterenter(AppContext ctx)
     Returns an Interpreter bound to the given AppContext with same DynamicEnvironment as the nearest enclosing Interpreter in the same thread that is bound to the same AppContext.
public static  Interpreterenter(DynamicEnvironment dynenv)
     Returns an Interpreter bound to the given DynamicEnvironment.
public static  Interpreterenter(String appName)
    
public static  Objectexecute(SchemeCaller caller)
     Calls caller with an Interpreter that shares the AppContext and DynamicEnvironment with the current Interpreter.
public static  Objectexecute(AppContext ctx, SchemeCaller caller)
     Calls caller with an Interpreter bound to the given AppContext with same DynamicEnvironment as the nearest enclosing Interpreter in the same thread that is bound to the same AppContext.
public static  Objectexecute(DynamicEnvironment dynenv, SchemeCaller caller)
     Obtains an Interpreter bound to the given DynamicEnvironment and invokes caller.execute(Interpreter) with that Interper. Once execute returns, the Interpreter is freed, and the return value of caller.execute() is returned from this method. NB: It is critical that the Interpreter reference provided during the call is used only in the thread which calls this method.
public static  Objectexecute(String appName, SchemeCaller caller)
    
public static  voidexit()
     Exits the current context, releasing the current Interpreter.
public static synchronized  AppContextgetDefaultAppContext()
     Returns the currently set default AppContext, or creates a new AppContext with default values if non was already set, and attempts to initialize it with the default heap.
public static  AppContextlookup(String appName)
    
public static  ThreadContextlookupThreadContext()
    
public static  voidregister(String appName, AppContext ctx)
    
public static synchronized  voidsetDefaultAppContext(AppContext ctx)
     Sets the default AppContext, which is used sparingly whenever a call originates from uncontrolled Java source that involves the Scheme environment.
public static  voidunregister(String appName)
    



Method Detail
currentAppContext
public static AppContext currentAppContext()(Code)
Returns the AppContext of any current interpreter in an internal call, or the default AppContext if no current interpreter is present.



currentInterpreter
public static Interpreter currentInterpreter()(Code)
Fetches the current Interpreter, if this is an internal call (that is, a call from Java to Scheme in the contex of a Scheme->Java call). the current Interpreter, or null if this is not aninternal call.



currentInterpreter
public static Interpreter currentInterpreter(AppContext ctx)(Code)
Fetches the nearest enclosing Interpreter that operates on a given AppContext, if this is an internal call (that is, a call from Java to Scheme in the contex of a Scheme->Java call).
Parameters:
  ctx - the AppContext the nearest enclosing Interpreter operating on thegiven ctx, or null if no such Interpreter exists.



enter
public static Interpreter enter()(Code)
Returns an Interpreter that shares the AppContext and DynamicEnvironment with the current Interpreter. If there is no current Interpreter present, an Interpreter bound to the default AppContext is returned instead. This method provides the usual mechanism for obtaining an Interpreter for calling from Java to Scheme.
See Also:   Interpreter



enter
public static Interpreter enter(AppContext ctx)(Code)
Returns an Interpreter bound to the given AppContext with same DynamicEnvironment as the nearest enclosing Interpreter in the same thread that is bound to the same AppContext. If no such Interpreter exists then a new DynamicEnvironment is created, bound to the AppContext.
Parameters:
  ctx - The AppContext The newly created Interpreter



enter
public static Interpreter enter(DynamicEnvironment dynenv)(Code)
Returns an Interpreter bound to the given DynamicEnvironment.
Parameters:
  dynenv - The DynamicEnvironment The newly created Interpreter



enter
public static Interpreter enter(String appName)(Code)
Context.enter(AppContext)



execute
public static Object execute(SchemeCaller caller) throws SchemeException(Code)
Calls caller with an Interpreter that shares the AppContext and DynamicEnvironment with the current Interpreter. If there is no current Interpreter present, an Interpreter bound to the default AppContext is created instead. This method provides the usual mechanism for managed calls from Java to Scheme.
Parameters:
  caller - The SchemeCaller to invoke the result of invoking the SchemeCaller



execute
public static Object execute(AppContext ctx, SchemeCaller caller) throws SchemeException(Code)
Calls caller with an Interpreter bound to the given AppContext with same DynamicEnvironment as the nearest enclosing Interpreter in the same thread that is bound to the same AppContext. If no such Interpreter exists then a new DynamicEnvironment is returned, bound to the AppContext.
Parameters:
  ctx - The AppContext
Parameters:
  caller - The SchemeCaller to invoke. the result of invoking the SchemeCaller



execute
public static Object execute(DynamicEnvironment dynenv, SchemeCaller caller) throws SchemeException(Code)
Obtains an Interpreter bound to the given DynamicEnvironment and invokes caller.execute(Interpreter) with that Interper. Once execute returns, the Interpreter is freed, and the return value of caller.execute() is returned from this method. NB: It is critical that the Interpreter reference provided during the call is used only in the thread which calls this method. New threads should obtain a different Interpreter via this or enter() calls.
Parameters:
  dynenv - The DynamicEnvironment.
Parameters:
  caller - The SchemeCaller to invoke. the result of invoking the SchemeCaller



execute
public static Object execute(String appName, SchemeCaller caller)(Code)
Context.execute(AppContext,SchemeCaller)



exit
public static void exit()(Code)
Exits the current context, releasing the current Interpreter.



getDefaultAppContext
public static synchronized AppContext getDefaultAppContext()(Code)
Returns the currently set default AppContext, or creates a new AppContext with default values if non was already set, and attempts to initialize it with the default heap.



lookup
public static AppContext lookup(String appName)(Code)



lookupThreadContext
public static ThreadContext lookupThreadContext()(Code)
thread context lookup **********



register
public static void register(String appName, AppContext ctx)(Code)



setDefaultAppContext
public static synchronized void setDefaultAppContext(AppContext ctx)(Code)
Sets the default AppContext, which is used sparingly whenever a call originates from uncontrolled Java source that involves the Scheme environment. For example, Java serialization initiated by a web application server.
Parameters:
  ctx - the AppContext to make the default.



unregister
public static void unregister(String appName)(Code)



Fields inherited from sisc.util.Util
public static Symbol BEGINERRORKEXPSCEXPTOPFCONTJEXCEPTIONLAMBDALOCATIONMESSAGENAMEOTHERPARENTQUOTESYMREPORTSETBANGSISCSISC_SPECIFICSYMENVTHISTOPLEVELBACKQUOTEUNQUOTEUNQUOTE_SPLICINGSOURCE_LINESOURCE_COLUMNSOURCE_FILEEVAL(Code)(Java Doc)
public static EmptyList EMPTYLIST(Code)(Java Doc)
public static SchemeVector EMPTYVEC(Code)(Java Doc)
public static EOFObject EOF(Code)(Java Doc)
final public static Quantity FIVE(Code)(Java Doc)
public static Syntax QUOTE(Code)(Java Doc)
public static Symbol SISCB(Code)(Java Doc)
public static SchemeBoolean TRUEFALSE(Code)(Java Doc)
public static SchemeVoid VOID(Code)(Java Doc)
final public static Value[] ZV(Code)(Java Doc)
public static WeakHashMap bundles(Code)(Java Doc)
final public static boolean caseSensitive(Code)(Java Doc)
final public static int maxFloatPrecision(Code)(Java Doc)
final public static int minFloatPrecision(Code)(Java Doc)
final public static boolean permitInterrupts(Code)(Java Doc)

Methods inherited from sisc.util.Util
final public static AnnotatedExpr annotated(Value o)(Code)(Java Doc)
public static Expression annotatedAppEval(Class clazz, String fn)(Code)(Java Doc)
public static Pair append(Pair p1, Pair p2)(Code)(Java Doc)
final public static void argCheck(Pair argl, int arity) throws Exception(Code)(Java Doc)
public static Symbol[] argsToSymbols(Pair p)(Code)(Java Doc)
public static Value assq(Value v, Pair p)(Code)(Java Doc)
final public static SchemeBinaryInputPort bininport(Value o)(Code)(Java Doc)
final public static InputStream bininstream(Value o)(Code)(Java Doc)
final public static SchemeBinaryOutputPort binoutport(Value o)(Code)(Java Doc)
final public static OutputStream binoutstream(Value o)(Code)(Java Doc)
final public static Box box(Value o)(Code)(Java Doc)
final public static char character(Value c)(Code)(Java Doc)
final public static SchemeCharacterInputPort charinport(Value o)(Code)(Java Doc)
final public static Reader charinreader(Value o)(Code)(Java Doc)
final public static SchemeCharacterOutputPort charoutport(Value o)(Code)(Java Doc)
final public static Writer charoutwriter(Value o)(Code)(Java Doc)
public static Charset charsetFromString(String charsetName)(Code)(Java Doc)
final public static SchemeCharacter chr(Value o)(Code)(Java Doc)
final public static CallFrame cont(Value o)(Code)(Java Doc)
public static ClassLoader currentClassLoader()(Code)(Java Doc)
final public static SymbolicEnvironment env(Value o)(Code)(Java Doc)
public static void error(Interpreter r, Value where, String errormessage, Pair moreData) throws ContinuationException(Code)(Java Doc)
public static void error(Interpreter r, Value where, String errormessage, Exception e) throws ContinuationException(Code)(Java Doc)
public static void error(Interpreter r, Value where, String errormessage) throws ContinuationException(Code)(Java Doc)
public static void error(Interpreter r, String errormessage, Pair moreData) throws ContinuationException(Code)(Java Doc)
public static void error(Interpreter r, String errormessage) throws ContinuationException(Code)(Java Doc)
public static void error(Interpreter r, Value errormessage) throws ContinuationException(Code)(Java Doc)
public static void error(Interpreter r, Pair error) throws ContinuationException(Code)(Java Doc)
final public static Expression expr(Value o)(Code)(Java Doc)
public static Charset getDefaultCharacterSet()(Code)(Java Doc)
final public static ImmutablePair immutablePair(Value o)(Code)(Java Doc)
final public static ImmutableVector immutableVector(Value o)(Code)(Java Doc)
final public static InputPort inport(Value o)(Code)(Java Doc)
protected static String javaExceptionToString(Exception e)(Code)(Java Doc)
public static Value javaWrap(Object o)(Code)(Java Doc)
public static String justify(String v, int p, char c)(Code)(Java Doc)
public static int length(Pair p)(Code)(Java Doc)
public static String liMessage(Symbol bundleName, String messageName)(Code)(Java Doc)
public static String liMessage(Symbol bundle, String messageName, String arg1)(Code)(Java Doc)
public static String liMessage(Symbol bundle, String messageName, String arg1, String arg2)(Code)(Java Doc)
public static String liMessage(Symbol bundle, String messageName, String arg1, String arg2, String arg3)(Code)(Java Doc)
public static String liMessage(Symbol bundle, String messageName, String arg1, String arg2, String arg3, String arg4)(Code)(Java Doc)
public static String liMessage(Symbol bundle, String messageName, String arg1, int arg2, int arg3)(Code)(Java Doc)
public static String liMessage(Symbol bundle, String messageName, Object[] args)(Code)(Java Doc)
final public static Pair list(Value o1)(Code)(Java Doc)
final public static Pair list(Value o1, Value o2)(Code)(Java Doc)
final public static Pair list(Value o1, Value o2, Value o3)(Code)(Java Doc)
final public static Pair list(Value o1, Value o2, Value o3, Value o4)(Code)(Java Doc)
final public static Pair list(Value o1, Value o2, Value o3, Value o4, Value o5)(Code)(Java Doc)
public static URL makeURL(String url)(Code)(Java Doc)
public static Pair mapcar(Pair list)(Code)(Java Doc)
public static Value memq(Value v, Pair p)(Code)(Java Doc)
final public static NativeLibrary nlib(Value o)(Code)(Java Doc)
final public static Quantity num(Value o)(Code)(Java Doc)
final public static OutputPort outport(Value o)(Code)(Java Doc)
final public static Pair pair(Value o)(Code)(Java Doc)
public static Vector pairToExpVect(Pair p)(Code)(Java Doc)
public static Expression[] pairToExpressions(Pair p)(Code)(Java Doc)
public static Value[] pairToValues(Pair p)(Code)(Java Doc)
final public static Procedure proc(Value o)(Code)(Java Doc)
public static Value read(String expr) throws IOException(Code)(Java Doc)
public static void registerBundle(Symbol bundleName) throws MissingResourceException(Code)(Java Doc)
public static Pair reverse(Pair p)(Code)(Java Doc)
public static Pair reverseInPlace(Pair s)(Code)(Java Doc)
public static String simpleErrorToString(Pair p)(Code)(Java Doc)
public static Pair sourceAnnotations(String file, int line, int column, Pair anns)(Code)(Java Doc)
final public static SchemeString str(Value o)(Code)(Java Doc)
final public static String string(Value o)(Code)(Java Doc)
final public static Symbol sym(String s)(Code)(Java Doc)
final public static Symbol symbol(Value o)(Code)(Java Doc)
final public static String symval(Value o)(Code)(Java Doc)
final public static Pair truePair(Value o)(Code)(Java Doc)
final public static SchemeBoolean truth(boolean b)(Code)(Java Doc)
final public static boolean truth(Value v)(Code)(Java Doc)
public static void typeError(String type, Value o)(Code)(Java Doc)
public static void typeError(Symbol bundleName, String type, Value o)(Code)(Java Doc)
public static void updateName(Value v, Symbol s)(Code)(Java Doc)
public static URL url(Value v)(Code)(Java Doc)
public static URL url(String s) throws MalformedURLException(Code)(Java Doc)
public static URL url(Value current, Value v)(Code)(Java Doc)
final public static Pair valArrayToList(Value[] r, int offset, int len)(Code)(Java Doc)
final public static Pair valArrayToList(Value[] r)(Code)(Java Doc)
final public static SchemeVector valArrayToVec(Value[] r)(Code)(Java Doc)
final public static SchemeVector vec(Value o)(Code)(Java Doc)
public static String warn(String messageClass)(Code)(Java Doc)
public static String warn(String messageClass, String sourceFile, int lineNumber, int columnNumber)(Code)(Java Doc)
public static String warn(String messageClass, String arg)(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.