org.mobicents.slee.resource.diameter.base.events
Class DiameterMessageImpl

java.lang.Object
  extended by org.mobicents.slee.resource.diameter.base.events.DiameterMessageImpl
All Implemented Interfaces:
java.lang.Cloneable, DiameterMessage
Direct Known Subclasses:
DeviceWatchdogAnswerImpl, DeviceWatchdogRequestImpl, DisconnectPeerAnswerImpl, DisconnectPeerRequestImpl, ExtensionDiameterMessageImpl

public abstract class DiameterMessageImpl
extends java.lang.Object
implements DiameterMessage

Super class for all diameter messages

Super project: mobicents
13:25:46 2008-05-08

Author:
baranowb - Bartosz Baranowski , Alexandre Mendonca , Erick Svenson

Field Summary
protected  boolean destinationHostMandatory
           
protected  boolean destinationRealmMandatory
           
protected  org.apache.log4j.Logger log
           
protected  org.jdiameter.api.Message message
           
protected  boolean originHostMandatory
           
protected  boolean originRealmMandatory
           
 
Constructor Summary
DiameterMessageImpl(org.jdiameter.api.Message message)
           
 
Method Summary
 void addAvp(DiameterAvp avp)
           
protected  void addAvpAsByteArray(int code, byte[] value, boolean mandatory)
           
 java.lang.Object clone()
          Creates and returns a deep copy of this Diameter message.
 long getAcctApplicationId()
           
protected  DiameterIdentityAvp[] getAllAvpAsIdentity(int code)
           
 long getAuthApplicationId()
           
protected  AddressAvp[] getAvpAsAddress(int code)
           
protected  java.util.Date getAvpAsDate(int code)
           
protected  DiameterIdentityAvp getAvpAsIdentity(int code)
           
protected  int getAvpAsInt32(int code)
           
protected  long getAvpAsUInt32(int code)
           
protected  java.lang.String getAvpAsUtf8(int code)
           
 DiameterAvp[] getAvps()
          Return the AVPs contained in this message, as an array of DiameterAvp objects.
protected  int[] getAvpsAsInt32(int code)
           
protected  long[] getAvpsAsUInt32(int code)
           
 DiameterCommand getCommand()
          Return the DiameterCommand contained in the header of this message.
 DiameterIdentityAvp getDestinationHost()
          Returns the value of the Destination-Host AVP, of type DiameterIdentity.
 DiameterIdentityAvp getDestinationRealm()
          Returns the value of the Destination-Realm AVP, of type DiameterIdentity.
 java.lang.String getErrorMessage()
           
 DiameterIdentityAvp getErrorReportingHost()
           
 java.util.Date getEventTimestamp()
           
 DiameterAvp[] getExtensionAvps()
          Returns the set of extension AVPs.
 FailedAvp[] getFailedAvps()
           
 org.jdiameter.api.Message getGenericData()
           
 DiameterHeader getHeader()
          Return the org.mobicents.slee.resource.diameter.base.DiameterHeader in this message, if it exists.
abstract  java.lang.String getLongName()
          This method returns long name of this message type - Like Device-Watchdog-Request
 DiameterIdentityAvp getOriginHost()
          Returns the value of the Origin-Host AVP, of type DiameterIdentity.
 DiameterIdentityAvp getOriginRealm()
          Returns the value of the Origin-Realm AVP, of type DiameterIdentity.
 long getOriginStateId()
           
 ProxyInfoAvp[] getProxyInfos()
           
 DiameterURIAvp[] getRedirectHosts()
           
 RedirectHostUsageType getRedirectHostUsage()
           
 long getRedirectMaxCacheTime()
           
 long getResultCode()
           
 DiameterIdentityAvp[] getRouteRecords()
           
 java.lang.String getSessionId()
          Returns the value of the Session-Id AVP, of type UTF8String.
