public interface Datasource
Modifier and Type | Method and Description |
---|---|
boolean |
containsAccount(java.lang.String userID)
Asks the datasource if the account exists for the given userID.
|
java.lang.String |
createAccount(java.lang.String userID,
java.lang.String password)
Create an account on the server.
|
java.util.List<java.lang.String> |
getAccounts()
Returns a list of the userIDs for all persistent accounts.
|
java.lang.String |
getPassword(java.lang.String userID)
Return the password for the given userID.
|
boolean |
init(DatasourceContext ctx)
Called when the datasource is initialized by the server.
|
void |
loadAccount(Account account)
Load the account fields from the persistent storage.
|
void |
loadAccountGlobalAttributes(Account account)
The datasource should load any global attributes it has for the account by
setting them on the account.
|
void |
loadAccountRoomAttributes(Account account,
java.lang.String roomID)
Load the account attributes for the specified room.
|
void |
loadAllAccountAttributes(Account account)
The datasource should load all account attributes it has for the account.
|
void |
loadRoomAttributes(Room room)
Called when a room is created.
|
void |
loadServerAttributes(Server server)
Called when the server starts.
|
java.lang.String |
removeAccount(java.lang.String userID)
Remove an account.
|
void |
removeAccountAttribute(Account account,
Attribute attribute)
Remove an account attribute.
|
void |
removeRoomAttribute(Room room,
Attribute attribute)
Remove a room attribute.
|
void |
removeServerAttribute(Attribute attribute)
Remove a server attribute.
|
java.lang.String |
saveAccount(Account account)
Save an existing account to the server.
|
void |
saveAccountAttribute(Account account,
Attribute attribute)
Save an account attribute.
|
void |
saveRoomAttribute(Room room,
Attribute attribute)
Save a room attribute.
|
void |
saveServerAttribute(Attribute attribute)
Save a server attribute.
|
void |
shutdown()
Called when the datasource is shutdown.
|
boolean init(DatasourceContext ctx)
ctx
- a context for the Datasource to run invoid shutdown()
java.lang.String createAccount(java.lang.String userID, java.lang.String password) throws DatasourceException
userID
- the userID for the accountpassword
- the password of the accountDatasourceException
- an Exception occurred in the datasourceboolean containsAccount(java.lang.String userID) throws DatasourceException
userID
- the userID of the accountDatasourceException
- an Exception occurred in the datasourcejava.lang.String saveAccount(Account account) throws DatasourceException
account
- - the account to saveDatasourceException
- an Exception occurred in the datasourcejava.lang.String getPassword(java.lang.String userID) throws DatasourceException
userID
- the userID of the accountDatasourceException
- an Exception occurred in the datasourcevoid loadAllAccountAttributes(Account account) throws DatasourceException
account
- DatasourceException
void loadAccountGlobalAttributes(Account account) throws DatasourceException
account
- the account that has logged inDatasourceException
- an Exception occurred in the datasourcevoid loadAccountRoomAttributes(Account account, java.lang.String roomID) throws DatasourceException
account
- the account for the clientroomID
- the ID of the room (i.e. the scope)DatasourceException
void saveAccountAttribute(Account account, Attribute attribute) throws DatasourceException
account
- the accountattribute
- the attribute to saveDatasourceException
- an Exception occurred in the datasourcevoid removeAccountAttribute(Account account, Attribute attribute) throws DatasourceException
account
- the accountattribute
- the attribute to removeDatasourceException
- an Exception occurred in the datasourcevoid loadAccount(Account account) throws DatasourceException
account
- - the account to loadDatasourceException
- an Exception occurred in the datasourcejava.lang.String removeAccount(java.lang.String userID) throws DatasourceException
userID
- the userID of the accountpassword
- the password of the accountDatasourceException
- an Exception occurred in the datasourcejava.util.List<java.lang.String> getAccounts() throws DatasourceException
DatasourceException
- an Exception occurred in the datasourcevoid loadRoomAttributes(Room room) throws DatasourceException
room
- the roomDatasourceException
void saveRoomAttribute(Room room, Attribute attribute) throws DatasourceException
room
- the roomattribute
- the attribute to saveDatasourceException
- an Exception occurred in the datasourcevoid removeRoomAttribute(Room room, Attribute attribute) throws DatasourceException
room
- the roomattribute
- the attribute to removeDatasourceException
- an Exception occurred in the datasourcevoid saveServerAttribute(Attribute attribute) throws DatasourceException
room
- the roomDatasourceException
- an Exception occurred in the datasourcevoid removeServerAttribute(Attribute attribute) throws DatasourceException
attribute
- the attribute to removeDatasourceException
- an Exception occurred in the datasourcevoid loadServerAttributes(Server server) throws DatasourceException
server
- the serverDatasourceException