blueme.messenger.kernel
Class Kernel

java.lang.Object
  extended by blueme.messenger.kernel.Kernel
All Implemented Interfaces:
iConstants, iKernel_BootLoader, iKernel_Com, iKernel_GUI, iKernel_Ticket, java.lang.Runnable

public class Kernel
extends java.lang.Object
implements iKernel_BootLoader, iKernel_GUI, iKernel_Com, iKernel_Ticket, iConstants, java.lang.Runnable


Field Summary
 
Fields inherited from interface blueme.messenger.common.iConstants
ADMIN_UID, APP_TITLE, BLUETOOTH_INDEX, BLUETOOTH_LENGTH, BLUETOOTH_POSTFIX, BLUETOOTH_PREFIX, COM_OBJECTS, DISCOVERY_SLEEP, GPRS_INDEX, MAX_REDIRECTS, MSG_MAX_COUNT, MSG_MAX_LENGTH, NICK_MAX_LENGTH, PID_LENGTH, SMS_PUSH_PORT, UID_LENGTH
 
Constructor Summary
Kernel()
          Creates a new instance of Kernel
 
Method Summary
 boolean addUser(iUserList user)
          Notify Kernel that the defined user is to be added to the buddy list.
 boolean addUserToLocalList(java.lang.String uid)
          Tries to add the user to the buddy list
 boolean addUserToLocalListBluetooth(java.lang.String bluetoothAddress)
          Tries to add the user to the buddy list (from Bluetooth)
 boolean announceNick(java.lang.String nick)
          Send your nick to server
 boolean changeFriend(iUserList user, boolean friend)
           
 boolean changeUnread(iMSG msg, boolean unread)
          Changes the read / unread flag of defined message.
 boolean deleteAllMessages(iUserList userList)
          Deletes all messages associated with the defined iUserList object.
 boolean deleteMessage(iMSG msg)
          Will delete defined message.
 boolean deleteUser(iUserList user)
          Deletes the user associated with the iUserList object.
 void deleteUserOnLocalList(java.lang.String uid)
          Tries to remove specified user from buddy list
 void deliverMessage(iMSG msg)
          Deliver new incoming message.
 void endApplication()
          Method used to inform the application that is must exit.
 iConfig getConfig()
          Used to get the configuration data.
 iMSG[] getMessages(iUserList userList)
          Used to get all messages associated with defined iUserList object.
 iProfile getProfile()
           
 iUserData getUserData()
          Used to get user data.
 iUserList[] getUserList()
          Used to get the buddy list.
 void newUser(java.lang.String bluetoothAddress)
          Deliver Bluetooth addres of newly discovered unit.
 boolean pauseApplication()
          Method returns “true” if the application could be put on pause, “false” otherwise.
 void run()
           
 boolean sendAddMessage(iUserList user)
          Send an ADD message to specified user
 int sendNewMessage(iMSG msg)
          Used for sending new messages.
 void setBootLoaderReference(iBootLoader_Kernel bootLoader)
          Method used to give a reference for BootLoader to Kernel.
 boolean setConfig(iConfig config)
          Used to store the configuration data defined in the argument.
 void setGUIReference(iGUI_Kernel gui)
          Method used to give a reference for GUI to Kernel.
 boolean setProfile(iProfile profile)
           
 boolean setUserData(iUserData userData)
          Used to store the user data defined in the argument.
 boolean startApplication()
          Method returns “true” if everything started OK, “false” otherwise.
 boolean updateListFromServer()
          Download the removely saved buddy list (on the server), and replace this with the local buddy list.
 boolean updateProfileOnUser(java.lang.String uid)
          Download profile for specified user.
 void updateUserNick(java.lang.String uid, java.lang.String nick)
          Update nick on specified user
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Kernel

public Kernel()
Creates a new instance of Kernel

Method Detail

startApplication

public boolean startApplication()
Description copied from interface: iKernel_BootLoader
Method returns “true” if everything started OK, “false” otherwise. If “false”, the application should exit. This method can not be used before Kernel has a reference to GUI.

Specified by:
startApplication in interface iKernel_BootLoader

pauseApplication

public boolean pauseApplication()
Description copied from interface: iKernel_BootLoader
Method returns “true” if the application could be put on pause, “false” otherwise. If “false”, the application should be ended.

Specified by:
pauseApplication in interface iKernel_BootLoader

endApplication

public void endApplication()
Description copied from interface: iKernel_BootLoader
Method used to inform the application that is must exit.

Specified by:
endApplication in interface iKernel_BootLoader

setGUIReference

public void setGUIReference(iGUI_Kernel gui)
Description copied from interface: iKernel_BootLoader
Method used to give a reference for GUI to Kernel. Method may only be used ones.

Specified by:
setGUIReference in interface iKernel_BootLoader

setBootLoaderReference

public void setBootLoaderReference(iBootLoader_Kernel bootLoader)
Description copied from interface: iKernel_BootLoader
Method used to give a reference for BootLoader to Kernel. Method may only be used ones.

Specified by:
setBootLoaderReference in interface iKernel_BootLoader

setUserData

public boolean setUserData(iUserData userData)
Description copied from interface: iKernel_GUI
Used to store the user data defined in the argument. Returns “true” if the data was saved, “false” otherwise.

Specified by:
setUserData in interface iKernel_GUI

getUserData

public iUserData getUserData()
Description copied from interface: iKernel_Com
Used to get user data. Returns a fresh iUserData object if there are no user data available.

