KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > edu > rice > cs > drjava > model > repl > InteractionsModelCallback


1 /*BEGIN_COPYRIGHT_BLOCK
2  *
3  * This file is part of DrJava. Download the current version of this project from http://www.drjava.org/
4  * or http://sourceforge.net/projects/drjava/
5  *
6  * DrJava Open Source License
7  *
8  * Copyright (C) 2001-2005 JavaPLT group at Rice University (javaplt@rice.edu). All rights reserved.
9  *
10  * Developed by: Java Programming Languages Team, Rice University, http://www.cs.rice.edu/~javaplt/
11  *
12  * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
13  * documentation files (the "Software"), to deal with the Software without restriction, including without limitation
14  * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
15  * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
16  *
17  * - Redistributions of source code must retain the above copyright notice, this list of conditions and the
18  * following disclaimers.
19  * - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the
20  * following disclaimers in the documentation and/or other materials provided with the distribution.
21  * - Neither the names of DrJava, the JavaPLT, Rice University, nor the names of its contributors may be used to
22  * endorse or promote products derived from this Software without specific prior written permission.
23  * - Products derived from this software may not be called "DrJava" nor use the term "DrJava" as part of their
24  * names without prior written permission from the JavaPLT group. For permission, write to javaplt@rice.edu.
25  *
26  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
27  * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
28  * CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
29  * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
30  * WITH THE SOFTWARE.
31  *
32  *END_COPYRIGHT_BLOCK*/

33
34 package edu.rice.cs.drjava.model.repl;
35
36 import java.io.File JavaDoc;
37 import java.io.IOException JavaDoc;
38
39 /** Callback interface which allows an InteractionsModel to respond to events in a remote Java interpreter.
40  * @version $Id: InteractionsModelCallback.java 3592 2006-03-14 18:50:21Z rcartwright $
41  */

42 public interface InteractionsModelCallback {
43
44   /** Returns an available port number to use for debugging a remote interpreter.
45    * @throws IOException if unable to get a valid port number.
46    */

47   public int getDebugPort() throws IOException JavaDoc;
48
49   /** Called when the repl prints to System.out.
50    * @param s String to print
51    */

52   public void replSystemOutPrint(String JavaDoc s);
53
54   /** Called when input is request from System.in.
55    * @return the input given to System.in
56    */

57   public String JavaDoc getConsoleInput();
58
59   /** Sets the listener for any type of single-source input event. The listener can only be changed with
60    * the changeInputListener method.
61    * @param listener a listener that reacts to input requests
62    * @throws IllegalStateException if the input listener is locked
63    */

64   public void setInputListener(InputListener listener);
65
66   /** Changes the input listener. Takes in the old listener to ensure that the owner of the original
67    * listener is aware that it is being changed.
68    * @param oldListener the previous listener
69    * @param newListener the listener to install
70    * @throws IllegalArgumentException if oldListener is not the currently installed listener
71    */

72   public void changeInputListener(InputListener oldListener, InputListener newListener);
73
74   /** Called when the repl prints to System.err.
75    * @param s String to print
76    */

77   public void replSystemErrPrint(String JavaDoc s);
78
79   /**
80    * Signifies that the most recent interpretation completed successfully,
81    * returning no value.
82    */

83   public void replReturnedVoid();
84
85   /**
86    * Signifies that the most recent interpretation completed successfully,
87    * returning a value.
88    *
89    * @param result The .toString-ed version of the value that was returned
90    * by the interpretation. We must return the String form
91    * because returning the Object directly would require the
92    * data type to be serializable.
93    */

94   public void replReturnedResult(String JavaDoc result, String JavaDoc style);
95
96   /** Signifies that the most recent interpretation was ended due to an exception being thrown.
97    * @param exceptionClass The name of the class of the thrown exception
98    * @param message The exception's message
99    * @param stackTrace The stack trace of the exception
100    */

101   public void replThrewException(String JavaDoc exceptionClass, String JavaDoc message, String JavaDoc stackTrace, String JavaDoc specialMessage);
102
103   /** Signifies that the most recent interpretation was preempted by a syntax error.
104    * @param errorMessage The syntax error message
105    * @param startRow The starting row of the error
106    * @param startCol The starting column of the error
107    * @param endRow The end row of the error
108    * @param endCol The end column of the error
109    */

110   public void replReturnedSyntaxError(String JavaDoc errorMessage, String JavaDoc interaction, int startRow, int startCol,
111                                       int endRow, int endCol);
112
113   /** Signifies that the most recent interpretation contained a call to System.exit.
114    * @param status The exit status that will be returned.
115    */

116   public void replCalledSystemExit(int status);
117
118   /** This method is called by the Main JVM if the Interpreter JVM cannot be exited (likely because of its
119    * having a security manager)
120    * @param th The Throwable thrown by System.exit
121    */

122   public void interpreterResetFailed(Throwable JavaDoc th);
123
124   /** Called when the interpreter starts to reset. */
125   public void interpreterResetting();
126
127   /** Called when a new Java interpreter has registered and is ready for use. */
128   public void interpreterReady(File JavaDoc wd);
129   
130   /** Called when the slave JVM is used */
131   public void slaveJVMUsed();
132 }
Popular Tags