server
Class WSIDOServer

java.lang.Object
  extended by java.rmi.server.RemoteObject
      extended by java.rmi.server.RemoteServer
          extended by java.rmi.server.UnicastRemoteObject
              extended by server.WSIDOServer
All Implemented Interfaces:
WSIDOInterface, WSIDOInterfaceAdmin, java.io.Serializable, java.rmi.Remote

public class WSIDOServer
extends java.rmi.server.UnicastRemoteObject
implements WSIDOInterface, WSIDOInterfaceAdmin

this class is the main class for the WhatShallIDo server to start the server use the following command: 1: start the rmiregistry in a command shell rmiregistry example: rmiregistry 33000 2. start the server with the following command from a command shell java -classpath .;lib/mysql-connector-java-5.0.4-bin.jar -Djava.rmi.server.codebase=http://localhost:8080/whatshallido/server.jar -Djava.security.policy=policy server.WSIDOServer localhost:33000

See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.rmi.server.RemoteObject
ref
 
Constructor Summary
WSIDOServer()
          constructor to instantiate the class WSIDOServer
 
Method Summary
 boolean addToContactList(UserVerification userver, long addUserId)
          method which adds a user to another users contact list
 boolean addUser(UserVerification userver, StandardUser user)
          administrator method
 boolean changePreferences(UserVerification userver, StandardUser user)
          updating the user preferences like changing nickname, changing email ...
 long createAccount(StandardUser user)
          method to create a new user account
 boolean createModule(UserVerification userver, java.lang.String name, java.lang.String language, java.lang.String description, java.lang.String question)
          method to create a new module
 boolean deleteContact(UserVerification userver, long deleteUserId)
          Method to delete a contact from the PowerUser contactlist
 boolean deleteModule(UserVerification userver, long moduleId)
          Method for the Administrator to delete modules
 boolean deleteOwnModule(UserVerification userver, long moduleId)
          Method where a user can delete his own modules
 boolean deleteUser(UserVerification userver, long userId)
          administrator method Method to delete a user
 boolean editModule(UserVerification userver, java.lang.String name, java.lang.String question, java.lang.String description)
          administrator method
 boolean editOwnModule(UserVerification userver, long moduleId, java.lang.String name, java.lang.String language, java.lang.String description, java.lang.String question)
          method for a user to edit his own modules
 boolean editUser(UserVerification userver, long userId, StandardUser user)
          administrator method
 java.util.Vector<Item> getAllModuleItems(UserVerification userver, long moduleId)
          method returns all items of a module
 java.util.Vector<Module> getChoicableModules(UserVerification userver)
          get modules, for which the user can choose an item (if not already chosen --> one per day)
 java.util.Vector<StandardUserExtended> getContactList(UserVerification userver)
          returns the contactlist of a user
 java.util.Vector<StandardUserExtended> getInteractionUsers(UserVerification userver, Item item)
          returns possible users for interaction
 java.util.Vector<Module> getModules(UserVerification userver, java.lang.String language)
          get all modules of the same language
 java.util.Vector<Module> getOwnModules(UserVerification userver)
          returns modules that a specific user has created
 java.util.Vector<Item> getPersonalizedToplist(UserVerification userver, long moduleId)
          simple toplist like the getToplist method with the following difference this toplist is only for PowerUsers. the ranking of the items of the toplist is different it will be checked if the PowerUser who requests the PersonalizedToplist has interacted with another user who has voted for this item. if this condition is true the item will be ranked higher.
 java.util.Vector<Item> getToplist(UserVerification userver, long moduleId)
          method which returns a vector with all items for a specified module sorted by votes (toplist) this toplist shows the DAILY ranking of the items!
 java.util.Vector<Item> getToplistDuration(UserVerification userver, int days, long moduleId)
          method which returns a vector with all items for a specified module sorted by votes (toplist) this toplist shows the ranking of the items in a specific time range (int days) including today
 boolean interact(UserVerification userver, long userId)
          the parameter long userId of this method is the userId from the possible chatPartner example request: i (requestingUser) want to chat with long userId (possible chatPartner)
 StandardUser login(UserVerification userver, WSIDOClientInterface clientApp)
          method to do a login in the WhatShallIDo network
 boolean logout(UserVerification userver)
          method for the user to logout from the WhatShallIDo Server
static void main(java.lang.String[] args)
           
 boolean sendMsg(UserVerification userver, long userId, java.lang.String message)
          Method to send a chat message to another user
 boolean setChoice(UserVerification userver, long itemId)
          vote for items of a module
 boolean setChoice(UserVerification userver, long moduleId, java.lang.String newItemName, java.lang.String url)
          vote for items of a module while creating a new item
 boolean updateSubscribedModules(StandardUser user)
          Subscribe new modules and delete subscribed modules
 
Methods inherited from class java.rmi.server.UnicastRemoteObject
clone, exportObject, exportObject, exportObject, unexportObject
 
