org.jdiameter.client.impl.controller
Class PeerImpl

java.lang.Object
  extended by org.jdiameter.client.impl.controller.PeerImpl
All Implemented Interfaces:
java.lang.Comparable<org.jdiameter.api.Peer>, org.jdiameter.api.Peer, IPeer
Direct Known Subclasses:
PeerImpl

public class PeerImpl
extends java.lang.Object
implements IPeer, java.lang.Comparable<org.jdiameter.api.Peer>


Nested Class Summary
protected  class PeerImpl.ActionContext
           
 
Field Summary
protected  java.net.InetAddress[] addresses
           
protected  java.util.Set<org.jdiameter.api.ApplicationId> commonApplications
           
protected  IConnection conn
           
protected  IConnectionListener connListener
           
protected  int firmWare
           
protected  IStateMachine fsm
           
protected  org.jdiameter.api.app.StateChangeListener fsmListener
           
protected  int hopByHopId
           
static int INT_COMMON_APP_ID
           
protected  java.util.logging.Logger logger
           
protected  IMetaData metaData
           
protected  IMessageParser parser
           
protected  java.util.Map<java.lang.Long,IMessage> peerRequests
           
protected  java.lang.String productName
           
protected  int rating
           
protected  java.lang.String realmName
           
protected  IRouter router
           
protected  java.util.Map<java.lang.String,org.jdiameter.api.NetworkReqListener> slc
           
protected  boolean stopping
           
protected  PeerTableImpl table
           
protected static UIDGenerator uid
           
protected  org.jdiameter.api.URI uri
           
protected  boolean useUriAsFQDN
           
protected  long vendorID
           
 
Constructor Summary
  PeerImpl(PeerTableImpl table, int rating, org.jdiameter.api.URI remotePeer, IMetaData metaData, org.jdiameter.api.Configuration config, org.jdiameter.api.Configuration peerConfig, IFsmFactory fsmFactory, ITransportLayerFactory trFactory, IMessageParser parser)
           
protected PeerImpl(PeerTableImpl table, int rating, org.jdiameter.api.URI remotePeer, IMetaData metaData, org.jdiameter.api.Configuration config, org.jdiameter.api.Configuration peerConfig, IFsmFactory fsmFactory, ITransportLayerFactory trFactory, IMessageParser parser, IConnection connection)
           
 
Method Summary
 void addConnectionListener(IConnectionListener listener)
          Add connection state change listener
 void addMessage(IMessage message)
          Append request to peer request storage map
 void addPeerStateListener(org.jdiameter.api.PeerStateListener listener)
           
 void addStateChangeListener(org.jdiameter.api.app.StateChangeListener listener)
          Add state change listener
 int compareTo(org.jdiameter.api.Peer o)
           
 void connect()
           
 void disconnect()
           
protected  void fillIPAddressTable(IMessage message)
           
protected  java.util.Set<org.jdiameter.api.ApplicationId> getCommonApplicationIds(IMessage message)
           
 java.util.Set<org.jdiameter.api.ApplicationId> getCommonApplications()
           
 IContext getContext()
           
 long getFirmware()
           
 int getHopByHopIdentifier()
          Return new hop by hop id for new message
 java.net.InetAddress[] getIPAddresses()
           
 java.lang.String getProductName()
           
 int getRaiting()
          Return rating of pee
 java.lang.String getRealmName()
           
<E> E
getState(java.lang.Class<E> enumc)
           
 org.jdiameter.api.URI getUri()
           
 long getVendorId()
           
 boolean hasValidConnection()
          Return true if peer has valid connection
protected  void preProcessRequest(IMessage answer)
           
 IMessage[] remAllMessage()
          Clear request storage map
 void remConnectionListener(IConnectionListener listener)
          Remove connection state change listener
 void remMessage(IMessage message)
          Remove request from request storage map
 void removePeerStateListener(org.jdiameter.api.PeerStateListener listener)
           
 void remStateChangeListener(org.jdiameter.api.app.StateChangeListener listener)
          Remove state change listener
 boolean sendMessage(IMessage message)
          Send message to diameter network
 void setRealm(java.lang.String realm)
          Attach peer to realm
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

