Java Doc for MainJVM.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.AbstractMasterJVM
   edu.rice.cs.drjava.model.repl.newjvm.MainJVM

MainJVM
public class MainJVM extends AbstractMasterJVM implements MainJVMRemoteI(Code)
Manages a remote JVM.
version:
   $Id: MainJVM.java 4255 2007-08-28 19:17:37Z mgricken $

Inner Class :public static class DummyInteractionsModel implements InteractionsModelCallback
Inner Class :public static class DummyJUnitModel implements JUnitModelCallback
Inner Class :public static class DummyDebugModel implements DebugModelCallback

Field Summary
final public static  StringDEFAULT_INTERPRETER_NAME
    

Constructor Summary
public  MainJVM(File wd)
     Creates a new MainJVM to interface to another JVM; the MainJVM has a link to the partially initialized global model.

Method Summary
public  voidaddBuildDirectoryClassPath(File f)
    
public  voidaddDebugInterpreter(String name, String className)
     Adds a named JavaDebugInterpreter to the list of interpreters.
public  voidaddExternalFilesClassPath(File f)
    
public  voidaddExtraClassPath(File f)
    
public  voidaddJavaInterpreter(String name)
     Adds a named DynamicJavaAdapter to the list of interpreters.
public  voidaddProjectClassPath(File f)
    
public  voidaddProjectFilesClassPath(File f)
    
protected  booleanallowAssertions()
     Return whether to allow assertions in the InterpreterJVM.
public  voidclassFileError(ClassFileError e)
     Called if the slave JVM encounters an illegal class file in testing.
public  voidenableRestart()
     ReEnables restarting the slave if it has been turned off by repeated startup failures.
public  InterpreterJVMRemoteIensureInterpreterConnected()
     If an interpreter has not registered itself, this method will block until one does.
public  voiderrorStartingSlave(Throwable cause)
     Called if the slave JVM dies before it is able to register.
public  List<String>findTestClasses(List<String> classNames, List<File> files)
    
public  Iterable<File>getClassPath()
     Returns the current classpath of the interpreter as a list of unique entries.
public  StringgetConsoleInput()
     Asks the main jvm for input from the console.
public  StringgetCurrentInterpreterName()
     Accesses the cached current interpreter name.
protected  intgetDebugPort()
     Returns the debug port to use, as specified by the model.
public  FilegetFileForClassName(String className)
     Called when the JUnitTestManager wants to open a file that is not currently open.
protected  InterpretResultVisitor<Object>getResultHandler()
     Returns the visitor to handle an InterpretResult.
public  StringgetVariableClassName(String var)
     Gets the class name of a variable in the current interpreter.
public  StringgetVariableToString(String var)
     Gets the string representation of the value of a variable in the current interpreter.
protected  voidhandleSlaveConnected()
     Called when Interpreter JVM connects to us after being started.
protected  voidhandleSlaveQuit(int status)
     React if the slave JVM quits.
public  voidinterpret(String s)
     Interprets string s in slave JVM.
public  voidinterpretResult(InterpretResult result)
     Called when a call to interpret has completed.
public  booleanisInterpreterRunning()
    
public  booleanisStartupInProgress()
     Returns whether a JVM is currently starting.
public  voidkillInterpreter(File wd)
     Kills the running interpreter JVM, and restarts with working directory wd if wd != null.
public  voidnonTestCase(boolean isTestAll)
     Called if JUnit is invoked on a non TestCase class.
public  voidquitFailed(Throwable th)
     This method is called by the interpreter JVM if it cannot be exited.
public  voidremoveInterpreter(String name)
     Removes the interpreter with the given name, if it exists.
public  booleanrunTestSuite()
     Runs the JUnit test suite already cached in the Interpreter JVM.
public  booleansetActiveInterpreter(String name)
    
public  voidsetAllowAssertions(boolean allow)
     Sets whether the remote JVM will run "assert" statements after the next restart.
public  voidsetDebugModel(DebugModelCallback model)
     Provides an object to listen to debug-related events.
