com.esf.device.network.service
Interface INetworkDeviceService

All Known Subinterfaces:
IEthernetDeviceService, IWifiDeviceService

public interface INetworkDeviceService

Manages Network device configurations. This is an interface that is not directly implemented by any bundles. Instead this is extended by other interfaces such as the @IEthernetDeviceService and the @IWifiDeviceService which are then in turn implemented. Copyright � 2009 Eurotech Inc. All rights reserved.


Field Summary
static java.lang.String SERVICE_NAME
          Reports the class name representing this interface.
static int TYPE_DHCP
          Definition for an interface that uses DHCP for configuration
static int TYPE_NULL
          Definition for an interface that is not configured
static int TYPE_STATIC
          Definition for an interface that is statically configured
 
Method Summary
 void bringInterfaceDown(NetworkDeviceContainer networkDeviceContainer)
          Brings an interface down
 void bringInterfaceDown(java.lang.String ifaceName)
          Brings an interface down
 void bringInterfaceUp(NetworkDeviceContainer device)
          Brings an interface up using the parameters currently set.
 void bringInterfaceUp(java.lang.String ifaceName)
          Brings an interface up using the parameters currently set.
 java.lang.String getBroadcast(java.lang.String iface)
          Gets the broadcast address currently associated with this interface
 java.lang.String getGateway(java.lang.String iface)
          Gets the gateway address currently associated with this interface
 java.util.ArrayList getIfaceNames()
          Returns a list of interface names present on this system
 java.lang.String getIpAddress(java.lang.String iface)
          Gets the IP address currently associated with this interface
 java.lang.String getMacAddress(java.lang.String ifaceName)
          Gets the MAC address of a specified interfaces
 java.lang.String getNetmask(java.lang.String iface)
          Gets the network mask currently associated with this interface
 java.lang.String getNetwork(java.lang.String iface)
          Gets the network currently associated with this interface
 NetworkDeviceContainer getParameters(java.lang.String iface)
          Gets all of the parameters that currently make up an EthernetDevice.
 java.lang.String getPrimaryDns(java.lang.String iface)
          Gets the primary DNS address currently associated with this interface
 java.lang.String getSecondaryDns(java.lang.String iface)
          Gets the secondary DNS address currently associated with this interface
 int getType(java.lang.String iface)
          Gets the defined type (DHCP or STATIC) from the currently running configuration
 boolean isIfaceUp(java.lang.String iface)
          Gets the state of an interface
 void setBroadcast(java.lang.String iface, java.lang.String broadcast)
          Sets the broadcast for an interface that has been defined to be statically defined.
 void setGateway(java.lang.String iface, java.lang.String gateway)
          Sets the default gateway for an interface that has been defined to be statically defined.
 void setIpAddress(java.lang.String iface, java.lang.String ipAddress)
          Sets the IP address for an interface that has been defined to be statically defined.
 void setNetmask(java.lang.String iface, java.lang.String netmask)
          Sets the network mask for an interface that has been defined to be statically defined.
 void setNetwork(java.lang.String iface, java.lang.String network)
          Sets the network definition for an interface that has been defined to be statically defined.
 void setPrimaryDns(java.lang.String iface, java.lang.String primaryDns)
          Sets the primary DNS for an interface that has been defined to be statically defined.
 void setSecondaryDns(java.lang.String iface, java.lang.String secondaryDns)
          Sets the secondary DNS for an interface that has been defined to be statically defined.
 void setToDhcp(java.lang.String iface)
          Sets the method used to configure a particular interface to use either DHCP.
 void setToNull(java.lang.String iface)
          Removes the configuration currently set and disables the interface.
 void setToStatic(java.lang.String iface, java.lang.String ipAddress, java.lang.String netmask, java.lang.String network, java.lang.String broadcast, java.lang.String gateway, java.lang.String primaryDns, java.lang.String secondaryDns)
          Sets the parameters of a statically defined interface.
 

Field Detail

SERVICE_NAME

static final java.lang.String SERVICE_NAME
Reports the class name representing this interface.


TYPE_DHCP

static final int TYPE_DHCP
Definition for an interface that uses DHCP for configuration

See Also:
Constant Field Values

TYPE_STATIC

static final int TYPE_STATIC
Definition for an interface that is statically configured

See Also:
Constant Field Values

TYPE_NULL

static final int TYPE_NULL
Definition for an interface that is not configured

See Also:
Constant Field Values
Method Detail

getIfaceNames

java.util.ArrayList getIfaceNames()
                                  throws java.lang.Exception
Returns a list of interface names present on this system

Returns:
an @ArrayList of @String representing the interface names present on this system
Throws:
java.lang.Exception - if the platform is improperly defined, not supported, or not defined

setToDhcp

