Package net.handle.hdllib
Class SiteInfo
- java.lang.Object
-
- net.handle.hdllib.SiteInfo
-
public class SiteInfo extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description Attribute[]attributesintdataFormatVersionstatic java.lang.StringDOMAINstatic byteHASH_TYPE_BY_ALLstatic byteHASH_TYPE_BY_PREFIXstatic byteHASH_TYPE_BY_SUFFIXbyte[]hashFilterbytehashOptionbooleanisPrimarybooleanisRootbytemajorProtocolVersionbyteminorProtocolVersionstatic shortMULTI_PRIMARYbooleanmultiPrimarystatic java.lang.StringPATHstatic shortPRIMARY_SITElongresponseTimeintserialNumberServerInfo[]servers
-
Constructor Summary
Constructors Constructor Description SiteInfo()Default constructor: object uninitialized except as above.SiteInfo(int siteVersion, boolean isPrimary, boolean isMultiPrimary, byte hashingOption, java.lang.String siteDescription, java.net.InetAddress listenAddr, int port, int httpPort, java.io.File pubKeyFile, boolean disableUDP)Constructor used by configuration routines.SiteInfo(int siteVersion, boolean isPrimary, boolean isMultiPrimary, byte hashingOption, java.lang.String siteDescription, java.net.InetAddress listenAddr, java.net.InetAddress altAddr, int port, int httpPort, java.io.File pubKeyFile, boolean disableUDP)SiteInfo(SiteInfo site)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ServerInfodetermineServer(byte[] handle)Return the ServerInfo that this handle hashes tointdetermineServerNum(byte[] handle)Shortcut to determineServerNum(handle, hashOption, numServers) using this.hashOptionstatic intdetermineServerNum(byte[] handle, int hashOption, int numServers)Return the index of the server that this handle hashes tobooleanequals(java.lang.Object obj)byte[]getAttribute(byte[] attribute)Get the value of the specified attribute for this site (if any).java.lang.StringgetAttributeForServer(java.lang.String attribute, int which)java.lang.StringgetDomainForServer(int which)static intgetHandleHash(byte[] handle, int hashOption)Return the positive integer generated by hashing the part of this handle indicated by hashOption.java.util.HashMap<java.lang.Integer,ServerInfo>getId2ServerMap()inthashCode()booleanhasZeroAddressServersAndDomain()static voidmain(java.lang.String[] argv)Hash the given arguments as handles and display the results.java.lang.StringtoString()Return a string of labeled members of this object.
-
-
-
Field Detail
-
DOMAIN
public static final java.lang.String DOMAIN
- See Also:
- Constant Field Values
-
PATH
public static final java.lang.String PATH
- See Also:
- Constant Field Values
-
HASH_TYPE_BY_PREFIX
public static final byte HASH_TYPE_BY_PREFIX
- See Also:
- Constant Field Values
-
HASH_TYPE_BY_SUFFIX
public static final byte HASH_TYPE_BY_SUFFIX
- See Also:
- Constant Field Values
-
HASH_TYPE_BY_ALL
public static final byte HASH_TYPE_BY_ALL
- See Also:
- Constant Field Values
-
PRIMARY_SITE
public static final short PRIMARY_SITE
- See Also:
- Constant Field Values
-
MULTI_PRIMARY
public static final short MULTI_PRIMARY
- See Also:
- Constant Field Values
-
dataFormatVersion
public int dataFormatVersion
-
serialNumber
public int serialNumber
-
majorProtocolVersion
public byte majorProtocolVersion
-
minorProtocolVersion
public byte minorProtocolVersion
-
isPrimary
public boolean isPrimary
-
multiPrimary
public boolean multiPrimary
-
isRoot
public boolean isRoot
-
responseTime
public long responseTime
-
hashOption
public byte hashOption
-
hashFilter
public byte[] hashFilter
-
servers
public ServerInfo[] servers
-
attributes
public Attribute[] attributes
-
-
Constructor Detail
-
SiteInfo
public SiteInfo()
Default constructor: object uninitialized except as above.
-
SiteInfo
public SiteInfo(int siteVersion, boolean isPrimary, boolean isMultiPrimary, byte hashingOption, java.lang.String siteDescription, java.net.InetAddress listenAddr, int port, int httpPort, java.io.File pubKeyFile, boolean disableUDP) throws java.io.IOExceptionConstructor used by configuration routines.- Throws:
java.io.IOException
-
SiteInfo
public SiteInfo(int siteVersion, boolean isPrimary, boolean isMultiPrimary, byte hashingOption, java.lang.String siteDescription, java.net.InetAddress listenAddr, java.net.InetAddress altAddr, int port, int httpPort, java.io.File pubKeyFile, boolean disableUDP) throws java.io.IOException- Throws:
java.io.IOException
-
SiteInfo
public SiteInfo(SiteInfo site)
-
-
Method Detail
-
getAttribute
public byte[] getAttribute(byte[] attribute)
Get the value of the specified attribute for this site (if any).
-
getHandleHash
public static final int getHandleHash(byte[] handle, int hashOption) throws HandleExceptionReturn the positive integer generated by hashing the part of this handle indicated by hashOption.- Throws:
HandleException
-
determineServerNum
public final int determineServerNum(byte[] handle) throws HandleExceptionShortcut to determineServerNum(handle, hashOption, numServers) using this.hashOption- Throws:
HandleException
-
determineServerNum
public static final int determineServerNum(byte[] handle, int hashOption, int numServers) throws HandleExceptionReturn the index of the server that this handle hashes to- Throws:
HandleException
-
determineServer
public ServerInfo determineServer(byte[] handle) throws HandleException
Return the ServerInfo that this handle hashes to- Throws:
HandleException
-
toString
public java.lang.String toString()
Return a string of labeled members of this object.- Overrides:
toStringin classjava.lang.Object
-
getId2ServerMap
public java.util.HashMap<java.lang.Integer,ServerInfo> getId2ServerMap()
-
main
public static final void main(java.lang.String[] argv) throws java.lang.ExceptionHash the given arguments as handles and display the results.- Throws:
java.lang.Exception
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
getAttributeForServer
public java.lang.String getAttributeForServer(java.lang.String attribute, int which)
-
getDomainForServer
public java.lang.String getDomainForServer(int which)
-
hasZeroAddressServersAndDomain
public boolean hasZeroAddressServersAndDomain()
-
-