dana-i2cat/opennaas — pull request #98 by isartcanyameres (2012-04-03 07:35:58+00:00)
Title: Feature/synchronize ProtocolSessionManager's and Resource's lifecycle

Fixes issue http://jira.i2cat.net:8080/browse/OPENNAAS-255

ResourceRepository is now responsible of synchronizing resource lifecycle with protocolSessionManager one.
- It creates a protocolSessionManager for the resource when the resource is created.
- It destroys the protocolSessionManager for a resource, when the resource is removed.
- It also creates one session per registered context when a resource is started, if it does not already exists.
(This assures a single session per each registered context is available after starting the resource.)
- It also destroys all sessions of a resource when the resource is stopped.
(This assures no session is available after stopping the resource.)

This patch includes some refactoring in ProtocolManager and ProtocolSessionManager.
The refactor is mainly aesthetic, but changes interfaces, requiring changes in users of these classes.

This branch has been tested and all test have passed.