public  voidsetInteractionsModel(InteractionsModelCallback model)
     Provides an object to listen to interactions-related events.
public  voidsetJUnitModel(JUnitModelCallback model)
     Provides an object to listen to test-related events.
public  voidsetOptionArgs(String argString)
     Sets the extra (optional) arguments to be passed to the interpreter.
public  voidsetPackageScope(String packageName)
     Sets the Interpreter to be in the given package.
public  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  voidsetStartupClassPath(String classPath)
     Sets the classpath to use for starting the interpreter JVM.
public  booleansetToDefaultInterpreter()
     Sets the default interpreter to be the current one. Whether the new interpreter is currently in progress with an interaction (ie.
public  booleanslaveJVMUsed()
    
protected  voidslaveQuitDuringStartup(int status)
     Action to take if the slave JVM quits before registering.
public  voidstartInterpreterJVM()
     Starts the interpreter if it's not running already.
public  voidsystemErrPrint(String s)
     Forwards a call to System.err from InterpreterJVM to the local InteractionsModel.
public  voidsystemOutPrint(String s)
     Forwards a call to System.out from InterpreterJVM to the local InteractionsModel.
public  voidtestEnded(String testName, boolean wasSuccessful, boolean causedError)
     Called when a particular test has ended.
public  voidtestStarted(String testName)
     Called when a particular test is started.
public  voidtestSuiteEnded(JUnitError[] errors)
     Called when a full suite of tests has finished running.
public  voidtestSuiteStarted(int numTests)
     Called to indicate that a suite of tests has started running.

Field Detail
DEFAULT_INTERPRETER_NAME
final public static String DEFAULT_INTERPRETER_NAME(Code)




Constructor Detail
MainJVM
public MainJVM(File wd) throws RemoteException(Code)
Creates a new MainJVM to interface to another JVM; the MainJVM has a link to the partially initialized global model. The MainJVM but does not automatically start the Interpreter JVM. Callers must set the InteractionsModel and JUnitModel and then call startInterpreterJVM().




Method Detail
addBuildDirectoryClassPath
public void addBuildDirectoryClassPath(File f)(Code)



addDebugInterpreter
public 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 void addExternalFilesClassPath(File f)(Code)



addExtraClassPath
public void addExtraClassPath(File f)(Code)



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



addProjectClassPath
public void addProjectClassPath(File f)(Code)



addProjectFilesClassPath
public void addProjectFilesClassPath(File f)(Code)



allowAssertions
protected boolean allowAssertions()(Code)
Return whether to allow assertions in the InterpreterJVM.



classFileError
public void classFileError(ClassFileError e) throws RemoteException(Code)
Called if the slave JVM encounters an illegal class file in testing. Forwards from the other JVM to the local JUnit model.
Parameters:
  e - the ClassFileError describing the error when loading the class file



enableRestart
public void enableRestart()(Code)
ReEnables restarting the slave if it has been turned off by repeated startup failures.



ensureInterpreterConnected
public InterpreterJVMRemoteI ensureInterpreterConnected()(Code)
If an interpreter has not registered itself, this method will block until one does.



errorStartingSlave
public void errorStartingSlave(Throwable cause) throws RemoteException(Code)
Called if the slave JVM dies before it is able to register.
Parameters:
  cause - The Throwable which caused the slave to die.



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)
Parameters:
  classNames - the class names to run in a test
Parameters:
  files - the associated file the class names that are actually test cases



getClassPath
public Iterable<File> getClassPath()(Code)
Returns the current classpath of the interpreter as a list of unique entries. The list is empty if a remote exception occurs.



getConsoleInput
public String getConsoleInput()(Code)
Asks the main jvm for input from the console. the console input



getCurrentInterpreterName
public String getCurrentInterpreterName()(Code)
Accesses the cached current interpreter name.



getDebugPort
protected int getDebugPort()(Code)
Returns the debug port to use, as specified by the model. Returns -1 if no usable port could be found.