Methods inherited from class java.rmi.server.RemoteServer
getClientHost, getLog, setLog
 
Methods inherited from class java.rmi.server.RemoteObject
equals, getRef, hashCode, toString, toStub
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

WSIDOServer

public WSIDOServer()
            throws java.rmi.RemoteException
constructor to instantiate the class WSIDOServer

Throws:
java.rmi.RemoteException
Method Detail

main

public static void main(java.lang.String[] args)
Parameters:
args - String array to get command line arguments

login

public StandardUser login(UserVerification userver,
                          WSIDOClientInterface clientApp)
method to do a login in the WhatShallIDo network

Specified by:
login in interface WSIDOInterface
Parameters:
userver -
clientApp -
Returns:
returns a StandardUser object with all the settings for a specified user stored in the database

logout

public boolean logout(UserVerification userver)
method for the user to logout from the WhatShallIDo Server

Specified by:
logout in interface WSIDOInterface
Parameters:
userver -
Returns:
true if logout successfull

createAccount

public long createAccount(StandardUser user)
method to create a new user account

Specified by:
createAccount in interface WSIDOInterface
Parameters:
user -
Returns:
returns the new generated user id

createModule

public boolean createModule(UserVerification userver,
                            java.lang.String name,
                            java.lang.String language,
                            java.lang.String description,
                            java.lang.String question)
method to create a new module

Specified by:
createModule in interface WSIDOInterface
Parameters:
userver -
name -
question -
description -
Returns:
true if module creation successfull

setChoice

public boolean setChoice(UserVerification userver,
                         long itemId)
vote for items of a module

Specified by:
setChoice in interface WSIDOInterface
Parameters:
userver -
itemId -
Returns:
true if vote successfull

setChoice

public boolean setChoice(UserVerification userver,
                         long moduleId,
                         java.lang.String newItemName,
                         java.lang.String url)
vote for items of a module while creating a new item

Specified by:
setChoice in interface WSIDOInterface
Parameters:
userver -
moduleId -
newItemName -
Returns:
true if successfull

addToContactList

public boolean addToContactList(UserVerification userver,
                                long addUserId)
method which adds a user to another users contact list

Specified by:
addToContactList in interface WSIDOInterface
Parameters:
userver -
addUserId -
Returns:
true if successfully added

addUser

public boolean addUser(UserVerification userver,
                       StandardUser user)
administrator method

Specified by:
addUser in interface WSIDOInterfaceAdmin
Parameters:
userver -
user -
Returns:
state if user has been successfully added

getToplist

public java.util.Vector<Item> getToplist(UserVerification userver,
                                         long moduleId)
method which returns a vector with all items for a specified module sorted by votes (toplist) this toplist shows the DAILY ranking of the items! example: somebody requests a toplist at 2007-02-15 22:15:00 the result toplist will be in the range from 2007-02-14 22:15:00 to 2007-02-15 22:15:00 (last 24 hours)

Specified by:
getToplist in interface WSIDOInterface
Parameters:
userver -
moduleId -
Returns:
vector with all items for a specified module sorted by number of votes

getToplistDuration

public java.util.Vector<Item> getToplistDuration(UserVerification userver,
                                                 int days,
                                                 long moduleId)
method which returns a vector with all items for a specified module sorted by votes (toplist) this toplist shows the ranking of the items in a specific time range (int days) including today

Specified by:
getToplistDuration in interface WSIDOInterface
Parameters:
userver -
days -
moduleId -
Returns:
returns a vector with all items for a specified module sorted by votes (toplist)

getPersonalizedToplist

public java.util.Vector<Item> getPersonalizedToplist(UserVerification userver,
                                                     long moduleId)
simple toplist like the getToplist method with the following difference this toplist is only for PowerUsers. the ranking of the items of the toplist is different it will be checked if the PowerUser who requests the PersonalizedToplist has interacted with another user who has voted for this item. if this condition is true the item will be ranked higher. that means normal votes + 5. if the PowerUser who requests the PersonalizedToplist has another user who has voted for this item in his contactlist the item will be ranked votes + 20 same in GERMAN: ================= normale topliste wie methode getToplist mit dem unterschied nur für PowerUser. es wird geprueft, ob mit benutzern, die für ein in der topliste vorhandenes item gevoted haben interagiert (gechatted) wurde. wenn gechatted wurde, wird dieses item auch wenn es moeglicherweise weniger votes hat, hoeher gerankt (wenn interagiert wurde werden 5 votes dazugezaehlt --> hoeheres ranking). wenn man nicht nur gechatted hat sondern einen anderen benutzer, der fuer dieses item gevoted hat, sogar in seiner contactlist hat, wird das item noch hoeher gerankt (20 votes dazugezählt).

Specified by:
getPersonalizedToplist in interface WSIDOInterface
Parameters:
userver -
moduleId -
Returns:
Vector with personalized items for the toplist

getModules

