Copyright © Rasmus Sten and contributors, 1997-2004

nu.dll.lyskom
Class Session

java.lang.Object
  |
  +--nu.dll.lyskom.Session
All Implemented Interfaces:
AsynchMessageReceiver, RpcEventListener, nu.dll.lyskom.RpcReplyReceiver

public class Session
extends java.lang.Object
implements AsynchMessageReceiver, nu.dll.lyskom.RpcReplyReceiver, RpcEventListener

This is the main interface to the LysKOM server and the LatteKOM library.

An instance of the Session class represents a single connection to a LysKOM server. Access methods are provided for both asynchronous and synchronous operations with the LysKOM server.

All methods starting with do... are asynchronous methods that takes care of constructing the RPC call, putting it on the send queue, and then returns immediately. The call will be written to the server by another thread.

An application may register itself as an RpcEventListener, and send commands to the server by calling the do...() methods. LatteKOM will then call the the rpcEvent(RpcEvent) method when a reply arrives from the server. The application may also use the waitFor(int), which will cause the thread to block until a reply has been received with the supplied reference number (an RPC call's reference is automatically assigned by LatteKOM in the do...() methods, and can be retreived by the getId() method in an RpcCall object).

LatteKOM also provides synchronous method for all RPC calls. The synchronous methods have the same names as the asynchronous methods, but without the "do" prefix. They also add the extra convenience of interpreting the RPC reply and returning objects that are easier to deal with. For example, the whoIsOnDynamic(boolean, boolean, boolean) returns an array of DynamicSessionInfo objects containing all the information returned by the server. If a synchronous call fails, a RpcFailure exception should be thrown containing information about the error that occured.

Asynchronous messages can be received by clients by registering AsynchMessageReceiver objects with the addAsynchMessageReceiver method. The objects' asynchMessage() method will be called by the network read thread at the moment a message has been received and parsed into an AsynchMessage object. As the asynchMessage() method will be executed by the thread responsible for reading server messages, no server messages will be read during the execution of the receiver's method. Most notably, the receiving method must not send an RPC call and then call the waitFor() method to wait for the reply (this will cause an IOException to be thrown by the waitFor() method).

The LatteKOM library keeps caches of texts, conferences, persons and membership information. The caches are refreshed or purged when the server indicates that it might be needed. At the moment, much of that functionality is still in development and might therefore be inefficient, incomplete or buggy (that goes for large parts of LatteKOM in general).

A very simple program to login and read a specific LysKOM text could look like this:

   // Invoke with command: "java SimpleSample serverHost userName password textNo" 
   import nu.dll.lyskom.Session;
   import nu.dll.lyskom.Text;
   Import nu.dll.lyskom.ConfInfo;
   class SimpleSample {
       public static void main(String[] argv) throws Exception {
           Session session = new Session();
           session.connect(argv[0], 4894);
           System.out.println("Connected.");
           ConfInfo[] names = session.lookupName(argv[1], true, false);
           session.login(names[0].getNo(), argv[2], false);
           System.out.println("Logged in.");

           Text t = session.getText(Integer.parseInt(argv[3]));
           System.out.println("Retreived text " + argv[3]);
           System.out.println("Subject: " + new String(t.getSubject()));
           System.out.println("Text body:");
           System.out.println(new String(t.getBody()));
       }
   }
 

Version:
$Id: Session.java,v 1.39 2004/04/06 05:04:55 pajp Exp $
Author:
rasmus@sno.pp.se
See Also:
addRpcEventListener(RpcEventListener), RpcEvent, RpcCall, RpcFailure, waitFor(int), addAsynchMessageReceiver(AsynchMessageReceiver), AsynchMessage

Field Summary
static int defaultBigTextHead
           
static int defaultBigTextLimit
           
static boolean defaultEnabledBigText
           
static java.lang.String defaultServerEncoding
          The encoding used by the LysKOM server.
static int rpcSoftTimeout
          This is the "soft" timeout, in milliseconds.
static int rpcTimeout
          Time-out used by the waitFor() method in milliseconds.
static int STATE_CONNECTED
          Connected to a LysKOM server, but not logged in.
static int STATE_DISCONNECTED
          Not connected to a LysKOM server
static int STATE_LOGIN
          Connected, and logged in as a specific user
 
Constructor Summary
Session()
           
 
Method Summary
 void addAsynchMessageReceiver(nu.dll.lyskom.AsynchMessageReceiver a)
          Adds a listener for asynchronous messages.
 void addMember(int confNo, int persNo, int prio, int listPos, boolean invitation, boolean passive, boolean secret)
          Adds a conference to a person's membership.
 void addRpcEventListener(nu.dll.lyskom.RpcEventListener l)
          Adds RPC reply listeners.
 void asynchMessage(nu.dll.lyskom.AsynchMessage m)
          Receiver of asynchronous messages.
 void changeConference(int confNo)
          Changes the user's current conference.
 void changeName(int confNo, java.lang.String newName)
          Changes the name of a conference or a person.
 void changeWhatIAmDoing(java.lang.String s)
           
 boolean connect(java.lang.String server)
          Connect to specified server on the default port (4894) and do initial handshake
 boolean connect(java.lang.String server, int port)
          Connect to specified server/port number and do initial handshake
 int count()
          Returns the next RPC reference number to use and increments the RPC reference counter.
 int createConf(java.lang.String name, boolean readProt, boolean original, boolean secret)
          Ask the server to create a new conference
 int createPerson(java.lang.String name, java.lang.String password, nu.dll.lyskom.Bitstring flags, nu.dll.lyskom.AuxItem[] auxItems)
          Asks the server to create a new person.
 int createText(nu.dll.lyskom.Text t)
          Creates a text on the server, then returns the number of the newly created text.
 void deleteText(int textNo)
          Deletes a text on the server.
 void disconnect(boolean force)
          Disconnects from the server
 void disconnect(int sessionNo)
           
 nu.dll.lyskom.RpcCall doAddMember(int confNo, int persNo, int prio, int listPos, nu.dll.lyskom.Bitstring type)
          Sends the RPC call add-member to the server.
 nu.dll.lyskom.RpcCall doChangeConference(int confNo)
          Sends the RPC call change-conference to the server.
 nu.dll.lyskom.RpcCall doChangeName(int confNo, java.lang.String newName)
          Sends the RPC call change-name to the server.
 nu.dll.lyskom.RpcCall doChangeWhatIAmDoing(java.lang.String s)
          Sends the RPC call change-what-i-am-doing to the server.
 nu.dll.lyskom.RpcCall doCreateConf(java.lang.String name, nu.dll.lyskom.Bitstring type, nu.dll.lyskom.AuxItem[] auxItems)
          Sends the RPC call create-conf to the server.
 nu.dll.lyskom.RpcCall doCreatePerson(java.lang.String name, java.lang.String password, nu.dll.lyskom.Bitstring flags, nu.dll.lyskom.AuxItem[] auxItems)
          Sends the RPC call create-person to the server.
 nu.dll.lyskom.RpcCall doCreateText(byte[] text, java.util.List miscInfo, nu.dll.lyskom.AuxItem[] auxItems)
          Sends the RPC call create-text to the server.
 nu.dll.lyskom.RpcCall doCreateText(nu.dll.lyskom.Text t)
          Sends the RPC call create-text to the server.
 nu.dll.lyskom.RpcCall doDeleteText(int textNo)
          Sends the RPC call delete-text to the server.
 nu.dll.lyskom.RpcCall doDisconnect(int sessionNo, boolean discardReply)
           
 nu.dll.lyskom.RpcCall doGetClientName(int sessionNo)
          Sends the RPC call get-client-name to the server.
 nu.dll.lyskom.RpcCall doGetClientVersion(int sessionNo)
          Sends the RPC call get-client-version to the server.
 nu.dll.lyskom.RpcCall doGetConfStat(int confNo)
          Sends the RPC call get-conf-stat to the server.
 nu.dll.lyskom.RpcCall doGetInfo()
           
 nu.dll.lyskom.RpcCall doGetMarks()
          Sends the RPC call get-marks to the server.
 nu.dll.lyskom.RpcCall doGetMembership(int persNo)
          Equal to doGetMembership(persNo, 0, 1000, new Bitstring("0")).
 nu.dll.lyskom.RpcCall doGetMembership(int persNo, int first, int no, nu.dll.lyskom.Bitstring mask)
          Sends the RPC call get-membership to the server.
 nu.dll.lyskom.RpcCall doGetPersonStat(int persNo)
          Sends the RPC call get-person-stat to the server.
 nu.dll.lyskom.RpcCall doGetStaticSessionInfo(int sessionNo)
          Sends the RPC call get-static-session-info to the server.
 nu.dll.lyskom.RpcCall doGetTextStat(int textNo)
          Sends the RPC call get-text-stat to the server.
 nu.dll.lyskom.RpcCall doGetTime()
           
 nu.dll.lyskom.RpcCall doGetUConfStat(int confNo)
          Sends the RPC call get-uconf-stat to the server.
 nu.dll.lyskom.RpcCall doGetUnreadConfs(int persNo)
          Sends the RPC call get-unread-confs to the server.
 nu.dll.lyskom.RpcCall doLocalToGlobal(int confNo, int firstLocalNo, int noOfExistingTexts)
          Sends the RPC call local-to-global to the server.
 nu.dll.lyskom.RpcCall doMarkAsRead(int confNo, int[] localTextNo)
          Sends the RPC call mark-as-read to the server.
 nu.dll.lyskom.RpcCall doMarkText(int textNo, int markType)
          Sends the RPC call mark-text to the server.
 nu.dll.lyskom.RpcCall doModifyAuxInfo(boolean isConf, int objNo, int[] delAuxNo, nu.dll.lyskom.AuxItem[] addAux)
          Sends the RPC call modify-conf-info or modify-text-info to the server.
 nu.dll.lyskom.RpcCall doQueryReadTexts(int persNo, int confNo)
          Sends the RPC call query-read-texts to the server.
 nu.dll.lyskom.RpcCall doReLookup(java.lang.String regexp, boolean wantPersons, boolean wantConfs)
          Lookup names of persons or conferences using regular expressions
 nu.dll.lyskom.RpcCall doSetClientVersion(java.lang.String clientName, java.lang.String clientVersion)
          Sends the RPC call set-client-version to the server.
 nu.dll.lyskom.RpcCall doSetLastRead(int confNo, int textNo)
          Sends the RPC call set-last-read to the server.
 nu.dll.lyskom.RpcCall doSetPresentation(int confNo, int textNo)
          Sends the RPC call set-presentation to the server.
 nu.dll.lyskom.RpcCall doSubMember(int confNo, int persNo)
          Sends the RPC call sub-member to the server.
 nu.dll.lyskom.RpcCall doUnmarkText(int textNo)
          Sends the RPC call mark-text to the server.
 nu.dll.lyskom.RpcCall doUserActive()
          Sends the RPC call user-active to the server.
 nu.dll.lyskom.RpcCall doWhoAmI()
           
 nu.dll.lyskom.RpcCall doWhoIsOnDynamic(boolean wantVisible, boolean wantInvisible, int activeLast)
          Sends the RPC call who-is-on-dynamic to the server.
 void endast(int no)
          Sets the maximum number of unread texts in the current conference.
 void endast(int confNo, int no)
          Sets the maximum number of unread texts in a conference.
 void finalize()
           
 byte[] getClientName(int sessionNo)
          Returns the client name (as a byte array) for a given session.
 byte[] getClientVersion(int sessionNo)
          Returns the client version (as a byte array) for a given session.
 byte[] getConfName(int confNo)
          Returns a byte-array containing the name for a conference, or null if the conference doesn't exist.
 nu.dll.lyskom.Conference getConfStat(int confNo)
          Returns a Conference object containing information about a given conference.
 nu.dll.lyskom.Conference getConfStat(int confNo, boolean refreshCache)
          Returns a Conference object containing information about a given conference.
 boolean getConnected()
          Return true if connected to a LysKOM server.
 int getCurrentConference()
          Returns the current conference (as entered by changeConference())
 int[] getGlobalUnreadInConf(int conf)
          Deprecated. Follow the standard LysKOM convention to get unreads or use nextUnreadText()/nextUnreadConference()
 java.util.Map getInfo()
           
 boolean getLoggedIn()
          Returns true if a user is currently logged in in this session.
 nu.dll.lyskom.Mark[] getMarks()
          Returns an array of Mark objects with all text-marks for this user.
 nu.dll.lyskom.Membership[] getMembership(int persNo)
          Returns an array of Membership objects for a given person, representing the persons full membership list.
 nu.dll.lyskom.Membership[] getMembership(int persNo, int first, int no, nu.dll.lyskom.Bitstring mask)
          Returns an array of Membership objects representing the membership information for a given person.
 java.util.List getMembershipList(int persNo, int first, int no, nu.dll.lyskom.Bitstring mask)
          Returns a List of Membership objects representing the membership information for a given person.
 java.util.List getMyMembershipList()
          Equal to getMembershipList(myPerson.getNo(), 0, myPerson.noOfConfs+1, new Bitstring("0"))
 nu.dll.lyskom.Person getMyPerson()
          Returns the Person object of the currently registered user.
 nu.dll.lyskom.Person getPersonStat(int persNo)
          Returns a Person object containing information about a given person.
 nu.dll.lyskom.Person getPersonStat(int persNo, boolean refreshCache)
          Returns a Person object containing information about a given person.
 int getPort()
           
 nu.dll.lyskom.ReadTextsMap getReadTexts()
          Returns a ReadTextsMap object.
 java.lang.String getServer()
           
 java.lang.String getServerEncoding()
           
 int getState()
          Returns the state of this connection.
 nu.dll.lyskom.SessionInfo getStaticSessionInfo(int sessionNo)
          Returns static session information for a given session number.
 nu.dll.lyskom.Text getText(int textNo)
          Returns a Text object corresponding to the specified global text number.
 nu.dll.lyskom.Text getText(int textNo, boolean refreshCache)
          Returns a Text object corresponding to the specified global text number.
 nu.dll.lyskom.TextStat getTextStat(int textNo)
          Returns a TextStat object containing information about a given text.
 nu.dll.lyskom.TextStat getTextStat(int textNo, boolean refreshCache)
          Returns a TextStat object for a given text number, or null if the text doesn't exist or is inaccessible.
 nu.dll.lyskom.HollerithStream getTextStream(int textNo, int startChar, int endChar)
          Returns a text's contents as a HollerithStream.
 nu.dll.lyskom.KomTime getTime()
           
 nu.dll.lyskom.UConference getUConfStat(int confNo)
          Returns an UConference object containing information about a specific conference.
 nu.dll.lyskom.UConference getUConfStat(int confNo, boolean refreshCache)
          Returns an UConference object containing information about a specific conference.
 int[] getUnreadConfs(int persNo)
          Returns an int array containing all conferences which may contain unread texts.
 java.util.List getUnreadConfsList(int persNo)
          Returns a List containing all conferences which may contain unread texts.
 java.util.List getUnreadConfsListCached()
          Testing, testning.
 int getUnreadCount(int confNo)
          Returns the highest possible number of unreads for a specific conference.
 nu.dll.lyskom.Membership[] getUnreadMembership()
          Returns an array of Membership objects, representing the conferences in which the currently logged in person might have unread texts.
 nu.dll.lyskom.TextMapping[] getUnreadTexts()
          return array of unread texts (in TextMapping for) for all conferences.
 boolean isMemberOf(int confNo)
          Returns true if the current user is a member of confNo, otherwise false.
 void joinConference(int confNo)
          Adds a conference with priority 100 at the last position of the currently logged in person's membership list.
 nu.dll.lyskom.TextMapping localToGlobal(int confNo, int firstLocalNo, int noOfExistingTexts)
          Returns a TextMapping that can be used to convert local text number in a conference to global text numbers.
 boolean login(int id, java.lang.String password, boolean hidden)
           
 boolean login(int id, java.lang.String password, boolean hidden, boolean getMembership)
          Logs on to the LysKOM server.
 void logout(boolean block)
          Logs out the currently logged in user.
 nu.dll.lyskom.ConfInfo[] lookupName(java.lang.String name, boolean wantPersons, boolean wantConfs)
          Lookup names of persons/conferences.
 void markAsRead(int textNo)
          Marks the text as read in all recipient conferences which the user is a member of.
 void markAsRead(int confNo, int[] localTextNo)
          Marks a text as read on the LysKOM server.
 void markText(int textNo, int markType)
          Place a personal mark on a LysKOM text.
 void modifyAuxInfo(boolean isConf, int objNo, int[] delAuxNo, nu.dll.lyskom.AuxItem[] addAux)
          Modifies Aux-Info for a conference or a text.
 int nextUnreadConference(boolean change)
          Returns the conference number of the next conference that _may_ contain an unread text, or -1 if no unread conference is found.
 int nextUnreadText(boolean updateUnread)
          Same as nextUnreadText(session.getCurrentConference(), updateUnread).
 int nextUnreadText(int conference, boolean updateUnread)
          Returns the global text number of the next unread text in the current conference.
 void purgeTextCache(int textNo)
          Removes any evidence of the given text in the caches (Text cache and Text-Stat cache)
 nu.dll.lyskom.Membership queryReadTexts(int persNo, int confNo)
          Returns a Membership object containing information about read/unread texts for a given person in a given conference.
 nu.dll.lyskom.Membership queryReadTexts(int persNo, int confNo, boolean refresh)
          Returns a Membership object containing information about read/unread texts for a given person in a given conference.
 nu.dll.lyskom.Membership queryReadTextsCached(int confNo)
           
 nu.dll.lyskom.ConfInfo[] reLookup(java.lang.String regexp, boolean wantPersons, boolean wantConfs)
           
 void removeAsynchMessageReceiver(nu.dll.lyskom.AsynchMessageReceiver a)
          Removes an AsyncMessageReceiver.
 void removeRpcEventListener(nu.dll.lyskom.RpcEventListener l)
          Removes an RPC reply listener.
 int reply(int textNo, nu.dll.lyskom.Text t)
          Very simple reply function.
 void rpcEvent(nu.dll.lyskom.RpcEvent e)
          Receiver of RPC events.
 void rpcReply(nu.dll.lyskom.RpcReply r)
          Receiver of RPC replies.
 boolean sendMessage(int recipient, java.lang.String message)
          Sends an asynchronous message with the send-message call.
 boolean sendMessage(int recipient, java.lang.String message, boolean block)
          Sends an asynchronous message with the send-message call.
 void setClientHost(java.lang.String s)
          Sets the client host name that is reported during the initial connection handshake with the LysKOM server.
 void setClientUser(java.lang.String s)
          Sets the client user name that is reportedduring the intial handshake.
 void setClientVersion(java.lang.String clientName, java.lang.String clientVersion)
          Reports the name and version of this client to the server.
 void setLastRead(int confNo, int textNo)
          Sets the highest local text number that has been read in a given conference.
 void setLatteVersion(java.lang.String clientName, java.lang.String clientVersion)
          Sets client name and version, prepending the supplied strings with a slash and the name and version of the LatteKOM library, respectively.
 void setPresentation(int confNo, int textNo)
          Sets the text number that contains a conference's or a person's presentation.
 void shutdown()
          Forcibly logout, disconnect, and finish all threads
 void subMember(int confNo, int persNo)
          Removes the person persNo from conference confNo.
 byte[] toByteArray(java.lang.String s)
           
 java.lang.String toString(byte[] buf)
           
 void unmarkText(int textNo)
          Unmarks a text.
 void updateUnreads()
          Updates the unreadMembership array with Membership objects for conferences that _may_ contain unreads.
 nu.dll.lyskom.RpcReply waitFor(int id)
          This methods provides a synchronous way of waiting for RPC replies.
 nu.dll.lyskom.RpcReply waitFor(nu.dll.lyskom.RpcCall r)
          Convenience wrapper for waitFor(int).
 int whoAmI()
           
 nu.dll.lyskom.DynamicSessionInfo[] whoIsOnDynamic(boolean wantVisible, boolean wantInvisible, int activeLast)
          Returns an array of DynamicSessionInfo objects containing information about online sessions
 void writeRaw(int id, java.lang.String s)
          Writes a raw (custom) RPC call to the server.
 nu.dll.lyskom.RpcCall writeRpcCall(nu.dll.lyskom.RpcCall c)
          Writes an RPC call constructed from an RpcCall object to the network output stream and add it to the RPC call storage.
 nu.dll.lyskom.RpcCall writeRpcCall(nu.dll.lyskom.RpcCall c, boolean store)
          Writes an RPC call constructed from an RpcCall object to the network output stream.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

rpcTimeout

public static int rpcTimeout
Time-out used by the waitFor() method in milliseconds. Can be set (in seconds) through the system property "lyskom.rpc-timeout". Default is 30 seconds.


rpcSoftTimeout

public static int rpcSoftTimeout
This is the "soft" timeout, in milliseconds. If larger than zero, the waitFor() call will only block for this long, and then check if a reply has been received even if the receiver thread hasn't notified yet. If none found, it will repeat the process until a reply is found or rpcTimeout has been reached.
Default is zero, i.e., no soft timeout will be used, and the waitFor() method will block until it is notified by the receiving thread. It can be set (in seconds) by the system property "lyskom.rpc-soft-timeout".


defaultServerEncoding

public static java.lang.String defaultServerEncoding
The encoding used by the LysKOM server. All conversions from bytes to String (and vice versa) in server I/O should respect this setting. It can be changed by setting the system property "lyskom.encoding". Default is "iso-8859-1".


defaultEnabledBigText

public static boolean defaultEnabledBigText

defaultBigTextLimit

public static int defaultBigTextLimit

defaultBigTextHead

public static int defaultBigTextHead

STATE_DISCONNECTED

public static final int STATE_DISCONNECTED
Not connected to a LysKOM server

See Also:
Constant Field Values

STATE_CONNECTED

public static final int STATE_CONNECTED
Connected to a LysKOM server, but not logged in. In this state only a few calls can be made to the server (lookupName(), login(), create(), etc.)

See Also:
Constant Field Values

STATE_LOGIN

public static final int STATE_LOGIN
Connected, and logged in as a specific user

See Also:
Constant Field Values
Constructor Detail

Session

public Session()
Method Detail

purgeTextCache

public void purgeTextCache(int textNo)
Removes any evidence of the given text in the caches (Text cache and Text-Stat cache)


setClientHost

public void setClientHost(java.lang.String s)
Sets the client host name that is reported during the initial connection handshake with the LysKOM server. This method must be called before connect().

See Also:
connect(String, int)

setClientUser

public void setClientUser(java.lang.String s)
Sets the client user name that is reportedduring the intial handshake. Must be called before connect().


addRpcEventListener

public void addRpcEventListener(nu.dll.lyskom.RpcEventListener l)
Adds RPC reply listeners. These will be called through the RpcEventListener (rpcEvent()) interface when RPC replies are received.

See Also:
RpcEventListener, RpcEvent

removeRpcEventListener

public void removeRpcEventListener(nu.dll.lyskom.RpcEventListener l)
Removes an RPC reply listener.


doDisconnect

public nu.dll.lyskom.RpcCall doDisconnect(int sessionNo,
                                          boolean discardReply)
                                   throws java.io.IOException
java.io.IOException

disconnect

public void disconnect(int sessionNo)
                throws java.io.IOException,
                       RpcFailure
java.io.IOException
RpcFailure

disconnect

public void disconnect(boolean force)
                throws java.io.IOException
Disconnects from the server

Parameters:
force - This parameter has no effect (currently)
java.io.IOException

finalize

public void finalize()
Overrides:
finalize in class java.lang.Object

connect

public boolean connect(java.lang.String server,
                       int port)
                throws java.io.IOException,
                       java.net.ProtocolException
Connect to specified server/port number and do initial handshake

Parameters:
server - The host name of the server
port - Port number to use (normally 4894)
Returns:
true if the connection was successful
java.io.IOException
java.net.ProtocolException
See Also:
connect(String)

toString

public java.lang.String toString(byte[] buf)
                          throws java.io.UnsupportedEncodingException
java.io.UnsupportedEncodingException

toByteArray

public byte[] toByteArray(java.lang.String s)
                   throws java.io.UnsupportedEncodingException
java.io.UnsupportedEncodingException

getServerEncoding

public java.lang.String getServerEncoding()

getServer

public java.lang.String getServer()

getPort

public int getPort()

connect

public boolean connect(java.lang.String server)
                throws java.io.IOException,
                       java.net.ProtocolException
Connect to specified server on the default port (4894) and do initial handshake

Parameters:
server - The host name of the server
Returns:
true if the connection was successful
java.io.IOException
java.net.ProtocolException
See Also:
connect(String, int)

addAsynchMessageReceiver

public void addAsynchMessageReceiver(nu.dll.lyskom.AsynchMessageReceiver a)
Adds a listener for asynchronous messages. At the moment, registered receivers must return quickly, and specifically, may not call the waitFor() method. Must not be called before connect()

See Also:
AsynchMessageReceiver

removeAsynchMessageReceiver

public void removeAsynchMessageReceiver(nu.dll.lyskom.AsynchMessageReceiver a)
Removes an AsyncMessageReceiver.

See Also:
addAsynchMessageReceiver(AsynchMessageReceiver)

getConnected

public boolean getConnected()
Return true if connected to a LysKOM server.


getGlobalUnreadInConf

public int[] getGlobalUnreadInConf(int conf)
                            throws java.io.IOException
Deprecated. Follow the standard LysKOM convention to get unreads or use nextUnreadText()/nextUnreadConference()

Supposed to return an array of global text number for all unreads in a conference. Generally not a good idea.

java.io.IOException
See Also:
nextUnreadText(boolean)

login

public boolean login(int id,
                     java.lang.String password,
                     boolean hidden)
              throws java.io.IOException
java.io.IOException

login

public boolean login(int id,
                     java.lang.String password,
                     boolean hidden,
                     boolean getMembership)
              throws java.io.IOException
Logs on to the LysKOM server. LysKOM call: login

Parameters:
id - ID number of the person to log in as
password - corresponding password
hidden - if true, session will not be broadcasted on LysKOM
java.io.IOException

getMyPerson

public nu.dll.lyskom.Person getMyPerson()
Returns the Person object of the currently registered user.


getUnreadConfsListCached

public java.util.List getUnreadConfsListCached()
Testing, testning.


queryReadTextsCached

public nu.dll.lyskom.Membership queryReadTextsCached(int confNo)

updateUnreads

public void updateUnreads()
                   throws java.io.IOException
Updates the unreadMembership array with Membership objects for conferences that _may_ contain unreads.

java.io.IOException

markAsRead

public void markAsRead(int textNo)
                throws java.io.IOException,
                       RpcFailure
Marks the text as read in all recipient conferences which the user is a member of.

java.io.IOException
RpcFailure

getCurrentConference

public int getCurrentConference()
Returns the current conference (as entered by changeConference())


nextUnreadConference

public int nextUnreadConference(boolean change)
                         throws java.io.IOException
Returns the conference number of the next conference that _may_ contain an unread text, or -1 if no unread conference is found.

Parameters:
change - if true, this method also calls changeConference()
java.io.IOException

nextUnreadText

public int nextUnreadText(int conference,
                          boolean updateUnread)
                   throws java.io.IOException
Returns the global text number of the next unread text in the current conference. Returns -1 if there are no unread texts. Implementation note: still inefficient.

Parameters:
updateUnread - if true, also marks the returned text as read
java.io.IOException
See Also:
nextUnreadText(boolean)

nextUnreadText

public int nextUnreadText(boolean updateUnread)
                   throws java.io.IOException
Same as nextUnreadText(session.getCurrentConference(), updateUnread).

Parameters:
updateUnread - if true, marks the returned text as unread
java.io.IOException
See Also:
nextUnreadText(int, boolean)

isMemberOf

public boolean isMemberOf(int confNo)
Returns true if the current user is a member of confNo, otherwise false.

Parameters:
confNo - Conference number

getUnreadCount

public int getUnreadCount(int confNo)
                   throws java.io.IOException
Returns the highest possible number of unreads for a specific conference.

Parameters:
confNo - Conference number
java.io.IOException

getReadTexts

public nu.dll.lyskom.ReadTextsMap getReadTexts()
Returns a ReadTextsMap object. The ReadTextsMap is a set containing all texts read during this session.


markAsRead

public void markAsRead(int confNo,
                       int[] localTextNo)
                throws java.io.IOException
Marks a text as read on the LysKOM server. Note that the text number is local.

Parameters:
confNo - conference number
localTextNo - local text number LysKOM call: mark-as-read
java.io.IOException

getClientVersion

public byte[] getClientVersion(int sessionNo)
                        throws java.io.IOException,
                               RpcFailure
Returns the client version (as a byte array) for a given session. Returns a zero length array of the client has no version string set.

Parameters:
sessionNo - The session for which to retreive the client version.
java.io.IOException
RpcFailure
See Also:
getClientName(int)

doGetClientVersion

public nu.dll.lyskom.RpcCall doGetClientVersion(int sessionNo)
                                         throws java.io.IOException
Sends the RPC call get-client-version to the server.

Parameters:
sessionNo - The session for which to retreive the client version.
java.io.IOException
See Also:
getClientVersion(int)

getClientName

public byte[] getClientName(int sessionNo)
                     throws java.io.IOException,
                            RpcFailure
Returns the client name (as a byte array) for a given session. Returns a zero length array of the client has no name string set.

Parameters:
sessionNo - The session for which to retreive the client name.
java.io.IOException
RpcFailure
See Also:
getClientVersion(int)

doGetClientName

public nu.dll.lyskom.RpcCall doGetClientName(int sessionNo)
                                      throws java.io.IOException
Sends the RPC call get-client-name to the server.

Parameters:
sessionNo - The session for which to retreive the client name.
java.io.IOException
See Also:
getClientName(int)

getInfo

public java.util.Map getInfo()
                      throws java.io.IOException,
                             RpcFailure
java.io.IOException
RpcFailure

doGetInfo

public nu.dll.lyskom.RpcCall doGetInfo()
                                throws java.io.IOException
java.io.IOException

getStaticSessionInfo

public nu.dll.lyskom.SessionInfo getStaticSessionInfo(int sessionNo)
                                               throws java.io.IOException,
                                                      RpcFailure
Returns static session information for a given session number. This is guaranteed by the LysKOM protocol to never change for a session number during a server's life time.

Parameters:
sessionNo - The session for which to retreive information
Returns:
A SessionInfo object containing static session information
java.io.IOException
RpcFailure
See Also:
SessionInfo

doGetStaticSessionInfo

public nu.dll.lyskom.RpcCall doGetStaticSessionInfo(int sessionNo)
                                             throws java.io.IOException
Sends the RPC call get-static-session-info to the server.

Parameters:
sessionNo - The session for which to retreive information
Returns:
An RpcCall object representing this specific RPC call
java.io.IOException

setLatteVersion

public void setLatteVersion(java.lang.String clientName,
                            java.lang.String clientVersion)
                     throws java.io.IOException,
                            RpcFailure
Sets client name and version, prepending the supplied strings with a slash and the name and version of the LatteKOM library, respectively. The resulting name and version would then be something like "LatteKOM/Swing", "0.1/0.9"

Parameters:
clientName - The name of the LysKOM client
clientVersion - The version of the LysKOM client
java.io.IOException
RpcFailure
See Also:
setClientVersion(String, String)

setClientVersion

public void setClientVersion(java.lang.String clientName,
                             java.lang.String clientVersion)
                      throws java.io.IOException,
                             RpcFailure
Reports the name and version of this client to the server. These can be retreived by other clients by the calls get-client-name and get-client-version. I recommend using the setLatteVersion(String, String) method instead, to also report name and version of the LatteKOM library.

Parameters:
clientName - The name of the LysKOM client
clientVersion - The version of the LysKOM client
java.io.IOException
RpcFailure
See Also:
setLatteVersion(String, String)

doSetClientVersion

public nu.dll.lyskom.RpcCall doSetClientVersion(java.lang.String clientName,
                                                java.lang.String clientVersion)
                                         throws java.io.IOException
Sends the RPC call set-client-version to the server.

Parameters:
clientName - The name of the LysKOM client
clientVersion - The version of the LysKOM client
Returns:
An RpcCall object representing this specific RPC call
java.io.IOException

doMarkAsRead

public nu.dll.lyskom.RpcCall doMarkAsRead(int confNo,
                                          int[] localTextNo)
                                   throws java.io.IOException
Sends the RPC call mark-as-read to the server.

Parameters:
confNo - the conference in which to mark texts as read
localTextNo - an int array containing the local text numbers to mark as read
Returns:
An RpcCall object representing this specific RPC call
java.io.IOException

doGetTime

public nu.dll.lyskom.RpcCall doGetTime()
                                throws java.io.IOException
java.io.IOException

getTime

public nu.dll.lyskom.KomTime getTime()
                              throws java.io.IOException
java.io.IOException

getText

public nu.dll.lyskom.Text getText(int textNo)
                           throws java.io.IOException,
                                  RpcFailure
Returns a Text object corresponding to the specified global text number. If a cached copy of the text exists, it will be returned instead.

Parameters:
textNo - Global text number
java.io.IOException
RpcFailure
See Also:
getText(int, boolean)

getText

public nu.dll.lyskom.Text getText(int textNo,
                                  boolean refreshCache)
                           throws java.io.IOException,
                                  RpcFailure
Returns a Text object corresponding to the specified global text number.

Parameters:
textNo - Global text number
refreshCache - If true, this call will never return a cached copy of a text.
java.io.IOException
RpcFailure
See Also:
getText(int)

getTextStream

public nu.dll.lyskom.HollerithStream getTextStream(int textNo,
                                                   int startChar,
                                                   int endChar)
                                            throws java.io.IOException,
                                                   RpcFailure
Returns a text's contents as a HollerithStream.

java.io.IOException
RpcFailure
See Also:
HollerithStream

doMarkText

public nu.dll.lyskom.RpcCall doMarkText(int textNo,
                                        int markType)
                                 throws java.io.IOException
Sends the RPC call mark-text to the server.

Parameters:
textNo - the text number to mark
markType - the type of mark to set
Returns:
An RpcCall object representing this specific RPC call
java.io.IOException

markText

public void markText(int textNo,
                     int markType)
              throws java.io.IOException,
                     RpcFailure
Place a personal mark on a LysKOM text. Blocks until the server has replied.

Parameters:
textNo - the text number to mark
markType - the type of mark to set
java.io.IOException
RpcFailure

doUnmarkText

public nu.dll.lyskom.RpcCall doUnmarkText(int textNo)
                                   throws java.io.IOException
Sends the RPC call mark-text to the server.

Parameters:
textNo - the text number to unmark
Returns:
An RpcCall object representing this specific RPC call
java.io.IOException

unmarkText

public void unmarkText(int textNo)
                throws java.io.IOException,
                       RpcFailure
Unmarks a text.

Parameters:
textNo - the text number to unmark
java.io.IOException
RpcFailure

doGetMarks

public nu.dll.lyskom.RpcCall doGetMarks()
                                 throws java.io.IOException,
                                        RpcFailure
Sends the RPC call get-marks to the server.

Returns:
An RpcCall object representing this specific RPC call
java.io.IOException
RpcFailure

getMarks

public nu.dll.lyskom.Mark[] getMarks()
                              throws java.io.IOException,
                                     RpcFailure
Returns an array of Mark objects with all text-marks for this user.

java.io.IOException
RpcFailure

doLocalToGlobal

public nu.dll.lyskom.RpcCall doLocalToGlobal(int confNo,
                                             int firstLocalNo,
                                             int noOfExistingTexts)
                                      throws java.io.IOException
Sends the RPC call local-to-global to the server.

Parameters:
confNo - The conference number in which to map text numbers
firstLocalNo - The first local number to map
noOfExistingTexts - The maximum number of texts that the returned mappnig should contain
Returns:
An RpcCall object representing this specific RPC call
java.io.IOException

localToGlobal

public nu.dll.lyskom.TextMapping localToGlobal(int confNo,
                                               int firstLocalNo,
                                               int noOfExistingTexts)
                                        throws java.io.IOException,
                                               RpcFailure
Returns a TextMapping that can be used to convert local text number in a conference to global text numbers. See the "local-to-global" RPC call and the "Text-Mapping" data structure in the LysKOM specification for more information. LysKOM call: local-to-global, but without the limitation that noOfExistingTexts must be between 1-255 inclusive

Parameters:
confNo - The conference number in which to map text numbers
firstLocalNo - The first local number to map
noOfExistingTexts - The maximum number of texts that the returned mappnig should contain
java.io.IOException
RpcFailure
See Also:
doLocalToGlobal(int, int, int)

doQueryReadTexts

public nu.dll.lyskom.RpcCall doQueryReadTexts(int persNo,
                                              int confNo)
                                       throws java.io.IOException
Sends the RPC call query-read-texts to the server.

Parameters:
persNo - The person number for which to query information
confNo - The conference number in which to query information about read texts
Returns:
An RpcCall object representing this specific RPC call
java.io.IOException

queryReadTexts

public nu.dll.lyskom.Membership queryReadTexts(int persNo,
                                               int confNo)
                                        throws java.io.IOException
Returns a Membership object containing information about read/unread texts for a given person in a given conference.

Parameters:
persNo - The person number for which to query information
confNo - The conference number in which to query information about read texts
java.io.IOException
See Also:
Membership, queryReadTexts(int, int, boolean)

queryReadTexts

public nu.dll.lyskom.Membership queryReadTexts(int persNo,
                                               int confNo,
                                               boolean refresh)
                                        throws java.io.IOException
Returns a Membership object containing information about read/unread texts for a given person in a given conference.

Parameters:
persNo - The person number for which to query information
confNo - The conference number in which to query information about read texts
refresh - If true, the membership cache will be refreshed
java.io.IOException
See Also:
Membership, queryReadTexts(int, int, boolean)

doGetUnreadConfs

public nu.dll.lyskom.RpcCall doGetUnreadConfs(int persNo)
                                       throws java.io.IOException
Sends the RPC call get-unread-confs to the server.

Parameters:
persNo - The person number for which to query information
Returns:
An RpcCall object representing this specific RPC call
java.io.IOException
See Also:
getUnreadConfsList(int), getUnreadConfs(int)

getUnreadConfsList

public java.util.List getUnreadConfsList(int persNo)
                                  throws java.io.IOException
Returns a List containing all conferences which may contain unread texts.

Parameters:
persNo - The person number for which to query information
java.io.IOException
See Also:
getUnreadConfs(int)

getUnreadConfs

public int[] getUnreadConfs(int persNo)
                     throws java.io.IOException
Returns an int array containing all conferences which may contain unread texts.

Parameters:
persNo - The person number for which to query information
java.io.IOException
See Also:
getUnreadConfsList(int)

doGetMembership

public nu.dll.lyskom.RpcCall doGetMembership(int persNo,
                                             int first,
                                             int no,
                                             nu.dll.lyskom.Bitstring mask)
                                      throws java.io.IOException
Sends the RPC call get-membership to the server.

Parameters:
persNo - The person number for which to query information
first - The first membership position in list to retreive
no - The number of conferences to retreive
mask - If the first bit is set, the server will not return a read-texts array with the membership information
Returns:
An RpcCall object representing this specific RPC call
java.io.IOException

doGetMembership

public nu.dll.lyskom.RpcCall doGetMembership(int persNo)
                                      throws java.io.IOException
Equal to doGetMembership(persNo, 0, 1000, new Bitstring("0")).

java.io.IOException
See Also:
doGetMembership(int, int, int, Bitstring)

getMyMembershipList

public java.util.List getMyMembershipList()
                                   throws java.io.IOException
Equal to getMembershipList(myPerson.getNo(), 0, myPerson.noOfConfs+1, new Bitstring("0"))

java.io.IOException
See Also:
getMembershipList(int, int, int, Bitstring)

getMembershipList

public java.util.List getMembershipList(int persNo,
                                        int first,
                                        int no,
                                        nu.dll.lyskom.Bitstring mask)
                                 throws java.io.IOException
Returns a List of Membership objects representing the membership information for a given person.

Parameters:
persNo - The person number for which to query information
first - The first membership position in list to retreive
no - The number of conferences to retreive
mask - If the first bit is set, the server will not return a read-texts array with the membership information
java.io.IOException

getMembership

public nu.dll.lyskom.Membership[] getMembership(int persNo,
                                                int first,
                                                int no,
                                                nu.dll.lyskom.Bitstring mask)
                                         throws java.io.IOException
Returns an array of Membership objects representing the membership information for a given person.

Parameters:
persNo - The person number for which to query information
first - The first membership position in list to retreive
no - The number of conferences to retreive
mask - If the first bit is set, the server will not return a read-texts array with the membership information
java.io.IOException

doCreatePerson

public nu.dll.lyskom.RpcCall doCreatePerson(java.lang.String name,
                                            java.lang.String password,
                                            nu.dll.lyskom.Bitstring flags,
                                            nu.dll.lyskom.AuxItem[] auxItems)
                                     throws java.io.IOException
Sends the RPC call create-person to the server.

Parameters:
name - The requested name of the person
password - The requested password for this new person
flags - A Bitstring of flags
auxItems - an array of AuxItem objects that should be set for this person
Returns:
An RpcCall object representing this specific RPC call
java.io.IOException
See Also:
createPerson(String, String, Bitstring, AuxItem[])

createPerson

public int createPerson(java.lang.String name,
                        java.lang.String password,
                        nu.dll.lyskom.Bitstring flags,
                        nu.dll.lyskom.AuxItem[] auxItems)
                 throws java.io.IOException,
                        RpcFailure
Asks the server to create a new person.

Parameters:
name - The requested name of the person
password - The requested password for this new person
flags - A Bitstring of flags
auxItems - an array of AuxItem objects that should be set for this person
Returns:
The number of the newly created person
java.io.IOException
RpcFailure
See Also:
createPerson(String, String, Bitstring, AuxItem[])

doCreateConf

public nu.dll.lyskom.RpcCall doCreateConf(java.lang.String name,
                                          nu.dll.lyskom.Bitstring type,
                                          nu.dll.lyskom.AuxItem[] auxItems)
                                   throws java.io.IOException
Sends the RPC call create-conf to the server.

Parameters:
name - The requested name of the confernece
auxItems - an array of AuxItem objects that should be set for this conference
Returns:
An RpcCall object representing this specific RPC call
java.io.IOException
See Also:
createConf(String, boolean, boolean, boolean)

createConf

public int createConf(java.lang.String name,
                      boolean readProt,
                      boolean original,
                      boolean secret)
               throws java.io.IOException
Ask the server to create a new conference

Parameters:
name - The requested name of the conference
readProt - if true, the new conference should be read protected
original - if true, the new conference should not allow comments
secret - if true, the new conference should be secret
Returns:
The number of the newly created conference
java.io.IOException

getMembership

public nu.dll.lyskom.Membership[] getMembership(int persNo)
                                         throws java.io.IOException
Returns an array of Membership objects for a given person, representing the persons full membership list.

Parameters:
persNo - The person for which to request membership information
java.io.IOException
See Also:
doGetMembership(int)

getUnreadMembership

public nu.dll.lyskom.Membership[] getUnreadMembership()
Returns an array of Membership objects, representing the conferences in which the currently logged in person might have unread texts.


getUnreadTexts

public nu.dll.lyskom.TextMapping[] getUnreadTexts()
return array of unread texts (in TextMapping for) for all conferences. You should call updateUnreads before this.


doGetUConfStat

public nu.dll.lyskom.RpcCall doGetUConfStat(int confNo)
                                     throws java.io.IOException
Sends the RPC call get-uconf-stat to the server.

Parameters:
confNo - The conference to request information about
Returns:
An RpcCall object representing this specific RPC call
java.io.IOException
See Also:
getUConfStat(int)

getUConfStat

public nu.dll.lyskom.UConference getUConfStat(int confNo,
                                              boolean refreshCache)
                                       throws java.io.IOException,
                                              RpcFailure
Returns an UConference object containing information about a specific conference.

Parameters:
confNo - The conference to request information about
refreshCache - if true, don't look in the cache
java.io.IOException
RpcFailure
See Also:
UConference

getUConfStat

public nu.dll.lyskom.UConference getUConfStat(int confNo)
                                       throws java.io.IOException,
                                              RpcFailure
Returns an UConference object containing information about a specific conference. Returns a cached copy if possible.

Parameters:
confNo - The conference to request information about
java.io.IOException
RpcFailure
See Also:
UConference

endast

public void endast(int no)
            throws java.io.IOException,
                   RpcFailure
Sets the maximum number of unread texts in the current conference. Note that this call will fail if the user is not currently in a conference.

Parameters:
no - The number of unread texts to request
java.io.IOException
RpcFailure
See Also:
endast(int, int)

endast

public void endast(int confNo,
                   int no)
            throws java.io.IOException,
                   RpcFailure
Sets the maximum number of unread texts in a conference.

Parameters:
confNo - The conference in which to set the number of unread texts
no - The number of unread texts to request
java.io.IOException
RpcFailure
See Also:
endast(int)

doSetLastRead

public nu.dll.lyskom.RpcCall doSetLastRead(int confNo,
                                           int textNo)
                                    throws java.io.IOException
Sends the RPC call set-last-read to the server.

Parameters:
confNo - The conference to set last-read information in
textNo - the text number to be the highest read text
Returns:
An RpcCall object representing this specific RPC call
java.io.IOException
See Also:
endast(int, int)

setLastRead

public void setLastRead(int confNo,
                        int textNo)
                 throws java.io.IOException
Sets the highest local text number that has been read in a given conference.

Parameters:
confNo - The conference to set last-read information in
textNo - the text number to be the highest read text
java.io.IOException
See Also:
endast(int, int)

doGetConfStat

public nu.dll.lyskom.RpcCall doGetConfStat(int confNo)
                                    throws java.io.IOException
Sends the RPC call get-conf-stat to the server.

Parameters:
confNo - The conference to retreive conf-stat information about
Returns:
An RpcCall object representing this specific RPC call
java.io.IOException

getConfStat

public nu.dll.lyskom.Conference getConfStat(int confNo)
                                     throws java.io.IOException,
                                            RpcFailure
Returns a Conference object containing information about a given conference. If the information has been cached previously, a cached copy will be returned.

Parameters:
confNo - The confernece to retreive information about
java.io.IOException
RpcFailure
See Also:
Session

getConfStat

public nu.dll.lyskom.Conference getConfStat(int confNo,
                                            boolean refreshCache)
                                     throws java.io.IOException,
                                            RpcFailure
Returns a Conference object containing information about a given conference.

Parameters:
confNo - The confernece to retreive information about
refreshCache - If true, don't go look into the cache before asking server
java.io.IOException
RpcFailure
See Also:
Session

changeConference

public void changeConference(int confNo)
                      throws java.io.IOException,
                             RpcFailure
Changes the user's current conference.

Parameters:
confNo - The conference to change to
java.io.IOException
RpcFailure

doChangeConference

public nu.dll.lyskom.RpcCall doChangeConference(int confNo)
                                         throws java.io.IOException
Sends the RPC call change-conference to the server.

Parameters:
confNo - The conference to change to
Returns:
An RpcCall object representing this specific RPC call
java.io.IOException

doSubMember

public nu.dll.lyskom.RpcCall doSubMember(int confNo,
                                         int persNo)
                                  throws java.io.IOException
Sends the RPC call sub-member to the server.

Parameters:
confNo - The conference to remove a member from
persNo - The person to be removed from a converence
Returns:
An RpcCall object representing this specific RPC call
java.io.IOException

subMember

public void subMember(int confNo,
                      int persNo)
               throws RpcFailure,
                      java.io.IOException
Removes the person persNo from conference confNo. Only the supervisor of confNo or persNo can do this. Also sets the current conference to be -1 if the call succeeds.

Parameters:
confNo - The conference to remove a member from
persNo - The person to be removed from a converence
RpcFailure
java.io.IOException

doAddMember

public nu.dll.lyskom.RpcCall doAddMember(int confNo,
                                         int persNo,
                                         int prio,
                                         int listPos,
                                         nu.dll.lyskom.Bitstring type)
                                  throws java.io.IOException
Sends the RPC call add-member to the server.

Parameters:
confNo - The conference to add to the membership list
persNo - The person who's membership list will be updated
prio - The priority of the membership
listPos - The position of this conference in the membership list
type - A Bitstring containing the membership type information
Returns:
An RpcCall object representing this specific RPC call
java.io.IOException

addMember

public void addMember(int confNo,
                      int persNo,
                      int prio,
                      int listPos,
                      boolean invitation,
                      boolean passive,
                      boolean secret)
               throws java.io.IOException,
                      RpcFailure
Adds a conference to a person's membership.

Parameters:
confNo - The conference to add to the membership list
persNo - The person who's membership list will be updated
prio - The priority of the membership
listPos - The position of this conference in the membership list
passive - If true, this membership is passive
secret - If true, this membership is secret
java.io.IOException
RpcFailure
See Also:
joinConference(int)

doChangeName

public nu.dll.lyskom.RpcCall doChangeName(int confNo,
                                          java.lang.String newName)
                                   throws java.io.IOException
Sends the RPC call change-name to the server.

Parameters:
confNo - The conference (or letterbox/person) to change the name of
newName - The new name of the conference
Returns:
An RpcCall object representing this specific RPC call
java.io.IOException

changeName

public void changeName(int confNo,
                       java.lang.String newName)
                throws java.io.IOException,
                       RpcFailure
Changes the name of a conference or a person.

Parameters:
confNo - The conference (or letterbox/person) to change the name of
newName - The new name of the conference
java.io.IOException
RpcFailure

setPresentation

public void setPresentation(int confNo,
                            int textNo)
                     throws java.io.IOException,
                            RpcFailure
Sets the text number that contains a conference's or a person's presentation.

Parameters:
confNo - The conference for which to set the presentation
textNo - The global text number containing the presentation
java.io.IOException
RpcFailure

doSetPresentation

public nu.dll.lyskom.RpcCall doSetPresentation(int confNo,
                                               int textNo)
                                        throws java.io.IOException
Sends the RPC call set-presentation to the server.

Parameters:
confNo - The conference for which to set the presentation
textNo - The global text number containing the presentation
Returns:
An RpcCall object representing this specific RPC call
java.io.IOException

joinConference

public void joinConference(int confNo)
                    throws java.io.IOException,
                           RpcFailure
Adds a conference with priority 100 at the last position of the currently logged in person's membership list.

Parameters:
confNo - The conference to join
java.io.IOException
RpcFailure
See Also:
addMember(int, int, int, int, boolean, boolean, boolean)

doGetPersonStat

public nu.dll.lyskom.RpcCall doGetPersonStat(int persNo)
                                      throws java.io.IOException
Sends the RPC call get-person-stat to the server.

Parameters:
persNo - The person to request information about
Returns:
An RpcCall object representing this specific RPC call
java.io.IOException

getPersonStat

public nu.dll.lyskom.Person getPersonStat(int persNo)
                                   throws java.io.IOException,
                                          RpcFailure
Returns a Person object containing information about a given person.

Parameters:
persNo - The person to request information about
java.io.IOException
RpcFailure
See Also:
Person

getPersonStat

public nu.dll.lyskom.Person getPersonStat(int persNo,
                                          boolean refreshCache)
                                   throws java.io.IOException,
                                          RpcFailure
Returns a Person object containing information about a given person.

Parameters:
persNo - The person to request information about
refreshCache - If true don't look in the cache first.
java.io.IOException
RpcFailure
See Also:
Person

getConfName

public byte[] getConfName(int confNo)
                   throws java.io.IOException,
                          RpcFailure
Returns a byte-array containing the name for a conference, or null if the conference doesn't exist.

Parameters:
confNo - conference number to retreive the name for
java.io.IOException
RpcFailure

doGetTextStat

public nu.dll.lyskom.RpcCall doGetTextStat(int textNo)
                                    throws java.io.IOException
Sends the RPC call get-text-stat to the server.

Parameters:
textNo - The text number to request information about
Returns:
An RpcCall object representing this specific RPC call
java.io.IOException

getTextStat

public nu.dll.lyskom.TextStat getTextStat(int textNo)
                                   throws java.io.IOException
Returns a TextStat object containing information about a given text.

Parameters:
textNo - The text number to request information about
java.io.IOException
See Also:
TextStat

getTextStat

public nu.dll.lyskom.TextStat getTextStat(int textNo,
                                          boolean refreshCache)
                                   throws java.io.IOException,
                                          RpcFailure
Returns a TextStat object for a given text number, or null if the text doesn't exist or is inaccessible.

Parameters:
textNo - The text number to request information about
refreshCache - If true, a cached copy will not be returned
java.io.IOException
RpcFailure
See Also:
TextStat

doUserActive

public nu.dll.lyskom.RpcCall doUserActive()
                                   throws java.io.IOException
Sends the RPC call user-active to the server. This method does not store the RpcCall for user with a later call to waitFor(), since the call is always expected to succeed.

Returns:
An RpcCall object representing this specific RPC call
java.io.IOException

doWhoAmI

public nu.dll.lyskom.RpcCall doWhoAmI()
                               throws java.io.IOException
java.io.IOException

whoAmI

public int whoAmI()
           throws java.io.IOException,
                  RpcFailure
java.io.IOException
RpcFailure

getLoggedIn

public boolean getLoggedIn()
Returns true if a user is currently logged in in this session.


logout

public void logout(boolean block)
            throws java.io.IOException,
                   RpcFailure
Logs out the currently logged in user.

Parameters:
block - If true, this method block until the server has confirmed the call
java.io.IOException
RpcFailure

getState

public int getState()
Returns the state of this connection.


shutdown

public void shutdown()
Forcibly logout, disconnect, and finish all threads


writeRaw

public void writeRaw(int id,
                     java.lang.String s)
              throws java.io.IOException
Writes a raw (custom) RPC call to the server. The reference number will be selected by this method.

Parameters:
id - The protocol request number to send to the server
s - A String containing the parameters to this call
java.io.IOException

count

public int count()
Returns the next RPC reference number to use and increments the RPC reference counter.


doCreateText

public nu.dll.lyskom.RpcCall doCreateText(nu.dll.lyskom.Text t)
                                   throws java.io.IOException
Sends the RPC call create-text to the server.

Parameters:
t - A Text object containing the information needed to construct the RPC call
Returns:
An RpcCall object representing this specific RPC call
java.io.IOException
See Also:
Text

reply

public int reply(int textNo,
                 nu.dll.lyskom.Text t)
          throws java.io.IOException
Very simple reply function. Application developers are encouraged to use createText() instead.

java.io.IOException

doCreateText

public nu.dll.lyskom.RpcCall doCreateText(byte[] text,
                                          java.util.List miscInfo,
                                          nu.dll.lyskom.AuxItem[] auxItems)
                                   throws java.io.IOException
Sends the RPC call create-text to the server.

Parameters:
text - byte-array containing the article subject and text
miscInfo - List of Selections with Misc-Info stuff (recipients, etc)
auxItems - Auxiallry items (Aux-Item) attached to this article
Returns:
An RpcCall object representing this specific RPC call
java.io.IOException

createText

public int createText(nu.dll.lyskom.Text t)
               throws java.io.IOException
Creates a text on the server, then returns the number of the newly created text.

Parameters:
t - A Text object containing the information needed to create the text
Returns:
The number of the newly created text.
java.io.IOException
See Also:
Text

doModifyAuxInfo

public nu.dll.lyskom.RpcCall doModifyAuxInfo(boolean isConf,
                                             int objNo,
                                             int[] delAuxNo,
                                             nu.dll.lyskom.AuxItem[] addAux)
                                      throws java.io.IOException,
                                             RpcFailure
Sends the RPC call modify-conf-info or modify-text-info to the server.

Parameters:
isConf - If true, the refered object is a conference, otherwise a text
objNo - If isConf is true: the conference to modify, otherwise the text number to modify
delAuxNo - An array containing Aux-Info numbers to delete
addAux - An array containing AuxItem objects to add
Returns:
An RpcCall object representing this specific RPC call
java.io.IOException
RpcFailure
See Also:
AuxItem

modifyAuxInfo

public void modifyAuxInfo(boolean isConf,
                          int objNo,
                          int[] delAuxNo,
                          nu.dll.lyskom.AuxItem[] addAux)
                   throws java.io.IOException,
                          RpcFailure
Modifies Aux-Info for a conference or a text.

Parameters:
isConf - If true, the refered object is a conference, otherwise a text
objNo - If isConf is true: the conference to modify, otherwise the text number to modify
delAuxNo - An array containing Aux-Info numbers to delete
addAux - An array containing AuxItem objects to add
java.io.IOException
RpcFailure
See Also:
AuxItem

doChangeWhatIAmDoing

public nu.dll.lyskom.RpcCall doChangeWhatIAmDoing(java.lang.String s)
                                           throws java.io.IOException
Sends the RPC call change-what-i-am-doing to the server.

Parameters:
s - A String telling the server what you are doing
Returns:
An RpcCall object representing this specific RPC call
java.io.IOException

changeWhatIAmDoing

public void changeWhatIAmDoing(java.lang.String s)
                        throws java.io.IOException
java.io.IOException

doWhoIsOnDynamic

public nu.dll.lyskom.RpcCall doWhoIsOnDynamic(boolean wantVisible,
                                              boolean wantInvisible,
                                              int activeLast)
                                       throws java.io.IOException
Sends the RPC call who-is-on-dynamic to the server.

Parameters:
wantVisible - If true, the server will return sessions marked as visible
wantInvisible - If true, the server will return sessions marked as invisible
activeLast - Do not return sessions that has been idle for more than activeLast seconds
Returns:
An RpcCall object representing this specific RPC call
java.io.IOException

whoIsOnDynamic

public nu.dll.lyskom.DynamicSessionInfo[] whoIsOnDynamic(boolean wantVisible,
                                                         boolean wantInvisible,
                                                         int activeLast)
                                                  throws java.io.IOException
Returns an array of DynamicSessionInfo objects containing information about online sessions

Parameters:
wantVisible - If true, the server will return sessions marked as visible
wantInvisible - If true, the server will return sessions marked as invisible
activeLast - Do not return sessions that has been idle for more than activeLast seconds
java.io.IOException
See Also:
DynamicSessionInfo

doDeleteText

public nu.dll.lyskom.RpcCall doDeleteText(int textNo)
                                   throws java.io.IOException
Sends the RPC call delete-text to the server.

Parameters:
textNo - The number of the text to delete
Returns:
An RpcCall object representing this specific RPC call
java.io.IOException

deleteText

public void deleteText(int textNo)
                throws java.io.IOException,
                       RpcFailure
Deletes a text on the server.

Parameters:
textNo - The number of the text to delete
java.io.IOException
RpcFailure

doReLookup

public nu.dll.lyskom.RpcCall doReLookup(java.lang.String regexp,
                                        boolean wantPersons,
                                        boolean wantConfs)
                                 throws java.io.IOException
Lookup names of persons or conferences using regular expressions

Parameters:
regexp - A string containing the regexp that will be used for search
wantPersons - Return persons matching name
wantConfs - Return conferences matching name
Returns:
An RpcCall object representing this specific RPC call
java.io.IOException
See Also:
lookupName(String, boolean, boolean)

reLookup

public nu.dll.lyskom.ConfInfo[] reLookup(java.lang.String regexp,
                                         boolean wantPersons,
                                         boolean wantConfs)
                                  throws java.io.IOException,
                                         RpcFailure
java.io.IOException
RpcFailure

lookupName

public nu.dll.lyskom.ConfInfo[] lookupName(java.lang.String name,
                                           boolean wantPersons,
                                           boolean wantConfs)
                                    throws java.io.IOException,
                                           RpcFailure
Lookup names of persons/conferences. Returns a ConfInfo array of matches.

Parameters:
name - (sub)string naming the person(s)/conference(s)
wantPersons - Return persons matching name
wantConfs - Return conferences matching name
java.io.IOException
RpcFailure
See Also:
ConfInfo

sendMessage

public boolean sendMessage(int recipient,
                           java.lang.String message)
                    throws java.io.IOException,
                           RpcFailure
Sends an asynchronous message with the send-message call.

Parameters:
recipient - The recipient conference, or 0 if it is a broadcast message
message - The message to be sent to the server
java.io.IOException
RpcFailure

sendMessage

public boolean sendMessage(int recipient,
                           java.lang.String message,
                           boolean block)
                    throws java.io.IOException,
                           RpcFailure
Sends an asynchronous message with the send-message call.

Parameters:
recipient - The recipient conference, or 0 if it is a broadcast message
message - The message to be sent to the server
block - If true, wait until the server has replied to the RPC call
java.io.IOException
RpcFailure

writeRpcCall

public nu.dll.lyskom.RpcCall writeRpcCall(nu.dll.lyskom.RpcCall c,
                                          boolean store)
                                   throws java.io.IOException
Writes an RPC call constructed from an RpcCall object to the network output stream.

Parameters:
c - RpcCall object to be sent to the server
store - if true, add it to the RPC call storage. This is required in order to use waitFor() etc
java.io.IOException

writeRpcCall

public nu.dll.lyskom.RpcCall writeRpcCall(nu.dll.lyskom.RpcCall c)
                                   throws java.io.IOException
Writes an RPC call constructed from an RpcCall object to the network output stream and add it to the RPC call storage.

Parameters:
c - RpcCall object to be sent to the server
java.io.IOException

waitFor

public nu.dll.lyskom.RpcReply waitFor(int id)
                               throws java.io.IOException
This methods provides a synchronous way of waiting for RPC replies. Note that this method should never be called from the MessageListener thread (for example, you may not call this method from inside an AsynchMessageListener's asynchMessage() method).
It blocks the current thread until a reply with the specified reference ID has been read from the server, or the rpcTimeout value has been reached.

Parameters:
id - The RPC call reference number to wait for
java.io.IOException
See Also:
rpcTimeout

waitFor

public nu.dll.lyskom.RpcReply waitFor(nu.dll.lyskom.RpcCall r)
                               throws java.io.IOException
Convenience wrapper for waitFor(int).

java.io.IOException
See Also:
waitFor(int)

rpcEvent

public void rpcEvent(nu.dll.lyskom.RpcEvent e)
Receiver of RPC events.

Specified by:
rpcEvent in interface RpcEventListener
See Also:
RpcEvent, RpcReply, RpcCall

rpcReply

public void rpcReply(nu.dll.lyskom.RpcReply r)
Receiver of RPC replies. This method and the RpcReplyReceiver are used internally by LatteKOM.

Specified by:
rpcReply in interface nu.dll.lyskom.RpcReplyReceiver
See Also:
RpcReplyReceiver

asynchMessage

public void asynchMessage(nu.dll.lyskom.AsynchMessage m)
Receiver of asynchronous messages.

Specified by:
asynchMessage in interface AsynchMessageReceiver
Parameters:
m - The parsed asynch message.
See Also:
AsynchMessageReceiver

Copyright © Rasmus Sten and contributors, 1997-2004