Java Doc for InterpreterJVM.java in  » IDE » DrJava » edu » rice » cs » drjava » model » repl » newjvm » 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 » IDE » DrJava » edu.rice.cs.drjava.model.repl.newjvm 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


edu.rice.cs.util.newjvm.AbstractSlaveJVM
   edu.rice.cs.drjava.model.repl.newjvm.InterpreterJVM

InterpreterJVM
public class InterpreterJVM extends AbstractSlaveJVM implements InterpreterJVMRemoteI,JUnitModelCallback(Code)
This is the main class for the interpreter JVM. All public methods except those involving remote calls (callbacks) synchronized (unless synchronization has no effect). This class is loaded in the Interpreter JVM, not the Main JVM. (Do not use DrJava's config framework here.)

Note that this class is specific to DynamicJava. It must be refactored to accommodate other interpreters.
version:
   $Id: InterpreterJVM.java 4255 2007-08-28 19:17:37Z mgricken $



Field Summary
final public static  StringEMPTY_TRACE_TEXT
     String to append to error messages when no stack trace is available.
final public static  InterpreterJVMONLY
     Singleton instance of this class.


Method Summary
protected  void_updateInterpreterClassPath(JavaInterpreter interpreter)
     Adds a classpath to the given interpreter.
public synchronized  voidaddBuildDirectoryClassPath(File f)
     Adds the given path to the classpath shared by ALL Java interpreters.
public synchronized  voidaddDebugInterpreter(String name, String className)
     Adds a named JavaDebugInterpreter to the list of interpreters.
public synchronized  voidaddExternalFilesClassPath(File f)
     Adds the given path to the classpath shared by ALL Java interpreters.
public synchronized  voidaddExtraClassPath(File f)
     Adds the given path to the classpath shared by ALL Java interpreters.
public synchronized  voidaddInterpreter(String name, Interpreter interpreter)
     Adds a named interpreter to the list of interpreters.
public synchronized  voidaddJavaInterpreter(String name)
     Adds a named DynamicJavaAdapter to list of interpreters.
public synchronized  voidaddProjectClassPath(File f)
     Adds the given file to the classpath shared by ALL Java interpreters.
public synchronized  voidaddProjectFilesClassPath(File f)
     Adds the given path to the classpath shared by ALL Java interpreters.
public  voidclassFileError(ClassFileError e)
     Notifies the main JVM that JUnitTestManager has encountered an illegal class file.
public  List<String>findTestClasses(List<String> classNames, List<File> files)
     Sets up a JUnit test suite in the Interpreter JVM and finds which classes are really TestCases classes (by loading them).
 InterpretergetActiveInterpreter()
     Returns the current active interpreter.
public  List<File>getAugmentedClassPath()
    
public synchronized  Iterable<File>getClassPath()
    
public  FilegetFileForClassName(String className)
     Called when the JUnitTestManager wants to open a file that is not currently open.
 InterpreterDatagetInterpreter(String name)
    
 Hashtable<String, InterpreterData>getInterpreters()
     Gets the hashtable containing the named interpreters.
public synchronized  JavaInterpretergetJavaInterpreter(String name)
    
public static  StringgetStackTrace(Throwable t)
     Gets the stack trace from the given exception, stripping off the bottom parts of the trace that are internal to the interpreter.
public synchronized  StringgetVariableClassName(String var)
     Gets the class name of a variable in the current interpreter.
public synchronized  StringgetVariableToString(String var)
     Gets the string representation of the value of a variable in the current interpreter.
protected  voidhandleStart(MasterRemote mainJVM)
     Actions to perform when this JVM is started (through its superclass, AbstractSlaveJVM).
public  voidinterpret(String s)
     Interprets the given string of source code in the active interpreter.
public  voidinterpret(String s, String interpreterName)
     Interprets the given string of source code with the given interpreter.
public  voidinterpret(String input, InterpreterData interpreter)
     Interprets the given string of source code with the given interpreter.
public  voidjunitJVMReady()
    
public  voidnonTestCase(boolean isTestAll)
     Notifies Main JVM that JUnit has been invoked on a non TestCase class.
protected  voidquitFailed(Throwable th)
     This method is called if the interpreterJVM cannot be exited (likely because of a modified security manager.
public  voidremoveInterpreter(String name)
     Removes the interpreter with the given name, if it exists.
public  booleanrunTestSuite()
     Runs JUnit test suite already cached in the Interpreter JVM.
public synchronized  booleansetActiveInterpreter(String name)
    
public  voidsetPackageScope(String s)
     Sets the package scope for the current active interpreter, if it is a JavaInterpreter.
public synchronized  voidsetPrivateAccessible(boolean allow)
     Sets the interpreter to allow access to private members.
public  voidsetShowMessageOnResetFailure(boolean show)
    
Parameters:
  show - Whether to show a message if a reset operation fails.
public synchronized  booleansetToDefaultInterpreter()
     Sets the default interpreter to be active.
public  voidtestEnded(String testName, boolean wasSuccessful, boolean causedError)
     Notifies that a particular test has ended.
public  voidtestStarted(String testName)
     Notifies that a particular test has started.
public  voidtestSuiteEnded(JUnitError[] errors)
     Notifies that a full suite of tests has finished running.
public  voidtestSuiteStarted(int numTests)
     Notifies that a suite of tests has started running.

Field Detail
EMPTY_TRACE_TEXT
final public static String EMPTY_TRACE_TEXT(Code)
String to append to error messages when no stack trace is available.



ONLY
final public static InterpreterJVM ONLY(Code)
Singleton instance of this class.





Method Detail
_updateInterpreterClassPath
protected void _updateInterpreterClassPath(JavaInterpreter interpreter)(Code)
Adds a classpath to the given interpreter. assumes that lock on this is held.
Parameters:
  interpreter - the interpreter



addBuildDirectoryClassPath
public synchronized void addBuildDirectoryClassPath(File f)(Code)
Adds the given path to the classpath shared by ALL Java interpreters. Only unique paths are added.
Parameters:
  f - Entry to add to the accumulated classpath



addDebugInterpreter
public synchronized void addDebugInterpreter(String name, String className)(Code)
Adds a named JavaDebugInterpreter to the list of interpreters.
Parameters:
  name - the unique name for the interpreter
Parameters:
  className - the fully qualified class name of the class the debug interpreter is in
throws:
  IllegalArgumentException - if the name is not unique



addExternalFilesClassPath
public synchronized void addExternalFilesClassPath(File f)(Code)
Adds the given path to the classpath shared by ALL Java interpreters. Only unique paths are added.
Parameters:
  f - Entry to add to the accumulated classpath



addExtraClassPath
public synchronized void addExtraClassPath(File f)(Code)
Adds the given path to the classpath shared by ALL Java interpreters. Only unique paths are added.
Parameters:
  f - Entry to add to the accumulated classpath



addInterpreter
public synchronized void addInterpreter(String name, Interpreter interpreter)(Code)
Adds a named interpreter to the list of interpreters.
Parameters:
  name - the unique name for the interpreter
Parameters:
  interpreter - the interpreter to add
throws:
  IllegalArgumentException - if the name is not unique



addJavaInterpreter
public synchronized void addJavaInterpreter(String name)(Code)
Adds a named DynamicJavaAdapter to list of interpreters. Presets it to contain the current accumulated classpath.
Parameters:
  name - the unique name for the interpreter
throws:
  IllegalArgumentException - if the name is not unique



addProjectClassPath
public synchronized void addProjectClassPath(File f)(Code)
Adds the given file to the classpath shared by ALL Java interpreters. Only unique paths are added.
Parameters:
  f - Entry to add to the accumulated classpath



addProjectFilesClassPath
public synchronized void addProjectFilesClassPath(File f)(Code)
Adds the given path to the classpath shared by ALL Java interpreters. Only unique paths are added.
Parameters:
  f - Entry to add to the accumulated classpath



classFileError
public void classFileError(ClassFileError e)(Code)
Notifies the main JVM that JUnitTestManager has encountered an illegal class file. Unsynchronized because it contains a remote call and does not involve mutable local state.
Parameters:
  e - the ClassFileError object describing the error on loading the file



findTestClasses
public List<String> findTestClasses(List<String> classNames, List<File> files) throws RemoteException(Code)
Sets up a JUnit test suite in the Interpreter JVM and finds which classes are really TestCases classes (by loading them). Unsynchronized because it contains a remote call and does not involve mutable local state.
Parameters:
  classNames - the class names to run in a test
Parameters:
  files - the associated file the class names that are actually test cases



getActiveInterpreter
Interpreter getActiveInterpreter()(Code)
Returns the current active interpreter. Package private; for tests only.



getAugmentedClassPath
public List<File> getAugmentedClassPath()(Code)



getClassPath
public synchronized Iterable<File> getClassPath()(Code)



getFileForClassName
public File getFileForClassName(String className)(Code)
Called when the JUnitTestManager wants to open a file that is not currently open. Unsynchronized because it contains a remote call and does not involve mutable local state.
Parameters:
  className - the name of the class for which we want to find the file the file associated with the given class



getInterpreter
InterpreterData getInterpreter(String name)(Code)
Returns the interpreter (with metadata) with the given name
Parameters:
  name - the unique name of the desired interpreter
throws:
  IllegalArgumentException - if no such named interpreter exists



getInterpreters
Hashtable<String, InterpreterData> getInterpreters()(Code)
Gets the hashtable containing the named interpreters. Package private for testing purposes. said hashtable



getJavaInterpreter
public synchronized JavaInterpreter getJavaInterpreter(String name)(Code)
Returns the Java interpreter with the given name
Parameters:
  name - the unique name of the desired interpreter
throws:
  IllegalArgumentException - if no such named interpreter exists, or if the named interpreter is not a Javainterpreter



getStackTrace
public static String getStackTrace(Throwable t)(Code)
Gets the stack trace from the given exception, stripping off the bottom parts of the trace that are internal to the interpreter. This would be much easier to do in JDK 1.4, since you can get the stack trace frames directly, instead of having to parse this! TODO: revise this code to use the JDK 1.4+ API.



getVariableClassName
public synchronized String getVariableClassName(String var) throws RemoteException(Code)
Gets the class name of a variable in the current interpreter.
Parameters:
  var - the name of the variable



getVariableToString
public synchronized String getVariableToString(String var) throws RemoteException(Code)
Gets the string representation of the value of a variable in the current interpreter.
Parameters:
  var - the name of the variable null if the variable is not defined, "null" if the value is null, or else its string representation



handleStart
protected void handleStart(MasterRemote mainJVM)(Code)
Actions to perform when this JVM is started (through its superclass, AbstractSlaveJVM). Contract from superclass mandates that this code does not synchronized on this across a remote call. This method has no synchronization because it can only be called once (part of the superclass contract) and _mainJVM is only assigned (once!) here.



interpret
public void interpret(String s)(Code)
Interprets the given string of source code in the active interpreter. The result is returned to MainJVM via the interpretResult method.
Parameters:
  s - Source code to interpret.



interpret
public void interpret(String s, String interpreterName)(Code)
Interprets the given string of source code with the given interpreter. The result is returned to MainJVM via the interpretResult method.
Parameters:
  s - Source code to interpret.
Parameters:
  interpreterName - Name of the interpreter to use
throws:
  IllegalArgumentException - if the named interpreter does not exist



interpret
public void interpret(String input, InterpreterData interpreter)(Code)
Interprets the given string of source code with the given interpreter. The result is returned to MainJVM via the interpretResult method. Not synchronized on this!
Parameters:
  input - Source code to interpret.
Parameters:
  interpreter - The interpreter (plus metadata) to use



junitJVMReady
public void junitJVMReady()(Code)



nonTestCase
public void nonTestCase(boolean isTestAll)(Code)
Notifies Main JVM that JUnit has been invoked on a non TestCase class. Unsynchronized because it contains a remote call and does not involve mutable local state.
Parameters:
  isTestAll - whether or not it was a use of the test all button



quitFailed
protected void quitFailed(Throwable th)(Code)
This method is called if the interpreterJVM cannot be exited (likely because of a modified security manager.



removeInterpreter
public void removeInterpreter(String name)(Code)
Removes the interpreter with the given name, if it exists. Unsynchronized because _interpreters is immutable and its methods are thread-safe.
Parameters:
  name - Name of the interpreter to remove



runTestSuite
public boolean runTestSuite() throws RemoteException(Code)
Runs JUnit test suite already cached in the Interpreter JVM. Unsynchronized because it contains a remote call and does not involve mutable local state. false if no test suite is cached; true otherwise



setActiveInterpreter
public synchronized boolean setActiveInterpreter(String name)(Code)
Sets the current interpreter to be the one specified by the given name
Parameters:
  name - the unique name of the interpreter to set active Whether the new interpreter is currently in progress with an interaction



setPackageScope
public void setPackageScope(String s)(Code)
Sets the package scope for the current active interpreter, if it is a JavaInterpreter.



setPrivateAccessible
public synchronized void setPrivateAccessible(boolean allow)(Code)
Sets the interpreter to allow access to private members.



setShowMessageOnResetFailure
public void setShowMessageOnResetFailure(boolean show)(Code)

Parameters:
  show - Whether to show a message if a reset operation fails.



setToDefaultInterpreter
public synchronized boolean setToDefaultInterpreter()(Code)
Sets the default interpreter to be active. Whether the new interpreter is currently in progress with an interaction



testEnded
public void testEnded(String testName, boolean wasSuccessful, boolean causedError)(Code)
Notifies that a particular test has ended. Unsynchronized because it contains a remote call.
Parameters:
  testName - The name of the test that has ended.
Parameters:
  wasSuccessful - Whether the test passed or not.
Parameters:
  causedError - If not successful, whether the test caused an error or simply failed.



testStarted
public void testStarted(String testName)(Code)
Notifies that a particular test has started. Unsynchronized because it contains a remote call and does not involve mutable local state.
Parameters:
  testName - The name of the test being started.



testSuiteEnded
public void testSuiteEnded(JUnitError[] errors)(Code)
Notifies that a full suite of tests has finished running. Unsynchronized because it contains a remote call and does not involve mutable local state.
Parameters:
  errors - The array of errors from all failed tests in the suite.



testSuiteStarted
public void testSuiteStarted(int numTests)(Code)
Notifies that a suite of tests has started running. Unsynchronized because it contains a remote call and does not involve mutable local state.
Parameters:
  numTests - The number of tests in the suite to be run.



Fields inherited from edu.rice.cs.util.newjvm.AbstractSlaveJVM
final public static int CHECK_MAIN_VM_ALIVE_SECONDS(Code)(Java Doc)
final protected static Log _log(Code)(Java Doc)
protected volatile String _pollMasterThreadName(Code)(Java Doc)
protected volatile String _quitSlaveThreadName(Code)(Java Doc)

Methods inherited from edu.rice.cs.util.newjvm.AbstractSlaveJVM
protected void beforeQuit()(Code)(Java Doc)
abstract protected void handleStart(MasterRemote master)(Code)(Java Doc)
final public synchronized void quit()(Code)(Java Doc)
protected void quitFailed(Throwable th)(Code)(Java Doc)
final public void start(MasterRemote master) throws RemoteException(Code)(Java Doc)

w___w___w_.___j__a__v__a_2s__.__c__o__m_ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.