getFileForClassName
public File getFileForClassName(String className) throws RemoteException(Code)
Called when the JUnitTestManager wants to open a file that is not currently open.
Parameters:
  className - the name of the class for which we want to find the file the file associated with the given class



getResultHandler
protected InterpretResultVisitor<Object> getResultHandler()(Code)
Returns the visitor to handle an InterpretResult.



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



getVariableToString
public String getVariableToString(String var)(Code)
Gets the string representation of the value of a variable in the current interpreter.
Parameters:
  var - the name of the variable



handleSlaveConnected
protected void handleSlaveConnected()(Code)
Called when Interpreter JVM connects to us after being started. Assumes that _masterJVMLock is already held.



handleSlaveQuit
protected void handleSlaveQuit(int status)(Code)
React if the slave JVM quits. Restarts the JVM unless _restart is false, and notifies the InteractionsModel if the quit was unexpected. Called from a thread within AbstractMasterJVM waiting for the death of the process that starts and runs the slave JVM.
Parameters:
  status - Status returned by the dead process.



interpret
public void interpret(String s)(Code)
Interprets string s in slave JVM. No masterJVMLock synchronization because reading _restart is the only access.to master JVM state.



interpretResult
public void interpretResult(InterpretResult result) throws RemoteException(Code)
Called when a call to interpret has completed.
Parameters:
  result - The result of the interpretation



isInterpreterRunning
public boolean isInterpreterRunning()(Code)



isStartupInProgress
public boolean isStartupInProgress()(Code)
Returns whether a JVM is currently starting. This override widens the visibility of the method.



killInterpreter
public void killInterpreter(File wd)(Code)
Kills the running interpreter JVM, and restarts with working directory wd if wd != null. If wd == null, the interpreter is not restarted. Note: If the interpreter is not restarted, all of the methods that delegate to the interpreter will silently fail! Therefore, killing without restarting should be used with extreme care and only in carefully controlled test cases or when DrJava is quitting anyway.



nonTestCase
public void nonTestCase(boolean isTestAll) throws RemoteException(Code)
Called if JUnit is invoked on a non TestCase class. Forwards from the other JVM to the local JUnit model.
Parameters:
  isTestAll - whether or not it was a use of the test all button



quitFailed
public void quitFailed(Throwable th) throws RemoteException(Code)
This method is called by the interpreter JVM if it cannot be exited.
Parameters:
  th - The Throwable thrown by System.exit



removeInterpreter
public void removeInterpreter(String name)(Code)
Removes the interpreter with the given name, if it exists.
Parameters:
  name - Name of the interpreter to remove



runTestSuite
public boolean runTestSuite() throws RemoteException(Code)
Runs the JUnit test suite already cached in the Interpreter JVM. false if no test suite is cached; true otherwise



setActiveInterpreter
public boolean setActiveInterpreter(String name)(Code)
Sets the current interpreter to the one specified by name
Parameters:
  name - the unique name of the interpreter to set active Whether the new interpreter is currently processing an interaction (i.e., whether an interactionEndedevent will be fired)



setAllowAssertions
public void setAllowAssertions(boolean allow)(Code)
Sets whether the remote JVM will run "assert" statements after the next restart.



setDebugModel
public void setDebugModel(DebugModelCallback model)(Code)
Provides an object to listen to debug-related events.
Parameters:
  model - the debug model



setInteractionsModel
public void setInteractionsModel(InteractionsModelCallback model)(Code)
Provides an object to listen to interactions-related events.



setJUnitModel
public void setJUnitModel(JUnitModelCallback model)(Code)
Provides an object to listen to test-related events.



setOptionArgs
public void setOptionArgs(String argString)(Code)
Sets the extra (optional) arguments to be passed to the interpreter.
Parameters:
  argString - the arguments as they would be typed at the command-line



setPackageScope
public void setPackageScope(String packageName)(Code)
Sets the Interpreter to be in the given package.
Parameters:
  packageName - Name of the package to enter.



setPrivateAccessible
public void setPrivateAccessible(boolean allow)(Code)
Sets the interpreter to allow access to private members. TODO: synchronize?



