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 NavuContext(Cdb) or NavuContext(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
    • getCdb

      @Deprecated public Cdb getCdb()
      Deprecated.
      This method is deprecated, use getBackingStoreCdb() instead
      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
    • currentCdbSession

      @Deprecated public CdbSession currentCdbSession()
      Deprecated.
      This method is deprecated, use getBackingStoreCdbSession() instead
      Returns:
      backing store CdbSession if applicable
    • 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.
    • getReadOnlyMaapi

      @Deprecated public Maapi getReadOnlyMaapi()
      Deprecated.
      This method is deprecated. The readOnly Maapi is not used and therefore obsolete.
      Returns:
      the read only maapi.
    • getMaapiReadOnlyHandle

      @Deprecated public int getMaapiReadOnlyHandle()
      Deprecated.
      This method is deprecated. The readOnly Maapi transaction is not used and therefore obsolete.
      Returns:
      the read only transaction id.
    • 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 NavuContext(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
    • getCdbSession

      @Deprecated public CdbSession getCdbSession(CdbDBType dbType)
      Deprecated.
      This method is deprecated. Use one of getReadConfSession(), getReadConfSession() or getWriteOperSession() instead. Get Cdb session for the specified database for reading purposes.
      Parameters:
      dbType -
      Returns:
      a CDB session.
    • getCdbSession

      @Deprecated public CdbSession getCdbSession(CdbDBType type, EnumSet<CdbLockType> lock)
      Deprecated.
      This method is deprecated. Use one of getReadConfSession(), getReadConfSession() or getWriteOperSession() instead.
      Parameters:
      type -
      lock -
      Returns:
      a CDB session.
    • getCdbOperSession

      @Deprecated public CdbSession getCdbOperSession()
      Deprecated.
      This method is deprecated. Use one of getReadConfSession(), getReadConfSession() or getWriteOperSession() instead. Return a CDB oper session.
      Returns:
      current Cdb oper session
    • getCdbOperSession

      @Deprecated public CdbSession getCdbOperSession(EnumSet<CdbLockType> lock)
      Deprecated.
      This method is deprecated. Use one of getReadConfSession(), getReadConfSession() or getWriteOperSession() instead. Return a CDB oper session with a lock.
      Parameters:
      lock - The locktype for this cdb session
      Returns:
      cdb oper session with lock of locktype
    • 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()
    • setLockingMode

      @Deprecated public void setLockingMode(boolean enable)
      Deprecated.
      This method is deprecated Use {link setWriteOperLocks(EnumSet) instead. If enabled = true, this method will add CdbLockType.LOCK_WAIT to the lockset of an CDB Oper Sessions. If false it will remove the same lock from the lockset.
      Parameters:
      enable - wait_lock if true.
    • toString

      public String toString()
      Overrides:
      toString in class Object