com.bits.common
Interface IMainServer

All Known Implementing Classes:
ServerLogic

public interface IMainServer

interface for communicating with the server

Author:
sophirha

Method Summary
 boolean addTaskToExperiment(java.lang.String expName, java.lang.String taskName)
          add an existing task to an experiment
 boolean createExperiment(java.lang.String expName)
          create new experiment
 boolean createTask(java.lang.String taskName, java.lang.String script)
          create new task
 void deleteExperiment(java.lang.String name)
          remove experiment from db
 void deleteTask(java.lang.String name)
          remove a task from the db
 boolean deleteTaskFromExperiment(java.lang.String expName, java.lang.String taskName)
          remove a task from the experiment
 Advisor.AdviceResult getAdviceForUser(java.lang.String userName, java.util.LinkedList<GameResult> resultList)
           
 TrainingProgram getCurrentTrainingProgram(UserInfo user)
          getter
 RecommendedSession getDoctorRecommendedSession(UserInfo patient)
          getter for doctor's session
 java.util.ArrayList<Task> getExperiment(java.lang.String expName)
          get the list of task related to an experiment
 java.util.ArrayList<Experiment> getExperimentsList()
          get all known experiments
 byte[] getGame(standards3.games.game.GameProperties game)
          download game
 java.util.LinkedList<standards3.games.game.GameProperties> getGamePropertiesByFilter(java.lang.String filterExpression)
          get all props that match the filter
 java.util.LinkedList<GameResult> getGameResultArray(java.lang.String userID, java.util.UUID gameID)
          getter
 java.util.LinkedList<UserInfo> getPatients(UserInfo user)
          get list of patients for the given doctor
 RecommendedSession getRecommendedSession(UserInfo user)
          getter
 java.util.HashMap<standards3.games.game.GameProperties,java.util.LinkedList<GameResult>> getResultsForUser(UserInfo ui)
          get all results for user organized by game
 java.util.HashMap<java.lang.String,java.lang.String[][]> getServerConfigurationData()
          get server configuration data
 java.util.LinkedList<Session> getSessionsList()
          getter
 java.lang.String getTask(java.lang.String taskName)
          get task's content
 java.util.ArrayList<Task> getTasksList()
          get all known tasks
 java.lang.Boolean IsDBConnected()
          check for db connection
 boolean isUserExist(java.lang.String username)
           
 java.lang.String loadRecordedTask()
          Deprecated. 
 java.lang.String loadScript()
          Deprecated. 
 UserInfo login(java.lang.String userID, java.lang.String password)
          perform login
 void refreshGamesServer()
          re-checks the game server file system for existing games
 void saveRecordedTask(java.lang.String task)
          Deprecated. 
 boolean saveScript(java.lang.String script)
          Deprecated. 
 boolean setRecommendedSession(UserInfo ui, RecommendedSession rs, boolean overide)
          setter
 void setServerConfigurationData(java.lang.String fileName, java.lang.String[][] configMatrix)
          set configuration
 java.lang.Boolean setUserInfo(UserInfo user)
          setter
 boolean setUserTrainingProgram(UserInfo ui, TrainingProgram tp)
          setter
 java.lang.Boolean updateResults(UserInfo user, standards3.games.game.GameProperties gp, java.util.UUID tpid, int gameDifficulty, java.lang.String gameRawData, long gameTime, int playerScore, double playerSuccessPercentage, boolean resultsValid)
          add new results to the db
 boolean validatePassword(UserInfo ui, java.lang.String oldPassword, java.lang.String newPassword, java.lang.String newPassword2)
          from security
 

Method Detail

IsDBConnected

java.lang.Boolean IsDBConnected()
check for db connection

Returns:
true if db is connected, false otherwise

getSessionsList

java.util.LinkedList<Session> getSessionsList()
getter

Returns:
all sessions available

getGame

byte[] getGame(standards3.games.game.GameProperties game)
download game

Parameters:
game - game to download
Returns:
byte array of the jar file

isUserExist

boolean isUserExist(java.lang.String username)

setUserInfo

java.lang.Boolean setUserInfo(UserInfo user)
setter

Parameters:
user - data to save
Returns:
true if the operation succeeded

login

UserInfo login(java.lang.String userID,
               java.lang.String password)
perform login

Parameters:
userID - name
password - password
Returns:
the details if succeeded, null otherwise

validatePassword

boolean validatePassword(UserInfo ui,
                         java.lang.String oldPassword,
                         java.lang.String newPassword,
                         java.lang.String newPassword2)
                         throws java.lang.Exception
from security

Parameters:
ui -
oldPassword -
newPassword -
newPassword2 -
Returns:
Throws:
java.lang.Exception