abstract  java.lang.String getShortName()
          This method return short name of this message type - for instance DWR,DWA for DeviceWatchdog message
 java.lang.String getUserName()
           
 VendorSpecificApplicationIdAvp getVendorSpecificApplicationId()
           
 boolean hasAcctApplicationId()
           
 boolean hasAuthApplicationId()
           
 boolean hasDestinationHost()
           
 boolean hasDestinationRealm()
           
 boolean hasErrorMessage()
           
 boolean hasErrorReportingHost()
           
 boolean hasEventTimestamp()
           
 boolean hasOriginHost()
          Returns true if the Origin-Host AVP is present in the message.
 boolean hasOriginRealm()
          Returns true if the Origin-Realm AVP is present in the message.
 boolean hasOriginStateId()
           
 boolean hasRedirectHostUsage()
           
 boolean hasRedirectMaxCacheTime()
           
 boolean hasResultCode()
           
 boolean hasSessionId()
          Returns true if the Session-Id AVP is present in the message.
 boolean hasUserName()
           
 boolean hasVendorSpecificApplicationId()
           
 void setAcctApplicationId(long acctApplicationId)
           
 void setAuthApplicationId(long authApplicationId)
           
 void setAvpAsAddress(int code, AddressAvp[] avps, boolean mandatory, boolean... remove)
           
protected  void setAvpAsDate(int code, java.util.Date value, boolean mandatory, boolean... remove)
           
protected  org.jdiameter.api.AvpSet setAvpAsGroup(int code, DiameterAvp[] childs, boolean mandatory, boolean... remove)
           
protected  void setAvpAsIdentity(int code, java.lang.String value, boolean octet, boolean mandatory, boolean... remove)
           
protected  void setAvpAsInt32(int code, int value, boolean mandatory, boolean... remove)
           
protected  void setAvpAsUInt32(int code, long value, boolean mandatory, boolean... remove)
           
protected  void setAvpAsUtf8(int code, java.lang.String value, boolean mandatory, boolean... remove)
           
protected  void setAvpsAsUInt32(int code, long[] values, boolean mandatory, boolean... remove)
           
 void setDestinationHost(DiameterIdentityAvp destinationHost)
          Sets the value of the Destination-Host AVP, of type DiameterIdentity.
 void setDestinationRealm(DiameterIdentityAvp destinationRealm)
          Sets the value of the Destination-Realm AVP, of type DiameterIdentity.
 void setErrorMessage(java.lang.String errorMessage)
           
 void setErrorReportingHost(DiameterIdentityAvp errorReportingHost)
           
 void setEventTimestamp(java.util.Date eventTimestamp)
           
 void setExtensionAvps(DiameterAvp[] avps)
          Sets the set of extension AVPs with all the values in the given array.
 void setFailedAvp(FailedAvp failedAvp)
           
 void setFailedAvps(FailedAvp[] failedAvps)
           
 void setOriginHost(DiameterIdentityAvp originHost)
          Sets the value of the Origin-Host AVP, of type DiameterIdentity.
 void setOriginRealm(DiameterIdentityAvp originRealm)
          Sets the value of the Origin-Realm AVP, of type DiameterIdentity.
 void setOriginStateId(long originStateId)
           
 void setProxyInfo(ProxyInfoAvp proxyInfo)
           
 void setProxyInfos(ProxyInfoAvp[] proxyInfos)
           
 void setRedirectHost(DiameterURIAvp redirectHost)
           
 void setRedirectHosts(DiameterURIAvp[] redirectHosts)
           
 void setRedirectHostUsage(RedirectHostUsageType redirectHostUsage)
           
 void setRedirectMaxCacheTime(long redirectMaxCacheTime)
           
 void setResultCode(long resultCode)
           
 void setRouteRecord(DiameterIdentityAvp routeRecord)
           
 void setRouteRecords(DiameterIdentityAvp[] routeRecords)
           
 void setSessionId(java.lang.String sessionId)
          Sets the value of the Session-Id AVP, of type UTF8String.
 void setUserName(java.lang.String userName)
           
 void setVendorSpecificApplicationId(VendorSpecificApplicationIdAvp id)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

message

protected org.jdiameter.api.Message message