setShowMessageOnResetFailure
public void setShowMessageOnResetFailure(boolean show)(Code)

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



setStartupClassPath
public void setStartupClassPath(String classPath)(Code)
Sets the classpath to use for starting the interpreter JVM. Must include the classes for the interpreter.
Parameters:
  classPath - Classpath for the interpreter JVM



setToDefaultInterpreter
public boolean setToDefaultInterpreter()(Code)
Sets the default interpreter to be the current one. Whether the new interpreter is currently in progress with an interaction (ie. whether an interactionEnded event will be fired)



slaveJVMUsed
public boolean slaveJVMUsed()(Code)



slaveQuitDuringStartup
protected void slaveQuitDuringStartup(int status)(Code)
Action to take if the slave JVM quits before registering. Assumes _masterJVMLock is held.
Parameters:
  status - Status code of the JVMTODO: revise the unit tests that kill the slave prematurely (by making them wait until theslave registers) and remove the TEST_MODE escape.



startInterpreterJVM
public void startInterpreterJVM()(Code)
Starts the interpreter if it's not running already.



systemErrPrint
public void systemErrPrint(String s) throws RemoteException(Code)
Forwards a call to System.err from InterpreterJVM to the local InteractionsModel.
Parameters:
  s - String that was printed in the other JVM



systemOutPrint
public void systemOutPrint(String s) throws RemoteException(Code)
Forwards a call to System.out from InterpreterJVM to the local InteractionsModel.
Parameters:
  s - String that was printed in the other JVM



testEnded
public void testEnded(String testName, boolean wasSuccessful, boolean causedError) throws RemoteException(Code)
Called when a particular test has ended. Forwards from the other JVM to the local JUnit model.
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) throws RemoteException(Code)
Called when a particular test is started. Forwards from the slave JVM to the local JUnit model.
Parameters:
  testName - The name of the test being started.



testSuiteEnded
public void testSuiteEnded(JUnitError[] errors) throws RemoteException(Code)
Called when a full suite of tests has finished running. Forwards from the other JVM to the local JUnit model.
Parameters:
  errors - The array of errors from all failed tests in the suite.



testSuiteStarted
public void testSuiteStarted(int numTests) throws RemoteException(Code)
Called to indicate that a suite of tests has started running. Forwards from the other JVM to the local JUnit model.
Parameters:
  numTests - The number of tests in the suite to be run.



Fields inherited from edu.rice.cs.util.newjvm.AbstractMasterJVM
final public static Log _log(Code)(Java Doc)
final protected Object _masterJVMLock(Code)(Java Doc)
protected volatile SlaveRemote _slave(Code)(Java Doc)
protected volatile String _waitForQuitThreadName(Code)(Java Doc)

Methods inherited from edu.rice.cs.util.newjvm.AbstractMasterJVM
public void checkStillAlive()(Code)(Java Doc)
public void dispose() throws RemoteException(Code)(Java Doc)
abstract public void errorStartingSlave(Throwable cause) throws RemoteException(Code)(Java Doc)
final protected SlaveRemote getSlave()(Code)(Java Doc)
abstract protected void handleSlaveConnected()(Code)(Java Doc)
abstract protected void handleSlaveQuit(int status)(Code)(Java Doc)
final protected void invokeSlave() throws IOException, RemoteException(Code)(Java Doc)
final protected void invokeSlave(String[] jvmArgs, File workDir) throws IOException, RemoteException(Code)(Java Doc)
final protected void invokeSlave(String[] jvmArgs, String cp, File workDir) throws IOException, RemoteException(Code)(Java Doc)
protected boolean isStartupInProgress()(Code)(Java Doc)
final protected void quitSlave() throws RemoteException(Code)(Java Doc)
public void registerSlave(SlaveRemote slave) throws RemoteException(Code)(Java Doc)
protected void slaveQuitDuringStartup(int status)(Code)(Java Doc)
public void waitSlaveDone()(Code)(Java Doc)

ww__w___.___j__a___v_a_2_s__.__c___o___m__ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.