com.gridsystems.utils.windows
Class Firewall

java.lang.Object
  extended by com.gridsystems.utils.windows.Firewall

public final class Firewall
extends java.lang.Object

Wrapper for the Windows firewall profile.

Version:
1.0
Author:
Rodrigo Ruiz Aguayo

Method Summary
static boolean closePort(int port)
          Closes a port in the firewall.
static boolean isEnabled()
          Gets if the windows firewall is enabled.
static boolean isPresent()
          Gets if the windows firewall is installed on this system.
static boolean openPort(java.lang.String serviceName, int port)
          Opens a port in the firewall.
static boolean setEnabled(boolean enable)
          Gets if the windows firewall is enabled.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

isPresent

public static boolean isPresent()
                         throws FirewallException
Gets if the windows firewall is installed on this system.

Returns:
true if the firewall is detected
Throws:
FirewallException

isEnabled

public static boolean isEnabled()
                         throws FirewallException
Gets if the windows firewall is enabled.

Returns:
true if the firewall is enabled
Throws:
FirewallException

setEnabled

public static boolean setEnabled(boolean enable)
                          throws FirewallException
Gets if the windows firewall is enabled.

Parameters:
enable - true if the firewall is to be enabled
Returns:
true if the operation is performed, false if it was not necessary
Throws:
FirewallException

openPort

public static boolean openPort(java.lang.String serviceName,
                               int port)
                        throws FirewallException
Opens a port in the firewall.

Parameters:
serviceName - The name of the port
port - The port number
Returns:
true if the port is open, false if it already was
Throws:
FirewallException - If an error occurs

closePort

public static boolean closePort(int port)
                         throws FirewallException
Closes a port in the firewall.

Parameters:
port - The port number
Returns:
true if the port was closed, false if it already was
Throws:
FirewallException - If an error occurs


Copyright © 2007-2008 Grid Systems, S.A.. All Rights Reserved.