com.h3c.sdn.misc.dsync.net

## Class BroadcastTreeSyncObj

- java.lang.Object
- - com.h3c.sdn.misc.dsync.AbstractSyncObj<BroadcastTreeSyncObj>
  - - com.h3c.sdn.misc.dsync.net.BroadcastTreeSyncObj

- All Implemented Interfaces:
    TopologyTree, SyncObj<BroadcastTreeSyncObj>, Serializable

      public class BroadcastTreeSyncObj
      extends AbstractSyncObj<BroadcastTreeSyncObj>
      implements TopologyTree

  A sync object for encoding and decoding `BroadcastTree` objects. for high availability.
  Author:
    Anshul Awasthi, Prashant Nayak
  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `ROOT`
    `static String` | `ROOTS`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `BroadcastTreeSyncObj()`
    `BroadcastTreeSyncObj(HashMap<DataPathId,Link> links, HashMap<DataPathId,Integer> costs)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `SyncObj` | `decode(com.fasterxml.jackson.databind.node.ObjectNode jsonNode)` Convert a given raw ObjectNode to required SyncObject.
    `com.fasterxml.jackson.databind.node.ObjectNode` | `encode(com.fasterxml.jackson.databind.node.ObjectNode rawNode)` Stuffs an empty ObjectNode with desired form of the SyncObj.
    `int` | `getCost(DataPathId dataPathId)` Provides cost associated a node in the tree.
    `HashMap<DataPathId,Integer>` | `getCosts()` Provides All nodes and associated cost in the tree.
    `HashMap<DataPathId,Link>` | `getLinks()` Provides All nodes and associated Links in the tree.
    `Link` | `getTreeLink(DataPathId node)` Adds a node and associated Link to the tree.

    - ### Methods inherited from class com.h3c.sdn.misc.dsync.AbstractSyncObj

      `isNull, mapper, marshal, unmarshal`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### ROOT

          public static final String ROOT

      See Also:
        Constant Field Values

    - #### ROOTS

          public static final String ROOTS

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### BroadcastTreeSyncObj

          public BroadcastTreeSyncObj()

    - #### BroadcastTreeSyncObj

          public BroadcastTreeSyncObj(HashMap<DataPathId,Link> links,
                              HashMap<DataPathId,Integer> costs)

  - ### Method Detail

    - #### decode

          public SyncObj decode(com.fasterxml.jackson.databind.node.ObjectNode jsonNode)

      Description copied from class: `AbstractSyncObj`
      Convert a given raw ObjectNode to required SyncObject.
      Specified by:
        `decode` in class `AbstractSyncObj<BroadcastTreeSyncObj>`
      Parameters:
        `jsonNode` - the raw ObjectNode synthesized from the bytes retrieved from the HA infrastructure.
      Returns:
        the decoded SyncObject

    - #### encode

          public com.fasterxml.jackson.databind.node.ObjectNode encode(com.fasterxml.jackson.databind.node.ObjectNode rawNode)

      Description copied from class: `AbstractSyncObj`
      Stuffs an empty ObjectNode with desired form of the SyncObj. at this point.
      Specified by:
        `encode` in class `AbstractSyncObj<BroadcastTreeSyncObj>`
      Parameters:
        `rawNode` - the empty ObjectNode that needs to be built on.
      Returns:
        the fully dressed ObjectNode that represents the SyncObj.

    - #### getCosts

          public HashMap<DataPathId,Integer> getCosts()

      Description copied from interface: `TopologyTree`
      Provides All nodes and associated cost in the tree.
      Specified by:
        `getCosts` in interface `TopologyTree`
      Returns:
        HashMap of nodes and its cost

    - #### getLinks

          public HashMap<DataPathId,Link> getLinks()

      Description copied from interface: `TopologyTree`
      Provides All nodes and associated Links in the tree.
      Specified by:
        `getLinks` in interface `TopologyTree`
      Returns:
        HashMap of nodes and its Link

    - #### getCost

          public int getCost(DataPathId dataPathId)

      Description copied from interface: `TopologyTree`
      Provides cost associated a node in the tree.
      Specified by:
        `getCost` in interface `TopologyTree`
      Parameters:
        `dataPathId` - Id of the device
      Returns:
        Cost

    - #### getTreeLink

          public Link getTreeLink(DataPathId node)

      Description copied from interface: `TopologyTree`
      Adds a node and associated Link to the tree.
      Specified by:
        `getTreeLink` in interface `TopologyTree`
      Parameters:
        `node` - Id of the device to be added to tree
      Returns:
        link Link associated to the new node to be added

Copyright © 2014. All Rights Reserved.