org.jdiameter.client.impl.router
Class RouterImpl

java.lang.Object
  extended by org.jdiameter.client.impl.router.RouterImpl
All Implemented Interfaces:
IRouter
Direct Known Subclasses:
RouterImpl

public class RouterImpl
extends java.lang.Object
implements IRouter


Nested Class Summary
protected  class RouterImpl.AnswerEntry
           
protected  class RouterImpl.RedirectEntry
           
 
Field Summary
static int ALL_APPLICATION
           
static int ALL_HOST
           
static int ALL_REALM
           
static int ALL_SESSION
           
static int ALL_USER
           
static int DONT_CACHE
           
protected  java.util.logging.Logger logger
           
protected  org.jdiameter.api.MetaData metaData
           
static int REALM_AND_APPLICATION
           
 int REDIRECT_TABLE_SIZE
           
protected  java.util.concurrent.ScheduledFuture redirectEntryHandler
           
protected  java.util.concurrent.ScheduledExecutorService redirectScheduler
           
protected  java.util.concurrent.ConcurrentHashMap<RouterImpl.RedirectEntry,RouterImpl.RedirectEntry> redirectTable
           
protected  java.lang.Runnable redirectTask
           
static int REQUEST_TABLE_CLEAR_SIZE
           
static int REQUEST_TABLE_SIZE
           
protected  java.util.HashMap<java.lang.Long,RouterImpl.AnswerEntry> requestEntryTable
           
protected  java.util.concurrent.locks.ReadWriteLock requestLock
           
protected  java.util.SortedMap<java.lang.Long,java.lang.Long> requestSortedEntryTable
           
 
Constructor Summary
RouterImpl(org.jdiameter.api.Configuration config, org.jdiameter.api.MetaData aMetaData)
           
 
Method Summary
protected  boolean checkRealm(java.lang.String name)
           
 void destroy()
          Release all resources
 IPeer getPeer(IMessage message, IPeerTable manager)
          Return peer from inner peer table by predefined pameters
protected  IPeer getPeerPredProcessing(IMessage message, java.lang.String destRealm, java.lang.String destHost)
           
 java.lang.String getRealmForPeer(java.lang.String destHost)
          Return realm of peer by fqdn
protected  java.lang.String[] getRealmPeers(java.lang.String key)
           
protected  java.util.Set<java.lang.String> getRealmsName()
           
 java.lang.String[] getRequestRouteInfo(long hopByHopIdentifier)
          Return Request route info
protected  void init()
           
protected  void loadConfiguration(org.jdiameter.api.Configuration config)
           
protected  void redirectProcessing(IMessage message, java.lang.String destRealm, java.lang.String destHost)
           
 void registerRequestRouteInfo(IMessage request)
          Register route information by received request.
protected  IPeer selectPeer(java.util.List<IPeer> avaliblePeers)
           
 void start()
          Start inner time facilities
 void stop()
          Stop inner time facilities
 void updateRedirectInformation(IMessage answer)
          Update redirect information
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DONT_CACHE

public static final int DONT_CACHE
See Also:
Constant Field Values

ALL_SESSION

public static final int ALL_SESSION
See Also:
Constant Field Values

ALL_REALM

public static final int ALL_REALM
See Also:
Constant Field Values

REALM_AND_APPLICATION

public static final int REALM_AND_APPLICATION
See Also:
Constant Field Values

ALL_APPLICATION

public static final int ALL_APPLICATION
See Also:
Constant Field Values

ALL_HOST

public static final int ALL_HOST
See Also:
Constant Field Values

ALL_USER

public static final int ALL_USER
See Also:
Constant Field Values

logger

protected java.util.logging.Logger logger

metaData

protected org.jdiameter.api.MetaData metaData

REDIRECT_TABLE_SIZE

public final int REDIRECT_TABLE_SIZE
See Also:
Constant Field Values

redirectTable

protected java.util.concurrent.ConcurrentHashMap<RouterImpl.RedirectEntry,RouterImpl.RedirectEntry> redirectTable

