Class ControlPanel
- java.lang.Object
- com.iizix.jre.ControlPanel
public class ControlPanel extends java.lang.Object
Handles routines that deals with deployment properties and configuration in the the Java Control Panel.- Author:
- Christopher Mindus
Constructor Summary
Constructors Constructor Description ControlPanel()
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
displaySystemProperties()
Sorts and displays the system properties.static boolean
doVerifyServerHostName()
Checks the setting for HTTPS host name verification.static java.net.InetAddress[]
getAllByName(java.lang.String host, boolean isVerbose)
Given the name of a host, returns an array of its IP addresses, based on the configured name service on the system.static java.net.InetAddress
getByName(java.lang.String host, boolean isVerbose)
Determines the IP address of a host, given the host's name.static java.util.HashSet<java.security.cert.X509Certificate>[]
getCertificates(boolean isVerbose)
Loads the certificates: CA, JSSE and Trusted Certificates (Code Signing).static java.lang.String[]
getClientCertificatesKeystoreFileNames()
Gets the file name for the System Client Certificates keystore.static javax.net.ssl.KeyManager[]
getDeploymentClientCertificates(ICertificateUI callback, boolean isVerbose)
Gets the array of client certificates from deployment information.static java.lang.String
getDescription(java.security.cert.X509Certificate c)
Gets the "WHO" string with certificate validity and issuer.static java.lang.String
getDescription(java.security.Principal p)
Formats a Principal entry.static byte[]
getIPv4Address(java.lang.String name)
Gets the IPv4 byte address.static java.util.ArrayList<java.net.Proxy>
getProxies(java.net.URL url, java.util.ArrayList<java.net.Proxy> cmdLineProxies, boolean isVerbose)
Gets the proxies to use for a particular host URL.static java.lang.String
getTS()
Gets a timestamp string.static boolean
initDeployData(boolean isVerbose)
Initializes the control panel to load the deployment data.static boolean
isLocalAddress(java.lang.String host, boolean isVerbose)
Checks if it's a local (intranet) host address.static boolean
isLocalhost(java.lang.String name)
Check if it's localhost.static void
readSystemProxies(boolean isApplet, boolean isVerbose)
Get a fresh list of the proxies defined.static boolean
useSystemProxies()
Checks if system proxies are used by default.
Method Detail
getIPv4Address
public static byte[] getIPv4Address(java.lang.String name)
Gets the IPv4 byte address.- Returns:
- null if not number address.
isLocalhost
public static boolean isLocalhost(java.lang.String name)
Check if it's localhost.
useSystemProxies
public static boolean useSystemProxies()
Checks if system proxies are used by default.
doVerifyServerHostName
public static boolean doVerifyServerHostName()
Checks the setting for HTTPS host name verification.- Returns:
- true if the server host name should be checked, false otherwise.
displaySystemProperties
public static void displaySystemProperties()
Sorts and displays the system properties.
initDeployData
public static boolean initDeployData(boolean isVerbose)
Initializes the control panel to load the deployment data.- Parameters:
isVerbose
- Flag to display verbose output.- Returns:
- true for success, false for failure.
readSystemProxies
public static void readSystemProxies(boolean isApplet, boolean isVerbose)
Get a fresh list of the proxies defined.
getProxies
public static java.util.ArrayList<java.net.Proxy> getProxies(java.net.URL url, java.util.ArrayList<java.net.Proxy> cmdLineProxies, boolean isVerbose)
Gets the proxies to use for a particular host URL.
getTS
public static java.lang.String getTS()
Gets a timestamp string.
getByName
public static java.net.InetAddress getByName(java.lang.String host, boolean isVerbose) throws java.net.UnknownHostException
Determines the IP address of a host, given the host's name.The host name can either be a machine name, such as "java.sun.com", or a textual representation of its IP address. If a literal IP address is supplied, only the validity of the address format is checked.
If the host is null then an InetAddress representing an address of the loop-back interface is returned.
- Parameters:
host
- The specified host, or null.isVerbose
- Verbose output flag.- Returns:
- An IP address for the given host name.
- Throws:
java.net.UnknownHostException
- if no IP address for the host could be found, or if a scope_id was specified for a global IPv6 address.
getAllByName
public static java.net.InetAddress[] getAllByName(java.lang.String host, boolean isVerbose) throws java.net.UnknownHostException
Given the name of a host, returns an array of its IP addresses, based on the configured name service on the system.The host name can either be a machine name, such as "java.sun.com", or a textual representation of its IP address. If a literal IP address is supplied, only the validity of the address format is checked.
For host specified in literal IPv6 address, either the form defined in RFC 2732 or the literal IPv6 address format defined in RFC 2373 is accepted. A literal IPv6 address may also be qualified by appending a scoped zone identifier or scope_id.
If the host is null then an InetAddress representing an address of the loop-back interface is returned.
- Parameters:
host
- host - the name of the host, or null.isVerbose
- Verbose output flag.- Returns:
- An array of all the IP addresses for a given host name.
- Throws:
java.net.UnknownHostException
- if no IP address for the host could be found, or if a scope_id was specified for a global IPv6 address.
isLocalAddress
public static boolean isLocalAddress(java.lang.String host, boolean isVerbose)
Checks if it's a local (intranet) host address.- Parameters:
host
- The host name.isVerbose
- Verbose output flag.- Returns:
- true if local intranet host address, false otherwise.
getCertificates
public static java.util.HashSet<java.security.cert.X509Certificate>[] getCertificates(boolean isVerbose)
Loads the certificates: CA, JSSE and Trusted Certificates (Code Signing). This method can only be called once the methodinitDeployData()
has been called.- Returns:
- An array of 3
ArrayList<X509Certificate>
. The first list contains the CA certificates, the second, the JSSE trusted certificates, and the third the Trusted (code signing) certificates.
getClientCertificatesKeystoreFileNames
public static java.lang.String[] getClientCertificatesKeystoreFileNames()
Gets the file name for the System Client Certificates keystore. This method can only be called once the methodinitDeployData()
has been called.- Returns:
- The file names for the KeyStore's of System and User, array size of 2. Note: the file might not exist.
getDescription
public static java.lang.String getDescription(java.security.Principal p)
Formats a Principal entry.
getDescription
public static java.lang.String getDescription(java.security.cert.X509Certificate c)
Gets the "WHO" string with certificate validity and issuer.
getDeploymentClientCertificates
public static javax.net.ssl.KeyManager[] getDeploymentClientCertificates(ICertificateUI callback, boolean isVerbose)
Gets the array of client certificates from deployment information.