Package g4ds :: Module communitymanager_db :: Class CM_DB
[show private | hide private]
[frames | no frames]

Class CM_DB


Maintains the connection to the PostgreSQL database.
Method Summary
  __init__(self)
Initialises the CommunityManager Database Connector.
  addAlgorithmToCommunity(self, communityid, algorithmid)
Adds a algorithm to the given community.
  addCommunity(self, community, updateMemberRelations)
Adds a community to the communities table.
  addCommunityAuthorityRelation(self, communityid, memberid)
Adds an entry into the table for the relation between authorities (members) and communities.
  addCommunityMemberRelation(self, communityid, memberid)
Adds an entry into the table for the relation between members and communities.
  addGateway(self, memberid, sourcecommunityid, destinationcommunityid)
Adds a gateway relation to the database.
  addMember(self, member, updateCommunityRelations)
Adds a member to the members table.
  addProtocolToCommunity(self, communityid, protocolid)
Adds a protocol to the given community.
List of String getAlgorithmsForCommunity(self, communityid)
Fetch a list of algorithms linked to the given community.
List of String getAuthorisedCommunities(self, member_id)
Fetches the list of all communities, which the given member is an authority for.
c{List} of String getAuthoritiesOfCommunity(self, community_id)
Fetches the list of all member ids which are authorities for the given community.
List of communitymanager.Community getCommunities(self)
Fetch list of all communities from the database.
List of String getCommunitiesForMember(self, member_id)
Fetches list of all communities the given member is a member of.
List of communitymanager.CommunityGateway getGateways(self, memberid, communityid)
Fetch list of all gateways from the database.
List of communitymanager.Member getMembers(self)
Fetch list of all members from the database.
c{List} of String getMembersOfCommunity(self, community_id)
Fetches the list of all member id for the given community.
List of String getProtocolsForCommunity(self, communityid)
Fetch a list of protocols linked to the given community.
  shutdown(self)
Shutdown the database connection.
  updateCommunity(self, community, dropAuthorityRelations, dropGatewayRelations, dropMemberRelations, dropProtocols, dropAlgorithms)
Updates the entry for the community in the database.
  updateMember(self, member, updateCommunityRelations)
Updates the entry for the member in the database.

Instance Variable Summary
PSQL-DB-Connection _connection: Reference to database connection

Method Details

__init__(self)
(Constructor)

Initialises the CommunityManager Database Connector.

Initialises the connection to the database using the settings in the configuration file / module config. The connection itself is stored in a local variable.

addAlgorithmToCommunity(self, communityid, algorithmid)

Adds a algorithm to the given community.
Parameters:
communityid - ID of the community the algorithm shall be added to
           (type=String)
algorithmid - ID of the algorithm, which shall be added to the community
           (type=String)

addCommunity(self, community, updateMemberRelations=0)

Adds a community to the communities table.
Parameters:
community - Community to be written to the database
           (type=communitymanager.Community)
updateMemberRelations - Indicates, whether the relation to the members shall be stored too. Be careful, only apply true on one of the sides: either community or member. Otherwise, duplicate entries in the table for the relationships will be occurent.
           (type=Boolean)

addCommunityAuthorityRelation(self, communityid, memberid)

Adds an entry into the table for the relation between authorities (members) and communities.
Parameters:
communityid - ID of the community to put into relation
           (type=String)
memberid - ID of the member to put into relation as a authority for the given community
           (type=String)

addCommunityMemberRelation(self, communityid, memberid)

Adds an entry into the table for the relation between members and communities.
Parameters:
communityid - ID of the community to put into relation
           (type=String)
memberid - ID of the member to put into relation
           (type=String)

addGateway(self, memberid, sourcecommunityid, destinationcommunityid)

Adds a gateway relation to the database.
Parameters:
memberid - ID of the member employing the role as a gateway
           (type=String)
sourcecommunityid - ID of the community the messages are passed from
           (type=String)
destinationcommunityid - ID of the community the messages are passed to
           (type=String)

addMember(self, member, updateCommunityRelations=0)

Adds a member to the members table.
Parameters:
member - Member to be written to the database
           (type=communitymanager.Member)
updateCommunityRelations - Indicates, whether the relation to the communities shall be stored too. Be careful, only apply true on one of the sides: either community or member. Otherwise, duplicate entries in the table for the relationships will be occurent.
           (type=Boolean)

addProtocolToCommunity(self, communityid, protocolid)

Adds a protocol to the given community.
Parameters:
communityid - ID of the community the protocol shall be added to
           (type=String)
protocolid - ID of the protocol, which shall be added to the community
           (type=String)

getAlgorithmsForCommunity(self, communityid)

Fetch a list of algorithms linked to the given community.
Parameters:
communityid - ID of the community, the algorithms shall be returned for
           (type=String)
Returns:
List of ids for algorithms
           (type=List of String)

getAuthorisedCommunities(self, member_id)

Fetches the list of all communities, which the given member is an authority for.
Returns:
List of ids of communities
           (type=List of String)

getAuthoritiesOfCommunity(self, community_id)

Fetches the list of all member ids which are authorities for the given community.
Returns:
List of member ids
           (type=c{List} of String)

getCommunities(self)

Fetch list of all communities from the database.
Returns:
List with instances of all communities.
           (type=List of communitymanager.Community)

getCommunitiesForMember(self, member_id)

Fetches list of all communities the given member is a member of.
Returns:
List of community ids
           (type=List of String)

getGateways(self, memberid=None, communityid=None)

Fetch list of all gateways from the database.
Returns:
List with instances of all gateways.
           (type=List of communitymanager.CommunityGateway)

getMembers(self)

Fetch list of all members from the database.
Returns:
List with instances of all members.
           (type=List of communitymanager.Member)

getMembersOfCommunity(self, community_id)

Fetches the list of all member id for the given community.
Returns:
List of member ids
           (type=c{List} of String)

getProtocolsForCommunity(self, communityid)

Fetch a list of protocols linked to the given community.
Parameters:
communityid - ID of the community, the protocols shall be returned for
           (type=String)
Returns:
List of ids for protocols
           (type=List of String)

shutdown(self)

Shutdown the database connection.

updateCommunity(self, community, dropAuthorityRelations=1, dropGatewayRelations=1, dropMemberRelations=0, dropProtocols=1, dropAlgorithms=1)

Updates the entry for the community in the database.
Parameters:
community - Community instance to be updated
           (type=communitymanager.Community)
dropAuthorityRelations - Indicates, whether all relations for authorities shall be dropped
           (type=Boolean)
dropGatewayRelations - Indicates, whether all relations for gateways shall be dropped
           (type=Boolean)
dropMemberRelations - Indicates, whether all relations for members shall be dropped
           (type=Boolean)
dropProtocols - Indicates, whether all relations with protocols shall be dropped
           (type=Boolean)
dropAlgorithms - Indicates, whether all relations with algorithms shall be dropped
           (type=Boolean)

updateMember(self, member, updateCommunityRelations=0)

Updates the entry for the member in the database.

Instance Variable Details

_connection

Reference to database connection
Type:
PSQL-DB-Connection

Generated by Epydoc 2.0 on Sat Oct 22 22:52:47 2005 http://epydoc.sf.net