org.jdiameter.client.impl.parser
Class MessageImpl

java.lang.Object
  extended by org.jdiameter.client.impl.parser.MessageImpl
All Implemented Interfaces:
java.io.Serializable, Answer, Message, Request, Wrapper, IAnswer, IMessage, IRequest

public class MessageImpl
extends java.lang.Object
implements IMessage

Represents a Diameter message.

Author:
erick.svenson@yahoo.com, Alexandre Mendonca , Bartosz Baranowski
See Also:
Serialized Form

Nested Class Summary
protected static class MessageImpl.TimerTask
           
 
Field Summary
 
Fields inherited from interface org.jdiameter.client.api.IMessage
STATE_ANSWERED, STATE_BUFFERED, STATE_NOT_SENT, STATE_SENT
 
Fields inherited from interface org.jdiameter.api.Message
ABORT_SESSION_ANSWER, ABORT_SESSION_REQUEST, ACCOUNTING_ANSWER, ACCOUNTING_REQUEST, CAPABILITIES_EXCHANGE_ANSWER, CAPABILITIES_EXCHANGE_REQUEST, DEVICE_WATCHDOG_ANSWER, DEVICE_WATCHDOG_REQUEST, DISCONNECT_PEER_ANSWER, DISCONNECT_PEER_REQUEST, RE_AUTH_ANSWER, RE_AUTH_REQUEST, SESSION_TERMINATION_ANSWER, SESSION_TERMINATION_REQUEST
 
Method Summary
 void clearTimer()
          Cancel timer
 java.lang.Object clone()
          Create clone object
protected  void copyHeader(MessageImpl request)
           
 Answer createAnswer()
           
 Answer createAnswer(long resultCode)
           
 Answer createAnswer(long vendorId, long experementalResultCode)
           
 void createTimer(java.util.concurrent.ScheduledExecutorService scheduledFacility, long timeOut, java.util.concurrent.TimeUnit timeUnit)
          Create timer for request timout procedure
 boolean equals(java.lang.Object o)
           
 long getApplicationId()
           
 java.util.List<ApplicationId> getApplicationIdAvps()
           
 AvpSet getAvps()
           
 int getCommandCode()
           
 java.lang.String getDuplicationKey()
          Return duplication key of message
 java.lang.String getDuplicationKey(java.lang.String host, long endToEndId)
          Generate duplication key
 long getEndToEndIdentifier()
           
 IEventListener getEventListener()
          Return event listener
 int getFlags()
          Return flags as inteher
 long getHeaderApplicationId()
          Return header applicationId
 long getHopByHopIdentifier()
           
 IPeer getPeer()
          Return attached peer
 Avp getResultCode()
           
 java.lang.String getSessionId()
           
 ApplicationId getSingleApplicationId()
          Return application id
 ApplicationId getSingleApplicationId(long applicationId)
          Return application id
 int getState()
          Return state of message
 byte getVersion()
           
 int hashCode()
           
 boolean isError()
           
 boolean isNetworkRequest()
           
 boolean isProxiable()
           
 boolean isRequest()
           
 boolean isReTransmitted()
           
 boolean isTimeOut()
          Check timeout
 boolean isWrapperFor(java.lang.Class<?> aClass)
           
 void runTimer()
          Execute timer task
 void setEndToEndIdentifier(long endByEndId)
          Set end by end id
 void setError(boolean b)
           
 void setHeaderApplicationId(long applicationId)
          Set header message application id
 void setHopByHopIdentifier(long hopByHopId)
          Set hop by hop id
 void setListener(IEventListener listener)
          Set event listener
 void setNetworkRequest(boolean isNetworkRequest)
          Set network request flag
 void setPeer(IPeer peer)
          Attach message to peer
 void setProxiable(boolean b)
           
 void setRequest(boolean b)
           
 void setReTransmitted(boolean b)
           
 void setState(int newState)
          Set new state
 java.lang.String toString()
           
<T> T
unwrap(java.lang.Class<T> aClass)
           
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

getVersion

public byte getVersion()
Specified by:
getVersion in interface Message

isRequest

public boolean isRequest()
Specified by:
isRequest in interface Message

setRequest

public void setRequest(boolean b)
Specified by:
setRequest in interface Message

isProxiable

public boolean isProxiable()
Specified by:
isProxiable in interface Message

setProxiable

public void setProxiable(boolean b)
Specified by:
setProxiable in interface Message

isError

public boolean isError()
Specified by:
isError in interface Message

setError

public void setError(boolean b)
Specified by:
setError in interface Message

isReTransmitted

public boolean isReTransmitted()
Specified by:
isReTransmitted in interface Message

setReTransmitted

public void setReTransmitted(boolean b)
Specified by:
setReTransmitted in interface Message

getCommandCode

public int getCommandCode()
Specified by:
getCommandCode in interface Message

getSessionId

public java.lang.String getSessionId()
Specified by:
getSessionId in interface Message

createAnswer

public Answer createAnswer()
Specified by:
createAnswer in interface Request

createAnswer

public Answer createAnswer(long resultCode)
Specified by:
createAnswer in interface Request

createAnswer

public Answer createAnswer(long vendorId,
                           long experementalResultCode)
Specified by:
createAnswer in interface Request

getApplicationId

public long getApplicationId()
Specified by:
getApplicationId in interface Message

getSingleApplicationId