destinationHostMandatory

protected boolean destinationHostMandatory

destinationRealmMandatory

protected boolean destinationRealmMandatory

originHostMandatory

protected boolean originHostMandatory

originRealmMandatory

protected boolean originRealmMandatory

log

protected org.apache.log4j.Logger log
Constructor Detail

DiameterMessageImpl

public DiameterMessageImpl(org.jdiameter.api.Message message)
Method Detail

addAvpAsByteArray

protected void addAvpAsByteArray(int code,
                                 byte[] value,
                                 boolean mandatory)

clone

public java.lang.Object clone()
Description copied from interface: DiameterMessage
Creates and returns a deep copy of this Diameter message.

Specified by:
clone in interface DiameterMessage
Overrides:
clone in class java.lang.Object
Returns:
a deep copy of this message.

getAvpAsAddress

protected AddressAvp[] getAvpAsAddress(int code)

getAcctApplicationId

public long getAcctApplicationId()

getAllAvpAsIdentity

protected DiameterIdentityAvp[] getAllAvpAsIdentity(int code)

getAuthApplicationId

public long getAuthApplicationId()

getAvpAsDate

protected java.util.Date getAvpAsDate(int code)

getAvpAsIdentity

protected DiameterIdentityAvp getAvpAsIdentity(int code)

getAvpAsInt32

protected int getAvpAsInt32(int code)

getAvpAsUInt32

protected long getAvpAsUInt32(int code)

getAvpAsUtf8

protected java.lang.String getAvpAsUtf8(int code)

getAvpsAsUInt32

protected long[] getAvpsAsUInt32(int code)

getAvpsAsInt32

protected int[] getAvpsAsInt32(int code)

getAvps

public DiameterAvp[] getAvps()
Description copied from interface: DiameterMessage
Return the AVPs contained in this message, as an array of DiameterAvp objects. AVPs are returned in the same order in which they appear in the message.

Specified by:
getAvps in interface DiameterMessage
Returns:
a list of AVPs

getCommand

public DiameterCommand getCommand()
Description copied from interface: DiameterMessage
Return the DiameterCommand contained in the header of this message.

Specified by:
getCommand in interface DiameterMessage
Returns:
a DiameterCommand instance

getDestinationHost

public DiameterIdentityAvp getDestinationHost()
Description copied from interface: DiameterMessage
Returns the value of the Destination-Host AVP, of type DiameterIdentity. A return value of null implies that the AVP has not been set.

Specified by:
getDestinationHost in interface DiameterMessage

getDestinationRealm

public DiameterIdentityAvp getDestinationRealm()
Description copied from interface: DiameterMessage
Returns the value of the Destination-Realm AVP, of type DiameterIdentity. A return value of null implies that the AVP has not been set.

Specified by:
getDestinationRealm in interface DiameterMessage

getErrorMessage

public java.lang.String getErrorMessage()

getErrorReportingHost

public DiameterIdentityAvp getErrorReportingHost()

getEventTimestamp

public java.util.Date getEventTimestamp()

getExtensionAvps

public DiameterAvp[] getExtensionAvps()
Description copied from interface: DiameterMessage
Returns the set of extension AVPs. The returned array contains the extension AVPs in the order they appear in the message. A return value of null implies that no extensions AVPs have been set.

Specified by:
getExtensionAvps in interface DiameterMessage

getFailedAvps

public FailedAvp[] getFailedAvps()

getGenericData

public org.jdiameter.api.Message getGenericData()

getHeader

public DiameterHeader getHeader()
Description copied from interface: DiameterMessage
Return the org.mobicents.slee.resource.diameter.base.DiameterHeader in this message, if it exists. The header will not exist for outgoing messages created via the net.java.slee.resource.diameter.base.DiameterMessageFactory.

Specified by:
getHeader in interface DiameterMessage
Returns:
DiameterHeader if one exists, otherwise null

getLongName

public abstract java.lang.String getLongName()
This method returns long name of this message type - Like Device-Watchdog-Request

Returns:

getOriginHost

