|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.ObjectDatabase
| Constructor Summary | |
Database()
|
|
| Method Summary | |
boolean |
bind(int id,
String adress)
This binds the peers address to his id in the CNS,
now he is marked as online.
|
boolean |
checkPassword(int id,
String pwd)
This methode is used to check the peers identity. |
boolean |
connect()
This methode connects the CNS to his DB. |
String |
getEmail(int id)
Returns the email of the peer identified by id. |
String |
getFirstName(int id)
Returns the first Name of the peer identified by id. |
String |
getImageURL(int id)
Returns an URL to an image of the peer identified by id. |
String |
getLastName(int id)
Returns the Last Name of the peer identified by id. |
String[] |
getSearchFields()
This methode is used to get a list of searchable colums used for the search(java.lang.String, java.lang.String) method. |
boolean |
isOnline(int id)
Returns true if the peer identified by id is online. |
String |
lookup(int id)
Before we can send messages we need there address. |
int |
register(String first,
String last,
String email,
String pwd,
String land,
String url)
The first time the user starts an Caltella client, we has to register. |
boolean |
removePeer(int id)
If ever called, this methode would remove the peer from the DB. |
int[] |
search(String colume,
String searchString)
Search the DB for one or more peers and return there ID's |
boolean |
setAllAtOnce(int id,
String newFirstName,
String newLastName,
String newEmail,
String newPassword,
String newImageURL)
This is mainly used to decrease network and DB load by sending all data at once. |
boolean |
setEmail(int id,
String email)
|
boolean |
setFirstName(int id,
String firstname)
|
boolean |
setImageURL(int id,
String url)
|
boolean |
setLastName(int id,
String last)
|
boolean |
setPassword(int id,
String newPassword)
|
boolean |
setStatus(int id,
boolean status)
|
boolean |
unbind(int id)
This methode will change the peers status to offline. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public Database()
| Method Detail |
public boolean connect()
IDataBaseAccess
connect in interface IDataBaseAccess
public int register(String first,
String last,
String email,
String pwd,
String land,
String url)
IDataBaseAccess
register in interface IDataBaseAccess
public boolean bind(int id,
String adress)
IDataBaseAccessid in the CNS,
now he is marked as online.
No password is needed since the other methodes don't need them ether.
bind in interface IDataBaseAccessid - The peers id number
address A String of the form host:port
we get host using the
InetAddress.getLocalHost() methode.
true if binding was successfulInetAddress,
IDataBaseAccess.unbind(int),
IDataBaseAccess.lookup(int)public boolean unbind(int id)
IDataBaseAccessstatus to offline.
unbind in interface IDataBaseAccessIDataBaseAccess.unbind(int)public String lookup(int id)
IDataBaseAccessIDataBaseAccess.search(java.lang.String, java.lang.String) methode to get
the id.
lookup in interface IDataBaseAccessIDataBaseAccess.bind(int, String)
public boolean setFirstName(int id,
String firstname)
setFirstName in interface IDataBaseAccess
public boolean setLastName(int id,
String last)
setLastName in interface IDataBaseAccess
public boolean setEmail(int id,
String email)
setEmail in interface IDataBaseAccess
public boolean setStatus(int id,
boolean status)
public boolean setImageURL(int id,
String url)
setImageURL in interface IDataBaseAccess
public boolean setPassword(int id,
String newPassword)
setPassword in interface IDataBaseAccesspublic boolean removePeer(int id)
IDataBaseAccess
removePeer in interface IDataBaseAccesspublic String getFirstName(int id)
IDataBaseAccessid.
getFirstName in interface IDataBaseAccesspublic String getLastName(int id)
IDataBaseAccessid.
getLastName in interface IDataBaseAccesspublic String getEmail(int id)
IDataBaseAccessid.
getEmail in interface IDataBaseAccesspublic boolean isOnline(int id)
IDataBaseAccesstrue if the peer identified by id is online.
isOnline in interface IDataBaseAccesspublic String getImageURL(int id)
IDataBaseAccessid.
getImageURL in interface IDataBaseAccess
public boolean checkPassword(int id,
String pwd)
IDataBaseAccess
checkPassword in interface IDataBaseAccesspublic String[] getSearchFields()
IDataBaseAccessIDataBaseAccess.search(java.lang.String, java.lang.String) method.
getSearchFields in interface IDataBaseAccess
public int[] search(String colume,
String searchString)
IDataBaseAccess
search in interface IDataBaseAccessid's of all peers matching the
searchString in the specified colum.IDataBaseAccess.getSearchFields()
public boolean setAllAtOnce(int id,
String newFirstName,
String newLastName,
String newEmail,
String newPassword,
String newImageURL)
setAllAtOnce in interface IDataBaseAccesstrue if successful
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||