public class NodeIdentity extends Object
A list of former identities is retained to aid in migrating from the former identity to the new identity.
Currently the storageIdentity is a randomly generated UUID, that is also used for backwards compatibility with JMRI 4.14. If we find a reliable cross-platform mechanism to tie that to the machine's unique identity (from the CPU or motherboard), not from a NIC, this may change. If a JMRI 4.14 generated UUID is available, it is retained and used as the storageIdentity.
Modifier and Type Method Description
formerIdentities()If network hardware on a node was replaced, the identity will change.
networkIdentity()Return the node's current network identity.
storageIdentity()Return the node's current storage identity for the active profile.
storageIdentity(Profile profile)Return the node's current storage identity.
protected static UUID
uuidFromCompactString(String compact)Decodes the original UUID from a 22 character string generated by
protected static String
uuidToCompactString(UUID uuid)Encodes a UUID into a 22 character URL compatible string.
Return the node's current network identity. For historical purposes, the network identity is also referred to as the node or node identity.
- A network identity. If this identity is not in the form
jmri-MACADDRESS-profileId, or if
MACADDRESSis a multicast MAC address, this identity should be considered unreliable and subject to change across JMRI restarts. Note that if the identity is in the form
jmri-MACADDRESSthe JMRI instance has not loaded a configuration profile, and the network identity will change once that a configuration profile is loaded.
Return the node's current storage identity for the active profile. This is a convenience method that calls
storageIdentity(Profile)with the result of
- A storage identity.
- See Also:
Return the node's current storage identity. This can be used in networked file systems to ensure per-computer storage is available.
Note this only ensure uniqueness if the preferences path is not shared between multiple computers as documented in
FileUtil.getPreferencesPath()(the most common cause of this would be sharing a user's home directory in its entirety between two computers with similar operating systems as noted in getPreferencesPath()).
profile- The profile to get the identity for. This is only needed to check that the identity should not be in an older format.
- A storage identity. If this identity is not in the form of a UUID
jmri-UUID-profileId, this identity should be considered unreliable and subject to change across JMRI restarts. When generating a new storage ID, the form is always a UUID and other forms are used only to ensure continuity where other forms may have been used in the past.
If network hardware on a node was replaced, the identity will change.
- A list of other identities this node may have had in the past.
Encodes a UUID into a 22 character URL compatible string. This is used to store the UUID in a manner compatible with JMRI 4.14.
From an example by Tom Lobato.
uuid- the UUID to encode
- the 22 character string
Decodes the original UUID from a 22 character string generated by
uuidToCompactString. This is used to store the UUID in a manner compatible with JMRI 4.14.
compact- the 22 character string
- the original UUID
- the former identities; this is a combination of former network and storage identities