Specified by:
getUserData in interface iKernel_Com
Specified by:
getUserData in interface iKernel_GUI

setConfig

public boolean setConfig(iConfig config)
Description copied from interface: iKernel_GUI
Used to store the configuration data defined in the argument. Returns "true" if the data was saved, "false" otherwise.

Specified by:
setConfig in interface iKernel_GUI

getConfig

public iConfig getConfig()
Description copied from interface: iKernel_Com
Used to get the configuration data. Returns a fresh iConfig object if there are no configuration data available.

Specified by:
getConfig in interface iKernel_Com
Specified by:
getConfig in interface iKernel_GUI

setProfile

public boolean setProfile(iProfile profile)

getProfile

public iProfile getProfile()

getUserList

public iUserList[] getUserList()
Description copied from interface: iKernel_Com
Used to get the buddy list. Returns an array of iUserList objects. Ordering are undefined, and if there are no users on the buddy list, an array of size 0 is returns.

Specified by:
getUserList in interface iKernel_Com
Specified by:
getUserList in interface iKernel_GUI

getMessages

public iMSG[] getMessages(iUserList userList)
Description copied from interface: iKernel_GUI
Used to get all messages associated with defined iUserList object. If no messages are associated with that user, an array of length 0 is returned. If more than one message is returned, messages are sorted by oldest first.

Specified by:
getMessages in interface iKernel_GUI

sendNewMessage

public int sendNewMessage(iMSG msg)
Description copied from interface: iKernel_GUI
Used for sending new messages. Method will return a integer defining how the method preformed. The number returned may be one of the following: 0: Messages sent successfully 1: Message could not be sent due to communication problems or problems at the server side 2: Message could not be sent due to access restrictions. This will happen if for instance the sender is out of free messages

Specified by:
sendNewMessage in interface iKernel_GUI

deleteAllMessages

public boolean deleteAllMessages(iUserList userList)
Description copied from interface: iKernel_GUI
Deletes all messages associated with the defined iUserList object. Returns “true” if all messages was deleted. It will also return “true” even if there were no messages to delete. Will return “false” if there were some internal problems.

Specified by:
deleteAllMessages in interface iKernel_GUI

deleteMessage

public boolean deleteMessage(iMSG msg)
Description copied from interface: iKernel_GUI
Will delete defined message. Returns "true" if defined message was deleted, "false" if defined message could not be found or there were some internal problems.

Specified by:
deleteMessage in interface iKernel_GUI

changeFriend

public boolean changeFriend(iUserList user,
                            boolean friend)

addUser

public boolean addUser(iUserList user)
Description copied from interface: iKernel_GUI
Notify Kernel that the defined user is to be added to the buddy list. Returns “true” if the user could be added, “false” otherwise. Will also return “true” is the user is already present on the buddy list.

Specified by:
addUser in interface iKernel_GUI

deleteUser

public boolean deleteUser(iUserList user)
Description copied from interface: iKernel_GUI
Deletes the user associated with the iUserList object. Returns “true” of the user was removed, “false” otherwise. This method will also delete all other information associated with this user, like for instance messages and matching profiles.

Specified by:
deleteUser in interface iKernel_GUI

changeUnread

public boolean changeUnread(iMSG msg,
                            boolean unread)
Description copied from interface: iKernel_GUI
Changes the read / unread flag of defined message. Method will return “true” of the flag could be changed, “false” otherwise.

Specified by:
changeUnread in interface iKernel_GUI

deliverMessage

public void deliverMessage(iMSG msg)
Description copied from interface: iKernel_Com
Deliver new incoming message.

Specified by:
deliverMessage in interface iKernel_Com

newUser

public void newUser(java.lang.String bluetoothAddress)
Description copied from interface: iKernel_Com
Deliver Bluetooth addres of newly discovered unit. Only used by "P2P" modules.

Specified by:
newUser in interface iKernel_Com

run

public void run()
Specified by:
run in interface java.lang.Runnable

announceNick

public boolean announceNick(java.lang.String nick)
Send your nick to server

Specified by:
announceNick in interface iKernel_Ticket

sendAddMessage

public boolean sendAddMessage(iUserList user)
Send an ADD message to specified user

Specified by:
sendAddMessage in interface iKernel_Ticket

addUserToLocalList

public boolean addUserToLocalList(java.lang.String uid)
Tries to add the user to the buddy list

Specified by:
addUserToLocalList in interface iKernel_Ticket

addUserToLocalListBluetooth

public boolean addUserToLocalListBluetooth(java.lang.String bluetoothAddress)
Tries to add the user to the buddy list (from Bluetooth)

Specified by:
addUserToLocalListBluetooth in interface iKernel_Ticket

updateProfileOnUser

public boolean updateProfileOnUser(java.lang.String uid)
Download profile for specified user. If the user does not exist on the local buddy list, the request is ignored.

Specified by:
updateProfileOnUser in interface iKernel_Ticket

updateUserNick

public void updateUserNick(java.lang.String uid,
                           java.lang.String nick)
Update nick on specified user

Specified by:
updateUserNick in interface iKernel_Ticket

updateListFromServer

public boolean updateListFromServer()
Download the removely saved buddy list (on the server), and replace this with the local buddy list.

Specified by:
updateListFromServer in interface iKernel_Ticket

deleteUserOnLocalList

public void deleteUserOnLocalList(java.lang.String uid)
Tries to remove specified user from buddy list

Specified by:
deleteUserOnLocalList in interface iKernel_Ticket