edu.rice.cs.drjava.model.repl
Class InteractionsModelTest.IncompleteInputInteractionsModel

java.lang.Object
  extended by edu.rice.cs.drjava.model.repl.InteractionsModel
      extended by edu.rice.cs.drjava.model.repl.RMIInteractionsModel
          extended by edu.rice.cs.drjava.model.repl.InteractionsModelTest.IncompleteInputInteractionsModel
All Implemented Interfaces:
InteractionsModelCallback
Enclosing class:
InteractionsModelTest

public static class InteractionsModelTest.IncompleteInputInteractionsModel
extends RMIInteractionsModel

This test model includes a slave JVM, just like a DefaultGlobalModel. It must be disposed before it is deallocated to kill the slave JVM. TODO: the mutation in this class is disgusting -- Corky 2 June 06.


Field Summary
private  boolean _interactionDone
           
private  Object _interactionLock
           
(package private)  boolean continuationException
           
(package private)  boolean syntaxException
           
 
Fields inherited from class edu.rice.cs.drjava.model.repl.RMIInteractionsModel
_jvm
 
Fields inherited from class edu.rice.cs.drjava.model.repl.InteractionsModel
_autoImportSet, _cDoc, _document, _inputListener, _lastError, _notifier, _pane, _secondToLastError, _waitingForFirstInterpreter, _workingDirectory, _writerLock, BANNER_PREFIX, WRITE_DELAY
 
Constructor Summary
InteractionsModelTest.IncompleteInputInteractionsModel(InteractionsDJDocument adapter)
          Constructs a new IncompleteInputInteractionsModel.
 
Method Summary
protected  void _interpreterResetFailed(Throwable t)
          Any extra action to perform (beyond notifying listeners) when the interpreter fails to reset.
protected  void _interpreterWontStart(Exception e)
          Action to perform when the interpreter won't start.
 void _logInteractionStart()
           
protected  void _notifyInteractionEnded()
          Notifies listeners that an interaction has ended.
protected  void _notifyInteractionIncomplete()
          Notifies the view that the current interaction is incomplete.
 void _notifyInteractionStarted()
          Notifies listeners that an interaction has started.
protected  void _notifyInterpreterChanged(boolean inProgress)
          Notifies listeners that the interpreter has changed.
protected  void _notifyInterpreterExited(int status)
          Notifies listeners that the interpreter has exited unexpectedly.
 void _notifyInterpreterReady(File wd)
          Notifies listeners that the interpreter is ready.
protected  void _notifyInterpreterResetFailed(Throwable t)
          Notifies listeners that the interpreter reset failed.
protected  void _notifyInterpreterResetting()
          Notifies listeners that the interpreter is resetting.
protected  void _notifySyntaxErrorOccurred(int offset, int length)
          Handles a syntax error being returned from an interaction
 void _waitInteractionDone()
           
 void dispose()
           
 List<File> getCompilerBootClassPath()
          A compiler can instruct DrJava to include additional elements for the boot class path of the Interactions JVM.
 ConsoleDocument getConsoleDocument()
          Gets the console tab document for this interactions model
 boolean isContinuationException()
           
 boolean isSyntaxException()
           
 void replReturnedSyntaxError(String errorMessage, String interaction, int startRow, int startCol, int endRow, int endCol)
          Signifies that the most recent interpretation was preempted by a syntax error.
 void replThrewException(String message)
          Signifies that the most recent interpretation was ended due to an exception being thrown.
 void replThrewException(String message, StackTraceElement[] stackTrace)
          Signifies that the most recent interpretation was ended due to an exception being thrown.
 String transformCommands(String interactionsString)
          Transform the command line to be interpreted into something the Interactions JVM can use.
 
Methods inherited from class edu.rice.cs.drjava.model.repl.RMIInteractionsModel
_interpret, _resetInterpreter, addBuildDirectoryClassPath, addExternalFilesClassPath, addExtraClassPath, addInterpreter, addProjectClassPath, addProjectFilesClassPath, getClassPath, getVariableToString, removeInterpreter, setActiveInterpreter, setEnforceAllAccess, setEnforcePrivateAccess, setRequireSemicolon, setRequireVariableType, setToDefaultInterpreter
 
Methods inherited from class edu.rice.cs.drjava.model.repl.InteractionsModel
_addNewline, _createNewDebugPort, _getHistoryText, _interactionIsOver, _removeSeparators, _writerDelay, addListener, append, autoImport, changeInputListener, getBanner, getBanner, getConsoleInput, getDebugPort, getDocument, getLastError, getSecondToLastError, getStartUpBanner, getWorkingDirectory, interactionContinues, interpret, interpretCurrentInteraction, interpreterReady, interpreterResetFailed, interpreterResetting, interpreterWontStart, loadHistory, loadHistoryAsScript, performDefaultImports, removeAllInteractionListeners, removeLastFromHistory, removeListener, replaceLLException, replCalledSystemExit, replReturnedResult, replReturnedVoid, replSystemErrPrint, replSystemOutPrint, resetInterpreter, resetLastErrors, scrollToCaret, setDebugPort, setInputListener, setUpPane, setWaitingForFirstInterpreter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

continuationException

boolean continuationException

syntaxException

boolean syntaxException

_interactionDone

private volatile boolean _interactionDone

_interactionLock

private final Object _interactionLock
Constructor Detail

InteractionsModelTest.IncompleteInputInteractionsModel

public InteractionsModelTest.IncompleteInputInteractionsModel(InteractionsDJDocument adapter)
                                                       throws RemoteException
Constructs a new IncompleteInputInteractionsModel.

Throws:
RemoteException
Method Detail

_logInteractionStart

public void _logInteractionStart()

