jitas.core
Class Admin

java.lang.Object
  extended by jitas.core.Admin

public class Admin
extends java.lang.Object

The Admin class is the doorway to JITAS for the Administration GUI

Version:
08 October 2007
Author:
DeathMarch (c314g2)

Constructor Summary
Admin()
          The default constructor for the admin class.
Admin(java.lang.String domainsFilePath)
          Constructor that takes in a file path for the domains.xml file
Admin(Tutor tutor)
          Constructor which takes in a current Tutor object, to use that tutor's domainManager, and set of Students.
 
Method Summary
 void addAllowedDomain(java.lang.String userName, java.lang.String domainName)
          Gives a student access to a specific domain
 void addUser(java.lang.String userName, java.lang.String password, java.util.Set<java.lang.String> domainNames)
          Adds a new student to JITAS.
 void deleteUser(java.lang.String userName)
          Deletes the student from the entire JITAS System, including all domain specific information about that student
 java.util.SortedSet<java.lang.String> getAllDomainNames()
          Returns a Sorted Set of all known domain names
 java.util.Set<java.lang.String> getAllStudentUsernameStrings()
          gets a set of all the students usernames in JITAS
 boolean getLoginStatus(java.lang.String userName, java.lang.String domainName)
          gets the login status of a student for a particular domain
 java.util.SortedSet<java.lang.String> getStudentUsernames()
          Returns all of the students usernames which have been read in from xml.
 java.util.Set<java.lang.String> getStudentUsernameStrings(java.lang.String currentFilter)
          Gets all the students usernames for a specific domain
 void logout(java.lang.String userName, java.lang.String domainName)
          Logs the Student out of the specified domain
 void refreshStudentList()
          loads all of the students usernames from xml into the stored set of students usernames in this class.
 void removeUser(java.lang.String userName, java.lang.String domainName)
          Removes the students student model from the specified domain.
 boolean studentHasAccountInDomain(java.lang.String userName, java.lang.String domainName)
          Tells whether a student has a student model within a certain domain
 boolean userCreationAllowed(java.lang.String domainName)
          Tells whether a domain is a Non-Restricted or Restricted
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Admin

public Admin()
      throws java.io.IOException
The default constructor for the admin class. This method should be called whenever an application wants to run the admin tool. All subsequent method calls should be made through the initial object.

Throws:
java.io.IOException

Admin

public Admin(java.lang.String domainsFilePath)
      throws java.io.IOException
Constructor that takes in a file path for the domains.xml file

Parameters:
domainsFilePath - The path to an xml file containing information about all the domains. The path must include the filename.
Throws:
java.io.IOException

Admin

public Admin(Tutor tutor)
      throws java.io.IOException
Constructor which takes in a current Tutor object, to use that tutor's domainManager, and set of Students.

Parameters:
tutor - The Tutor object which is currently being used.
Throws:
java.io.IOException
Method Detail

getStudentUsernames

public java.util.SortedSet<java.lang.String> getStudentUsernames()
Returns all of the students usernames which have been read in from xml.

Returns:
usernames A Sorted Set of all the students usernames.

getAllDomainNames

public java.util.SortedSet<java.lang.String> getAllDomainNames()
Returns a Sorted Set of all known domain names

Returns:
A Sorted Set of all the known domain names

studentHasAccountInDomain

public boolean studentHasAccountInDomain(java.lang.String userName,
                                         java.lang.String domainName)
                                  throws UserNotFoundException
Tells whether a student has a student model within a certain domain

Parameters:
userName - - the students username
domainName - - the domain name we wish to check
Returns:
true if the student has a student model in the domain, else false
Throws:
UserNotFoundException

userCreationAllowed

public boolean userCreationAllowed(java.lang.String domainName)
                            throws DomainNotFoundException,
                                   DomainNotLoadedException
Tells whether a domain is a Non-Restricted or Restricted

Parameters:
domainName -
Returns:
True if the domain is not Restricted, false if the domain is Restricted
Throws:
DomainNotFoundException
DomainNotLoadedException
jess.JessException

