|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.hprog.code.CodeSession
Shared sessions
Field Summary | |
java.lang.String |
desc
Description of this session |
java.lang.String |
lang
Language used in this session |
Method Summary | |
boolean |
addUser(java.lang.String handle,
CodeProtocol prot)
Add a user/connection pair to this session |
void |
close()
Delete this session, closing all connections associated with it |
boolean |
createFile(java.lang.String handle,
java.lang.String fname)
Request the creation of a new file, with an access check |
void |
eval(java.lang.String exp)
Evaluate an expression in the interpreter. |
static CodeSession |
get(java.lang.String name,
java.lang.String lang,
java.lang.String desc)
Get a session by name |
java.lang.String |
getEditor()
Get the current editor's handle |
java.util.Map |
getFiles()
Get map from shared filenames to their String contents |
CodeProtocol |
getUser(java.lang.String handle)
Get the connection associated with a user |
java.util.Map |
getUsers()
Get map from user handles to their connections |
boolean |
hasEditor()
Is there currently an editor in this session? |
boolean |
insertText(java.lang.String handle,
java.lang.String fname,
int pos,
java.lang.String text)
Request insertion of text into a shared source file |
void |
interrupt()
Interrupt current interpreter execution |
boolean |
isAdmin(java.lang.String handle)
Check if a user is an operator |
boolean |
isEditor(java.lang.String handle)
Is a user the editor or an operator? |
void |
load()
Load all source files into the interpreter |
boolean |
makeAdmin(java.lang.String handle,
java.lang.String name)
Try to make a user an operator, with an access check |
boolean |
makeEditor(java.lang.String handle,
java.lang.String name)
Try to make a user the editor, with an access check |
boolean |
removeText(java.lang.String handle,
java.lang.String fname,
int pos,
int len)
Request deletion of text from a shared source file |
void |
removeUser(java.lang.String handle)
Remove a user from the session |
void |
sendByte(byte b)
Send a byte to every client for this session |
void |
sendChat(java.lang.String s)
Send a line of chat to all clients |
boolean |
sendInterpIn(java.lang.String handle,
java.lang.String s)
Send a notification of a running query to all clients but the editor's |
void |
sendInterpOut(java.lang.String s)
Send shared interpreter output to all clients |
void |
sendLoading()
Notify all clients that source files are being loaded in the shared interpreter |
void |
setAdmin(java.lang.String editor)
Make a user an operator |
boolean |
setCaret(java.lang.String handle,
java.lang.String fname,
int pos,
int len)
Request a change in a shared source file's caret position |
void |
setEditor(java.lang.String editor)
Make a user the editor |
java.util.Iterator |
userIterator()
Get an iterator for the set of user/CodeProtocol key/value pairs in this session |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public java.lang.String lang
public java.lang.String desc
Method Detail |
public java.util.Iterator userIterator()
public static CodeSession get(java.lang.String name, java.lang.String lang, java.lang.String desc)
name
- session namelang
- language code (only used if the session must be created)desc
- session description (only used if the session must be created)
public void close()
public boolean addUser(java.lang.String handle, CodeProtocol prot)
handle
- handle of user to addprot
- his connection
public void removeUser(java.lang.String handle)
handle
- handle of user to removepublic java.util.Map getUsers()
public java.util.Map getFiles()
public CodeProtocol getUser(java.lang.String handle)
handle
- handle of target user
public void sendByte(byte b)
b
- byte to sendpublic void sendChat(java.lang.String s)
s
- text to sendpublic void sendLoading()
public boolean sendInterpIn(java.lang.String handle, java.lang.String s)
handle
- handle of user that sent the querys
- query he sent
public void sendInterpOut(java.lang.String s)
s
- output textpublic void setAdmin(java.lang.String editor)
editor
- handle of user to make operatorpublic void setEditor(java.lang.String editor)
editor
- handle of user to make editorpublic boolean makeEditor(java.lang.String handle, java.lang.String name)
handle
- handle of user requesting to make another user editorname
- handle of requested new editor
public boolean makeAdmin(java.lang.String handle, java.lang.String name)
handle
- handle of user requesting to make another user operatorname
- handle of requested new operator
public boolean isAdmin(java.lang.String handle)
handle
- user to check
public java.lang.String getEditor()
public boolean hasEditor()
public boolean isEditor(java.lang.String handle)
public boolean createFile(java.lang.String handle, java.lang.String fname)
handle
- handle of user requesting the creationfname
- name of new file
public boolean insertText(java.lang.String handle, java.lang.String fname, int pos, java.lang.String text)
handle
- handle of requesting userfname
- name of filepos
- index of position in file into which to inserttext
- text to insert
public boolean removeText(java.lang.String handle, java.lang.String fname, int pos, int len)
handle
- handle of requesting userfname
- file namepos
- beginning of region in file to deletelen
- number of characters to delete
public boolean setCaret(java.lang.String handle, java.lang.String fname, int pos, int len)
handle
- handle of user requesting changefname
- name of filepos
- beginning of selection arealen
- length of selection areapublic void eval(java.lang.String exp)
exp
- expression to evaluatepublic void interrupt()
public void load()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |