verinec.importer.parser.ethernet
Class ImportEth

java.lang.Object
  extended by verinec.importer.parser.ethernet.ImportEth

public class ImportEth
extends Object

ImportEth represents the set of all Ethernet config files in the /etc/sysconfig/network-scripts directiory.
Search for all Ethernet configuration files, i.e. files begining with "ifcfg-eth" in the /etc/sysconfig/network-scripts directory or in a directory given by the user. Create a VeriNeC <ethernet> XML element for every found interface configuration file and save this element.
Special treatment for alias files (e.g. ifcfg-eth0:1), only an additional VeriNeC <nw> XML element is added to the corresponding <ethernet> element.

Author:
geraldine.antener at unifr.ch

Field Summary
private  ImporterEnvironment environment
          The environment
private  String filename
          Name of current configuration file.
private  ConfigFile ifcfg
          current ConfigFile object
private  String ifname
          Name of interface in current file.
private  ImportEthernet importConfig
           
private  Logger log
           
 
Constructor Summary
ImportEth(ImportEthernet impConf, ImporterEnvironment environment)
          Perform the import of ethernet files.
 
Method Summary
private  Element etherbindingElement()
          Create a Verinec <ethernet-binding> XML element with the specifications of the file.
private  Element ethernetElement()
          Create a Verinec <ethernet> XML element with the specifications of the file.
 void extractInfo()
          Parses configuration files and adds the information to importConfig
 String getRawConfiguration()
          Get a string with all configuration files for ethernet
private  void importLoopback()
          Todo: should not rely on nickname of device.
private  void loadFile(File f)
          Initialise all variables depending on the file f, make a new ConfigFile object
private  Element nwElement(int i)
          Create a Verinec <nw> XML element with the specifications of the file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private Logger log

importConfig

private final ImportEthernet importConfig

environment

private ImporterEnvironment environment
The environment


filename

private String filename
Name of current configuration file.


ifname

private String ifname
Name of interface in current file.


ifcfg

private ConfigFile ifcfg
current ConfigFile object

Constructor Detail

ImportEth

public ImportEth(ImportEthernet impConf,
                 ImporterEnvironment environment)
Perform the import of ethernet files.

Parameters:
impConf - The main ethernet import class is used to get configuration and store results
environment - General env. for logging
Method Detail

extractInfo

public void extractInfo()
                 throws VerinecImporterException
Parses configuration files and adds the information to importConfig

Throws:
VerinecImporterException

getRawConfiguration

public String getRawConfiguration()
Get a string with all configuration files for ethernet

Returns:
Configuration files content

ethernetElement

private Element ethernetElement()
                         throws VerinecImporterException
Create a Verinec <ethernet> XML element with the specifications of the file. These items of the configuration file:
are analysed and translated.

Returns:
the <ethernet> element
Throws:
VerinecImporterException

etherbindingElement

private Element etherbindingElement()
                             throws VerinecImporterException
Create a Verinec <ethernet-binding> XML element with the specifications of the file. The name of the interface given in the file name is imported.

Returns:
the <ethernet-binding> element
Throws:
VerinecImporterException

nwElement

private Element nwElement(int i)
                   throws VerinecImporterException
Create a Verinec <nw> XML element with the specifications of the file. These items of the configuration file:
are analysed and translated.

Parameters:
i - id number of the network
Returns:
the <ethernet> element
Throws:
VerinecImporterException

loadFile

private void loadFile(File f)
               throws VerinecImporterException
Initialise all variables depending on the file f, make a new ConfigFile object

Parameters:
f - The file to open
Throws:
VerinecImporterException

importLoopback

private void importLoopback()
                     throws VerinecImporterException
Todo: should not rely on nickname of device. Rather just check the hashtable after parsing all ini files.

Throws:
VerinecImporterException

Copyright © 2005 Verinec, DIUF