INT_COMMON_APP_ID

public static final int INT_COMMON_APP_ID
See Also:
Constant Field Values

uid

protected static UIDGenerator uid

logger

protected java.util.logging.Logger logger

uri

protected org.jdiameter.api.URI uri

addresses

protected java.net.InetAddress[] addresses

realmName

protected java.lang.String realmName

vendorID

protected long vendorID

productName

protected java.lang.String productName

firmWare

protected int firmWare

commonApplications

protected java.util.Set<org.jdiameter.api.ApplicationId> commonApplications

hopByHopId

protected int hopByHopId

rating

protected int rating

stopping

protected boolean stopping

metaData

protected IMetaData metaData

table

protected PeerTableImpl table

router

protected IRouter router

slc

protected java.util.Map<java.lang.String,org.jdiameter.api.NetworkReqListener> slc

peerRequests

protected java.util.Map<java.lang.Long,IMessage> peerRequests

fsm

protected IStateMachine fsm

fsmListener

protected org.jdiameter.api.app.StateChangeListener fsmListener

parser

protected IMessageParser parser

useUriAsFQDN

protected boolean useUriAsFQDN

conn

protected IConnection conn

connListener

protected IConnectionListener connListener
Constructor Detail

PeerImpl

public PeerImpl(PeerTableImpl table,
                int rating,
                org.jdiameter.api.URI remotePeer,
                IMetaData metaData,
                org.jdiameter.api.Configuration config,
                org.jdiameter.api.Configuration peerConfig,
                IFsmFactory fsmFactory,
                ITransportLayerFactory trFactory,
                IMessageParser parser)
         throws org.jdiameter.api.InternalException,
                TransportException
Throws:
org.jdiameter.api.InternalException
TransportException

PeerImpl

protected PeerImpl(PeerTableImpl table,
                   int rating,
                   org.jdiameter.api.URI remotePeer,
                   IMetaData metaData,
                   org.jdiameter.api.Configuration config,
                   org.jdiameter.api.Configuration peerConfig,
                   IFsmFactory fsmFactory,
                   ITransportLayerFactory trFactory,
                   IMessageParser parser,
                   IConnection connection)
            throws org.jdiameter.api.InternalException,
                   TransportException
Throws:
org.jdiameter.api.InternalException
TransportException
Method Detail

getContext

public IContext getContext()

addPeerStateListener

public void addPeerStateListener(org.jdiameter.api.PeerStateListener listener)
Specified by:
addPeerStateListener in interface org.jdiameter.api.Peer

removePeerStateListener

public void removePeerStateListener(org.jdiameter.api.PeerStateListener listener)
Specified by:
removePeerStateListener in interface org.jdiameter.api.Peer

connect

public void connect()
             throws org.jdiameter.api.InternalException,
                    java.io.IOException,
                    org.jdiameter.api.IllegalDiameterStateException
Specified by:
connect in interface org.jdiameter.api.Peer
Throws:
org.jdiameter.api.InternalException
java.io.IOException
org.jdiameter.api.IllegalDiameterStateException

disconnect

public void disconnect()
                throws org.jdiameter.api.InternalException,
                       org.jdiameter.api.IllegalDiameterStateException
Specified by:
disconnect in interface org.jdiameter.api.Peer
Throws:
org.jdiameter.api.InternalException
org.jdiameter.api.IllegalDiameterStateException

getState

public <E> E getState(java.lang.Class<E> enumc)
Specified by:
getState in interface org.jdiameter.api.Peer

getUri

public org.jdiameter.api.URI getUri()
Specified by:
getUri in interface org.jdiameter.api.Peer

getIPAddresses

