jap.forward
Class JAPRoutingConnectionClassSelector

java.lang.Object
  extended by java.util.Observable
      extended by jap.forward.JAPRoutingConnectionClassSelector

public class JAPRoutingConnectionClassSelector
extends java.util.Observable

This class stores all known connection classes. Also the currently choosen one is stored here. Observers of this class get a notification, if the number of connection classes, the current connection class, bandwidth or connection number parameters, ... are changed.


Field Summary
static int CONNECTION_CLASS_1MBIT
          This is the identifier of the 1 Mbit upload connection class.
static int CONNECTION_CLASS_DSL128
          This is the identifier of the DSL 128 kbit/sec upload connection class.
static int CONNECTION_CLASS_DSL192
          This is the identifier of the DSL 192 kbit/sec upload connection class.
static int CONNECTION_CLASS_DSL256
          This is the identifier of the DSL 256 kbit/sec upload connection class.
static int CONNECTION_CLASS_DSL384
          This is the identifier of the DSL 384 kbit/sec upload connection class.
static int CONNECTION_CLASS_DSL512
          This is the identifier of the DSL 512 kbit/sec upload connection class.
static int CONNECTION_CLASS_ISDN128
          This is the identifier of the 2xISDN connection class.
static int CONNECTION_CLASS_ISDN64
          This is the identifier of the 1xISDN connection class.
static int CONNECTION_CLASS_USER
          This is the identifier of the user-definable connection class.
private  java.util.Hashtable m_connectionClasses
          This table stores all connection classes.
private  int m_currentConnectionClass
          This stores the identifier of the currently used connection class.
 
Constructor Summary
JAPRoutingConnectionClassSelector()
          This creates a new instance of JAPRoutingConnectionClassSelector.
 
Method Summary
 java.util.Vector getConnectionClasses()
          Returns a Vector of all connection classes.
 JAPRoutingConnectionClass getCurrentConnectionClass()
          This returns the currently used connection class.
 org.w3c.dom.Element getSettingsAsXml(org.w3c.dom.Document a_doc)
          Returns the current connection class settings (currently selected connection class, settings of the single connection classes) for storage within an XML document.
 boolean loadSettingsFromXml(org.w3c.dom.Element a_connectionClassSettingsNode)
          This method loads all connection classes related settings from a prior created XML structure.
 void setCurrentConnectionClass(int a_connectionClass)
          This changes the currently used connection class.
 
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONNECTION_CLASS_ISDN64

public static final int CONNECTION_CLASS_ISDN64
This is the identifier of the 1xISDN connection class.

See Also:
Constant Field Values

CONNECTION_CLASS_ISDN128

public static final int CONNECTION_CLASS_ISDN128
This is the identifier of the 2xISDN connection class.

See Also:
Constant Field Values

CONNECTION_CLASS_DSL128

public static final int CONNECTION_CLASS_DSL128
This is the identifier of the DSL 128 kbit/sec upload connection class.

See Also:
Constant Field Values

CONNECTION_CLASS_DSL192

public static final int CONNECTION_CLASS_DSL192
This is the identifier of the DSL 192 kbit/sec upload connection class.

See Also:
Constant Field Values

CONNECTION_CLASS_DSL256

public static final int CONNECTION_CLASS_DSL256
This is the identifier of the DSL 256 kbit/sec upload connection class.

See Also:
Constant Field Values

CONNECTION_CLASS_DSL384

public static final int CONNECTION_CLASS_DSL384
This is the identifier of the DSL 384 kbit/sec upload connection class.

See Also:
Constant Field Values

CONNECTION_CLASS_DSL512

public static final int CONNECTION_CLASS_DSL512
This is the identifier of the DSL 512 kbit/sec upload connection class.

See Also:
Constant Field Values

CONNECTION_CLASS_1MBIT

public static final int CONNECTION_CLASS_1MBIT
This is the identifier of the 1 Mbit upload connection class.

See Also:
Constant Field Values

CONNECTION_CLASS_USER

public static final int CONNECTION_CLASS_USER
This is the identifier of the user-definable connection class.

See Also:
Constant Field Values

m_connectionClasses

private java.util.Hashtable m_connectionClasses
This table stores all connection classes.


m_currentConnectionClass

private int m_currentConnectionClass
This stores the identifier of the currently used connection class.

Constructor Detail

JAPRoutingConnectionClassSelector

public JAPRoutingConnectionClassSelector()
This creates a new instance of JAPRoutingConnectionClassSelector. Also all connection classes are initialized here and the currently used connection class is set to a default value.

Method Detail

getCurrentConnectionClass

public JAPRoutingConnectionClass getCurrentConnectionClass()
This returns the currently used connection class.

Returns:
The currently used connection class.

setCurrentConnectionClass

public void setCurrentConnectionClass(int a_connectionClass)
This changes the currently used connection class. Also this methode must be called after a change of the parameters of the current connection class in order to update the forwarding system to the new bandwidth/user values. When the connection class has been changed, a CONNECTION_CLASS_CHANGED JAPRoutingMessage is sent to all observers of this class. Also a CONNECTION_PARAMETERS_CHANGED JAPRoutingMessage is sent, if the connection number/bandwidth parameters of the forwarding system has been changed.

Parameters:
a_connectionClass - The ID of the new connection class. If this is not a valid ID, nothing is done.

getConnectionClasses

public java.util.Vector getConnectionClasses()
Returns a Vector of all connection classes.

Returns:
The Vector with all connection classes.

getSettingsAsXml

public org.w3c.dom.Element getSettingsAsXml(org.w3c.dom.Document a_doc)
Returns the current connection class settings (currently selected connection class, settings of the single connection classes) for storage within an XML document.

Parameters:
a_doc - The context document for the connection class settings.
Returns:
An XML node (ConnectionClassSettings) with all connection class settings.

loadSettingsFromXml

public boolean loadSettingsFromXml(org.w3c.dom.Element a_connectionClassSettingsNode)
This method loads all connection classes related settings from a prior created XML structure. If there is an error while loading the settings, it is still tried to load as much settings as possible.

Parameters:
a_connectionClassSettingsNode - The ConnectionClasses XML node, which was created by the getSettingsAsXml() method.
Returns:
True, if there was no error while loading the settings and false, if there was one.