getLoginStatus

public boolean getLoginStatus(java.lang.String userName,
                              java.lang.String domainName)
                       throws UserNotFoundException,
                              java.rmi.RemoteException
gets the login status of a student for a particular domain

Parameters:
userName - The students domain name
domainName - The domain we wish to check
Returns:
True if the student is logged in else false
Throws:
java.rmi.RemoteException
UserNotFoundException - If the user does not exist

logout

public void logout(java.lang.String userName,
                   java.lang.String domainName)
            throws DomainNotFoundException,
                   DomainNotLoadedException,
                   UserNotFoundException,
                   UserNotLoggedInException,
                   java.rmi.RemoteException
Logs the Student out of the specified domain

Parameters:
userName - - the students username
domainName - - the domain the student wishes to log out of
Throws:
java.rmi.RemoteException
UserNotLoggedInException
UserNotFoundException
DomainNotLoadedException
DomainNotFoundException

addUser

public void addUser(java.lang.String userName,
                    java.lang.String password,
                    java.util.Set<java.lang.String> domainNames)
             throws AddUserDeniedException,
                    DomainNotFoundException,
                    DomainNotLoadedException,
                    IllegalUserNameException,
                    StudentModelAlreadyExistsException,
                    java.rmi.RemoteException
Adds a new student to JITAS. The Set of domainNames is all of the domains that the new student can log into

Parameters:
userName - Student's user name
password - Student's password
domainNames - All the domains the student can log into
Throws:
java.rmi.RemoteException
StudentModelAlreadyExistsException
IllegalUserNameException
DomainNotLoadedException
DomainNotFoundException
AddUserDeniedException
UserNotFoundException

removeUser

public void removeUser(java.lang.String userName,
                       java.lang.String domainName)
                throws DomainNotFoundException,
                       DomainNotLoadedException,
                       UserNotFoundException,
                       UserNotLoggedInException,
                       java.rmi.RemoteException
Removes the students student model from the specified domain. Does not delete the student altogether - just removes the student information from the specified domain

Parameters:
userName -
domainName -
Throws:
java.rmi.RemoteException
UserNotLoggedInException
UserNotFoundException
DomainNotLoadedException
DomainNotFoundException

deleteUser

public void deleteUser(java.lang.String userName)
                throws DomainNotFoundException,
                       DomainNotLoadedException,
                       UserNotFoundException,
                       UserNotLoggedInException,
                       java.rmi.RemoteException
Deletes the student from the entire JITAS System, including all domain specific information about that student

Parameters:
userName - Student's user name
Throws:
java.rmi.RemoteException
UserNotLoggedInException
UserNotFoundException
DomainNotLoadedException
DomainNotFoundException

addAllowedDomain

public void addAllowedDomain(java.lang.String userName,
                             java.lang.String domainName)
                      throws AddUserDeniedException,
                             DomainNotFoundException,
                             DomainNotLoadedException,
                             StudentModelAlreadyExistsException,
                             UserNotFoundException,
                             java.rmi.RemoteException
Gives a student access to a specific domain

Parameters:
userName - The student's username
domainName - The domain the student will have access to
Throws:
java.rmi.RemoteException
UserNotFoundException
StudentModelAlreadyExistsException
DomainNotLoadedException
DomainNotFoundException
AddUserDeniedException

getAllStudentUsernameStrings

public java.util.Set<java.lang.String> getAllStudentUsernameStrings()
gets a set of all the students usernames in JITAS

Returns:
a set of all of the students usernames in JITAS

getStudentUsernameStrings

public java.util.Set<java.lang.String> getStudentUsernameStrings(java.lang.String currentFilter)
Gets all the students usernames for a specific domain

Parameters:
currentFilter - The domain the students will belong to
Returns:
set A set of all the students usernames in the filtered domain

refreshStudentList

public void refreshStudentList()
                        throws java.io.FileNotFoundException
loads all of the students usernames from xml into the stored set of students usernames in this class.

Throws:
java.io.FileNotFoundException
java.io.FileNotFoundException