public java.net.InetAddress[] getIPAddresses()
Specified by:
getIPAddresses in interface org.jdiameter.api.Peer

getRealmName

public java.lang.String getRealmName()
Specified by:
getRealmName in interface org.jdiameter.api.Peer

getVendorId

public long getVendorId()
Specified by:
getVendorId in interface org.jdiameter.api.Peer

getProductName

public java.lang.String getProductName()
Specified by:
getProductName in interface org.jdiameter.api.Peer

getFirmware

public long getFirmware()
Specified by:
getFirmware in interface org.jdiameter.api.Peer

getCommonApplications

public java.util.Set<org.jdiameter.api.ApplicationId> getCommonApplications()
Specified by:
getCommonApplications in interface org.jdiameter.api.Peer

getHopByHopIdentifier

public int getHopByHopIdentifier()
Description copied from interface: IPeer
Return new hop by hop id for new message

Specified by:
getHopByHopIdentifier in interface IPeer
Returns:
new hop by hop id

addMessage

public void addMessage(IMessage message)
Description copied from interface: IPeer
Append request to peer request storage map

Specified by:
addMessage in interface IPeer
Parameters:
message - request instance

remMessage

public void remMessage(IMessage message)
Description copied from interface: IPeer
Remove request from request storage map

Specified by:
remMessage in interface IPeer
Parameters:
message - request instance

remAllMessage

public IMessage[] remAllMessage()
Description copied from interface: IPeer
Clear request storage map

Specified by:
remAllMessage in interface IPeer

sendMessage

public boolean sendMessage(IMessage message)
                    throws TransportException,
                           org.jdiameter.api.OverloadException,
                           org.jdiameter.api.InternalException
Description copied from interface: IPeer
Send message to diameter network

Specified by:
sendMessage in interface IPeer
Parameters:
message - request instance
Returns:
true if message will be set to FSM
Throws:
TransportException
org.jdiameter.api.OverloadException
org.jdiameter.api.InternalException

hasValidConnection

public boolean hasValidConnection()
Description copied from interface: IPeer
Return true if peer has valid connection

Specified by:
hasValidConnection in interface IPeer
Returns:
true if peer has valid connection

setRealm

public void setRealm(java.lang.String realm)
Description copied from interface: IPeer
Attach peer to realm

Specified by:
setRealm in interface IPeer
Parameters:
realm - realm name

addStateChangeListener

public void addStateChangeListener(org.jdiameter.api.app.StateChangeListener listener)
Description copied from interface: IPeer
Add state change listener

Specified by:
addStateChangeListener in interface IPeer
Parameters:
listener - listener instance

remStateChangeListener

public void remStateChangeListener(org.jdiameter.api.app.StateChangeListener listener)
Description copied from interface: IPeer
Remove state change listener

Specified by:
remStateChangeListener in interface IPeer
Parameters:
listener - listener instance

addConnectionListener

public void addConnectionListener(IConnectionListener listener)
Description copied from interface: IPeer
Add connection state change listener

Specified by:
addConnectionListener in interface IPeer
Parameters:
listener - listener instance

remConnectionListener

public void remConnectionListener(IConnectionListener listener)
Description copied from interface: IPeer
Remove connection state change listener

Specified by:
remConnectionListener in interface IPeer
Parameters:
listener - listener instance

getRaiting

public int getRaiting()
Description copied from interface: IPeer
Return rating of pee

Specified by:
getRaiting in interface IPeer
Returns:
int value

compareTo

public int compareTo(org.jdiameter.api.Peer o)
Specified by:
compareTo in interface java.lang.Comparable<org.jdiameter.api.Peer>

toString

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

fillIPAddressTable

protected void fillIPAddressTable(IMessage message)

getCommonApplicationIds

protected java.util.Set<org.jdiameter.api.ApplicationId> getCommonApplicationIds(IMessage message)

preProcessRequest

protected void preProcessRequest(IMessage answer)


Copyright © 2008. All Rights Reserved.