Package com.tailf.dp

Class DpTrans

Object
Thread
com.tailf.dp.DpTrans
All Implemented Interfaces:
Runnable
Direct Known Subclasses:
DpActionTrans, DpValidateTrans

public class DpTrans extends Thread
The transaction context. Each transaction is running in separate thread.
See Also:
  • Method Details

    • getDp

      public Dp getDp()
      Return the data provider (DP) instance that this transaction belongs to.
      Returns:
      Data provider instance
    • getTransaction

      public int getTransaction()
      Return the current transaction handle.
      Returns:
      transaction handle
    • getSocket

      public Socket getSocket()
      Return the worker socket socket. A default is allocated by Dp, but this can be changed with setSocket from the init callback (e.g before the socket is connected to Conf)
    • getMode

      public int getMode()
      The mode. Is always either Conf.MODE_READ or Conf.MODE_READ_WRITE
    • getDBName

      public int getDBName()
      The database name. Is always either of:
    • getUserInfo

      public DpUserInfo getUserInfo()
      The user information.
    • getTransactionUserOpaque

      public Object getTransactionUserOpaque()
      Get method for User owned opaque data. This field is meant to be used by the user so that we easily can pass data between our Data callbacks and out transaction callbacks. Typically in the Transaction init() callback, we open a database handle which is the later used by the various DataProvider callbacks such as getElem() and setElem()
    • setTransactionUserOpaque

      public void setTransactionUserOpaque(Object opaque)
      Set method for User owned opaque data. This field is meant to be used by the user so that we easily can pass data between our Data callbacks and our transaction callbacks. Typically in the Transaction init() callback, we open a database handle which is the later used by the various DataProvider callbacks such as getElem() and setElem()
      Parameters:
      opaque -
    • getOpaque

      public String getOpaque()
      If the tailf:opaque substatement has been used with the tailf:callpoint statement in the data model, the argument string is made available to the callbacks via this method
    • getSecondaryIndex

      public long getSecondaryIndex()
      Secondary index. When specified in get-next operations the provider needs to sort objects on this named secondary-index.
    • isHideInactive

      public boolean isHideInactive()
      hideInactive flag. Set to true if inactive element is not present.
    • getDevNo

      public int getDevNo()
      for ConfM The device number (needs to be public since access from Maapi package)
    • getDeviceType

      public int getDeviceType()
      for ConfM The device type (needs to be public since access from Maapi package)
    • setSocket

      public void setSocket(Socket sock)
      A possibility to give a specified worker socket for the transaction. The default worker socket is otherwise allocated by Dp when the transaction is created. Only use this method from within the DpTransCallback.init() method.

      If this option is used the Socket needs to be connected to ConfD/NCS.

      Parameters:
      sock - A socket connected to ConfD/NCS.
    • getWorkerSocket

      public Socket getWorkerSocket()
    • honorFilter

      public void honorFilter(boolean h)
      Tell the server whether the currently requested filtering is being honored or not. Only use this method from within one of the DpDataCallback.iterator() methods. If this method is not called, the server will assume that the filter was not honored.
      Parameters:
      h - whether or not the filter is being honored
    • run

      public void run()
      Runs the thread.
      Specified by:
      run in interface Runnable
      Overrides:
      run in class Thread
    • getNsList

      public ArrayList<ConfNamespace> getNsList()
      Returns the namespace list stored by the data provider.
    • accumulated

      public Iterator<DpAccumulate> accumulated()
      Returns an iterator for the accumulated objects.
    • dataSetTimeout

      public void dataSetTimeout(int timeoutSeconds) throws IOException, DpCallbackException
      A data callback should normally complete "quickly", since e.g. the execution of a show command in the CLI may require many data callback invocations. Thus it should be possible to set the /confdConfig/capi/queryTimeout in confd.conf such that it covers the longest possible execution time for any data callback. In some rare cases it may still be necessary for a data callback to have a longer execution time, and then this function can be used to extend (or shorten) the timeout for the current callback invocation. The timeout is given in seconds from the point in time when the function is called.
      Parameters:
      timeoutSeconds - timeout in seconds
      Throws:
      IOException
      DpCallbackException