be.ac.ulg.montefiore.run.totem.trafficMatrix.model.impl
Class LinkLoadComputerImpl

java.lang.Object
  extended by be.ac.ulg.montefiore.run.totem.trafficMatrix.model.impl.LinkLoadComputerImpl
All Implemented Interfaces:
DomainChangeListener, LinkLoadComputer, TrafficMatrixChangeListener

public class LinkLoadComputerImpl
extends java.lang.Object
implements LinkLoadComputer, DomainChangeListener, TrafficMatrixChangeListener

Calculates the links load and utilization of a given domain thanks to a TmLoadComputer and a traffic matrix. It listens to domain events and traffic Matrix events to maintain the calculated load up-to-date.

Creation date: 10 mars 2006

Author:
Ga�l Monfort (monfort@run.montefiore.ulg.ac.be)

Constructor Summary
LinkLoadComputerImpl(Domain domain, TmLoadComputer tmlc, TrafficMatrix tm)
           
 
Method Summary
 void addLinkEvent(Link link)
          Notify a add link event
 void addListener(LinkLoadComputerListener listener)
          Add a listener.
 void addLspEvent(Lsp lsp)
          Notify a add LSP event
 void addNodeEvent(Node node)
          Notify a add node event
 void destroy()
          Free resources associated with the object.
 void elementChangeEvent(java.lang.String src, java.lang.String dst)
          Notify a change in the value of the source-destination pair from node src to node dst.
 boolean equals(java.lang.Object o)
           
 Domain getDomain()
          Returns the domain associated.
 java.lang.String getId()
          Returns the id associated with the instance, if it has been set.
 double[] getLoad()
          Returns a vector that represent links load.
 double getLoad(Link lnk)
          Returns the load calculated for the given link.
 TmLoadComputer getLoadComputer()
          Returns the associated routing strategy.
 java.lang.String getShortName()
          Return a string representing the parameters in short.
 TrafficMatrix getTrafficMatrix()
          Returns the traffic matrix.
 double[] getUtilization()
          Returns a vector that represent links utilization.
 double getUtilization(Link lnk)
          Returns the utilization calculated for the given link.
 int hashCode()
           
 boolean isConsistent()
          return true if the object is consistent (not yet destroyed).
 boolean isSetId()
          returns true if the id has been set
 void linkBandwidthChangeEvent(Link link)
          Notify a link bandwidth change event
 void linkDelayChangeEvent(Link link)
          Notify a link delay change event
 void linkMetricChangeEvent(Link link)
          Notify a link metric change event
 void linkReservedBandwidthChangeEvent(Link link)
          Notify a link reserved bandwidth change event
 void linkStatusChangeEvent(Link link)
          Notify a link status change event
 void linkTeMetricChangeEvent(Link link)
          Notify a link TE metric change event
 void lspReservationChangeEvent(Lsp lsp)
          Notify a LSP reservation change event
 void lspWorkingPathChangeEvent(Lsp lsp)
          Notify a change in the working path of the lsp.
 void nodeLocationChangeEvent(Node node)
          Notify a node location change event
 void nodeStatusChangeEvent(Node node)
          Notify a node status change event
 void removeLinkEvent(Link link)
          Notify a remove link event
 void removeListener(LinkLoadComputerListener listener)
          Remove a listener.
 void removeLspEvent(Lsp lsp)
          Notify a remove LSP event
 void removeNodeEvent(Node node)
          Notify a remove node event
 void rerouteLspEvent(Lsp lsp)
          Notify the fact that a LSP must be rerouted.
 void setId(java.lang.String id)
          Sets the id of the LinkLoadComputer
 java.lang.String toString()
           
 void unsetId()
          unsets the id
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LinkLoadComputerImpl

public LinkLoadComputerImpl(Domain domain,
                            TmLoadComputer tmlc,
                            TrafficMatrix tm)
                     throws DataConsistencyException
Throws:
DataConsistencyException
Method Detail

addListener

public void addListener(LinkLoadComputerListener listener)
Add a listener. Once added, the listener will be notified of changes in the calculatd load.

Specified by:
addListener in interface LinkLoadComputer
Parameters:
listener -

removeListener

public void removeListener(LinkLoadComputerListener listener)
Remove a listener.

Specified by:
removeListener in interface LinkLoadComputer
Parameters:
listener -

