use of net.java.slee.resource.diameter.base.events.DiameterCommand in project jain-slee.diameter by RestComm.
the class ValidatorImpl method validate.
// NOTE: this class possibly should be Singleton, however some impl may use something more to perform validation
// hence, its not static, each RA provides instance through RA Sbb Interface.
/*
* (non-Javadoc)
*
* @see
* net.java.slee.resource.diameter.Validator#validate(net.java.slee.resource
* .diameter.base.events.DiameterMessage)
*/
@Override
public void validate(DiameterMessage msg) throws AvpNotAllowedException {
Dictionary dictionary = DictionarySingleton.getDictionary();
if (dictionary.isConfigured() && dictionary.isEnabled()) {
DiameterCommand com = msg.getCommand();
MessageRepresentation rep = dictionary.getMessage(com.getCode(), com.getApplicationId(), com.isRequest());
if (rep != null) {
DiameterMessageImpl impl = (DiameterMessageImpl) msg;
try {
rep.validate(impl.getGenericData(), ValidatorLevel.ALL);
} catch (org.jdiameter.api.validation.AvpNotAllowedException e) {
throw new AvpNotAllowedException("Failed to validate message.", e, e.getAvpCode(), e.getVendorId());
}
}
}
}
Aggregations