Class NavuContextBase

Object
com.tailf.navu.NavuContextBase
Direct Known Subclasses:
NavuContext

public abstract class NavuContextBase extends Object
This class is the base class for NavuContext. It many contains methods for handling CDB type contexts i.e contexts created by the NavuContextBase(Cdb) or NavuContextBase(CdbSession) constructors. Note, that instead of using CDB type contexts it is possible to instead use the NavuContext(Maapi) constructor followed by a call of NavuContext.startOperationalTrans(int)
  • Field Details

  • Method Details

    • setOption

      public void setOption(NavuContextBase.UnSetCaseInChoice unSetChoiceInCase)
      Set the behavior of how a unset case in choice should be treated.
      Parameters:
      unSetChoiceInCase - the specified option for behavior of unset case in choice
    • set

      public void set(NavuContextBase context)
      Set the context attributes using another context object.

      This this operation will make an abrupt change in connection type, transactions etc. Therefore it is the responsibility of the user to handle open transactions, locks, socket or any other resources that otherwise will be left orphaned.

      Note, that the context is normally set at the creation of the NAVU root node. The context is then shared between all child nodes and a change of context attributes will therefore affect all nodes in the current NAVU tree. This implies that data can become stale between maapi transactions or cdb locks and the it is the responsibility of the user to handle when and how stale data should be dismissed.

      Parameters:
      context -
    • getMaapi

      public Maapi getMaapi()
      Getter for MAAPI
      Returns:
      current Maapi object
    • getBackingStoreCdb

      public Cdb getBackingStoreCdb()
      Get the backing store Cdb instance. The backing store Cdb is actually never used, instead it is used as primary for the internal NavuCdbSessionPool. The reason for this is that NAVU needs several CdbSessions concurrently and a Cdb instance can only hold one open CdbSession
      Returns:
      backing store Cdb if applicable for this context
    • getBackingStoreCdbSession

      public CdbSession getBackingStoreCdbSession()
      Get the backing store CdbSession in this context was based on this. Otherwise this method returns null. Creating a context based on a CdbSession is an alternative to creating context based on a Cdb instance. If the CdbSession option is used, this session will be the backing store session and also its related Cdb instance is retrieved and stored as backing store Cdb instance. This CdbSession is never used by NAVU, instead it is primary for the internal NavuCdbSessionPool.
      Returns:
      backing store CdbSession if applicable for this context
    • getMaapiHandle

      public int getMaapiHandle()
      Getter for MAAPI transaction handle.
      Returns:
      current maapi transaction handle
    • isMaapi

      public boolean isMaapi()
      Returns:
      true if the a Maapi context.
    • isCdbSession

      public boolean isCdbSession()
    • isCdb

      public boolean isCdb()
    • hasCdbSubscriber

      public boolean hasCdbSubscriber()
    • getCdbSubscriber

      public CdbSubscription getCdbSubscriber()
    • getNsList

      public ArrayList<ConfNamespace> getNsList()
      Returns:
      registered namespaces.
    • setReadOperLocks

      public void setReadOperLocks(EnumSet<CdbLockType> locks)
      Sets the locks for a read CDB operational data session Default is no locks.
      Parameters:
      locks -
    • setReadConfLocks

      public void setReadConfLocks(EnumSet<CdbLockType> locks)
      Sets the locks for a read CDB configuration data session Default is no locks.
      Parameters:
      locks -
    • setWriteOperLocks

      public void setWriteOperLocks(EnumSet<CdbLockType> locks)
      Sets the locks for a write CDB operational data session Default is EnumSet.of(CdbLockType.LOCK_REQUEST,CdbLockType.LOCK_PARTIAL)
      Parameters:
      locks -
    • getReadOperSession

      public CdbSession getReadOperSession()
      Retrieves a CdbSession for reading CDB_OPERATIONAL database with the default locks if not defined by setReadOperLocks(EnumSet)
      Returns:
      CdbSession
    • getReadConfSession

      public CdbSession getReadConfSession()
      If the context is created with NavuContextBase(CdbSession) this session will be returned. Otherwise retrieves a CdbSession for reading CDB_RUNNING database with the default locks if not defined by setReadConfLocks(EnumSet)
      Returns:
      CdbSession
    • getWriteOperSession

      public CdbSession getWriteOperSession()
      Retrieves a CdbSession for writing CDB_OPERATIONAL database with the default locks if not defined by setWriteOperLocks(EnumSet)
      Returns:
      CdbSession
    • removeCdbSessions

      public void removeCdbSessions()
      Clears all the CDB sessions associates with the mapping between the the supplied Cdb socket and the ( in CDB mode )
    • isOnline

      public boolean isOnline()
    • toString

      public String toString()
      Overrides:
      toString in class Object