public class DefaultNode extends Object implements Node, Distributable, Serializable
Node
. This implementation allows all
optional fields to remain unspecified or to be changed.NetworkElement.Type
Modifier and Type | Field and Description |
---|---|
static NetworkElement.Type |
DEFAULT_TYPE
The default type for any node.
|
static int |
NODE_INTF_CHANGED |
static int |
NODE_LOC_CHANGED |
static int |
NODE_MAC_CHANGED |
static int |
NODE_TIMEOUT_CHANGED |
static int |
NODE_TS_CHANGED |
static int |
NODE_UNCHANGED
Fields that can change for node
|
Constructor and Description |
---|
DefaultNode(NodeId id)
Constructs a node with all optional values unspecified.
|
DefaultNode(NodeId id,
SupplierId supplierId,
Interface netIntf,
MacAddress mac,
NodeLocation loc,
long timeout)
Constructs a node with the given parameters.
|
Modifier and Type | Method and Description |
---|---|
boolean |
check(NodeInfo info)
Deprecated.
|
int |
detectChanges(NodeInfo info)
Detects which fields have changed between this node and the supplied info.
|
boolean |
equals(Object obj) |
int |
hashCode() |
NodeId |
id()
Returns the globally-unique identifier of this node.
|
IpAddress |
ip()
Returns the IPv4 or IPv6 address of this node.
|
NodeLocation |
location()
Returns the most recent node location.
|
MacAddress |
mac()
Returns the MAC address of this node.
|
int |
modify(NodeInfo info)
Modifies this node by applying the given information.
|
String |
name()
Returns the friendly name of the network element.
|
Interface |
netInterface()
Returns the network interface through which the node attaches to the
network.
|
List<NodeLocation> |
recentLocations()
Returns the list of recent node locations.
|
SegmentId |
segmentId()
Returns the network segment id on which this node has been discovered.
|
DefaultNode |
setLocation(NodeLocation loc)
Sets the most recent node location.
|
DefaultNode |
setMac(MacAddress mac)
Sets the node MAC address.
|
DefaultNode |
setNetInterface(Interface intf)
Sets the node network interface.
|
DefaultNode |
setSupplierId(SupplierId supplierId)
Sets the node supplier ID.
|
DefaultNode |
setTimeout(long timeout)
Sets the node timeout.
|
SupplierId |
supplierId()
Returns the id of the supplier that provided this model entity.
|
long |
timeout()
Returns the original time offset (in seconds) after which the node would
be removed.
|
String |
toDebugString()
Provides a little more detailed information about this object.
|
String |
toString() |
NetworkElement.Type |
type()
Returns the network element type, e.g.
|
boolean |
update(NodeInfo info)
Deprecated.
|
public static final NetworkElement.Type DEFAULT_TYPE
public static final int NODE_UNCHANGED
public static final int NODE_INTF_CHANGED
public static final int NODE_MAC_CHANGED
public static final int NODE_LOC_CHANGED
public static final int NODE_TS_CHANGED
public static final int NODE_TIMEOUT_CHANGED
public DefaultNode(NodeId id)
id
- node IDpublic DefaultNode(NodeId id, SupplierId supplierId, Interface netIntf, MacAddress mac, NodeLocation loc, long timeout)
NodeId
is a required field, all other fields are optional. Optional fields
should be specified with their default value if they are unknown.
All default values are null, except for the timeout which defaults to 0.id
- node IDsupplierId
- node supplier IDnetIntf
- node network interfacemac
- node MAC addressloc
- node locationtimeout
- node timeout value (in seconds)public NodeId id()
Node
id
in interface NetworkElement
id
in interface Node
public IpAddress ip()
Node
public SegmentId segmentId()
Node
public String name()
NetworkElement
name
in interface NetworkElement
public NetworkElement.Type type()
NetworkElement
type
in interface NetworkElement
public SupplierId supplierId()
Model
supplierId
in interface Model
public DefaultNode setSupplierId(SupplierId supplierId)
supplierId
- node supplier IDpublic Interface netInterface()
Node
Device
to which the node is attached.netInterface
in interface Node
public DefaultNode setNetInterface(Interface intf)
intf
- node network interfacepublic MacAddress mac()
Node
public DefaultNode setMac(MacAddress mac)
mac
- node MAC addresspublic NodeLocation location()
Node
public List<NodeLocation> recentLocations()
Node
recentLocations
in interface Node
public DefaultNode setLocation(NodeLocation loc)
loc
- node locationpublic long timeout()
Node
public DefaultNode setTimeout(long timeout)
timeout
- node timeout@Deprecated public boolean update(NodeInfo info)
Node
@Deprecated public boolean check(NodeInfo info)
Node
Node.update(NodeInfo)
without modifying this object.public int detectChanges(NodeInfo info)
info
- node infopublic int modify(NodeInfo info)
info
- given node informationpublic String toDebugString()
Copyright © 2015. All Rights Reserved.