jap.forward
Class JAPRoutingConnectionClass

java.lang.Object
  extended by jap.forward.JAPRoutingConnectionClass

public class JAPRoutingConnectionClass
extends java.lang.Object

This is the implementation of a structure, which stores the paramters of a connection class, like ISDN, DSL, ...


Field Summary
private  int m_connectionClassIdentifier
          Stores an identifier for this connection class.
private  java.lang.String m_connectionClassName
          Stores the name of the connection class.
private  int m_maximumBandwidth
          Stores the maximal possible bandwidth for this connection class in bytes/sec.
private  int m_relativeBandwidth
          Stores the percentage of the maximum bandwidth of the connection which shall be used for forwarding.
 
Constructor Summary
JAPRoutingConnectionClass(int a_connectionClassIdentifier, java.lang.String a_connectionClassName, int a_maximumBandwidth, int a_relativeBandwidth)
          Creates a new JAPRoutingConnectionClass structure.
 
Method Summary
 int getCurrentBandwidth()
          Returns the current maximum bandwidth, which can be used for the forwarding server with this connection class (= relative bandwidth * maximum bandwidth).
 int getIdentifier()
          Returns the identifier for this connection class.
 int getMaximumBandwidth()
          Returns the maximum bandwidth of this connection class.
 int getMaxSimultaneousConnections()
          Returns the maximum number of simultaneous connections, the forwarding server can handle with the current bandwidth.
 int getMinimumRelativeBandwidth()
          Returns the minimum relative forwarding bandwidth.
 int getRelativeBandwidth()
          Returns the percentage of the maximum bandwidth which shall be used for forwarding.
 org.w3c.dom.Element getSettingsAsXml(org.w3c.dom.Document a_doc)
          Returns the settings for this connection class (bandwidth settings) for storage within an XML document.
 boolean loadSettingsFromXml(org.w3c.dom.Element a_connectionClassNode)
          This method loads some settings for this connection class from a prior created XML structure.
 void setMaximumBandwidth(int a_maximumBandwidth)
          Changes the maximum bandwidth of this connection class.
 void setRelativeBandwidth(int a_relativeBandwidth)
          Changes the percentage of the maximum bandwidth which shall be used for forwarding.
 java.lang.String toString()
          Returns the name of this connection class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

m_connectionClassIdentifier

private int m_connectionClassIdentifier
Stores an identifier for this connection class. See the constants in JAPRoutingConnectionClassSelector.

See Also:
JAPRoutingConnectionClassSelector

m_connectionClassName

private java.lang.String m_connectionClassName
Stores the name of the connection class. This name is displayed in the GUI, so it should be an identifier for JAPMessages.


m_maximumBandwidth

private int m_maximumBandwidth
Stores the maximal possible bandwidth for this connection class in bytes/sec.


m_relativeBandwidth

private int m_relativeBandwidth
Stores the percentage of the maximum bandwidth of the connection which shall be used for forwarding.

Constructor Detail

JAPRoutingConnectionClass

public JAPRoutingConnectionClass(int a_connectionClassIdentifier,
                                 java.lang.String a_connectionClassName,
                                 int a_maximumBandwidth,
                                 int a_relativeBandwidth)
Creates a new JAPRoutingConnectionClass structure. The number is depending on a_currentBandwidth set to the maximum possible value according to JAPConstants.ROUTING_BANDWIDTH_PER_USER.

Parameters:
a_connectionClassIdentifier - The identifier for this connection class. See the constants in JAPRoutingConnectionClassSelector.
a_connectionClassName - The name for the connection class, which is displayed in the GUI. So it should be an identifier for JAPMessages.
a_maximumBandwidth - The maximum possible bandwidth for this connection class in bytes/sec.
a_currentBandwidth - The bandwidth which can be used for the forwarding server with this connection class.
Method Detail

getIdentifier

public int getIdentifier()
Returns the identifier for this connection class. See the constants in JAPRoutingConnectionClassSelector.

Returns:
The identifier of this connection class.
See Also:
JAPRoutingConnectionClassSelector

getMaximumBandwidth

public int getMaximumBandwidth()
Returns the maximum bandwidth of this connection class.

Returns:
The maximum bandwidth of this connection class.

setMaximumBandwidth

public void setMaximumBandwidth(int a_maximumBandwidth)
Changes the maximum bandwidth of this connection class. This is only possible for the user-defined connection class. Any other connection class will ignore a call of this method.

Parameters:
a_maximumBandwidth - The new maximum bandwidth (in bytes/sec), for this connection class.

getCurrentBandwidth

public int getCurrentBandwidth()
Returns the current maximum bandwidth, which can be used for the forwarding server with this connection class (= relative bandwidth * maximum bandwidth).

Returns:
The current maximum bandwidth in bytes/sec, which can be used for the forwarding server with this connection class.

getMaxSimultaneousConnections

public int getMaxSimultaneousConnections()
Returns the maximum number of simultaneous connections, the forwarding server can handle with the current bandwidth. The value depends on JAPConstants.ROUTING_BANDWIDTH_PER_USER.

Returns:
The maximum number of simultaneous forwarded connections, the server can handle with the current bandwidth.

getRelativeBandwidth

public int getRelativeBandwidth()
Returns the percentage of the maximum bandwidth which shall be used for forwarding.

Returns:
The relative connection bandwidth (in %) useable for forwarding.

setRelativeBandwidth

public void setRelativeBandwidth(int a_relativeBandwidth)
Changes the percentage of the maximum bandwidth which shall be used for forwarding. The new value must not be smaller than the value returned by getMinimumRelativeBandwidth() (if it is smaller, the value returned by getMinimumRelativeBandwidth() is set as the new relative bandwidth).

Parameters:
a_relativeBandwidth - The relative connection bandwidth (in %) useable for forwarding.

getMinimumRelativeBandwidth

public int getMinimumRelativeBandwidth()
Returns the minimum relative forwarding bandwidth. This is the percentage of the maximum bandwidth necessary to forward at least one connection, see JAPConstants.ROUTING_BANDWIDTH_PER_USER).

Returns:
The minimum possible relative connection bandwidth (in %).

toString

public java.lang.String toString()
Returns the name of this connection class. If it is an identifier for JAPMessages, the String after resolving the identifier is returned.

Overrides:
toString in class java.lang.Object
Returns:
The name of this connection class, which can be used in the GUI.

getSettingsAsXml

public org.w3c.dom.Element getSettingsAsXml(org.w3c.dom.Document a_doc)
Returns the settings for this connection class (bandwidth settings) for storage within an XML document.

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

loadSettingsFromXml

public boolean loadSettingsFromXml(org.w3c.dom.Element a_connectionClassNode)
This method loads some settings for this connection class from a prior created XML structure. But the identifier and the maximum bandwidth (both belong to the characteristics of this connection class) are normally not changed, but checked, whether they match to this connection class. Only the user-defined connection class will change the maximum bandwidth value to the loaded setting. If there is an error while loading the settings, it is still tried to load as much settings as possible.

Parameters:
a_connectionClassNode - The ConnectionClass 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.