getId

public java.lang.String getId()
                       throws LinkLoadComputerIdException
Description copied from interface: LinkLoadComputer
Returns the id associated with the instance, if it has been set.

Specified by:
getId in interface LinkLoadComputer
Returns:
Throws:
LinkLoadComputerIdException - id the Id was not set

setId

public void setId(java.lang.String id)
           throws LinkLoadComputerIdException
Description copied from interface: LinkLoadComputer
Sets the id of the LinkLoadComputer

Specified by:
setId in interface LinkLoadComputer
Throws:
LinkLoadComputerIdException - if the id was already set

isSetId

public boolean isSetId()
Description copied from interface: LinkLoadComputer
returns true if the id has been set

Specified by:
isSetId in interface LinkLoadComputer
Returns:

unsetId

public void unsetId()
Description copied from interface: LinkLoadComputer
unsets the id

Specified by:
unsetId in interface LinkLoadComputer

getLoad

public double[] getLoad()
                 throws DataConsistencyException,
                        NoRouteToHostException,
                        RoutingException
Description copied from interface: LinkLoadComputer
Returns a vector that represent links load. For each link lnk of class Link in the domain, the corresponding load is located at the index domain.getConvertor().getLinkId(lnk.getId()) of the returned array.

Specified by:
getLoad in interface LinkLoadComputer
Returns:
links load for all links in the domain.
Throws:
DataConsistencyException
NoRouteToHostException
RoutingException

getLoad

public double getLoad(Link lnk)
               throws LinkNotFoundException,
                      DataConsistencyException,
                      NoRouteToHostException,
                      RoutingException
Description copied from interface: LinkLoadComputer
Returns the load calculated for the given link.

Specified by:
getLoad in interface LinkLoadComputer
Returns:
Return the load calculated for the given link.
Throws:
LinkNotFoundException
DataConsistencyException
NoRouteToHostException
RoutingException

getUtilization

public double[] getUtilization()
                        throws DataConsistencyException,
                               NoRouteToHostException,
                               RoutingException
Description copied from interface: LinkLoadComputer
Returns a vector that represent links utilization. Utilization is defined as load divided by capacity. For each link lnk of class Link in the domain, the corresponding utilization is located at the index domain.getConvertor().getLinkId(lnk.getId()) of the returned array.

Specified by:
getUtilization in interface LinkLoadComputer
Returns:
links load for all links in the domain.
Throws:
DataConsistencyException
NoRouteToHostException
RoutingException

getUtilization

public double getUtilization(Link lnk)
                      throws LinkNotFoundException,
                             DataConsistencyException,
                             NoRouteToHostException,
                             RoutingException
Description copied from interface: LinkLoadComputer
Returns the utilization calculated for the given link. Utilization is defined as load divided by capacity.

Specified by:
getUtilization in interface LinkLoadComputer
Returns:
Return the load calculated for the given link.
Throws:
LinkNotFoundException
DataConsistencyException
NoRouteToHostException
RoutingException

getDomain

public Domain getDomain()
Description copied from interface: LinkLoadComputer
Returns the domain associated.

Specified by:
getDomain in interface LinkLoadComputer
Returns:

getLoadComputer

public TmLoadComputer getLoadComputer()
Description copied from interface: LinkLoadComputer
Returns the associated routing strategy.

Specified by:
getLoadComputer in interface LinkLoadComputer
Returns:

getTrafficMatrix

public TrafficMatrix getTrafficMatrix()
Description copied from interface: LinkLoadComputer
Returns the traffic matrix.

Specified by:
getTrafficMatrix in interface LinkLoadComputer
Returns:

isConsistent

public boolean isConsistent()
Description copied from interface: LinkLoadComputer
return true if the object is consistent (not yet destroyed).

Specified by:
isConsistent in interface LinkLoadComputer
Returns:

getShortName

public java.lang.String getShortName()
Description copied from interface: LinkLoadComputer
Return a string representing the parameters in short.

Specified by:
getShortName in interface LinkLoadComputer
Returns:

destroy

public void destroy()
Description copied from interface: LinkLoadComputer
Free resources associated with the object.

Specified by:
destroy in interface LinkLoadComputer

equals

public boolean equals(java.lang.Object o)
Specified by:
equals in interface LinkLoadComputer
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Specified by:
hashCode in interface LinkLoadComputer
Overrides:
hashCode in class java.lang.Object