_waitInteractionDone

public void _waitInteractionDone()
                          throws InterruptedException
Throws:
InterruptedException

_notifyInteractionStarted

public void _notifyInteractionStarted()
Description copied from class: InteractionsModel
Notifies listeners that an interaction has started. (Subclasses must maintain listeners.)

Specified by:
_notifyInteractionStarted in class InteractionsModel

_notifyInteractionEnded

protected void _notifyInteractionEnded()
Description copied from class: InteractionsModel
Notifies listeners that an interaction has ended. (Subclasses must maintain listeners.)

Specified by:
_notifyInteractionEnded in class InteractionsModel

_notifySyntaxErrorOccurred

protected void _notifySyntaxErrorOccurred(int offset,
                                          int length)
Description copied from class: InteractionsModel
Handles a syntax error being returned from an interaction

Specified by:
_notifySyntaxErrorOccurred in class InteractionsModel
Parameters:
offset - the first character of the error in the InteractionsDocument
length - the length of the error.

_notifyInterpreterExited

protected void _notifyInterpreterExited(int status)
Description copied from class: InteractionsModel
Notifies listeners that the interpreter has exited unexpectedly. (Subclasses must maintain listeners.)

Specified by:
_notifyInterpreterExited in class InteractionsModel
Parameters:
status - Status code of the dead process

_notifyInterpreterResetting

protected void _notifyInterpreterResetting()
Description copied from class: InteractionsModel
Notifies listeners that the interpreter is resetting. (Subclasses must maintain listeners.)

Specified by:
_notifyInterpreterResetting in class InteractionsModel

_notifyInterpreterResetFailed

protected void _notifyInterpreterResetFailed(Throwable t)
Description copied from class: InteractionsModel
Notifies listeners that the interpreter reset failed. (Subclasses must maintain listeners.)

Specified by:
_notifyInterpreterResetFailed in class InteractionsModel
Parameters:
t - Throwable explaining why the reset failed.

_notifyInterpreterReady

public void _notifyInterpreterReady(File wd)
Description copied from class: InteractionsModel
Notifies listeners that the interpreter is ready. (Subclasses must maintain listeners.)

Specified by:
_notifyInterpreterReady in class InteractionsModel

_interpreterResetFailed

protected void _interpreterResetFailed(Throwable t)
Description copied from class: InteractionsModel
Any extra action to perform (beyond notifying listeners) when the interpreter fails to reset.

Specified by:
_interpreterResetFailed in class InteractionsModel
Parameters:
t - The Throwable thrown by System.exit

_interpreterWontStart

protected void _interpreterWontStart(Exception e)
Description copied from class: InteractionsModel
Action to perform when the interpreter won't start.

Specified by:
_interpreterWontStart in class InteractionsModel

_notifyInteractionIncomplete

protected void _notifyInteractionIncomplete()
Description copied from class: InteractionsModel
Notifies the view that the current interaction is incomplete.

Specified by:
_notifyInteractionIncomplete in class InteractionsModel

_notifyInterpreterChanged

protected void _notifyInterpreterChanged(boolean inProgress)
Description copied from class: RMIInteractionsModel
Notifies listeners that the interpreter has changed. (Subclasses must maintain listeners.)

Specified by:
_notifyInterpreterChanged in class RMIInteractionsModel
Parameters:
inProgress - Whether the new interpreter is currently in progress with an interaction, i.e., whether an interactionEnded event will be fired)

dispose

public void dispose()
             throws RemoteException
Throws:
RemoteException

getConsoleDocument

public ConsoleDocument getConsoleDocument()
Description copied from class: InteractionsModel
Gets the console tab document for this interactions model

Specified by:
getConsoleDocument in class InteractionsModel

replThrewException

public void replThrewException(String message,
                               StackTraceElement[] stackTrace)
Description copied from class: InteractionsModel
Signifies that the most recent interpretation was ended due to an exception being thrown.

Specified by:
replThrewException in interface InteractionsModelCallback
Overrides:
replThrewException in class InteractionsModel
Parameters:
message - The exception's message

replThrewException

public void replThrewException(String message)
Description copied from class: InteractionsModel
Signifies that the most recent interpretation was ended due to an exception being thrown.

Specified by:
replThrewException in interface InteractionsModelCallback
Overrides:
replThrewException in class InteractionsModel
Parameters:
message - The exception's message

replReturnedSyntaxError

public void replReturnedSyntaxError(String errorMessage,
                                    String interaction,
                                    int startRow,
                                    int startCol,
                                    int endRow,
                                    int endCol)
Description copied from class: InteractionsModel
Signifies that the most recent interpretation was preempted by a syntax error. The integer parameters support future error highlighting.

Specified by:
replReturnedSyntaxError in interface InteractionsModelCallback
Overrides:
replReturnedSyntaxError in class InteractionsModel
Parameters:
errorMessage - The syntax error message
startRow - The starting row of the error
startCol - The starting column of the error
endRow - The end row of the error param endCol The end column of the error
endCol - The end column of the error

isContinuationException

public boolean isContinuationException()

isSyntaxException

public boolean isSyntaxException()

getCompilerBootClassPath

public List<File> getCompilerBootClassPath()
Description copied from interface: InteractionsModelCallback
A compiler can instruct DrJava to include additional elements for the boot class path of the Interactions JVM.


transformCommands

public String transformCommands(String interactionsString)
Description copied from interface: InteractionsModelCallback
Transform the command line to be interpreted into something the Interactions JVM can use. This replaces "java MyClass a b c" with Java code to call MyClass.main(new String[]{"a","b","c"}). "import MyClass" is not handled here.

Parameters:
interactionsString - unprocessed command line
Returns:
command line with commands transformed