org.jdiameter.common.impl.validation
Class DiameterMessageValidator

java.lang.Object
  extended by org.jdiameter.common.impl.validation.DiameterMessageValidator

public class DiameterMessageValidator
extends java.lang.Object

Start time:11:42:36 2009-05-26
Project: diameter-parent

Author:
Bartosz Baranowski , Alexandre Mendonca

Method Summary
static DiameterMessageValidator getInstance()
          Retrieves singleton instance of DiameterMessageValidator
 boolean hasRepresentation(int commandCode, long appId, boolean isRequest, int avpCode, long avpVendor)
          Return values is computed as follows:
return messages.get(commandCode,appId,isRequest)!=null && messages.get(commandCode ,appId,isRequest).getAvp(avpCode,avpVendor)!=null;
 boolean isAllowed(int commandCode, long appId, boolean isRequest, int avpCode, long avpVendor)
          Determines if avp is allowed in message.
 boolean isCountValidForMultiplicity(int commandCode, long appId, boolean isRequest, org.jdiameter.api.AvpSet destination, int avpCode, long avpVendor)
          Determines if avp identified by code and vendor has correct multiplicity in passed set.
 boolean isOn()
          Determines if validator is enabled.
 void parseConfiguration(java.io.InputStream is)
           
 void validate(int commandCode, long appId, boolean isRequest, org.jdiameter.api.AvpSet destination, org.jdiameter.api.Avp avp)
          Validate if avp can be added/present in message - meaning it checks if there is place for passed avp.
 void validate(org.jdiameter.api.Message msg)
          Valdiates message against XML configuration file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

parseConfiguration

public void parseConfiguration(java.io.InputStream is)

getInstance

public static final DiameterMessageValidator getInstance()
Retrieves singleton instance of DiameterMessageValidator

Returns:

isOn

public boolean isOn()
Determines if validator is enabled.

Returns:
  • true if validator is enabled
  • false if validator is disabled

validate

public void validate(org.jdiameter.api.Message msg)
              throws JAvpNotAllowedException
Valdiates message against XML configuration file. If there is no representation it does nothing. If hasRepresentation(int, long, boolean, int, long) returns false this method returns always without exception.

Parameters:
msg -
Throws:
JAvpNotAllowedException - - thrown when validation fails.

validate

public void validate(int commandCode,
                     long appId,
                     boolean isRequest,
                     org.jdiameter.api.AvpSet destination,
                     org.jdiameter.api.Avp avp)
Validate if avp can be added/present in message - meaning it checks if there is place for passed avp. If hasRepresentation(int, long, boolean, int, long) returns false this method returns always without exception.

Parameters:
commandCode - - message command code
appId - - application id of message
isRequest - - true if message is request.
destination - - AvpSet of message
avp - - avp to be checked.

isCountValidForMultiplicity

public boolean isCountValidForMultiplicity(int commandCode,
                                           long appId,
                                           boolean isRequest,
                                           org.jdiameter.api.AvpSet destination,
                                           int avpCode,
                                           long avpVendor)
Determines if avp identified by code and vendor has correct multiplicity in passed set. If hasRepresentation(int, long, boolean, int, long) returns false this method returns always true.

Parameters:
commandCode - - message code
appId - - message application id.
isRequest - - true if message is request.
destination - - message AvpSet
avpCode - - avp code
avpVendor - - avp vendor - zero if there is none

isAllowed

public boolean isAllowed(int commandCode,
                         long appId,
                         boolean isRequest,
                         int avpCode,
                         long avpVendor)
Determines if avp is allowed in message. If hasRepresentation(int, long, boolean, int, long) returns false this method returns always true.

Parameters:
commandCode - - message command code
appId - - message application id
isRequest - - true if message is request.
avpCode - - avp code.
avpVendor - - avp vendor, zero if none.
Returns:

hasRepresentation

public boolean hasRepresentation(int commandCode,
                                 long appId,
                                 boolean isRequest,
                                 int avpCode,
                                 long avpVendor)
Return values is computed as follows:
return messages.get(commandCode,appId,isRequest)!=null && messages.get(commandCode ,appId,isRequest).getAvp(avpCode,avpVendor)!=null;

Parameters:
commandCode - - message command code
appId - - message application id
isRequest - - true if message is request.
avpCode - - avp code.
avpVendor - - avp vendor, zero if none.
Returns:


Copyright © 2009. All Rights Reserved.