public class DceSecurityUuidCreator extends TimeBasedUuidCreator
Standard local domains: - Local Domain Person (POSIX UserID domain): 0 - Local Domain Group (POSIX GroupID domain): 1 - Local Domain Org: 2
| Modifier and Type | Class and Description |
|---|---|
protected class |
DceSecurityUuidCreator.DCESTimestampCounter
Class used to keep a counter to simulate minimize repetition.
|
| Modifier and Type | Field and Description |
|---|---|
static byte |
LOCAL_DOMAIN_GROUP |
static byte |
LOCAL_DOMAIN_ORG |
static byte |
LOCAL_DOMAIN_PERSON |
protected byte |
localDomain |
protected TimeBasedUuidCreator |
timeBasedUUIDCreator |
protected DceSecurityUuidCreator.DCESTimestampCounter |
timestampCounter |
clockSequenceStrategy, nodeIdentifierStrategy, timestampStrategyNIL_UUID, RFC4122_VARIANT_BITS, RFC4122_VERSION_BITS, version| Constructor and Description |
|---|
DceSecurityUuidCreator()
Facoty that creates DCE Security UUIDs, version 2.
|
| Modifier and Type | Method and Description |
|---|---|
UUID |
create()
Returns a new time-based UUID.
### Timestamp
The timestamp has 100-nanoseconds resolution, starting from 1582-10-15.
|
UUID |
create(byte localDomain,
int localIdentifier)
Returns a DCE Security UUID based in a local domain and a local
identifier.
|
UUID |
create(int localIdentifier)
Returns a DCE Security UUID based in a local identifier.
|
protected static long |
setLocalDomainBits(long lsb,
byte localDomain,
long counter)
Insert the local domain bits in the most significant bits.
#### Security-Version (Version 2) UUIDs
(2) The clock_seq_low field (which represents an integer in the range [0,
2^8-1]) is interpreted as a local domain (as represented by
sec_rgy_domain_t; see sec_rgy_domain_t ); that is, an identifier domain
meaningful to the local host.
|
protected static long |
setLocalIdentifierBits(long msb,
int localIdentifier)
Insert the local identifier bits in the most significant bits.
#### Security-Version (Version 2) UUIDs
(3) The time_low field (which represents an integer in the range [0,
2^32-1]) is interpreted as a local-ID; that is, an identifier (within the
domain specified by clock_seq_low) meaningful to the local host.
|
DceSecurityUuidCreator |
withLocalDomain(byte localDomain)
Set a fixed local domain.
|
formatMostSignificantBitsformatLeastSignificantBits, withClockSequence, withClockSequenceStrategy, withHardwareAddressNodeIdentifier, withInstant, withNodeIdentifier, withNodeIdentifierStrategy, withRandomNodeIdentifier, withRandomNodeIdentifier, withSystemDataHashNodeIdentifier, withTimestamp, withTimestampStrategy, withUnixEpochMillisecondsgetVariantBits, getVersion, getVersionBits, setVariantBits, setVersionBits, validpublic static final byte LOCAL_DOMAIN_PERSON
public static final byte LOCAL_DOMAIN_GROUP
public static final byte LOCAL_DOMAIN_ORG
protected TimeBasedUuidCreator timeBasedUUIDCreator
protected DceSecurityUuidCreator.DCESTimestampCounter timestampCounter
protected byte localDomain
public DceSecurityUuidCreator()
public UUID create()
AbstractTimeBasedUuidCreators = 10_000_000 m = 60 * s h = 60 * m d = 24 * h y = 365.25 * d 2^60 / y = ~3653 3653 + 1582 = 5235### RFC-4122 - 4.1.4. Timestamp The timestamp is a 60-bit value. For UUID version 1, this is represented by Coordinated Universal Time (UTC) as a count of 100- nanosecond intervals since 00:00:00.00, 15 October 1582 (the date of Gregorian reform to the Christian calendar). ### RFC-4122 - 4.1.5. Clock Sequence For UUID version 1, the clock sequence is used to help avoid duplicates that could arise when the clock is set backwards in time or if the node ID changes. ### RFC-4122 - 4.1.6. Node For UUID version 1, the node field consists of an IEEE 802 MAC address, usually the host address. For systems with multiple IEEE 802 addresses, any available one can be used. The lowest addressed octet (octet number 10) contains the global/local bit and the unicast/multicast bit, and is the first octet of the address transmitted on an 802.3 LAN. For systems with no IEEE address, a randomly or pseudo-randomly generated value may be used; see Section 4.5. The multicast bit must be set in such addresses, in order that they will never conflict with addresses obtained from network cards. ### RFC-4122 - 4.2.1. Basic Algorithm (1a) Obtain a system-wide global lock (2a) From a system-wide shared stable store (e.g., a file), read the UUID generator state: the values of the timestamp, clock sequence, and node ID used to generate the last UUID. (3a) Get the current time as a 60-bit count of 100-nanosecond intervals since 00:00:00.00, 15 October 1582. (4a) Get the current node ID. (5a) If the state was unavailable (e.g., non-existent or corrupted), or the saved node ID is different than the current node ID, generate a random clock sequence value. (6a) If the state was available, but the saved timestamp is later than the current timestamp, increment the clock sequence value. (7a) Save the state (current timestamp, clock sequence, and node ID) back to the stable store. (8a) Release the global lock. (9a) Format a UUID from the current timestamp, clock sequence, and node ID values according to the steps in Section 4.2.2.
create in interface NoArgumentsUuidCreatorcreate in class AbstractTimeBasedUuidCreatorUUID a UUID valuepublic UUID create(byte localDomain, int localIdentifier)
localDomain - a local domainlocalIdentifier - a local identifierpublic UUID create(int localIdentifier)
create(byte, int)localIdentifier - a local identifierprotected static long setLocalIdentifierBits(long msb,
int localIdentifier)
msb - the MSBlocalIdentifier - the local identifierprotected static long setLocalDomainBits(long lsb,
byte localDomain,
long counter)
lsb - the LSBlocalDomain - a local domaincounter - a counter valuepublic DceSecurityUuidCreator withLocalDomain(byte localDomain)
localDomain - a local domainDceSecurityUuidCreatorCopyright © 2019. All rights reserved.