void setToDhcp(java.lang.String iface)
               throws java.lang.Exception
Sets the method used to configure a particular interface to use either DHCP. If there are any static parameters defined they will be deleted.

Parameters:
iface - the interface being set as either DHCP or static
Throws:
java.lang.Exception - if any parameters are invalid or the iface can not be found

setToStatic

void setToStatic(java.lang.String iface,
                 java.lang.String ipAddress,
                 java.lang.String netmask,
                 java.lang.String network,
                 java.lang.String broadcast,
                 java.lang.String gateway,
                 java.lang.String primaryDns,
                 java.lang.String secondaryDns)
                 throws java.lang.Exception
Sets the parameters of a statically defined interface. If the interface is configured as DHCP it will be set to STATIC. This change takes effect immediately.

Parameters:
iface - the interface to configure
ipAddress - the static IP address to set
netmask - the network mask to set
network - the network to set (for example 192.168.1.0)
broadcast - the broadcast address to set
gateway - the gateway to use
primaryDns - the primary DNS to use
secondaryDns - the secondary DNS to use
Throws:
java.lang.Exception - if any parameters are invalid

setIpAddress

void setIpAddress(java.lang.String iface,
                  java.lang.String ipAddress)
                  throws java.lang.Exception
Sets the IP address for an interface that has been defined to be statically defined. This change takes effect immediately.

Parameters:
iface - the interface to configure
ipAddress - the new static IP address to set
Throws:
java.lang.Exception - if any parameters are invalid, if the interface to set is configured to use DHCP

setToNull

void setToNull(java.lang.String iface)
               throws java.lang.Exception
Removes the configuration currently set and disables the interface. This change takes effect immediately.

Parameters:
iface - the interface which will have its current running configuration deleted
Throws:
java.lang.Exception - if the parameters are invalid.

setNetmask

void setNetmask(java.lang.String iface,
                java.lang.String netmask)
                throws java.lang.Exception
Sets the network mask for an interface that has been defined to be statically defined. This change takes effect immediately.

Parameters:
iface - the interface to configure
netmask - the new network mask to use
Throws:
java.lang.Exception - if any parameters are invalid, if the interface to set is configured to use DHCP

setNetwork

void setNetwork(java.lang.String iface,
                java.lang.String network)
                throws java.lang.Exception
Sets the network definition for an interface that has been defined to be statically defined. This change takes effect immediately.

Parameters:
iface - the interface to configure
network - the new network definition to use
Throws:
java.lang.Exception - if any parameters are invalid, if the interface to set is configured to use DHCP

setBroadcast

void setBroadcast(java.lang.String iface,
                  java.lang.String broadcast)
                  throws java.lang.Exception
Sets the broadcast for an interface that has been defined to be statically defined. This change takes effect immediately.

Parameters:
iface - the interface to configure
broadcast - the new broadcast definition to use
Throws:
java.lang.Exception - if any parameters are invalid, if the interface to set is configured to use DHCP

setGateway

void setGateway(java.lang.String iface,
                java.lang.String gateway)
                throws java.lang.Exception
Sets the default gateway for an interface that has been defined to be statically defined. This change takes effect immediately.

Parameters:
iface - the interface to configure
gateway - the new gateway to use
Throws:
java.lang.Exception - if any parameters are invalid, if the interface to set is configured to use DHCP

setPrimaryDns

void setPrimaryDns(java.lang.String iface,
                   java.lang.String primaryDns)
                   throws java.lang.Exception
Sets the primary DNS for an interface that has been defined to be statically defined. This change takes effect immediately.

Parameters:
iface - the interface to configure
primaryDns - the new primary DNS to use
Throws:
java.lang.Exception - if any parameters are invalid, if the interface to set is configured to use DHCP

setSecondaryDns

void setSecondaryDns(java.lang.String iface,
                     java.lang.String secondaryDns)
                     throws java.lang.Exception
Sets the secondary DNS for an interface that has been defined to be statically defined. This change takes effect immediately.

Parameters:
iface - the interface to configure
secondaryDns - the new secondary DNS to use
Throws:
java.lang.Exception - if any parameters are invalid, if the interface to set is configured to use DHCP

getType

int getType(java.lang.String iface)
            throws java.lang.Exception
Gets the defined type (DHCP or STATIC) from the currently running configuration

Parameters:
iface - the interface to get the type from
Returns:
the type defined as either IEthernetDeviceService.TYPE_DHCP or IEthernetDeviceService.TYPE_STATIC
Throws:
java.lang.Exception - if there is an error, the type is not defined, or if the interface is not valid

getParameters

NetworkDeviceContainer getParameters(java.lang.String iface)
                                     throws java.lang.Exception
Gets all of the parameters that currently make up an EthernetDevice.

