|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--structures.DBImplementation
Implements DBInterface using files.
The information in the files are structured in Hashtables
.
DBInterface
,
ObjectInputStream
,
Stream,
Hashtable
Constructor Summary | |
DBImplementation()
|
Method Summary | |
void |
associate(String threadName,
String groupName,
String agentName)
Associates a thread with an agent and its group. |
void |
createGroup(String groupName,
long time)
Creates a new group and specifies the lifetime of the agents that will belong to the group. |
void |
createRoot(String rootName)
Creates an empty root in the database. |
void |
deleteGroup(String groupName)
Deletes an existing group from the database. |
void |
deleteRoot(String rootName)
Deletes an existing group from the database. |
Object |
get(String rootName)
Retrieves a root content from the database. |
String |
getAgentName(String threadName)
Retrieves from the database the name of the agent associated to the specified thread. |
String |
getGroup(String threadName)
Retrieves from the database the name of the group associated to the specified thread. |
String[] |
getGroups()
Retrieves the names of all the groups stored in the database. |
String[] |
getGroupsToRead(String rootName)
Retrieves from the database the names of the groups with read permission to a specific root. |
String[] |
getGroupsToWrite(String rootName)
Retrieves from the database the names of the groups with write and delete permissions to a specific root. |
String[] |
getRoots()
Retrieves the names of all the roots stored in the database. |
String[] |
getRootsToRead(String groupName)
Retrieves from the database the names of the roots that this group has permission to read. |
String[] |
getRootsToWrite(String groupName)
Retrieves from the database the names of the roots that this group has permission to write and delete. |
long |
getTime(String groupName)
Retrieves from the database the lifetime of the agents that belongs to this group. |
void |
initialize()
Initializes the database with the firsts groups. |
boolean |
isGroup(String groupName)
Tests if this group name already exists in the database. |
boolean |
isReadable(String rootName,
String groupName)
Tests if a group has permission to read a root. |
boolean |
isRoot(String rootName)
Tests if a root exists in the database. |
boolean |
isWriteable(String rootName,
String groupName)
Tests if a group has permission to write and delete a root. |
void |
removeAssociation(String threadName)
Removes the association between an agent and a thread. |
void |
set(String rootName,
Object root)
Updates a root content. |
void |
setGroupToRead(String rootName,
String groupToRead)
Gives permission for a group to read a specified root. |
void |
setGroupToWrite(String rootName,
String groupToWrite)
Gives permission for a group to read a specified root. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public DBImplementation()
Method Detail |
public void initialize()
public void createGroup(String groupName, long time)
groupName
- the name of the group to be createdtime
- the lifetime of the agents that belongs to this group in milliseconds.public void deleteGroup(String groupName)
groupName
- the name of the group to be deletedpublic String[] getRootsToRead(String groupName)
groupName
- the group namepublic String[] getRootsToWrite(String groupName)
groupName
- the group namepublic long getTime(String groupName)
groupName
- the group namepublic boolean isGroup(String groupName)
groupName
- the group nametrue
if the group already exists, false
otherwise.public String[] getGroups()
public void createRoot(String rootName)
rootName
- the name of the root to be createdpublic Object get(String rootName)
rootName
- the root namepublic void deleteRoot(String rootName)
rootName
- the name of the root to be deletedpublic void set(String rootName, Object root)
rootName
- the name of the root to be updated.root
- the contents to be stored.public void setGroupToRead(String rootName, String groupToRead)
rootName
- the root namegroupToRead
- the group namepublic void setGroupToWrite(String rootName, String groupToWrite)
rootName
- the root namegroupToRead
- the group namepublic String[] getRoots()
public boolean isRoot(String rootName)
rootName
- the root nametrue
if the roor already exists, false
otherwise.public String[] getGroupsToRead(String rootName)
rootName
- the root namepublic String[] getGroupsToWrite(String rootName)
rootName
- the root namepublic boolean isReadable(String rootName, String groupName)
rootName
- the root namegroupName
- the group nametrue
if the group has permission to read the root, false
otherwise.public boolean isWriteable(String rootName, String groupName)
rootName
- the root namegroupName
- the group nametrue
if the group has permission to write and delete the root, false
otherwise.public void associate(String threadName, String groupName, String agentName)
threadName
- the thread namegroupName
- the group nameagentName
- the agent namepublic String getGroup(String threadName)
threadName
- the thread namepublic String getAgentName(String threadName)
threadName
- the thread namepublic void removeAssociation(String threadName)
threadName
- the name of the thread to be excluded
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |