OSB_LIB::NetworkManager Class Reference

Collaboration diagram for OSB_LIB::NetworkManager:

Collaboration graph
[legend]
List of all members.

Detailed Description

Manager of all networks.

Definition at line 1091 of file network.h.

Public Types

Guard types

Public Member Functions

Read access to data members
Network maintenace
Lock maintenace
Timezone operations.

Private Member Functions

Private Attributes


Member Typedef Documentation

typedef ReadGuard<Network*> OSB_LIB::NetworkManager::NetworkRg

Read guard for one network.

Definition at line 1096 of file network.h.

typedef ReadGuard<Networks*> OSB_LIB::NetworkManager::NetworksRg

Read guard for the network list.

Definition at line 1098 of file network.h.

typedef RwGuard OSB_LIB::NetworkManager::NetworksWg

Write guard for the network list.

Remarks:
Because only the network manager may get a write guard for all networks, there is no need to provide the pointer to the list within the guard.

Definition at line 1109 of file network.h.

typedef WriteGuard<Network*> OSB_LIB::NetworkManager::NetworkWg

Write guard for one network.

Definition at line 1100 of file network.h.


Constructor & Destructor Documentation

OSB_LIB::NetworkManager::NetworkManager (  ) 

Default Constructor.


Member Function Documentation

bool OSB_LIB::NetworkManager::addNetwork ( OSB_DB::Session session,
Network net 
)

Creates a new network in the database.

This method will write lock the whole list of network.
Add a network entry to the database. Also add it to the network list. The object id and object version will be set if insertion success.
Session will be committed if successful.

Parameters:
session The database session.
net The new network (oid not set).
Returns:
True if the network was created to the database.
Exceptions:
OsbException 
  • can not lock the mutex
  • as specified by the gateway class (see there).

bool OSB_LIB::NetworkManager::delNetwork ( OSB_DB::Session session,
const Network::Oid oid 
)

Deletes a network from the database.

This method will write lock the whole list of network.
This will delete an entry from the database, also delete it from the network list. Session will be committed if successful.

Parameters:
session The database session.
oid Network to delete.
Returns:
True if the network was deleted from the database.
Exceptions:
OsbException 
  • can not lock the mutex
  • network is not found in the list
  • as specified by the gateway class (see there).

const Network* OSB_LIB::NetworkManager::findNetwork ( const Network::Oid oid  )  const

Find the network based on the given oid.

Parameters:
oid Object id of the network.
Returns:
Pointer to the found network,
NULL pointer if network can not be found.

const Network& OSB_LIB::NetworkManager::getNetwork ( const Network::Oid oid  )  const

Get the network based on the given oid.

Parameters:
oid Object id of the network.
Returns:
Reference to the found network.
Exceptions:
ObjectNotFound 

const TimeZone& OSB_LIB::NetworkManager::getTimeZone ( const TimeZone::Oid oid  )  const

Return the timezone for the given object id.

This will compare the given timezone id with the ids in the timezone container. If the given id is matched then it will return the reference to the timezone object else throw the exception.

Parameters:
oid Unique identifier of the timezone.
Exceptions:
ObjectNotFound 
Returns:
TimeZone reference for the given timezone id.

const TimeZones& OSB_LIB::NetworkManager::getTimeZones (  )  const

Return the timezones.

Returns:
Reference to the list of TimeZone

const TrunkGroup& OSB_LIB::NetworkManager::getTrkGroup ( const Id< TrunkGroup > &  tgId  )  const

Find a trunk group by its id.

Parameters:
tgId Id of the trunk group to find.
Exceptions:
ObjectNotFound 
Returns:
Reference to the found trunk group.

Network* OSB_LIB::NetworkManager::network ( const Network::Oid oid  ) 

Get the writable network based on the given oid.

Parameters:
oid Object id of network.
Returns:
Pointer to network if found,
else 0.

const Networks& OSB_LIB::NetworkManager::networks (  )  const [inline]

Definition at line 1117 of file network.h.

References networks_.

NetworkRg OSB_LIB::NetworkManager::readLock ( const Network::Oid oid  ) 

Read-lock a network by its object id.

Parameters:
oid Object id of the network.
Returns:
Read guard for this locked network.
Exceptions:
OsbException 
  • can not lock the mutex
  • can not find this network.

NetworksRg OSB_LIB::NetworkManager::readLockList (  ) 

Read-lock all networks.

Returns:
Read guard for all locked networks.
Exceptions:
OsbException 
  • Can not lock the mutex.

long OSB_LIB::NetworkManager::readNetworks ( const OSB_DB::Session session  ) 

Get all networks.

Load all networks from database and store them to the list.

Parameters:
session Database session to use.
Returns:
Number of objects loaded.
Exceptions:
OsbException 
  • as specified by the gateway class (see there).

long OSB_LIB::NetworkManager::readTimeZones ( const OSB_DB::Session session  ) 

Read all timezone.

Load all the timezone from the database.

Parameters:
session Database session to use.

void OSB_LIB::NetworkManager::sortNetworkByName ( bool  desc = false  ) 

Sort networks by name.

Parameters:
desc Flag to sort in descending (true) or ascending (false) order.

bool OSB_LIB::NetworkManager::updNetwork ( OSB_DB::Session session,
Network net 
)

Update a network to the database.

This method will write lock the network object.
Update network to the database. Also update it to the network list. The object version will be update if success.
Session will be committed if successful.

Parameters:
session The database session.
net Network to update.
Returns:
True if the network was updated to the database.
Exceptions:
OsbException 
  • can not lock the mutex
  • can not find this network.
  • as specified by the gateway class (see there).

NetworkWg OSB_LIB::NetworkManager::writeLock ( const Network::Oid oid  ) 

Write-lock a network by its object id.

Parameters:
oid Object id of the network.
Returns:
Write guard for this locked network.
Exceptions:
OsbException 
  • can not lock the mutex
  • can not find this network.

NetworksWg OSB_LIB::NetworkManager::writeLockList (  )  [private]

Write-lock the list of all networks.


Member Data Documentation

RwMutex OSB_LIB::NetworkManager::mutex_ [private]

Mutex for network and networks.

Definition at line 1325 of file network.h.

Networks OSB_LIB::NetworkManager::networks_ [private]

Master list of networks.

Definition at line 1323 of file network.h.

Referenced by networks().

TimeZones OSB_LIB::NetworkManager::timezones_ [private]

list of all timezone.

Definition at line 1327 of file network.h.


The documentation for this class was generated from the following file:
Generated on Sat Sep 2 14:11:49 2006 for OSB Library by  doxygen 1.4.7