NavuContext(Cdb) and NavuContext(CdbSession)
constructors deprecated
In NSO 4.2 the NAVU has been changed to fully support writable
operational data transactions via MAAPI.
For this reason the NavuContext(Cdb) and NavuContext(CdbSession)
constructors has been deprecated.
The NavuCdbXXXSubscribers was deprecated in NSO 4.2 and finally
removed in NSO 5.1 and the strong
recommendation is to change these to plain Cdb subscribers and if
necessary in diff iterators make use of KeyPath2NavuNode.getNode()
to be able to reuse old NavuCdbDiffIterator code.
The following is an example on how to make these changes.
The prerequisite is an NavuCdbSubscriber that is used as an
application component in a package.
We start with the following code which is part of the
web-site-service example.
First change the use of the NavuCdbConfigDiffIterate interface to the
plain CdbDiffIterate interface instead:
Make use of a Cdb instance for the subscription and a Maapi instance for
a NavuContext that will be used in the iterate method.
We also define a requestStop flag to signal the finish of the subscription:
We remove the reference to the NavuCdbSubscriber:
In the application components init() method we start a user session for the
Maapi and define the cdb subscription.
The NavuCdbSubscribers registration is removed:
In the application components run() method we remove the
NavuCdbSubscriber start and replace it with a read loop for the plain
Cdb subscriber:
In the application components finish() method we set the requestStop flag,
finish the maapi user session and unregister the resources.
Here the ResourceManager.unregisterResources will close both the Cdb and
Maapi sockets.
We remove the earlier NavuCdbSubscriber stopping code:
We change the iterate method to the CdbDiffIterate interface:
In the iterate() method we make use of the KeyPath2NavuNode.getNode() to
obtain a NavuNode for the subscription entry:
In the iterate() method obtain the DiffIterateOperFlag and the
newValue directly and we change we need to return with the
DiffIterateResultFlag directly:
The resulting code should look the as the following: