|
||||||||||
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)
IDataBaseAccess
id
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 IDataBaseAccess
id
- 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)
IDataBaseAccess
status
to offline.
unbind
in interface IDataBaseAccess
IDataBaseAccess.unbind(int)
public String lookup(int id)
IDataBaseAccess
IDataBaseAccess.search(java.lang.String, java.lang.String)
methode to get
the id
.
lookup
in interface IDataBaseAccess
IDataBaseAccess.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 IDataBaseAccess
public boolean removePeer(int id)
IDataBaseAccess
removePeer
in interface IDataBaseAccess
public String getFirstName(int id)
IDataBaseAccess
id
.
getFirstName
in interface IDataBaseAccess
public String getLastName(int id)
IDataBaseAccess
id
.
getLastName
in interface IDataBaseAccess
public String getEmail(int id)
IDataBaseAccess
id
.
getEmail
in interface IDataBaseAccess
public boolean isOnline(int id)
IDataBaseAccess
true
if the peer identified by id
is online.
isOnline
in interface IDataBaseAccess
public String getImageURL(int id)
IDataBaseAccess
id
.
getImageURL
in interface IDataBaseAccess
public boolean checkPassword(int id, String pwd)
IDataBaseAccess
checkPassword
in interface IDataBaseAccess
public String[] getSearchFields()
IDataBaseAccess
IDataBaseAccess.search(java.lang.String, java.lang.String)
method.
getSearchFields
in interface IDataBaseAccess
public int[] search(String colume, String searchString)
IDataBaseAccess
search
in interface IDataBaseAccess
id
'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 IDataBaseAccess
true
if successful
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |