verinec.importer.parser
Class ImportHostname

java.lang.Object
  extended by verinec.importer.parser.ImportHostname
All Implemented Interfaces:
IServiceParser

public class ImportHostname
extends Object
implements IServiceParser

Main class of NetworkImporter. Starts the different ImportHostname-* classes for all services. Saves the configuration.

Author:
geraldine.antener at unifr.ch

Nested Class Summary
 class ImportHostname.HostnameConfig
          Config panel for hostname import.
 
Field Summary
private  ImportHostname.HostnameConfig configPanel
           
private  String hostname
           
private  Logger log
           
 
Constructor Summary
ImportHostname()
           
 
Method Summary
 JPanel getConfigPanel()
          Config panel just to select whether import of hostname is on or off.
private  String getLocalHostName()
          Find out the name of the local host name.
 String getRawConfiguration()
          Get the raw configuration, that is the configuratio ninformation of the implementation of service.
private  String getRemoteHostname(ImporterEnvironment config)
          Get name of remote host.
 void notifyMode(ImporterDialog.SettingsPanelBase mode)
          Change mode.
private  String parseHostname(String hostname)
           
 void runImport(ImporterEnvironment config)
          Create the hostname attribute.
 void updateNode(PCNode node)
          Update the PCNode with new information.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private Logger log

hostname

private String hostname

configPanel

private ImportHostname.HostnameConfig configPanel
Constructor Detail

ImportHostname

public ImportHostname()
Method Detail

runImport

public void runImport(ImporterEnvironment config)
               throws VerinecImporterException
Create the hostname attribute.

Specified by:
runImport in interface IServiceParser
Parameters:
config - the ImporterEnvironment of the import run.
Throws:
VerinecImporterException - If local host name can not be determined.

getRawConfiguration

public String getRawConfiguration()
Description copied from interface: IServiceParser
Get the raw configuration, that is the configuratio ninformation of the implementation of service.

Specified by:
getRawConfiguration in interface IServiceParser
Returns:
null There is no useful information

updateNode

public void updateNode(PCNode node)
Update the PCNode with new information.

Specified by:
updateNode in interface IServiceParser
Parameters:
node - The node object to update

getLocalHostName

private String getLocalHostName()
                         throws VerinecImporterException
Find out the name of the local host name. First we try to ask the java.net.InetAddress, if this does not work or is localhost, we run the program hostname (won't work with Windows, though).

Returns:
The name of the host.
Throws:
VerinecImporterException - If anything goes wrong

getRemoteHostname

private String getRemoteHostname(ImporterEnvironment config)
                          throws VerinecImporterException
Get name of remote host. If dialog contains ip execute hostname on remote host. If dialog contains fully qualified name: truncate to first name before '.'

Parameters:
config - The configuration dialog to connect to remote host.
Returns:
The name of the remote host.
Throws:
VerinecImporterException - If executing hostname command on remote host fails.

parseHostname

private String parseHostname(String hostname)

notifyMode

public void notifyMode(ImporterDialog.SettingsPanelBase mode)
Change mode. For Hostname, this method does nothing, as the options do not change.

Specified by:
notifyMode in interface IServiceParser
Parameters:
mode - One of remote, local or test

getConfigPanel

public JPanel getConfigPanel()
Config panel just to select whether import of hostname is on or off.

Specified by:
getConfigPanel in interface IServiceParser
Returns:
config panel.

Copyright © 2005 Verinec, DIUF