getRecommendedSession

RecommendedSession getRecommendedSession(UserInfo user)
getter

Parameters:
user - user to get the session for
Returns:
the session

saveRecordedTask

@Deprecated
void saveRecordedTask(java.lang.String task)
Deprecated. 


loadRecordedTask

@Deprecated
java.lang.String loadRecordedTask()
Deprecated. 


saveScript

@Deprecated
boolean saveScript(java.lang.String script)
Deprecated. 


loadScript

@Deprecated
java.lang.String loadScript()
Deprecated. 


getCurrentTrainingProgram

TrainingProgram getCurrentTrainingProgram(UserInfo user)
getter

Parameters:
user -
Returns:
the users training program

getGamePropertiesByFilter

java.util.LinkedList<standards3.games.game.GameProperties> getGamePropertiesByFilter(java.lang.String filterExpression)
get all props that match the filter

Parameters:
filterExpression - SQL where clause
Returns:
list of all matching

setUserTrainingProgram

boolean setUserTrainingProgram(UserInfo ui,
                               TrainingProgram tp)
setter

Parameters:
ui -
tp -
Returns:
true if successful

getGameResultArray

java.util.LinkedList<GameResult> getGameResultArray(java.lang.String userID,
                                                    java.util.UUID gameID)
getter

Parameters:
userID -
gameID -
Returns:

refreshGamesServer

void refreshGamesServer()
re-checks the game server file system for existing games


updateResults

java.lang.Boolean updateResults(UserInfo user,
                                standards3.games.game.GameProperties gp,
                                java.util.UUID tpid,
                                int gameDifficulty,
                                java.lang.String gameRawData,
                                long gameTime,
                                int playerScore,
                                double playerSuccessPercentage,
                                boolean resultsValid)
add new results to the db

Parameters:
user -
gp -
tpid -
gameDifficulty -
gameRawData -
gameTime -
playerScore -
playerSuccessPercentage -
resultsValid -
Returns:
true if successful

getPatients

java.util.LinkedList<UserInfo> getPatients(UserInfo user)
get list of patients for the given doctor

Parameters:
user - doctor
Returns:
list of patients

getDoctorRecommendedSession

RecommendedSession getDoctorRecommendedSession(UserInfo patient)
getter for doctor's session

Parameters:
patient -
Returns:
session

setRecommendedSession

boolean setRecommendedSession(UserInfo ui,
                              RecommendedSession rs,
                              boolean overide)
setter

Parameters:
ui -
rs -
overide - if true and a session exists it will be overriden
Returns:
true if successful

createExperiment

boolean createExperiment(java.lang.String expName)
create new experiment

Parameters:
expName - name
Returns:
true if successful

createTask

boolean createTask(java.lang.String taskName,
                   java.lang.String script)
create new task

Parameters:
taskName - name
script - task content
Returns:
true if successful

addTaskToExperiment

boolean addTaskToExperiment(java.lang.String expName,
                            java.lang.String taskName)
add an existing task to an experiment

Parameters:
expName -
taskName -
Returns:
true if successful

deleteTaskFromExperiment

boolean deleteTaskFromExperiment(java.lang.String expName,
                                 java.lang.String taskName)
remove a task from the experiment

Parameters:
expName -
taskName -
Returns:

getExperiment

java.util.ArrayList<Task> getExperiment(java.lang.String expName)
get the list of task related to an experiment

Parameters:
expName - experiment name
Returns:

getTask

java.lang.String getTask(java.lang.String taskName)
get task's content

Parameters:
taskName - name
Returns:
content

getExperimentsList

java.util.ArrayList<Experiment> getExperimentsList()
get all known experiments

Returns:

getTasksList

java.util.ArrayList<Task> getTasksList()
get all known tasks

Returns:

deleteTask

void deleteTask(java.lang.String name)
remove a task from the db

Parameters:
name -

deleteExperiment

void deleteExperiment(java.lang.String name)
remove experiment from db

Parameters:
name -

getResultsForUser

java.util.HashMap<standards3.games.game.GameProperties,java.util.LinkedList<GameResult>> getResultsForUser(UserInfo ui)
get all results for user organized by game

Parameters:
ui -
Returns:
mapping game->list of results

getServerConfigurationData

java.util.HashMap<java.lang.String,java.lang.String[][]> getServerConfigurationData()
get server configuration data

Returns:

setServerConfigurationData

void setServerConfigurationData(java.lang.String fileName,
                                java.lang.String[][] configMatrix)
set configuration

Parameters:
fileName -
configMatrix -

getAdviceForUser

Advisor.AdviceResult getAdviceForUser(java.lang.String userName,
                                      java.util.LinkedList<GameResult> resultList)