org.jdiameter.api.validation
Interface Dictionary


public interface Dictionary

Second generation Dictionary/Validator. This interface is exposed directly.

Version:
1.1
Author:
Alexandre Mendonca , Bartosz Baranowski

Method Summary
 void configure(java.io.InputStream is)
          Configures dictionary.
 AvpRepresentation getAvp(int code)
          Fetches Avp representation for given code.
 AvpRepresentation getAvp(int code, long vendorId)
          Fetches Avp representation for given code and vendorId.
 AvpRepresentation getAvp(java.lang.String avpName)
          Fetches Avp representation for given name.
 MessageRepresentation getMessage(int commandCode, boolean isRequest)
           
 MessageRepresentation getMessage(int commandCode, long applicationId, boolean isRequest)
           
 ValidatorLevel getReceiveLevel()
          Gets validator level for INCOMING messages.
 ValidatorLevel getSendLevel()
          Gets validator level for OUTGOING messages.
 boolean isConfigured()
          Gets whether validator is configured.
 boolean isEnabled()
          Gets whether validator is enabled.
 void setEnabled(boolean enabled)
          Sets whether validator is enabled.
 void setReceiveLevel(ValidatorLevel receiveLevel)
          Sets validator level for INCOMING messages.
 void setSendLevel(ValidatorLevel sendLevel)
          Gets validator level for OUTGOING messages.
 void validate(Message message, boolean incoming)
          Performs validation according to configured levels
 

Method Detail

getAvp

AvpRepresentation getAvp(int code)
Fetches Avp representation for given code. If no such AVP is found, null value is returned.

Parameters:
code - - positive integer, equal to AVP code.
Returns:
AvpRepresentation for given code or null

getAvp

AvpRepresentation getAvp(int code,
                         long vendorId)
Fetches Avp representation for given code and vendorId. If no such AVP is found, null value is returned.

Parameters:
code - - positive integer, equal to AVP code.
vendorId - - positive long representing vendor code.
Returns:
AvpRepresentation for given code/vendor pair or null

getAvp

AvpRepresentation getAvp(java.lang.String avpName)
Fetches Avp representation for given name. If no such AVP is found, null value is returned.

Parameters:
name - - name of AVP, like Session-Id.
Returns:
AvpRepresentation for given name or null

getMessage

MessageRepresentation getMessage(int commandCode,
                                 boolean isRequest)
Parameters:
commandCode - - command code of message
isRequest - - switches if lookup searches for request or answer
Returns:
message representation for given code and flag value or null

getMessage

MessageRepresentation getMessage(int commandCode,
                                 long applicationId,
                                 boolean isRequest)
Parameters:
commandCode - - command code of message
applicationId - - application id present in message header
isRequest - - switches if lookup searches for request or answer
Returns:
message representation for given code, application and flag value or null

configure

void configure(java.io.InputStream is)
Configures dictionary. It can be called multiple times, each call reconfigures dictionary.

Parameters:
is -

isEnabled

boolean isEnabled()
Gets whether validator is enabled.

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

setEnabled

void setEnabled(boolean enabled)
Sets whether validator is enabled.

Parameters:
enabled - true to enable the validator, false to disable it

isConfigured

boolean isConfigured()
Gets whether validator is configured.

Returns:
  • true if validator has been initialized
  • false if validator has not yet been initialized

getSendLevel

ValidatorLevel getSendLevel()
Gets validator level for OUTGOING messages. Possible values are defined at ValidatorLevel

Returns:
an instance of ValidatorLevel representing the current level

setSendLevel

void setSendLevel(ValidatorLevel sendLevel)
Gets validator level for OUTGOING messages. Possible values are defined at ValidatorLevel

Parameters:
sendLevel - an instance of ValidatorLevel representing the new level

getReceiveLevel

ValidatorLevel getReceiveLevel()
Gets validator level for INCOMING messages. Possible values are defined at ValidatorLevel

Returns:
an instance of ValidatorLevel representing the current level

setReceiveLevel

void setReceiveLevel(ValidatorLevel receiveLevel)
Sets validator level for INCOMING messages. Possible values are defined at ValidatorLevel

Parameters:
receiveLevel - an instance of ValidatorLevel representing the new level

validate

void validate(Message message,
              boolean incoming)
              throws AvpNotAllowedException
Performs validation according to configured levels

Parameters:
message - - message we want to validate
incoming - - flag indicating if #message is incoming message or outgoing.
Throws:
AvpNotAllowedException - - in case validation fails. Exception has details(avp code and similar) about failure.


Copyright © 2013. All Rights Reserved.