Class NavuAction

Object
com.tailf.navu.NavuNode
com.tailf.navu.NavuAction

public class NavuAction extends NavuNode
This class represents a action modeled in the data model.

Although the NavuAction implements NavuNode the usage of this class only to call the action with given parameters and it is limited in functionality specifies in NavuNode.

  • Method Details

    • getChanges

      public List<NavuNode> getChanges(boolean emitSubtree, DiffIterateOperFlag... forOps) throws NavuException
      Description copied from class: NavuNode
      Since this method cannot return delete changes in a reliable way this method is deprecated. Use instead NavuNode.getChanges(NavuContext, boolean, DiffIterateOperFlag...)
      Overrides:
      getChanges in class NavuNode
      Throws:
      NavuException
    • getChanges

      public List<NavuNode> getChanges(NavuContext delContext, boolean emitSubtree, DiffIterateOperFlag... forOps) throws NavuException
      Description copied from class: NavuNode
      Return the descendant NavuNode including this NavuNode that has been affected by the current MAAPI transaction. Since deletes are already removed in current transactions a delete context is necessary to retrieve information about delete changes.

      The delContext is a NavuContext with a read transaction on the running database to read deletes. If null delete changes will not be able to be retrieved.

      The emitSubtree flag specified if the desired sub-tree should be included in the return set. If set to true then the behavior is to include the whole sub-tree of affected NavuNode's.

      If set to false the sibling NavuNode that has been affected by changes to the current transaction is to be included.

      The forOps argument specifies those specific changes that the NavuNode previously NavuNode's to be included filter out the set that does not match the specified arguments.

      Overrides:
      getChanges in class NavuNode
      Parameters:
      delContext - NavuContext to retrieve deleted values with.
      emitSubtree - boolean to control subtree changes
      forOps - operations for which changes are of interest.
      Returns:
      A list of NavuNode that has been affected by changes to the current MAAPI transaction.
      Throws:
      NavuException - if we try to iterate on a transaction which is in the wrong state and not attached or if delContext is the same as the NavuNode context.
    • xPathSelect

      public List<NavuNode> xPathSelect(String xPath) throws NavuException
      Description copied from class: NavuNode
      Evaluates the XPath path expression query and returns the resulting node set as list of NavuNode's.

      The expression query will be evaluated using this node as the context node.

      Example:

       NavuContainer =
       root.container(myns._somecontainer1)
           .container(myns._somecontainer2).container(myns._servers);
      
       // Retrieve all the entries of the server list "server"
       servers.xPathSelect("server");
      
       // Retrieve all child nodes of servers with srv-name = www1
       servers.xPathSelect("server[srv-name='www1']/*");
      
       // Retrieve all leaf ip nodes of servers with srv-name = www1
       servers.xPathSelect("server[srv-name='www1']/ip");
       
      Overrides:
      xPathSelect in class NavuNode
      Parameters:
      xPath - XPath 1.0 query
      Returns:
      a collection a nodes marching the query
      Throws:
      NavuException
    • getChanges

      public List<NavuNode> getChanges() throws NavuException
      Description copied from class: NavuNode
      Since this method cannot return delete changes in a reliable way this method is deprecated. Use instead NavuNode.getChanges(NavuContext)
      Overrides:
      getChanges in class NavuNode
      Throws:
      NavuException
    • getChanges

      public List<NavuNode> getChanges(NavuContext delcontext) throws NavuException
      Description copied from class: NavuNode
      Return the descendant NavuNode's (including this element) that has been affected by changes to the MAAPI transaction. Since deletes are already removed in current transactions a delete context is necessary to retrieve information about delete changes.

      The delContext is a NavuContext with a read transaction on the running database to read deletes. If null delete changes will not be able to be retrieved.

      The default behavior is to emit the affected descendant and include all the affected NavuNode's regardless of type of change.

      To filter out specific type of change use the methods NavuNode.getChanges(boolean, DiffIterateOperFlag...)

      Overrides:
      getChanges in class NavuNode
      Parameters:
      delcontext - NavuContext to retrieve deleted values with.
      Returns:
      A list of NavuNode's that has been affected by the changes to the current MAAPI transaction.
      Throws:
      NavuException - Is returned if we try to iterate on a transaction which is in the wrong state and not attached.
    • leaf

      public NavuLeaf leaf(Integer key) throws NavuException
      Description copied from class: NavuNode
      Returns a reference to a subordinate leaf with the hash value key.
      Overrides:
      leaf in class NavuNode
      Parameters:
      key - hashed name of the subordinate leaf
      Returns:
      reference to a subordinate container node
      Throws:
      NavuException - if the corresponding subordinate node is not a leaf node or if there is no subordinate node with the hash value key
    • leaf

      public NavuLeaf leaf(String leaf) throws NavuException
      Description copied from class: NavuNode
      Returns a reference to a subordinate leaf with the name key.
      Overrides:
      leaf in class NavuNode
      Parameters:
      leaf - the name of the subordinate leaf
      Returns:
      reference to a subordinate leaf node
      Throws:
      NavuException - if the corresponding subordinate node is not a leaf node or if there is no subordinate node with the name key
    • leaf

      public NavuLeaf leaf(String prefix, String leaf) throws NavuException
      Description copied from class: NavuNode
      Overrides:
      leaf in class NavuNode
      Throws:
      NavuException
    • leafList

      public NavuLeafList leafList(Integer key) throws NavuException
      Description copied from class: NavuNode
      Returns a reference to a subordinate leaf-list with the hash value key.
      Overrides:
      leafList in class NavuNode
      Parameters:
      key - hashed name of the subordinate leaf-list
      Returns:
      reference to a subordinate leaf-list node
      Throws:
      NavuException - if the corresponding subordinate node is not a leaf-list node or if there is no subordinate node with the hash value key
    • leafList

      public NavuLeafList leafList(String leafList) throws NavuException
      Description copied from class: NavuNode
      Returns a reference to a subordinate leaf-list with the name key.
      Overrides:
      leafList in class NavuNode
      Parameters:
      leafList - the name of the subordinate leaf-list
      Returns:
      reference to a subordinate leaf-list node
      Throws:
      NavuException - if the corresponding subordinate node is not a leaf-list node or if there is no subordinate node with the name key
    • leafList

      public NavuLeafList leafList(String prefix, String leafList) throws NavuException
      Description copied from class: NavuNode
      Overrides:
      leafList in class NavuNode
      Throws:
      NavuException
    • list

      public NavuList list(Integer key) throws NavuException
      Description copied from class: NavuNode
      Returns a reference to a subordinate list with the hash value key.
      Overrides:
      list in class NavuNode
      Parameters:
      key - the hashed name of the subordinate list
      Returns:
      reference to a subordinate list node
      Throws:
      NavuException - if the corresponding subordinate node is not a list node or if there is no subordinate node with the hash value key
    • list

      public NavuList list(String key) throws NavuException
      Description copied from class: NavuNode
      Returns a reference to a subordinate list with the name key.
      Overrides:
      list in class NavuNode
      Parameters:
      key - the name of the subordinate list
      Returns:
      reference to a subordinate list node
      Throws:
      NavuException - if the corresponding subordinate node is not a list node or if there is no subordinate node with the name key
    • list

      public NavuList list(String prefix, String key) throws NavuException
      Description copied from class: NavuNode
      Overrides:
      list in class NavuNode
      Throws:
      NavuException
    • container

      public NavuContainer container(Integer key) throws NavuException
      Description copied from class: NavuNode
      Returns a reference to a subordinate container with the hash value key. The container hash value can be obtained as a constant from a namespace file generated by confdc or ncsc, or retrieved with one of the methods ConfNamespace.stringToHash(String) or MaapiSchemas.stringToHash(String). It is also possible to access a container based on its name only, using the overloaded method NavuNode.container(String).
      Overrides:
      container in class NavuNode
      Parameters:
      key - hashed name of the container to return
      Returns:
      reference to a subordinate container node
      Throws:
      NavuException - if the corresponding subordinate node is not a container or if there is no subordinate node with the hash value key
    • container

      public NavuContainer container(String key) throws NavuException
      Description copied from class: NavuNode
      Returns a reference to a subordinate container with the name key.
      Overrides:
      container in class NavuNode
      Parameters:
      key - the name of the subordinate container
      Returns:
      reference to a subordinate container node
      Throws:
      NavuException - if the corresponding subordinate node is not a container node or if there is no subordinate node with the name key
    • container

      public NavuContainer container(String prefix, String key) throws NavuException
      Description copied from class: NavuNode
      Overrides:
      container in class NavuNode
      Throws:
      NavuException
    • getChanges

      public List<NavuNode> getChanges(boolean emitSubtree) throws NavuException
      Description copied from class: NavuNode
      Since this method cannot return delete changes in a reliable way this method is deprecated. Use instead NavuNode.getChanges(NavuContext, boolean)
      Overrides:
      getChanges in class NavuNode
      Throws:
      NavuException
    • getChanges

      public List<NavuNode> getChanges(NavuContext delcontext, boolean emitSubtree) throws NavuException
      Description copied from class: NavuNode
      Return the descendant NavuNode including this NavuNode that has been affected by the current MAAPI transaction. Since deletes are already removed in current transactions a delete context is necessary to retrieve information about delete changes.

      The delContext is a NavuContext with a read transaction on the running database to read deletes. If null delete changes will not be able to be retrieved.

      The emitSubtree flag specified if the desired sub-tree should be included in the return set. If set to true then the behavior is to include the whole sub-tree of affected NavuNode's.

      If set to false the sibling changes to the current transaction is to only included.

      Overrides:
      getChanges in class NavuNode
      Parameters:
      delcontext - NavuContext to retrieve deleted values with.
      emitSubtree - boolean to control subtree changes
      Returns:
      A list of NavuNode that has been affected by changes to the current MAAPI transaction.
      Throws:
      NavuException - Is returned if we try to iterate on changes on a transaction which is in the wrong state and not attached.
    • getNavuNode

      public NavuNode getNavuNode(ConfPath path) throws NavuException
      Description copied from class: NavuNode
      Retrieve a NavuNode based on the given absolute or relative path.

      If the path is relative it is relative this NavuNode .

      Overrides:
      getNavuNode in class NavuNode
      Returns:
      NavuNode pointed by path if it is absolute or if relative the NavuNode pointed by path relative this NavuNode
      Throws:
      NavuException - if the path is invalid according the schema or does not lead to a instance node.
    • encodeXML

      public List<ConfXMLParam> encodeXML() throws NavuException
      Description copied from class: NavuNode
      Encodes the sub-tree including the current NavuNode as the topmost NavuNode as a ConfXMLParam array.

      The returned ConfXMLParam array contains no values except for list keys. The leaf elements are encoded as ConfXMLParamLeaf. Therefore, the returning array can be used as a the input parameter to NavuNode.getValues(ConfXMLParam[]) on the current node's parent.

       NavuNode node = ...;
       ConfXMLParam[] cxa = node.encodeXML().toArray(new ConfXMLParam[0]);
       // cxa contains a structure that does not contain values except for
       // keys in list elements
      
       NavuNode parent = node.getParent();
       ConfXMLParam[] cxb = parent.getValues(cxa);
       // cxb contains the same sub-tree with all the values
       
      Specified by:
      encodeXML in class NavuNode
      Returns:
      A list of ConfXMLParam objects corresponding to the sub-tree of this node, with no values except list keys.
      Throws:
      NavuException
      See Also:
    • encodeValues

      public List<ConfXMLParam> encodeValues() throws NavuException
      Description copied from class: NavuNode
      Encodes the sub-tree including the current NavuNode as the topmost NavuNode as a ConfXMLParam array.

      As opposed to NavuNode.encodeXML(), the returned ConfXMLParam array does contain values in the form of ConfXMLParamValue

      Specified by:
      encodeValues in class NavuNode
      Returns:
      A list of ConfXMLParam objects corresponding to the sub-tree of this node, including all values.
      Throws:
      NavuException
      See Also:
    • getChangeFlag

      public DiffIterateOperFlag getChangeFlag()
      Returns the latest change that this NavuNode has been a subject to by a transaction.
      Overrides:
      getChangeFlag in class NavuNode
      Returns:
      Flag for the latest change
      See Also:
    • getInfo

      public NavuNodeInfo getInfo()
      Description copied from class: NavuNode
      Returns the NaveNodeInfo regarding this node.

      A NavuNodeInfo is an object which further information could be retrieved from the current node.

      Overrides:
      getInfo in class NavuNode
      Returns:
      A informational instance about this NavuNode
    • getKeyPath

      public String getKeyPath()
      Description copied from class: NavuNode
      Returns the absolute keypath of this node.
      Overrides:
      getKeyPath in class NavuNode
      Returns:
      A String representing the absolute keypath that this NavuNode
    • getName

      public String getName()
      Description copied from class: NavuNode
      Returns the name of this NavuNode.
      Overrides:
      getName in class NavuNode
      Returns:
      - the node name.
    • startCdbSession

      @Deprecated public void startCdbSession(CdbDBType dbtype, EnumSet<CdbLockType> lockflags)
      Deprecated.
      This method has been deprecated This method is a no op the internal session pool handles the session start
      Overrides:
      startCdbSession in class NavuNode
    • stopCdbSession

      public void stopCdbSession()
      Description copied from class: NavuNode
      Closes all CdbSessions for the NavuContainer. This is only necessary the case if the the NavuContainer was created with a constructor for CDB access. In such cases it is important to call this method as soon as the NavuContainer has been used. The reason for this is to release any locks on the CDB database as soon as possible. Calling this method several times under the life-cycle of the NavuContainer object is supported.
      Overrides:
      stopCdbSession in class NavuNode
    • getParent

      public NavuNode getParent()
      Description copied from class: NavuNode
      Returns the parent of the node.
      Overrides:
      getParent in class NavuNode
      Returns:
      - this node parent or null if this NavuNode represents the root node.
    • reset

      public void reset()
      Not supported does nothing
      Specified by:
      reset in class NavuNode
    • select

      public Collection<NavuNode> select(List<String> query) throws NavuException
      Not supported returns only an empty Collection
      Specified by:
      select in class NavuNode
      Parameters:
      query - a list of regular expression.
      Returns:
      a collection a nodes marching the query
      Throws:
      NavuException
    • select

      public Collection<NavuNode> select(String query) throws NavuException
      Not supported returns only an empty Collection
      Specified by:
      select in class NavuNode
      Parameters:
      query - a "/" separated regular expression.
      Returns:
      a collection a nodes marching the query
      Throws:
      NavuException
    • select

      public Collection<NavuNode> select(ConfObject[] query) throws NavuException
      Specified by:
      select in class NavuNode
      Parameters:
      query -
      Returns:
      a collection a nodes matching a Regular Expression query
      Throws:
      NavuException
    • getValues

      public ConfXMLParam[] getValues(String xml) throws NavuException
      Invokes or call an action defined in the data model (see tailf_yang_extensions(5)).

      The XML input value to this action is the eqvivalent ConfXMLParam[] structure.

      The retrn uarrays are the parameters for and results from the action, respectively, and use the ConfXMLParam.

      Overrides:
      getValues in class NavuNode
      Parameters:
      xml - XML string representation as the input values to this action
      Throws:
      NavuException
      See Also:
    • getValues

      public ConfXMLParam[] getValues(ConfXMLParam[] param) throws NavuException
      Invokes or call an action defined in the data model (see tailf_yang_extensions(5)). The params and values arrays are the parameters for and results from the action, respectively, and use the ConfXMLParam.
      Overrides:
      getValues in class NavuNode
      Parameters:
      param - pre-populated array of ConfXMLParam
      Returns:
      Array of ConfXMLParam where ConfXMLParamLeaf is replaced with ConfXMLParamValue
      Throws:
      NavuException - If the input parameter does not conform to the current data model or an error occurs during the read.
    • setChange

      public NavuNode setChange(List<ConfObject> kp, DiffIterateOperFlag op, ConfValue oldValue, NavuContext delContext) throws NavuException
      Sets the change type on a node.
      Parameters:
      kp -
      op -
      oldValue -
      Returns:
      the actual NavuNode that was updated.
      Throws:
      NavuException
    • children

      public Collection<NavuNode> children() throws NavuException
      Return the children of this node.
      Overrides:
      children in class NavuNode
      Returns:
      children of this node
      Throws:
      NavuException
    • valueUpdateInd

      public void valueUpdateInd(NavuNode child)
    • getCdbSession

      @Deprecated public CdbSession getCdbSession(CdbDBType dbType)
      Deprecated.
      This method is deprecated. Use one of NavuContextBase.getReadConfSession(), NavuContextBase.getReadConfSession() or NavuContextBase.getWriteOperSession() instead. Returns the current cdbSession.
      Overrides:
      getCdbSession in class NavuNode
      Returns:
      current cdbSession().
    • context

      public NavuContext context()
      Returns the current NavuContext that this node is attached to.
      Overrides:
      context in class NavuNode
      Returns:
      current cdbSession().
    • getRootNS

      public ConfNamespace getRootNS()
      Returns the root namespace of the topmost ancestor.
      Overrides:
      getRootNS in class NavuNode
      Returns:
      topmost namespace.
    • call

      public ConfXMLParam[] call() throws NavuException
      Issues an action with empty parameters
      Returns:
      result from this action call
      Throws:
      NavuException
    • call

      public ConfXMLParam[] call(ConfXMLParam[] params) throws NavuException
      Issues an action call with given parameters
      Parameters:
      params - parameters to the action call
      Throws:
      NavuException - if the NavuContext is not created with Maapi
    • call

      public ConfXMLParam[] call(String xml) throws NavuException
      Issues an action call with given parameter
      Parameters:
      xml - parameters as corresponding xml string data
      Throws:
      NavuException
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object o)
      Compares the specified object with this NavuAction for equality. Returns true if the given object is also a NavuAction and it has the same ConfPath as this NavuAction.
      Specified by:
      equals in class NavuNode
      Parameters:
      o - the object to be compared for equality with this NavuAction
      Returns:
      true if the specified object is equal to this NavuAction
    • exists

      public boolean exists() throws NavuException
      Description copied from class: NavuNode
      Generic exists test for Navu navigational elements
      Specified by:
      exists in class NavuNode
      Returns:
      boolean
      Throws:
      NavuException