addNodeEvent

public void addNodeEvent(Node node)
Description copied from interface: DomainChangeListener
Notify a add node event

Specified by:
addNodeEvent in interface DomainChangeListener

removeNodeEvent

public void removeNodeEvent(Node node)
Description copied from interface: DomainChangeListener
Notify a remove node event

Specified by:
removeNodeEvent in interface DomainChangeListener

nodeStatusChangeEvent

public void nodeStatusChangeEvent(Node node)
Description copied from interface: DomainChangeListener
Notify a node status change event

Specified by:
nodeStatusChangeEvent in interface DomainChangeListener

nodeLocationChangeEvent

public void nodeLocationChangeEvent(Node node)
Description copied from interface: DomainChangeListener
Notify a node location change event

Specified by:
nodeLocationChangeEvent in interface DomainChangeListener

addLinkEvent

public void addLinkEvent(Link link)
Description copied from interface: DomainChangeListener
Notify a add link event

Specified by:
addLinkEvent in interface DomainChangeListener

removeLinkEvent

public void removeLinkEvent(Link link)
Description copied from interface: DomainChangeListener
Notify a remove link event

Specified by:
removeLinkEvent in interface DomainChangeListener

linkStatusChangeEvent

public void linkStatusChangeEvent(Link link)
Description copied from interface: DomainChangeListener
Notify a link status change event

Specified by:
linkStatusChangeEvent in interface DomainChangeListener

linkMetricChangeEvent

public void linkMetricChangeEvent(Link link)
Description copied from interface: DomainChangeListener
Notify a link metric change event

Specified by:
linkMetricChangeEvent in interface DomainChangeListener

linkTeMetricChangeEvent

public void linkTeMetricChangeEvent(Link link)
Description copied from interface: DomainChangeListener
Notify a link TE metric change event

Specified by:
linkTeMetricChangeEvent in interface DomainChangeListener

linkBandwidthChangeEvent

public void linkBandwidthChangeEvent(Link link)
Description copied from interface: DomainChangeListener
Notify a link bandwidth change event

Specified by:
linkBandwidthChangeEvent in interface DomainChangeListener

linkReservedBandwidthChangeEvent

public void linkReservedBandwidthChangeEvent(Link link)
Description copied from interface: DomainChangeListener
Notify a link reserved bandwidth change event

Specified by:
linkReservedBandwidthChangeEvent in interface DomainChangeListener

linkDelayChangeEvent

public void linkDelayChangeEvent(Link link)
Description copied from interface: DomainChangeListener
Notify a link delay change event

Specified by:
linkDelayChangeEvent in interface DomainChangeListener

addLspEvent

public void addLspEvent(Lsp lsp)
Description copied from interface: DomainChangeListener
Notify a add LSP event

Specified by:
addLspEvent in interface DomainChangeListener

removeLspEvent

public void removeLspEvent(Lsp lsp)
Description copied from interface: DomainChangeListener
Notify a remove LSP event

Specified by:
removeLspEvent in interface DomainChangeListener

rerouteLspEvent

public void rerouteLspEvent(Lsp lsp)
Description copied from interface: DomainChangeListener
Notify the fact that a LSP must be rerouted.

Specified by:
rerouteLspEvent in interface DomainChangeListener
Parameters:
lsp - The LSP to reroute.

lspReservationChangeEvent

public void lspReservationChangeEvent(Lsp lsp)
Description copied from interface: DomainChangeListener
Notify a LSP reservation change event

Specified by:
lspReservationChangeEvent in interface DomainChangeListener

lspWorkingPathChangeEvent

public void lspWorkingPathChangeEvent(Lsp lsp)
Description copied from interface: DomainChangeListener
Notify a change in the working path of the lsp. The working path of a lsp is the path used for routing.

Specified by:
lspWorkingPathChangeEvent in interface DomainChangeListener

elementChangeEvent

public void elementChangeEvent(java.lang.String src,
                               java.lang.String dst)
Description copied from interface: TrafficMatrixChangeListener
Notify a change in the value of the source-destination pair from node src to node dst.

Specified by:
elementChangeEvent in interface TrafficMatrixChangeListener

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2004-2007 Research Unit in Networking, All Rights Reserved.