gudusoft.gsqlparser.crypto
Class HardwareBinder

java.lang.Object
  extended by gudusoft.gsqlparser.crypto.HardwareBinder

public class HardwareBinder
extends java.lang.Object


Field Summary
static java.lang.String HEXES
           
 
Constructor Summary
HardwareBinder()
           
 
Method Summary
static java.lang.String getHex(byte[] raw)
           
 java.lang.String getMachineIdString()
           
 void ignoreArchitecture()
          The UUID generation uses the architecture string as returned by System.getProperty("os.arch").
 void ignoreHostName()
          When calculating the machine UUID the host name is also taken into account by default.
 void ignoreNetwork()
          When calculating the uuid of a machine the network interfaces are enumerated and their parameters are taken into account.
 void setUseHwAddress()
          By default the class does not take the hardware addresses into account.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HEXES

public static final java.lang.String HEXES
See Also:
Constant Field Values
Constructor Detail

HardwareBinder

public HardwareBinder()
Method Detail

setUseHwAddress

public void setUseHwAddress()
By default the class does not take the hardware addresses into account. Anyway hardware address can only be queried only with Java6 or later. Binding software to a specific hardware address may also be annoying when customer has to replace an Ethernet card.

Even though it is possible using this class to create a machine ID that relies on the hardware addresses and the names of the network cards if the software runs on Java6 or later.

To do so call this method before calling any other uuid calculating method.

If the code runs on Java5 then the algorith automatically falls back to ignoring the mac addresses and thus may generate different ID than when it is run under Java6.


ignoreHostName

public void ignoreHostName()
When calculating the machine UUID the host name is also taken into account by default. If you want the method to ignore the machine name then call this method before calling any UUID calculation method.


ignoreNetwork

public void ignoreNetwork()
When calculating the uuid of a machine the network interfaces are enumerated and their parameters are taken into account. Under Java5 the names of the network interfaces are used. With Java6 the names and the hardware addresses are used.

If you want to ignore the network when generating the uuid then call this method before any uuid calculating methos.


ignoreArchitecture

public void ignoreArchitecture()
The UUID generation uses the architecture string as returned by System.getProperty("os.arch"). In some rare cases you want to have a UUID that is independent of the architecture.


getMachineIdString

public java.lang.String getMachineIdString()

getHex

public static java.lang.String getHex(byte[] raw)