PIRL

PIRL.Utilities
Class Host

java.lang.Object
  extended by PIRL.Utilities.Host

public class Host
extends Object

The Host class provides information about the host on which the process is running.

Version:
1.7
Author:
Bradford Castalia, UA/PIRL

Field Summary
static String DEFAULT_HOSTNAME
          The name that will be provided for the hostname or IP address if they can not be obtained from the host system.
static String FULL_HOSTNAME
          The cannonical, fully qualified name of the host system.
static String ID
           
static String IP_ADDRESS
          The Internet Protocol address of the host system.
static String SHORT_HOSTNAME
          The short, single word name of the host system.
 
Method Summary
static Properties Environment()
          Get all the environment variables from the host.
static String Full_Hostname()
          Get the fully qualified name of the host system.
static String Full_Hostname(String hostname)
          Get the fully qualified name for a hostname.
static String Hostname()
          Get the name of the host system.
static String Hostname(String address)
          Get the name of a host system.
static String IP_Address()
          Get the IP address of the host system.
static String IP_Address(String hostname)
          Get the IP address for a hostname.
static String OS_Name()
          Get the name of the host operating system.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ID

public static final String ID
See Also:
Constant Field Values

FULL_HOSTNAME

public static final String FULL_HOSTNAME
The cannonical, fully qualified name of the host system.

If the hostname can not be obtained from the host system the DEFAULT_HOSTNAME will be used.

See Also:
SHORT_HOSTNAME

SHORT_HOSTNAME

public static final String SHORT_HOSTNAME
The short, single word name of the host system.

If the hostname can not be obtained from the host system the DEFAULT_HOSTNAME will be used.

See Also:
FULL_HOSTNAME

IP_ADDRESS

public static final String IP_ADDRESS
The Internet Protocol address of the host system.

If the IP address can not be obtained from the host system the DEFAULT_HOSTNAME will be used.


DEFAULT_HOSTNAME

public static final String DEFAULT_HOSTNAME
The name that will be provided for the hostname or IP address if they can not be obtained from the host system.

See Also:
Constant Field Values
Method Detail

Hostname

public static String Hostname()
Get the name of the host system.

Returns:
The hostname String of the local system. If the hostname can not be determined, the DEFAULT_HOSTNAME is returned.
See Also:
SHORT_HOSTNAME

Hostname

public static String Hostname(String address)
Get the name of a host system.

Parameters:
address - The textual representation of a host system IP address or its hostname. If null, the local host system is assumed.
Returns:
The hostname String for the address. This will be null if hostname lookup failed. N.B.: Unlike for the local system, the DEFAULT_HOSTNAME will not be returned if hostname lookup fails; instead of an ambiguous name for possibly multiple unknown hostnames, the calling application is expected to have rules to deal with an unknown hostname in this case.
Throws:
SecurityException - If hostname lookup is not allowed.

Full_Hostname

public static String Full_Hostname()
Get the fully qualified name of the host system.

Returns:
The fully qualified hostname String of the local system. If the hostname can not be determined, the DEFAULT_HOSTNAME is returned.
See Also:
FULL_HOSTNAME

Full_Hostname

public static String Full_Hostname(String hostname)
Get the fully qualified name for a hostname.

Parameters:
hostname - The name host system or the textual representation of its IP address. If null, the local host system is assumed.
Returns:
The fully qualified hostname String for the hostname. This will be null if hostname lookup failed. N.B.: Unlike for the local system, the DEFAULT_HOSTNAME will not be returned if hostname lookup fails; instead of an ambiguous name for possibly multiple unknown hostnames, the calling application is expected to have rules to deal with an unknown hostname in this case.
Throws:
SecurityException - If hostname lookup is not allowed.

IP_Address

public static String IP_Address()
Get the IP address of the host system.

Returns:
The String representation of the IP address of the local system. If the IP address can not be determined, the DEFAULT_HOSTNAME is returned.
See Also:
IP_ADDRESS

IP_Address

public static String IP_Address(String hostname)
Get the IP address for a hostname.

Parameters:
hostname - The name host system or the textual representation of its IP address. If null, the local host system is assumed.
Returns:
The String representation of the IP address for the hostname. This will be null if no IP address for the hostname could be found. N.B.: Unlike for the local system, the DEFAULT_HOSTNAME will not be returned if hostname lookup fails; instead of an ambiguous name for possibly multiple unknown hostnames, the calling application is expected to have rules to deal with an unknown hostname in this case.
Throws:
SecurityException - If hostname lookup is not allowed.

OS_Name

public static String OS_Name()
Get the name of the host operating system.

Returns:
The name of the host OS from the os.name system property.

Environment

public static Properties Environment()
Get all the environment variables from the host.

Returns:
A Properties object contain all of the environment variables.

PIRL

Copyright (C) \ 2003-2009 Bradford Castalia, University of Arizona