public DiameterIdentityAvp getOriginHost()
Description copied from interface: DiameterMessage
Returns the value of the Origin-Host AVP, of type DiameterIdentity. A return value of null implies that the AVP has not been set.

Specified by:
getOriginHost in interface DiameterMessage

getOriginRealm

public DiameterIdentityAvp getOriginRealm()
Description copied from interface: DiameterMessage
Returns the value of the Origin-Realm AVP, of type DiameterIdentity. A return value of null implies that the AVP has not been set.

Specified by:
getOriginRealm in interface DiameterMessage

getOriginStateId

public long getOriginStateId()

getProxyInfos

public ProxyInfoAvp[] getProxyInfos()

getRedirectHosts

public DiameterURIAvp[] getRedirectHosts()

getRedirectHostUsage

public RedirectHostUsageType getRedirectHostUsage()

getRedirectMaxCacheTime

public long getRedirectMaxCacheTime()

getResultCode

public long getResultCode()

getRouteRecords

public DiameterIdentityAvp[] getRouteRecords()

getSessionId

public java.lang.String getSessionId()
Description copied from interface: DiameterMessage
Returns the value of the Session-Id AVP, of type UTF8String. A return value of null implies that the AVP has not been set.

Specified by:
getSessionId in interface DiameterMessage

getShortName

public abstract java.lang.String getShortName()
This method return short name of this message type - for instance DWR,DWA for DeviceWatchdog message

Returns:

getUserName

public java.lang.String getUserName()

getVendorSpecificApplicationId

public VendorSpecificApplicationIdAvp getVendorSpecificApplicationId()

hasAcctApplicationId

public boolean hasAcctApplicationId()

hasAuthApplicationId

public boolean hasAuthApplicationId()

hasDestinationHost

public boolean hasDestinationHost()

hasDestinationRealm

public boolean hasDestinationRealm()

hasErrorMessage

public boolean hasErrorMessage()

hasErrorReportingHost

public boolean hasErrorReportingHost()

hasEventTimestamp

public boolean hasEventTimestamp()

hasOriginHost

public boolean hasOriginHost()
Description copied from interface: DiameterMessage
Returns true if the Origin-Host AVP is present in the message.

Specified by:
hasOriginHost in interface DiameterMessage

hasOriginRealm

public boolean hasOriginRealm()
Description copied from interface: DiameterMessage
Returns true if the Origin-Realm AVP is present in the message.

Specified by:
hasOriginRealm in interface DiameterMessage

hasOriginStateId

public boolean hasOriginStateId()

hasRedirectHostUsage

public boolean hasRedirectHostUsage()

hasRedirectMaxCacheTime

public boolean hasRedirectMaxCacheTime()

hasResultCode

public boolean hasResultCode()

hasSessionId

public boolean hasSessionId()
Description copied from interface: DiameterMessage
Returns true if the Session-Id AVP is present in the message.

Specified by:
hasSessionId in interface DiameterMessage

hasUserName

public boolean hasUserName()

hasVendorSpecificApplicationId

public boolean hasVendorSpecificApplicationId()

setAvpAsAddress

public void setAvpAsAddress(int code,
                            AddressAvp[] avps,
                            boolean mandatory,
                            boolean... remove)

setAcctApplicationId

public void setAcctApplicationId(long acctApplicationId)

setAuthApplicationId

public void setAuthApplicationId(long authApplicationId)

setAvpAsDate

protected void setAvpAsDate(int code,
                            java.util.Date value,
                            boolean mandatory,
                            boolean... remove)

setAvpAsGroup

protected org.jdiameter.api.AvpSet setAvpAsGroup(int code,
                                                 DiameterAvp[] childs,
                                                 boolean mandatory,
                                                 boolean... remove)

setAvpAsIdentity

protected void setAvpAsIdentity(int code,
                                java.lang.String value,
                                boolean octet,
                                boolean mandatory,
                                boolean... remove)

setAvpAsInt32

protected void setAvpAsInt32(int code,
                             int value,
                             boolean mandatory,
                             boolean... remove)