redirectScheduler

protected java.util.concurrent.ScheduledExecutorService redirectScheduler

redirectTask

protected java.lang.Runnable redirectTask

redirectEntryHandler

protected java.util.concurrent.ScheduledFuture redirectEntryHandler

REQUEST_TABLE_SIZE

public static final int REQUEST_TABLE_SIZE
See Also:
Constant Field Values

REQUEST_TABLE_CLEAR_SIZE

public static final int REQUEST_TABLE_CLEAR_SIZE
See Also:
Constant Field Values

requestLock

protected java.util.concurrent.locks.ReadWriteLock requestLock

requestEntryTable

protected java.util.HashMap<java.lang.Long,RouterImpl.AnswerEntry> requestEntryTable

requestSortedEntryTable

protected java.util.SortedMap<java.lang.Long,java.lang.Long> requestSortedEntryTable
Constructor Detail

RouterImpl

public RouterImpl(org.jdiameter.api.Configuration config,
                  org.jdiameter.api.MetaData aMetaData)
Method Detail

init

protected void init()

loadConfiguration

protected void loadConfiguration(org.jdiameter.api.Configuration config)

registerRequestRouteInfo

public void registerRequestRouteInfo(IMessage request)
Description copied from interface: IRouter
Register route information by received request. This information will be used during answer routing.

Specified by:
registerRequestRouteInfo in interface IRouter
Parameters:
request - request

getRequestRouteInfo

public java.lang.String[] getRequestRouteInfo(long hopByHopIdentifier)
Description copied from interface: IRouter
Return Request route info

Specified by:
getRequestRouteInfo in interface IRouter
Parameters:
hopByHopIdentifier - hop By Hop Indentifier
Returns:
Array (host and realm)

updateRedirectInformation

public void updateRedirectInformation(IMessage answer)
                               throws org.jdiameter.api.InternalException,
                                      org.jdiameter.api.RouteException
Description copied from interface: IRouter
Update redirect information

Specified by:
updateRedirectInformation in interface IRouter
Parameters:
answer - redirect answer message
Throws:
org.jdiameter.api.InternalException
org.jdiameter.api.RouteException

getPeer

public IPeer getPeer(IMessage message,
                     IPeerTable manager)
              throws org.jdiameter.api.RouteException,
                     org.jdiameter.api.AvpDataException
Description copied from interface: IRouter
Return peer from inner peer table by predefined pameters

Specified by:
getPeer in interface IRouter
Parameters:
message - message with routed avps
manager - instance of peer manager
Returns:
peer instance
Throws:
org.jdiameter.api.RouteException
org.jdiameter.api.AvpDataException

getPeerPredProcessing

protected IPeer getPeerPredProcessing(IMessage message,
                                      java.lang.String destRealm,
                                      java.lang.String destHost)

start

public void start()
Description copied from interface: IRouter
Start inner time facilities

Specified by:
start in interface IRouter

stop

public void stop()
Description copied from interface: IRouter
Stop inner time facilities

Specified by:
stop in interface IRouter

destroy

public void destroy()
Description copied from interface: IRouter
Release all resources

Specified by:
destroy in interface IRouter

selectPeer

protected IPeer selectPeer(java.util.List<IPeer> avaliblePeers)

redirectProcessing

protected void redirectProcessing(IMessage message,
                                  java.lang.String destRealm,
                                  java.lang.String destHost)
                           throws org.jdiameter.api.AvpDataException
Throws:
org.jdiameter.api.AvpDataException

getRealmForPeer

public java.lang.String getRealmForPeer(java.lang.String destHost)
Description copied from interface: IRouter
Return realm of peer by fqdn

Specified by:
getRealmForPeer in interface IRouter
Parameters:
destHost - host name
Returns:
realm of peer

checkRealm

protected boolean checkRealm(java.lang.String name)

getRealmsName

protected java.util.Set<java.lang.String> getRealmsName()

getRealmPeers

protected java.lang.String[] getRealmPeers(java.lang.String key)


Copyright © 2008. All Rights Reserved.