public ApplicationId getSingleApplicationId()
Description copied from interface: IMessage
Return application id

Specified by:
getSingleApplicationId in interface IMessage
Returns:
application id

getApplicationIdAvps

public java.util.List<ApplicationId> getApplicationIdAvps()
Specified by:
getApplicationIdAvps in interface Message

getSingleApplicationId

public ApplicationId getSingleApplicationId(long applicationId)
Description copied from interface: IMessage
Return application id

Specified by:
getSingleApplicationId in interface IMessage
Returns:
application id

getHopByHopIdentifier

public long getHopByHopIdentifier()
Specified by:
getHopByHopIdentifier in interface Message

getEndToEndIdentifier

public long getEndToEndIdentifier()
Specified by:
getEndToEndIdentifier in interface Message

getAvps

public AvpSet getAvps()
Specified by:
getAvps in interface Message

copyHeader

protected void copyHeader(MessageImpl request)

getResultCode

public Avp getResultCode()
Specified by:
getResultCode in interface Answer

setNetworkRequest

public void setNetworkRequest(boolean isNetworkRequest)
Description copied from interface: IRequest
Set network request flag

Specified by:
setNetworkRequest in interface IRequest
Parameters:
isNetworkRequest - true if this request is neteork

isNetworkRequest

public boolean isNetworkRequest()
Specified by:
isNetworkRequest in interface Request

isWrapperFor

public boolean isWrapperFor(java.lang.Class<?> aClass)
                     throws InternalException
Specified by:
isWrapperFor in interface Wrapper
Throws:
InternalException

unwrap

public <T> T unwrap(java.lang.Class<T> aClass)
         throws InternalException
Specified by:
unwrap in interface Wrapper
Throws:
InternalException

setHopByHopIdentifier

public void setHopByHopIdentifier(long hopByHopId)
Description copied from interface: IMessage
Set hop by hop id

Specified by:
setHopByHopIdentifier in interface IMessage
Parameters:
hopByHopId - hopByHopId value

setEndToEndIdentifier

public void setEndToEndIdentifier(long endByEndId)
Description copied from interface: IMessage
Set end by end id

Specified by:
setEndToEndIdentifier in interface IMessage
Parameters:
endByEndId - endByEndId value

getPeer

public IPeer getPeer()
Description copied from interface: IMessage
Return attached peer

Specified by:
getPeer in interface IMessage
Returns:
attached peer

setPeer

public void setPeer(IPeer peer)
Description copied from interface: IMessage
Attach message to peer

Specified by:
setPeer in interface IMessage
Parameters:
peer - attached peer

getState

public int getState()
Description copied from interface: IMessage
Return state of message

Specified by:
getState in interface IMessage
Returns:
state of message

getHeaderApplicationId

public long getHeaderApplicationId()
Description copied from interface: IMessage
Return header applicationId

Specified by:
getHeaderApplicationId in interface IMessage
Returns:
header applicationId

setHeaderApplicationId

public void setHeaderApplicationId(long applicationId)
Description copied from interface: IMessage
Set header message application id

Specified by:
setHeaderApplicationId in interface IMessage
Parameters:
applicationId - header message application id

getFlags

public int getFlags()
Description copied from interface: IMessage
Return flags as inteher

Specified by:
getFlags in interface IMessage
Returns:
flags as inteher

setState

public void setState(int newState)
Description copied from interface: IMessage
Set new state

Specified by:
setState in interface IMessage
Parameters:
newState - new state value

createTimer

public void createTimer(java.util.concurrent.ScheduledExecutorService scheduledFacility,
                        long timeOut,
                        java.util.concurrent.TimeUnit timeUnit)
Description copied from interface: IMessage
Create timer for request timout procedure

Specified by:
createTimer in interface IMessage
Parameters:
scheduledFacility - timer facility
timeOut - value of timeout
timeUnit - time unit

runTimer

public void runTimer()
Description copied from interface: IMessage
Execute timer task

Specified by:
runTimer in interface IMessage

isTimeOut

public boolean isTimeOut()
Description copied from interface: IMessage
Check timeout

Specified by:
isTimeOut in interface IMessage
Returns:
true if request has timeout

setListener

public void setListener(IEventListener listener)
Description copied from interface: IMessage
Set event listener

Specified by:
setListener in interface IMessage
Parameters:
listener - event listener

getEventListener

public IEventListener getEventListener()
Description copied from interface: IMessage
Return event listener

Specified by:
getEventListener in interface IMessage
Returns:
event listener

clearTimer

public void clearTimer()
Description copied from interface: IMessage
Cancel timer

Specified by:
clearTimer in interface IMessage

toString

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

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

getDuplicationKey

public java.lang.String getDuplicationKey()
Description copied from interface: IMessage
Return duplication key of message

Specified by:
getDuplicationKey in interface IMessage
Returns:
duplication key of message

getDuplicationKey

public java.lang.String getDuplicationKey(java.lang.String host,
                                          long endToEndId)
Description copied from interface: IMessage
Generate duplication key

Specified by:
getDuplicationKey in interface IMessage
Parameters:
host - origination host
endToEndId - end to end id
Returns:
duplication key

clone

public java.lang.Object clone()
Description copied from interface: IMessage
Create clone object

Specified by:
clone in interface IMessage
Overrides:
clone in class java.lang.Object
Returns:
clone


Copyright © 2014. All Rights Reserved.