Class UUIDCalculator


  • public class UUIDCalculator
    extends java.lang.Object
    Calculate a UUID that is specific to the machne. Note that machines are hard to identify and therefore there is no guarantee that two machines will not ever have the same UUID and also there is no guarantee that a single machine will always have the same UUID. The first one is less of a problem. The later, the stability of the UUID of a single machine can be managed with the parameters of the calculator, controlling what the calculation takes into account. The less parameters you select the more stable the UUID will be. On the other hand the less parameter you use the more machines may end-up having the same UUID. Machne UUIDs may be used to restrict the usage of a software to certain machines.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean assertUUID​(java.lang.String uuid, boolean useNetwork, boolean useHostName, boolean useArchitecture)  
      boolean assertUUID​(java.util.UUID uuid, boolean useNetwork, boolean useHostName, boolean useArchitecture)  
      java.util.UUID getMachineId​(boolean useNetwork, boolean useHostName, boolean useArchitecture)  
      java.lang.String getMachineIdString​(boolean useNetwork, boolean useHostName, boolean useArchitecture)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getMachineId

        public java.util.UUID getMachineId​(boolean useNetwork,
                                           boolean useHostName,
                                           boolean useArchitecture)
                                    throws java.net.SocketException,
                                           java.net.UnknownHostException,
                                           java.security.NoSuchAlgorithmException
        Throws:
        java.net.SocketException
        java.net.UnknownHostException
        java.security.NoSuchAlgorithmException
      • getMachineIdString

        public java.lang.String getMachineIdString​(boolean useNetwork,
                                                   boolean useHostName,
                                                   boolean useArchitecture)
                                            throws java.net.SocketException,
                                                   java.net.UnknownHostException,
                                                   java.security.NoSuchAlgorithmException
        Throws:
        java.net.SocketException
        java.net.UnknownHostException
        java.security.NoSuchAlgorithmException
      • assertUUID

        public boolean assertUUID​(java.util.UUID uuid,
                                  boolean useNetwork,
                                  boolean useHostName,
                                  boolean useArchitecture)
                           throws java.net.SocketException,
                                  java.net.UnknownHostException,
                                  java.security.NoSuchAlgorithmException
        Throws:
        java.net.SocketException
        java.net.UnknownHostException
        java.security.NoSuchAlgorithmException
      • assertUUID

        public boolean assertUUID​(java.lang.String uuid,
                                  boolean useNetwork,
                                  boolean useHostName,
                                  boolean useArchitecture)