setAvpAsUInt32

protected void setAvpAsUInt32(int code,
                              long value,
                              boolean mandatory,
                              boolean... remove)

setAvpAsUtf8

protected void setAvpAsUtf8(int code,
                            java.lang.String value,
                            boolean mandatory,
                            boolean... remove)

setAvpsAsUInt32

protected void setAvpsAsUInt32(int code,
                               long[] values,
                               boolean mandatory,
                               boolean... remove)

setDestinationHost

public void setDestinationHost(DiameterIdentityAvp destinationHost)
Description copied from interface: DiameterMessage
Sets the value of the Destination-Host AVP, of type DiameterIdentity.

Specified by:
setDestinationHost in interface DiameterMessage

setDestinationRealm

public void setDestinationRealm(DiameterIdentityAvp destinationRealm)
Description copied from interface: DiameterMessage
Sets the value of the Destination-Realm AVP, of type DiameterIdentity.

Specified by:
setDestinationRealm in interface DiameterMessage

setErrorMessage

public void setErrorMessage(java.lang.String errorMessage)

setErrorReportingHost

public void setErrorReportingHost(DiameterIdentityAvp errorReportingHost)

setEventTimestamp

public void setEventTimestamp(java.util.Date eventTimestamp)

setExtensionAvps

public void setExtensionAvps(DiameterAvp[] avps)
                      throws AvpNotAllowedException
Description copied from interface: DiameterMessage
Sets the set of extension AVPs with all the values in the given array. The AVPs will be added to message in the order in which they appear in the array. Note: the array must not be altered by the caller following this call, and getExtensionAvps() is not guaranteed to return the same array instance, e.g. an "==" check would fail.

Specified by:
setExtensionAvps in interface DiameterMessage
Throws:
AvpNotAllowedException - if an AVP is encountered of a type already known to this class (i.e. an AVP for which get/set methods already appear in this class)

setFailedAvp

public void setFailedAvp(FailedAvp failedAvp)

setFailedAvps

public void setFailedAvps(FailedAvp[] failedAvps)

setOriginHost

public void setOriginHost(DiameterIdentityAvp originHost)
Description copied from interface: DiameterMessage
Sets the value of the Origin-Host AVP, of type DiameterIdentity.

Specified by:
setOriginHost in interface DiameterMessage

setOriginRealm

public void setOriginRealm(DiameterIdentityAvp originRealm)
Description copied from interface: DiameterMessage
Sets the value of the Origin-Realm AVP, of type DiameterIdentity.

Specified by:
setOriginRealm in interface DiameterMessage

setOriginStateId

public void setOriginStateId(long originStateId)

setProxyInfo

public void setProxyInfo(ProxyInfoAvp proxyInfo)

setProxyInfos

public void setProxyInfos(ProxyInfoAvp[] proxyInfos)

setRedirectHost

public void setRedirectHost(DiameterURIAvp redirectHost)

setRedirectHosts

public void setRedirectHosts(DiameterURIAvp[] redirectHosts)

setRedirectHostUsage

public void setRedirectHostUsage(RedirectHostUsageType redirectHostUsage)

setRedirectMaxCacheTime

public void setRedirectMaxCacheTime(long redirectMaxCacheTime)

setResultCode

public void setResultCode(long resultCode)

setRouteRecord

public void setRouteRecord(DiameterIdentityAvp routeRecord)

setRouteRecords

public void setRouteRecords(DiameterIdentityAvp[] routeRecords)

setSessionId

public void setSessionId(java.lang.String sessionId)
Description copied from interface: DiameterMessage
Sets the value of the Session-Id AVP, of type UTF8String.

Specified by:
setSessionId in interface DiameterMessage

setUserName

public void setUserName(java.lang.String userName)

setVendorSpecificApplicationId

public void setVendorSpecificApplicationId(VendorSpecificApplicationIdAvp id)

toString

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

addAvp

public void addAvp(DiameterAvp avp)


Copyright © 2008. All Rights Reserved.