Parameters:
iface - the interface to get the configuration of
Returns:
the parameters associated with this interface and state
Throws:
java.lang.Exception - if there is an error, the type is not defined, or if the interface is not valid

getIpAddress

java.lang.String getIpAddress(java.lang.String iface)
                              throws java.lang.Exception
Gets the IP address currently associated with this interface

Parameters:
iface - the interface to get the IP address of
Returns:
the IP address associated with this interface and state
Throws:
java.lang.Exception - if there is an error, the type is not defined, or if the interface is not valid

getNetmask

java.lang.String getNetmask(java.lang.String iface)
                            throws java.lang.Exception
Gets the network mask currently associated with this interface

Parameters:
iface - the interface to get the network mask of
Returns:
the network mask associated with this interface and state
Throws:
java.lang.Exception - if there is an error, the type is not defined, or if the interface is not valid

getNetwork

java.lang.String getNetwork(java.lang.String iface)
                            throws java.lang.Exception
Gets the network currently associated with this interface

Parameters:
iface - the interface to get the network of
Returns:
the network associated with this interface and state
Throws:
java.lang.Exception - if there is an error, the type is not defined, or if the interface is not valid

getBroadcast

java.lang.String getBroadcast(java.lang.String iface)
                              throws java.lang.Exception
Gets the broadcast address currently associated with this interface

Parameters:
iface - the interface to get the broadcast address of
Returns:
the broadcast address associated with this interface and state
Throws:
java.lang.Exception - if there is an error, the type is not defined, or if the interface is not valid

getGateway

java.lang.String getGateway(java.lang.String iface)
                            throws java.lang.Exception
Gets the gateway address currently associated with this interface

Parameters:
iface - the interface to get the gateway address of
Returns:
the gateway address associated with this interface and state
Throws:
java.lang.Exception - if there is an error, the type is not defined, or if the interface is not valid

getPrimaryDns

java.lang.String getPrimaryDns(java.lang.String iface)
                               throws java.lang.Exception
Gets the primary DNS address currently associated with this interface

Parameters:
iface - the interface to get the primary DNS address of
Returns:
the primary DNS address associated with this interface and state
Throws:
java.lang.Exception - if there is an error, the type is not defined, or if the interface is not valid

getSecondaryDns

java.lang.String getSecondaryDns(java.lang.String iface)
                                 throws java.lang.Exception
Gets the secondary DNS address currently associated with this interface

Parameters:
iface - the interface to get the secondary DNS address of
Returns:
the secondary DNS address associated with this interface and state
Throws:
java.lang.Exception - if there is an error, the type is not defined, or if the interface is not valid

bringInterfaceUp

void bringInterfaceUp(NetworkDeviceContainer device)
                      throws java.lang.Exception
Brings an interface up using the parameters currently set. This method will automatically call bringInterfaceDown(String iface) before bringing the interface up. This ensures it comes up in a clean state. The interface will come up using the parameters set for this interface.

Parameters:
networkDevice - the @NetworkDeviceContainer to bring up
Throws:
java.lang.Exception - if the iface is invalid or if the interface is not properly configured

bringInterfaceUp

void bringInterfaceUp(java.lang.String ifaceName)
                      throws java.lang.Exception
Brings an interface up using the parameters currently set. This method will automatically call bringInterfaceDown(String iface) before bringing the interface up. This ensures it comes up in a clean state. The interface will come up using the parameters set for this interface.

Parameters:
ifaceName - the interface name to bring up
Throws:
java.lang.Exception - if the iface is invalid or if the interface is not properly configured

bringInterfaceDown

void bringInterfaceDown(NetworkDeviceContainer networkDeviceContainer)
                        throws java.lang.Exception
Brings an interface down

Parameters:
networkDeviceContainer - the @NetworkDeviceContainer to bring down
Throws:
java.lang.Exception - if the iface is invalid or if the interface is not up

bringInterfaceDown

void bringInterfaceDown(java.lang.String ifaceName)
                        throws java.lang.Exception
Brings an interface down

Parameters:
ifaceName - the interface name to bring down
Throws:
java.lang.Exception - if the ifaceName is invalid or if the interface is not up

isIfaceUp

boolean isIfaceUp(java.lang.String iface)
                  throws java.lang.Exception
Gets the state of an interface

Parameters:
iface - the interface to check for its status
Returns:
true if the interface is up, otherwise false
Throws:
java.lang.Exception - if the interface is invalid

getMacAddress

java.lang.String getMacAddress(java.lang.String ifaceName)
                               throws java.lang.Exception
Gets the MAC address of a specified interfaces

Parameters:
ifaceName - the interface to get the MAC id of
Returns:
a String representing the MAC id
Throws:
java.lang.Exception