public java.util.Vector<Module> getModules(UserVerification userver,
                                           java.lang.String language)
get all modules of the same language

Specified by:
getModules in interface WSIDOInterface
Parameters:
userver -
language -
Returns:
Vector with modules of the same language

getOwnModules

public java.util.Vector<Module> getOwnModules(UserVerification userver)
returns modules that a specific user has created

Specified by:
getOwnModules in interface WSIDOInterface
Parameters:
userver -
Returns:
Vector with all modules that a specific user has created

getChoicableModules

public java.util.Vector<Module> getChoicableModules(UserVerification userver)
Description copied from interface: WSIDOInterface
get modules, for which the user can choose an item (if not already chosen --> one per day)

Specified by:
getChoicableModules in interface WSIDOInterface
Parameters:
userver -
Returns:
get modules, for which the user can choose an item (if not already chosen --> one per day)

getAllModuleItems

public java.util.Vector<Item> getAllModuleItems(UserVerification userver,
                                                long moduleId)
method returns all items of a module

Specified by:
getAllModuleItems in interface WSIDOInterface
Parameters:
userver -
moduleId -
Returns:
Vector with all items of a module

getContactList

public java.util.Vector<StandardUserExtended> getContactList(UserVerification userver)
returns the contactlist of a user

Specified by:
getContactList in interface WSIDOInterface
Parameters:
userver -
Returns:
Vector used for the contactlist of a user

changePreferences

public boolean changePreferences(UserVerification userver,
                                 StandardUser user)
updating the user preferences like changing nickname, changing email ...

Specified by:
changePreferences in interface WSIDOInterface
Parameters:
userver -
user -
Returns:
true if successfull

editOwnModule

public boolean editOwnModule(UserVerification userver,
                             long moduleId,
                             java.lang.String name,
                             java.lang.String language,
                             java.lang.String description,
                             java.lang.String question)
method for a user to edit his own modules

Specified by:
editOwnModule in interface WSIDOInterface
Parameters:
userver -
name -
question -
description -
Returns:
true if update successfull

editUser

public boolean editUser(UserVerification userver,
                        long userId,
                        StandardUser user)
administrator method

Specified by:
editUser in interface WSIDOInterfaceAdmin
Parameters:
userver -
userId -
user -
Returns:
state if action has been successfully implemented

editModule

public boolean editModule(UserVerification userver,
                          java.lang.String name,
                          java.lang.String question,
                          java.lang.String description)
administrator method

Specified by:
editModule in interface WSIDOInterfaceAdmin
Parameters:
userver -
name -
question -
description -
Returns:
state if action has been successfully implemented

updateSubscribedModules

public boolean updateSubscribedModules(StandardUser user)
Subscribe new modules and delete subscribed modules

Specified by:
updateSubscribedModules in interface WSIDOInterface
Parameters:
user -
Returns:
true if successfull

deleteUser

public boolean deleteUser(UserVerification userver,
                          long userId)
administrator method Method to delete a user

Specified by:
deleteUser in interface WSIDOInterfaceAdmin
Parameters:
userver -
userId -
Returns:
state if action has been successfully implemented

deleteModule

public boolean deleteModule(UserVerification userver,
                            long moduleId)
Method for the Administrator to delete modules

Specified by:
deleteModule in interface WSIDOInterfaceAdmin
Parameters:
moduleId -
userver -
Returns:
state if action has been successfully implemented
Throws:
java.lang.Throwable

deleteContact

public boolean deleteContact(UserVerification userver,
                             long deleteUserId)
Method to delete a contact from the PowerUser contactlist

Specified by:
deleteContact in interface WSIDOInterface
Parameters:
userver -
deleteUserId -
Returns:
true if contact deleted successfully else false

deleteOwnModule

public boolean deleteOwnModule(UserVerification userver,
                               long moduleId)
Method where a user can delete his own modules

Specified by:
deleteOwnModule in interface WSIDOInterface
Parameters:
userver -
moduleId -
Returns:
true if module deleted successfully

getInteractionUsers

public java.util.Vector<StandardUserExtended> getInteractionUsers(UserVerification userver,
                                                                  Item item)
returns possible users for interaction

Specified by:
getInteractionUsers in interface WSIDOInterface
Parameters:
userver -
item -
Returns:
vector with StandardUsersExtended

interact

public boolean interact(UserVerification userver,
                        long userId)
the parameter long userId of this method is the userId from the possible chatPartner example request: i (requestingUser) want to chat with long userId (possible chatPartner)

Specified by:
interact in interface WSIDOInterface
Parameters:
userver -
userId - to interact with
Returns:
true if possible chatPartner accepts the chat request

sendMsg

public boolean sendMsg(UserVerification userver,
                       long userId,
                       java.lang.String message)
Method to send a chat message to another user

Specified by:
sendMsg in interface WSIDOInterface
Parameters:
userver -
userId -
message -
Returns:
true if message sent successfully